void-packages/srcpkgs/notmuch/patches/0001-configure-detect-versi...

52 lines
1.6 KiB
Diff

From 5402e4d357d7957942acc4b906b58102b6bd4fdf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
<congdanhqx@gmail.com>
Date: Mon, 27 Jul 2020 15:46:35 +0700
Subject: [PATCH] configure: detect version by compiler for build
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
We'll need to run the compiled binary to report our current version.
With the same code base, we should have the same version information
regardless of compiler and architecture.
Let's use the compiler for building architecture to build the reporting
binary. Which is usually reported under variable CC_FOR_BUILD,
a convention established by GNU Autotools, and fall back to CC if it's
not defined.
Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
configure | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/configure b/configure
index 80cbac4f..6c77960f 100755
--- a/configure
+++ b/configure
@@ -85,8 +85,10 @@ fi
BASHCMD=${BASHCMD:-bash}
PERL=${PERL:-perl}
CC=${CC:-cc}
+CC_FOR_BUILD=${CC_FOR_BUILD:-$CC}
CXX=${CXX:-c++}
CFLAGS=${CFLAGS:--g -O2}
+CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD:-$CFLAGS}
CPPFLAGS=${CPPFLAGS:-}
CXXFLAGS_for_sh=${CXXFLAGS:-${CFLAGS}}
CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)}
@@ -409,7 +411,7 @@ int main(void) {
return 0;
}
EOF
-if ${CC} ${CFLAGS} -I"$srcdir" _libversion.c -o _libversion > /dev/null 2>&1 \
+if ${CC_FOR_BUILD} ${CFLAGS_FOR_BUILD} -I"$srcdir" _libversion.c -o _libversion > /dev/null 2>&1 \
&& ./_libversion > _libversion.sh && . ./_libversion.sh
then
printf "OK.\n"
--
2.28.0.rc2.21.g5c06d60fc5