Controlling _BOOST_CMAKEDIR in installed .cmake files
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?
Jonathan Wakely wrote:
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")
That shouldn't be a problem. This portion tries to detect a corner case in which the CMake directory is reached through a symlink; if it's moved, this check will just not activate, which is fine. The config files are still fully relocatable. I have an open issue to implement support for DESTDIR, but this will happen for 1.74.
On Fri, 24 Apr 2020 at 19:06, Peter Dimov via Boost
Jonathan Wakely wrote:
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")
That shouldn't be a problem. This portion tries to detect a corner case in which the CMake directory is reached through a symlink; if it's moved, this check will just not activate, which is fine. The config files are still fully relocatable.
The problem is that the Fedora RPM build process fails at this point, because it's a fatal error if the string "/builddir/build/BUILDROOT/boost-1.73.0-0.1.fc33.x86_64/" appears in any of the files being packaged. Since that directory is purely an artefact of building the package and never exists on the end users' machines, any hardcoded reference to that path is wrong.
I have an open issue to implement support for DESTDIR, but this will happen for 1.74.
Good to know, thanks. If there's nothing like a --destdir flag that I'm missing then I'll just use sed to get rid of those paths. Thanks for the confirmation.
participants (2)
-
Jonathan Wakely
-
Peter Dimov