mirror of
https://github.com/NixOS/nix
synced 2025-07-05 20:41:47 +02:00
Improve boost hacks
This commit is contained in:
parent
8399bd6b8f
commit
0b539dea4a
11 changed files with 26 additions and 131 deletions
|
@ -254,12 +254,7 @@ this_library = library(
|
|||
|
||||
install_headers(headers, subdir : 'nix', preserve_path : true)
|
||||
|
||||
# Part of how we copy boost libraries to a separate installation to
|
||||
# reduce closure size. These libraries will be copied to our `$out/bin`,
|
||||
# and these `-l` flags will pick them up there.
|
||||
#
|
||||
# https://github.com/NixOS/nixpkgs/issues/45462
|
||||
libraries_private = ['-lboost_context', '-lboost_coroutine']
|
||||
libraries_private = []
|
||||
if host_machine.system() == 'windows'
|
||||
# `libraries_private` cannot contain ad-hoc dependencies (from
|
||||
# `find_library), so we need to do this manually
|
||||
|
|
|
@ -65,7 +65,6 @@ mkMesonDerivation (finalAttrs: {
|
|||
];
|
||||
|
||||
buildInputs = [
|
||||
boost
|
||||
brotli
|
||||
libsodium
|
||||
openssl
|
||||
|
@ -73,37 +72,17 @@ mkMesonDerivation (finalAttrs: {
|
|||
;
|
||||
|
||||
propagatedBuildInputs = [
|
||||
boost.dev
|
||||
boost
|
||||
libarchive
|
||||
nlohmann_json
|
||||
];
|
||||
|
||||
disallowedReferences = [ boost ];
|
||||
|
||||
preConfigure =
|
||||
# TODO: change release process to add `pre` in `.version`, remove it before tagging, and restore after.
|
||||
''
|
||||
chmod u+w ./.version
|
||||
echo ${version} > ../../.version
|
||||
''
|
||||
# Copy some boost libraries so we don't get all of Boost in our
|
||||
# closure. https://github.com/NixOS/nixpkgs/issues/45462
|
||||
+ lib.optionalString (!stdenv.hostPlatform.isStatic) (''
|
||||
mkdir -p $out/lib
|
||||
cp -pd ${boost}/lib/{libboost_context*,libboost_thread*,libboost_system*} $out/lib
|
||||
rm -f $out/lib/*.a
|
||||
'' + lib.optionalString stdenv.hostPlatform.isLinux ''
|
||||
chmod u+w $out/lib/*.so.*
|
||||
patchelf --set-rpath $out/lib:${stdenv.cc.cc.lib}/lib $out/lib/libboost_thread.so.*
|
||||
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||
for LIB in $out/lib/*.dylib; do
|
||||
chmod u+w $LIB
|
||||
install_name_tool -id $LIB $LIB
|
||||
install_name_tool -delete_rpath ${boost}/lib/ $LIB || true
|
||||
done
|
||||
install_name_tool -change ${boost}/lib/libboost_system.dylib $out/lib/libboost_system.dylib $out/lib/libboost_thread.dylib
|
||||
''
|
||||
);
|
||||
'';
|
||||
|
||||
mesonFlags = [
|
||||
(lib.mesonEnable "cpuid" stdenv.hostPlatform.isx86_64)
|
||||
|
@ -120,20 +99,6 @@ mkMesonDerivation (finalAttrs: {
|
|||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
postInstall =
|
||||
# Remove absolute path to boost libs that ends up in `Libs.private`
|
||||
# by default, and would clash with out `disallowedReferences`. Part
|
||||
# of the https://github.com/NixOS/nixpkgs/issues/45462 workaround.
|
||||
''
|
||||
sed -i "$out/lib/pkgconfig/nix-util.pc" -e 's, ${lib.getLib boost}[^ ]*,,g'
|
||||
''
|
||||
+ lib.optionalString stdenv.isDarwin ''
|
||||
install_name_tool \
|
||||
-change ${boost}/lib/libboost_context.dylib \
|
||||
$out/lib/libboost_context.dylib \
|
||||
$out/lib/libnixutil.dylib
|
||||
'';
|
||||
|
||||
separateDebugInfo = !stdenv.hostPlatform.isStatic;
|
||||
|
||||
# TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue