Convert some shell variables into macros

PYTHON2_VERSION needs to be visible across sections, and it's awkward to
define it twice.  Just make it a macro.  %global expands once only.

PYTHON3_* technically doesn't need this, but let's be consistent.
This commit is contained in:
Petr Machata 2012-08-09 22:05:39 +02:00
parent cccfe7b394
commit 0c64b73a16

View File

@ -484,13 +484,19 @@ a number of significant features and is now developed independently
%patch12 -p3 %patch12 -p3
%patch15 -p0 %patch15 -p0
%build # At least python2_version needs to be a macro so that it's visible in
# %%install as well.
PYTHON2_VERSION=$(/usr/bin/python2 %{SOURCE1}) %global python2_version %(/usr/bin/python2 %{SOURCE1})
%if %{with python3} %if %{with python3}
PYTHON3_VERSION=$(/usr/bin/python3 %{SOURCE1}) %global python3_version %(/usr/bin/python3 %{SOURCE1})
PYTHON3_ABIFLAGS=$(/usr/bin/python3-config --abiflags) %global python3_abiflags %(/usr/bin/python3-config --abiflags)
%endif
%build
: PYTHON2_VERSION=%{python2_version}
%if %{with python3}
: PYTHON3_VERSION=%{python3_version}
: PYTHON3_ABIFLAGS=%{python3_abiflags}
%endif %endif
cat >> ./tools/build/v2/user-config.jam << EOF cat >> ./tools/build/v2/user-config.jam << EOF
@ -498,7 +504,7 @@ using mpi ;
%if %{with python3} %if %{with python3}
# This _adds_ extra python version. It doesn't replace whatever # This _adds_ extra python version. It doesn't replace whatever
# python 2.X is default on the system. # python 2.X is default on the system.
using python : ${PYTHON3_VERSION} : /usr/bin/python3 : /usr/include/python${PYTHON3_VERSION}${PYTHON3_ABIFLAGS} ; using python : %{python3_version} : /usr/bin/python3 : /usr/include/python%{python3_version}%{python3_abiflags} ;
%endif %endif
EOF EOF
@ -520,7 +526,7 @@ echo ============================= build serial ==================
./b2 -d+2 -q %{?_smp_mflags} --layout=tagged \ ./b2 -d+2 -q %{?_smp_mflags} --layout=tagged \
--without-mpi --without-graph_parallel --build-dir=serial \ --without-mpi --without-graph_parallel --build-dir=serial \
variant=release threading=single,multi debug-symbols=on pch=off \ variant=release threading=single,multi debug-symbols=on pch=off \
python=${PYTHON2_VERSION} stage python=%{python2_version} stage
# Build MPI parts of Boost with OpenMPI support # Build MPI parts of Boost with OpenMPI support
# #
@ -534,7 +540,7 @@ echo ============================= build $MPI_COMPILER ==================
./b2 -d+2 -q %{?_smp_mflags} --layout=tagged \ ./b2 -d+2 -q %{?_smp_mflags} --layout=tagged \
--with-mpi --with-graph_parallel --build-dir=$MPI_COMPILER \ --with-mpi --with-graph_parallel --build-dir=$MPI_COMPILER \
variant=release threading=multi debug-symbols=on pch=off \ variant=release threading=multi debug-symbols=on pch=off \
python=${PYTHON2_VERSION} stage python=%{python2_version} stage
%{_openmpi_unload} %{_openmpi_unload}
export PATH=/bin${PATH:+:}$PATH export PATH=/bin${PATH:+:}$PATH
%endif %endif
@ -546,7 +552,7 @@ echo ============================= build $MPI_COMPILER ==================
./b2 -d+2 -q %{?_smp_mflags} --layout=tagged \ ./b2 -d+2 -q %{?_smp_mflags} --layout=tagged \
--with-mpi --with-graph_parallel --build-dir=$MPI_COMPILER \ --with-mpi --with-graph_parallel --build-dir=$MPI_COMPILER \
variant=release threading=multi debug-symbols=on pch=off \ variant=release threading=multi debug-symbols=on pch=off \
python=${PYTHON2_VERSION} stage python=%{python2_version} stage
%{_mpich2_unload} %{_mpich2_unload}
export PATH=/bin${PATH:+:}$PATH export PATH=/bin${PATH:+:}$PATH
%endif %endif
@ -561,7 +567,6 @@ echo ============================= build Boost.Build ==================
%install %install
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
PYTHON2_VERSION=$(/usr/bin/python2 %{SOURCE1})
cd %{_builddir}/%{toplev_dirname} cd %{_builddir}/%{toplev_dirname}
@ -572,7 +577,7 @@ echo ============================= install $MPI_COMPILER ==================
--with-mpi --with-graph_parallel --build-dir=$MPI_COMPILER \ --with-mpi --with-graph_parallel --build-dir=$MPI_COMPILER \
--stagedir=${RPM_BUILD_ROOT}${MPI_HOME} \ --stagedir=${RPM_BUILD_ROOT}${MPI_HOME} \
variant=release threading=multi debug-symbols=on pch=off \ variant=release threading=multi debug-symbols=on pch=off \
python=${PYTHON2_VERSION} stage python=%{python2_version} stage
# Remove generic parts of boost that were built for dependencies. # Remove generic parts of boost that were built for dependencies.
rm -f ${RPM_BUILD_ROOT}${MPI_HOME}/lib/libboost_{python,{w,}serialization}* rm -f ${RPM_BUILD_ROOT}${MPI_HOME}/lib/libboost_{python,{w,}serialization}*
@ -588,7 +593,7 @@ echo ============================= install $MPI_COMPILER ==================
--with-mpi --with-graph_parallel --build-dir=$MPI_COMPILER \ --with-mpi --with-graph_parallel --build-dir=$MPI_COMPILER \
--stagedir=${RPM_BUILD_ROOT}${MPI_HOME} \ --stagedir=${RPM_BUILD_ROOT}${MPI_HOME} \
variant=release threading=multi debug-symbols=on pch=off \ variant=release threading=multi debug-symbols=on pch=off \
python=${PYTHON2_VERSION} stage python=%{python2_version} stage
# Remove generic parts of boost that were built for dependencies. # Remove generic parts of boost that were built for dependencies.
rm -f ${RPM_BUILD_ROOT}${MPI_HOME}/lib/libboost_{python,{w,}serialization}* rm -f ${RPM_BUILD_ROOT}${MPI_HOME}/lib/libboost_{python,{w,}serialization}*
@ -603,7 +608,7 @@ echo ============================= install serial ==================
--prefix=$RPM_BUILD_ROOT%{_prefix} \ --prefix=$RPM_BUILD_ROOT%{_prefix} \
--libdir=$RPM_BUILD_ROOT%{_libdir} \ --libdir=$RPM_BUILD_ROOT%{_libdir} \
variant=release threading=single,multi debug-symbols=on pch=off \ variant=release threading=single,multi debug-symbols=on pch=off \
python=${PYTHON2_VERSION} install python=%{python2_version} install
echo ============================= install Boost.Build ================== echo ============================= install Boost.Build ==================
(cd tools/build/v2 (cd tools/build/v2