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
This commit is contained in:
Matthew Krupcale 2022-01-27 20:57:46 -05:00
parent 4cc4bb9c97
commit 13250ad902

View File

@ -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}