From 0e23b6245e19e42b2314fb35479af72e671e20a4 Mon Sep 17 00:00:00 2001 From: luofeng14 Date: Sat, 2 Mar 2024 10:50:05 +0000 Subject: [PATCH] support clang build Signed-off-by: luofeng14 --- unzip-6.0-support-clang-build.patch | 90 +++++++++++++++++++++++++++++ unzip.spec | 6 +- 2 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 unzip-6.0-support-clang-build.patch diff --git a/unzip-6.0-support-clang-build.patch b/unzip-6.0-support-clang-build.patch new file mode 100644 index 0000000..b302289 --- /dev/null +++ b/unzip-6.0-support-clang-build.patch @@ -0,0 +1,90 @@ +From 31848a266e5b31127967e02ac316104928e2d529 Mon Sep 17 00:00:00 2001 +From: luofeng +Date: Sat, 2 Mar 2024 18:36:19 +0800 +Subject: [PATCH] support clang build + +--- + unix/Makefile | 18 +++++++++--------- + unix/configure | 2 +- + 2 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/unix/Makefile b/unix/Makefile +index ab32270..be36f29 100644 +--- a/unix/Makefile ++++ b/unix/Makefile +@@ -42,12 +42,12 @@ + # such as -DDOSWILD). + + # UnZip flags +-CC = cc# try using "gcc" target rather than changing this (CC and LD ++CC ?= cc# try using "gcc" target rather than changing this (CC and LD + LD = $(CC)# must match, else "unresolved symbol: ___main" is possible) + AS = as + LOC = $(D_USE_BZ2) $(LOCAL_UNZIP) + AF = $(LOC) +-CFLAGS = -O ++CFLAGS ?= -O + CF_NOOPT = -I. -I$(IZ_BZIP2) -DUNIX $(LOC) + CF = $(CFLAGS) $(CF_NOOPT) + LFLAGS1 = +@@ -231,7 +231,7 @@ generic_msg: + # yes, we should be able to use the $O macro to combine these two, but it + # fails on some brain-damaged makes (e.g., AIX's)...no big deal + .c.o: +- $(CC) -c $(CF) $*.c ++ $(CC) -c $(CF) -Wno-error=implicit-int $(CFLAGS) $*.c + + .c.obj: + $(CC) -c $(CF) $*.c +@@ -335,7 +335,7 @@ crypt_$O: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h + $(CC) -c $(CF) -DSFX -o $@ crypt.c + + extract_$O: extract.c $(UNZIP_H) crc32.h crypt.h +- $(CC) -c $(CF) -DSFX -o $@ extract.c ++ $(CC) -c $(CF) -Wno-error=implicit-int -DSFX -o $@ extract.c + + fileio_$O: fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h + $(CC) -c $(CF) -DSFX -o $@ fileio.c +@@ -545,7 +545,7 @@ generic: flags # now try autoconfigure first + # make $(MAKEF) unzips CF="${CF} `cat flags`" + + generic_gcc: +- $(MAKE) $(MAKEF) generic CC=gcc IZ_BZIP2="$(IZ_BZIP2)" ++ $(MAKE) $(MAKEF) generic IZ_BZIP2="$(IZ_BZIP2)" + + # extensions to perform SVR4 package-creation after compilation + generic_pkg: generic svr4package +@@ -594,13 +594,13 @@ generic_shlib: unix_make + @echo\ + 'which is UnZip linked with the DLL). This target is an example only.' + @echo "" +- $(MAKE) objsdll CC=gcc CFLAGS="-O3 -Wall -fPIC -DDLL" +- gcc -shared -Wl,-soname,libunzip.so.0 -o libunzip.so.0.4 $(OBJSDLL) ++ $(MAKE) objsdll CFLAGS="-O3 -Wall -fPIC -DDLL" ++ $(CC) -shared -Wl,-soname,libunzip.so.0 -o libunzip.so.0.4 $(OBJSDLL) + $(RM) libunzip.so.0 libunzip.so + $(LN) -s libunzip.so.0.4 libunzip.so.0 + $(LN) -s libunzip.so.0 libunzip.so +- gcc -c -O unzipstb.c +- gcc -o unzip_shlib unzipstb.o -L. -lunzip ++ $(CC) -c -O unzipstb.c ++ $(CC) -o unzip_shlib unzipstb.o -L. -lunzip + + #---------------------------------------------------------------------------- + # "Autoconfig" group, aliases for the generic targets using configure: +diff --git a/unix/configure b/unix/configure +index 4d6f867..ed26fa7 100755 +--- a/unix/configure ++++ b/unix/configure +@@ -433,7 +433,7 @@ if [ $? -ne 0 ]; then + if [ ${OPT} ]; then + LFLAGS2="${LFLAGS2} ${OPT}" + else +- CFLAGSR="${CFLAGSR} -DNO_DIR" ++ CFLAGSR="${CFLAGSR} " + fi + fi + +-- +2.19.1 + diff --git a/unzip.spec b/unzip.spec index 1872512..5ec22f5 100644 --- a/unzip.spec +++ b/unzip.spec @@ -1,6 +1,6 @@ Name: unzip Version: 6.0 -Release: 51 +Release: 52 Summary: A utility for unpacking zip files License: Info-ZIP,Public Domain URL: http://www.info-zip.org/UnZip.html @@ -29,6 +29,7 @@ Patch0020: unzip-6.0-alt-iconv-utf8-print.patch Patch0021: 0001-Fix-CVE-2016-9844-rhbz-1404283.patch Patch0022: unzip-6.0-timestamp.patch Patch0023: unzip-6.0-cve-2018-1000035-heap-based-overflow.patch +Patch0024: unzip-6.0-support-clang-build.patch Patch6000: CVE-2018-18384.patch Patch6001: CVE-2019-13232-pre.patch @@ -76,6 +77,9 @@ make check -f unix/Makefile %{_mandir}/man1/* %changelog +* Fri Mar 1 2024 luofeng - 6.0-51 +- support clang build + * Sat Mar 4 2023 yanglongkang - 6.0-51 - add "PIE" compiler options -- Gitee