From: Jonathan Wakely (jwakely.boost_at_[hidden])
Date: 2020-04-24 17:47:57


With Peter Dimov's help I've resolved my earlier problems packaging
Boost for Fedora.

Now my problem is that the generated .cmake files contain the full
--prefix path, which is not what I want because that's just a staging
area, not the final resting place for the files (think DESTDIR in an
autotools build).

I see lines like this in each of the installed .cmake files:

/builddir/build/BUILDROOT/boost-1.73.0-0.1.fc33.x86_64/usr/lib64/openmpi/lib/cmake/boost_python-1.73.0/boost_python-config.cmake:if(EXISTS
"/builddir/build/BUILDROOT/boost-1.73.0-0.1.fc33.x86_64/usr/lib64/openmpi/lib/cmake")
/builddir/build/BUILDROOT/boost-1.73.0-0.1.fc33.x86_64/usr/lib64/openmpi/lib/cmake/boost_python-1.73.0/boost_python-config.cmake:
 get_filename_component(_BOOST_CMAKEDIR_ORIGINAL
"/builddir/build/BUILDROOT/boost-1.73.0-0.1.fc33.x86_64/usr/lib64/openmpi/lib/cmake"
REALPATH)
/builddir/build/BUILDROOT/boost-1.73.0-0.1.fc33.x86_64/usr/lib64/openmpi/lib/cmake/boost_python-1.73.0/boost_python-config.cmake:
   set(_BOOST_CMAKEDIR
"/builddir/build/BUILDROOT/boost-1.73.0-0.1.fc33.x86_64/usr/lib64/openmpi/lib/cmake")

These files won't work after everything gets moved from the staging
area $RPM_BUILD_ROOT/usr/... to the final lcoation on a user's
machine, under /usr/...

I can just use sed to alter them, but surely there's way to set the
desired prefix?

I'm trying:

./bootstrap.sh --with-toolset=gcc --with-icu --prefix=/usr

./b2 -d+2 -q -j 4 \
    --without-mpi --without-graph_parallel --build-dir=serial \
    --prefix=/usr --libdir=/usr/lib64 \
    variant=release threading=multi debug-symbols=on pch=off \
    python=3.8 \
    stage

...

./b2 -d+2 -q -j 4 \
    --without-mpi --without-graph_parallel --build-dir=serial \
    --prefix=$RPM_BUILD_ROOT/usr \
    --libdir=$RPM_BUILD_ROOT/usr/lib64 \
    variant=release threading=multi debug-symbols=on pch=off \
    python=%{python3_version} \
    install

And this produces the .cmake files with the unwanted
$RPM_BUILD_ROOT/usr prefixes.

I originally didn't have the --prefix and --libdir options on the
bootstrap.sh command and the 'b2 .. . stage' command, but it doesn't
seem to matter whether they're there or not.

Is there some way to control the prefix that ends up in those .cmake files?