Compare commits
10 Commits
4bbb170d43
...
685134d4e4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
685134d4e4 | ||
|
|
37d68480f3 | ||
|
|
f44b9ae1f2 | ||
|
|
b4463edfc9 | ||
|
|
de99dcff6f | ||
|
|
d98c32bfbc | ||
|
|
69095e0cd3 | ||
|
|
d964049828 | ||
|
|
0f73ea8d3e | ||
|
|
fb50d60edd |
@ -1,115 +0,0 @@
|
||||
From 6210c2007a430882d234d846d133d5f3799434aa Mon Sep 17 00:00:00 2001
|
||||
From: Euler Hanzh <18221254@bjtu.edu.cn>
|
||||
Date: Mon, 17 May 2021 17:32:51 +0800
|
||||
Subject: [PATCH] this patch is created for performance optimization in crc calculation only suitable for openeuler of aarch64 architecture.
|
||||
The speed of zip software when running can be accelerate by nearly 20% than before.
|
||||
|
||||
---
|
||||
zip30/crc32.c | 27 +++++++++++++++++++++++++++
|
||||
zip30/crc32.h | 4 ++++
|
||||
zip30/unix/Makefile | 13 +++++++++++--
|
||||
3 files changed, 42 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/zip30/crc32.c b/zip30/crc32.c
|
||||
index 6b2403b..9e26af7 100644
|
||||
--- a/zip30/crc32.c
|
||||
+++ b/zip30/crc32.c
|
||||
@@ -675,7 +675,32 @@ void free_crc_table()
|
||||
|
||||
#endif /* (IZ_CRC_BE_OPTIMIZ || IZ_CRC_LE_OPTIMIZ) */
|
||||
|
||||
+#ifdef ARCH_AARCH64
|
||||
+u_int32_t crc32(u_int32_t crc,const u_int8_t *p, unsigned int len)
|
||||
+{
|
||||
+ int64_t length = len;
|
||||
+
|
||||
+ while ((length -= sizeof(u_int64_t)) >=0) {
|
||||
+ __builtin_aarch64_crc32cx(crc, *((u_int64_t *)p));
|
||||
+ p += sizeof(u_int64_t);
|
||||
+ }
|
||||
|
||||
+ if (length & sizeof(u_int32_t)) {
|
||||
+ __builtin_aarch64_crc32cw(crc, *((u_int32_t *)p));
|
||||
+ p += sizeof(u_int32_t);
|
||||
+ }
|
||||
+
|
||||
+ if (length & sizeof(u_int16_t)) {
|
||||
+ __builtin_aarch64_crc32ch(crc, *((u_int16_t *)p));
|
||||
+ p += sizeof(u_int16_t);
|
||||
+ }
|
||||
+
|
||||
+ if (length & sizeof(u_int8_t))
|
||||
+ __builtin_aarch64_crc32cb(crc, *p);
|
||||
+
|
||||
+ return crc;
|
||||
+}
|
||||
+#else
|
||||
/* ========================================================================= */
|
||||
ulg crc32(crc, buf, len)
|
||||
ulg crc; /* crc shift register */
|
||||
@@ -726,6 +751,8 @@ ulg crc32(crc, buf, len)
|
||||
|
||||
return REV_BE(c) ^ 0xffffffffL; /* (instead of ~c for 64-bit machines) */
|
||||
}
|
||||
+#endif /* !ARCH_AARCH64*/
|
||||
#endif /* !ASM_CRC */
|
||||
#endif /* !CRC_TABLE_ONLY */
|
||||
#endif /* !USE_ZLIB */
|
||||
diff --git a/zip30/crc32.h b/zip30/crc32.h
|
||||
index 83af240..6fdaf32 100644
|
||||
--- a/zip30/crc32.h
|
||||
+++ b/zip30/crc32.h
|
||||
@@ -36,7 +36,11 @@
|
||||
# undef IZ_CRC_BE_OPTIMIZ
|
||||
# endif
|
||||
#else /* !(USE_ZLIB || CRC_TABLE_ONLY) */
|
||||
+# ifdef ARCH_AARCH64
|
||||
+ u_int32_t crc32(u_int32_t crc,const u_int8_t *p, unsigned int len);
|
||||
+# else
|
||||
ulg crc32 OF((ulg crc, ZCONST uch *buf, extent len));
|
||||
+# endif
|
||||
#endif /* ?(USE_ZLIB || CRC_TABLE_ONLY) */
|
||||
|
||||
#ifndef CRC_32_TAB
|
||||
diff --git a/zip30/unix/Makefile b/zip30/unix/Makefile
|
||||
index abd0c44..065395a 100644
|
||||
--- a/zip30/unix/Makefile
|
||||
+++ b/zip30/unix/Makefile
|
||||
@@ -37,6 +37,9 @@ CHMOD = chmod
|
||||
BINFLAGS = 755
|
||||
MANFLAGS = 644
|
||||
|
||||
+
|
||||
+TARGET_ARCH = $(shell uname -m)
|
||||
+ARCH = $(shell getconf LONG_BIT)
|
||||
# target directories - where to install executables and man pages to
|
||||
prefix = /usr/local
|
||||
BINDIR = $(prefix)/bin
|
||||
@@ -59,6 +62,12 @@ IZ_OUR_BZIP2_DIR = bzip2
|
||||
# LFLAGS2 flags after obj file list (libraries, etc)
|
||||
CFLAGS_NOOPT = -I. -DUNIX $(LOCAL_ZIP)
|
||||
CFLAGS = -O2 $(CFLAGS_NOOPT)
|
||||
+ifeq ($(TARGET_ARCH),aarch64)
|
||||
+CFF = -DARCH=$(ARCH) -march=armv8.1-a -D ARCH_AARCH64
|
||||
+else
|
||||
+CFF =
|
||||
+endif
|
||||
+
|
||||
LFLAGS1 =
|
||||
LFLAGS2 = -s
|
||||
|
||||
@@ -80,10 +89,10 @@ ZIP_H = zip.h ziperr.h tailor.h unix/osdep.h
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: _.o .o .c .doc .1
|
||||
.c_.o:
|
||||
- $(CC) -c $(CFLAGS) -DUTIL -o $@ $<
|
||||
+ $(CC) -c $(CFLAGS) -DUTIL $(CFF) -o $@ $<
|
||||
|
||||
.c.o:
|
||||
- $(CC) -c $(CFLAGS) $<
|
||||
+ $(CC) -c $(CFLAGS) $(CFF) $<
|
||||
|
||||
.1.doc:
|
||||
nroff -man $< | col -bx | uniq > $@
|
||||
--
|
||||
2.23.0
|
||||
11
zip-fix-cc.patch
Normal file
11
zip-fix-cc.patch
Normal file
@ -0,0 +1,11 @@
|
||||
--- a/unix/Makefile 2008-05-07 14:33:56.000000000 +0800
|
||||
+++ b/unix/Makefile 2023-04-16 16:14:10.611625606 +0800
|
||||
@@ -22,7 +22,7 @@
|
||||
LN = ln -s
|
||||
|
||||
# (to use the GNU compiler, change cc to gcc in CC)
|
||||
-CC = cc
|
||||
+CC ?= cc
|
||||
BIND = $(CC)
|
||||
AS = $(CC) -c
|
||||
CPP = /lib/cpp
|
||||
91
zip-fix-type-conflict.patch
Normal file
91
zip-fix-type-conflict.patch
Normal file
@ -0,0 +1,91 @@
|
||||
--- zip30/unix/configure.bak 2024-03-03 22:16:42.341658986 +0800
|
||||
+++ zip30/unix/configure 2024-03-03 22:22:07.021622151 +0800
|
||||
@@ -18,6 +18,8 @@ trap "rm -f conftest* core a.out; exit 1
|
||||
|
||||
CC=${1-cc}
|
||||
CFLAGS=${2-"-I. -DUNIX"}
|
||||
+CC_OMIT_ERR=" -Wno-implicit-function-declaration"
|
||||
+CFLAGS="${CFLAGS} ${CC_OMIT_ERR}"
|
||||
LFLAGS1=''
|
||||
LFLAGS2=''
|
||||
LN="ln -s"
|
||||
@@ -376,7 +378,7 @@ int main()
|
||||
}
|
||||
_EOF_
|
||||
# compile it
|
||||
-$CC -o conftest conftest.c >/dev/null 2>/dev/null
|
||||
+$CC $CC_OMIT_ERR -o conftest conftest.c >/dev/null 2>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -- UID/GID test failed on compile - disabling old 16-bit UID/GID support
|
||||
CFLAGS="${CFLAGS} -DUIDGID_NOT_16BIT"
|
||||
@@ -430,7 +432,7 @@ int main()
|
||||
}
|
||||
_EOF_
|
||||
# compile it
|
||||
-$CC -o conftest conftest.c >/dev/null 2>/dev/null
|
||||
+$CC $CC_OMIT_ERR -o conftest conftest.c >/dev/null 2>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -- no Large File Support
|
||||
else
|
||||
@@ -472,7 +474,7 @@ int main()
|
||||
}
|
||||
_EOF_
|
||||
# compile it
|
||||
-$CC -o conftest conftest.c >/dev/null 2>/dev/null
|
||||
+$CC $CC_OMIT_ERR -o conftest conftest.c >/dev/null 2>/dev/null
|
||||
# OCRCU8 is used by all utilities if Unicode is enabled
|
||||
# OCRCTB is only used by zipcloak
|
||||
if [ $? -ne 0 ]; then
|
||||
@@ -513,14 +515,14 @@ for func in rmdir strchr strrchr rename
|
||||
do
|
||||
echo Check for $func
|
||||
echo "int main(){ $func(); return 0; }" > conftest.c
|
||||
- $CC $BFLAG -o conftest conftest.c >/dev/null 2>/dev/null
|
||||
+ $CC $CC_OMIT_ERR $BFLAG -o conftest conftest.c >/dev/null 2>/dev/null
|
||||
[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_`echo $func | tr '[a-z]' '[A-Z]'`"
|
||||
done
|
||||
|
||||
|
||||
echo Check for memset
|
||||
echo "int main(){ char k; memset(&k,0,0); return 0; }" > conftest.c
|
||||
-$CC -o conftest conftest.c >/dev/null 2>/dev/null
|
||||
+$CC $CC_OMIT_ERR -o conftest conftest.c >/dev/null 2>/dev/null
|
||||
[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DZMEM"
|
||||
|
||||
|
||||
@@ -544,7 +546,7 @@ $CC -o conftest conftest.c >/dev/null 2>
|
||||
echo Check for errno declaration
|
||||
cat > conftest.c << _EOF_
|
||||
#include <errno.h>
|
||||
-main()
|
||||
+int main()
|
||||
{
|
||||
errno = 0;
|
||||
return 0;
|
||||
@@ -559,12 +561,12 @@ cat > conftest.c << _EOF_
|
||||
int main() { return closedir(opendir(".")); }
|
||||
_EOF_
|
||||
|
||||
-$CC -o conftest conftest.c >/dev/null 2>/dev/null
|
||||
+$CC $CC_OMIT_ERR -o conftest conftest.c >/dev/null 2>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
OPT=""
|
||||
for lib in ndir dir ucb bsd BSD PW x dirent
|
||||
do
|
||||
- $CC -o conftest conftest.c -l$lib >/dev/null 2>/dev/null
|
||||
+ $CC $CC_OMIT_ERR -o conftest conftest.c -l$lib >/dev/null 2>/dev/null
|
||||
[ $? -eq 0 ] && OPT=-l$lib && break
|
||||
done
|
||||
if [ ${OPT} ]; then
|
||||
@@ -579,9 +581,9 @@ fi
|
||||
|
||||
echo Check for readlink
|
||||
echo "int main(){ return readlink(); }" > conftest.c
|
||||
-$CC -o conftest conftest.c >/dev/null 2>/dev/null
|
||||
+$CC $CC_OMIT_ERR -o conftest conftest.c >/dev/null 2>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
- $CC -o conftest conftest.c -lseq >/dev/null 2>/dev/null
|
||||
+ $CC $CC_OMIT_ERR -o conftest conftest.c -lseq >/dev/null 2>/dev/null
|
||||
[ $? -eq 0 ] && LFLAGS2="${LFLAGS2} -lseq"
|
||||
fi
|
||||
|
||||
28
zip.spec
28
zip.spec
@ -1,6 +1,6 @@
|
||||
Name: zip
|
||||
Version: 3.0
|
||||
Release: 27
|
||||
Release: 32
|
||||
Summary: A compression and file packaging/archive utility
|
||||
License: Info-ZIP
|
||||
URL: http://www.info-zip.org/Zip.html
|
||||
@ -13,15 +13,14 @@ Patch3: zip-3.0-time.patch
|
||||
Patch4: man.patch
|
||||
Patch5: zip-3.0-format-security.patch
|
||||
Patch6: zipnote.patch
|
||||
Patch7: zip-fix-cc.patch
|
||||
Patch8: zip-fix-type-conflict.patch
|
||||
|
||||
Patch6000: CVE-2018-13410.patch
|
||||
|
||||
Patch9000: openEuler-Cleanup-residual-temporary-file.patch
|
||||
|
||||
Patch12000: zip-3.0-crc-builtin.patch
|
||||
|
||||
BuildRequires: bzip2-devel gcc
|
||||
Requires: unzip
|
||||
|
||||
%description
|
||||
The zip program is a compression and file packaging utility. Zip has one
|
||||
@ -40,7 +39,7 @@ This package contains the documents and manuals related to zip.
|
||||
%autosetup -n zip30 -p1
|
||||
|
||||
%build
|
||||
%make_build -f unix/Makefile prefix=%{_prefix} "CFLAGS_NOOPT=-I. -DUNIX $RPM_OPT_FLAGS" generic_gcc
|
||||
%make_build -f unix/Makefile prefix=%{_prefix} "CFLAGS_NOOPT=-I. -DUNIX $RPM_OPT_FLAGS" generic
|
||||
|
||||
%install
|
||||
mkdir -p %{buildroot}%{_bindir}
|
||||
@ -58,10 +57,25 @@ mkdir -p %{buildroot}%{_mandir}/man1
|
||||
%{_mandir}/man1/zip*
|
||||
|
||||
%changelog
|
||||
* May Sun 9 2021 hanzhelii <182212254@bjtu.edu.cn> - 3.0-27
|
||||
* Sun Mar 3 2024 lijinzhe <jinzhe.oerv@isrc.iscas.ac.cn> - 3.0-32
|
||||
- fix clang issue when compile zip, ignore error Wimplicit-function-declaration
|
||||
|
||||
* Fri Nov 10 2023 luofeng <luofeng13@huawei.com> - 3.0-31
|
||||
- support clang build
|
||||
|
||||
* Fri May 27 2022 konglidong <konglidong@uniontech.com> - 3.0-30
|
||||
- modify bad date in %changelog
|
||||
|
||||
* Tue Aug 03 2021 shixuantong <shixuantong@huawei.com> - 3.0-29
|
||||
- remove unnecessary installation dependencies
|
||||
|
||||
* Mon Jun 21 2021 shixuantong <shixuantong@huawei.com> - 3.0-28
|
||||
- revert zip-3.0-crc-builtin.patch
|
||||
|
||||
* Sun May 9 2021 hanzhelii <182212254@bjtu.edu.cn> - 3.0-27
|
||||
- Add zip-3.0-crc-builtin.patch
|
||||
|
||||
* Dec Thu 8 2020 wuchaochao <wuchaochao4@huawei.com> - 3.0-26
|
||||
* Tue Dec 8 2020 wuchaochao <wuchaochao4@huawei.com> - 3.0-26
|
||||
- Add openEuler-Cleanup-residual-temporary-file.patch
|
||||
|
||||
* Fri Feb 14 2020 chengquan <chengquan3@huawei.com> - 3.0-25
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user