From 13250ad902f753deb86eb049810423db8f5a2084 Mon Sep 17 00:00:00 2001 From: Matthew Krupcale Date: Thu, 27 Jan 2022 20:57:46 -0500 Subject: [PATCH] Explicitly define CC and CFLAGS for bootstrap builds build2 does not directly build any C code since it instead directly #include's bundled C dependencies in C++ TUs, but this premptively ensures that if this were to change we build such C code with the proper flags. Non-bootstrap builds already define the proper C flags through the use of the %build2 or %build2_configure macros. * build2.spec: define CC and CFLAGS for bootstrap builds --- build2.spec | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/build2.spec b/build2.spec index 7e3665a..b28f421 100644 --- a/build2.spec +++ b/build2.spec @@ -312,7 +312,9 @@ mv libbutl-%{version} %{name}-%{version} config.install.lib.mode=755 \\\ config.install.chroot=%{?buildroot} %if %{with bootstrap} +CC=gcc CXX=g++ +CFLAGS="${CFLAGS:-%{build_cflags}}" CXXFLAGS="${CXXFLAGS:-%{build_cxxflags}}" LDFLAGS="${LDFLAGS:-%{build_ldflags}}" export LD_LIBRARY_PATH=$PWD/%{name}-%{version}/lib%{name}:${LD_LIBRARY_PATH} @@ -326,14 +328,18 @@ export LD_LIBRARY_PATH=$PWD/%{name}-%{version}/lib%{name}/version:${LD_LIBRARY_P export LD_LIBRARY_PATH=$PWD/%{name}-%{version}/libbutl-%{version}/libbutl:${LD_LIBRARY_PATH} pushd %{name}-%{version} # bootstrap, phase 1: minimal build system +export CC export CXX +export CFLAGS export CXXFLAGS export LDFLAGS %make_build -f bootstrap.gmake # bootstrap, phase 2: statically linked build system build2/b-boot \ config.bin.lib=static \ + config.c=${CC} \ config.cxx=${CXX} \ + config.c.coptions="${CFLAGS}" \ config.cxx.coptions="${CXXFLAGS}" \ config.cxx.poptions+="$(pkgconf --cflags-only-I libpkgconf)" \ config.cxx.loptions+="$(pkgconf --libs-only-L libpkgconf) ${LDFLAGS}" \ @@ -346,7 +352,9 @@ build2/b-boot configure %endif config.bin.rpath.auto=false \ config.bin.rpath_link.auto=false \ + config.c=${CC} \ config.cxx=${CXX} \ + config.c.coptions="${CFLAGS}" \ config.cxx.coptions="${CXXFLAGS}" \ config.cxx.loptions="${LDFLAGS}" \ %{config_install} @@ -358,7 +366,9 @@ popd libodb-%{libodb_bundle_version}/ \ libodb-sqlite-%{libodb_bundle_version}/ \ config.bin.lib=static \ + config.c=${CC} \ config.cxx=${CXX} \ + config.c.coptions="${CFLAGS}" \ config.cxx.coptions="${CXXFLAGS}" \ config.cxx.loptions="${LDFLAGS}" \ config.import.libodb="libodb-%{libodb_bundle_version}/" \ @@ -374,7 +384,9 @@ popd %endif config.bin.rpath.auto=false \ config.bin.rpath_link.auto=false \ + config.c=${CC} \ config.cxx=${CXX} \ + config.c.coptions="${CFLAGS}" \ config.cxx.coptions="${CXXFLAGS}" \ config.cxx.loptions="${LDFLAGS}" \ %if %{with bundle_libodb}