Signed-off-by: Cheng Li <cheng@kubuds.cn> (cherry picked from commit b8ff847b26ac8c1a11f1c585db9977eb3108a00e)
74 lines
2.3 KiB
Diff
74 lines
2.3 KiB
Diff
From 3ac162e9f6ff4b138f3141af2b5c345b9c9b4ee1 Mon Sep 17 00:00:00 2001
|
|
From: Cheng Li <cheng@kubuds.cn>
|
|
Date: Tue, 9 Apr 2024 13:46:50 +0000
|
|
Subject: [PATCH] unzip-6.0-support-clang-build
|
|
|
|
---
|
|
unix/Makefile | 15 +++++++++------
|
|
unix/configure | 2 ++
|
|
2 files changed, 11 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/unix/Makefile b/unix/Makefile
|
|
index ab32270..3de8873 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 =
|
|
@@ -547,6 +547,9 @@ generic: flags # now try autoconfigure first
|
|
generic_gcc:
|
|
$(MAKE) $(MAKEF) generic CC=gcc IZ_BZIP2="$(IZ_BZIP2)"
|
|
|
|
+generic_clang:
|
|
+ $(MAKE) $(MAKEF) generic CC=clang IZ_BZIP2="$(IZ_BZIP2)"
|
|
+
|
|
# extensions to perform SVR4 package-creation after compilation
|
|
generic_pkg: generic svr4package
|
|
generic_gccpkg: generic_gcc svr4package
|
|
@@ -594,13 +597,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..c231721 100755
|
|
--- a/unix/configure
|
|
+++ b/unix/configure
|
|
@@ -432,6 +432,8 @@ if [ $? -ne 0 ]; then
|
|
done
|
|
if [ ${OPT} ]; then
|
|
LFLAGS2="${LFLAGS2} ${OPT}"
|
|
+ elif [ "$CC" == "clang" ]; then
|
|
+ CFLAGSR="${CFLAGSR}"
|
|
else
|
|
CFLAGSR="${CFLAGSR} -DNO_DIR"
|
|
fi
|
|
--
|
|
2.41.0
|
|
|