From: Jan Palus Date: Mon, 28 Mar 2022 09:00:36 +0000 (+0200) Subject: fix cc misdetection X-Git-Tag: auto/th/zlib-1.2.12-1 X-Git-Url: http://git.pld-linux.org/gitweb.cgi?a=commitdiff_plain;h=6f901dc3c490e541a8941459b06d641dee495f47;p=packages%2Fzlib.git fix cc misdetection from https://github.com/madler/zlib/pull/607 --- diff --git a/cc.patch b/cc.patch new file mode 100644 index 0000000..f34c404 --- /dev/null +++ b/cc.patch @@ -0,0 +1,43 @@ +From 80d086357a55b94a13e43756cf3e131f25eef0e4 Mon Sep 17 00:00:00 2001 +From: Sam James +Date: Mon, 28 Mar 2022 08:40:45 +0100 +Subject: [PATCH] Fix CC logic in configure + +In https://github.com/madler/zlib/commit/e9a52aa129efe3834383e415580716a7c4027f8d, +the logic was changed to try check harder for GCC, but it dropped +the default setting of cc=${CC}. It was throwing away any pre-set CC value as +a result. + +The rest of the script then cascades down a bad path because it's convinced +it's not GCC or a GCC-like compiler. + +This led to e.g. misdetection of inability to build shared libs +for say, multilib cases (w/ CC being one thing from the environment being used +for one test (e.g. x86_64-unknown-linux-gnu-gcc -m32 and then 'cc' used for +shared libs (but missing "-m32"!)). Obviously just one example of how +the old logic could break. + +This restores the old default of 'CC' if nothing overrides it later +in configure. + +Bug: https://bugs.gentoo.org/836308 +Signed-off-by: Sam James +--- + configure | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/configure b/configure +index 52ff4a04e..3fa3e8618 100755 +--- a/configure ++++ b/configure +@@ -174,7 +174,10 @@ if test -z "$CC"; then + else + cc=${CROSS_PREFIX}cc + fi ++else ++ cc=${CC} + fi ++ + cflags=${CFLAGS-"-O3"} + # to force the asm version use: CFLAGS="-O3 -DASMV" ./configure + case "$cc" in diff --git a/zlib.spec b/zlib.spec index c7356af..352e781 100644 --- a/zlib.spec +++ b/zlib.spec @@ -24,6 +24,7 @@ Group: Libraries Source0: http://www.zlib.net/current/%{name}-%{version}.tar.gz # Source0-md5: 5fc414a9726be31427b440b434d05f78 Patch0: %{name}-asm.patch +Patch1: cc.patch URL: http://www.zlib.net/ BuildRequires: autoconf >= 2.50 BuildRequires: automake @@ -302,6 +303,7 @@ cp contrib/asm686/match.S . cp contrib/amd64/amd64-match.S match.S %endif %endif +%patch1 -p1 %build CC="%{__cc}" \