mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 14:06:16 +02:00
Improve boost hacks
This commit is contained in:
parent
8399bd6b8f
commit
0b539dea4a
11 changed files with 26 additions and 131 deletions
|
@ -207,7 +207,7 @@
|
||||||
# https://github.com/NixOS/nixpkgs/issues/320448
|
# https://github.com/NixOS/nixpkgs/issues/320448
|
||||||
"static-" = nixpkgsFor.${system}.static;
|
"static-" = nixpkgsFor.${system}.static;
|
||||||
})
|
})
|
||||||
(nixpkgsPrefix: nixpkgs:
|
(nixpkgsPrefix: nixpkgs:
|
||||||
flatMapAttrs nixpkgs.nixComponents
|
flatMapAttrs nixpkgs.nixComponents
|
||||||
(pkgName: pkg:
|
(pkgName: pkg:
|
||||||
flatMapAttrs pkg.tests or {}
|
flatMapAttrs pkg.tests or {}
|
||||||
|
@ -304,8 +304,8 @@
|
||||||
env = {
|
env = {
|
||||||
# Needed for Meson to find Boost.
|
# Needed for Meson to find Boost.
|
||||||
# https://github.com/NixOS/nixpkgs/issues/86131.
|
# https://github.com/NixOS/nixpkgs/issues/86131.
|
||||||
BOOST_INCLUDEDIR = "${lib.getDev pkgs.boost}/include";
|
BOOST_INCLUDEDIR = "${lib.getDev pkgs.nixDependencies.boost}/include";
|
||||||
BOOST_LIBRARYDIR = "${lib.getLib pkgs.boost}/lib";
|
BOOST_LIBRARYDIR = "${lib.getLib pkgs.nixDependencies.boost}/lib";
|
||||||
# For `make format`, to work without installing pre-commit
|
# For `make format`, to work without installing pre-commit
|
||||||
_NIX_PRE_COMMIT_HOOKS_CONFIG =
|
_NIX_PRE_COMMIT_HOOKS_CONFIG =
|
||||||
"${(pkgs.formats.yaml { }).generate "pre-commit-config.yaml" modular.pre-commit.settings.rawConfig}";
|
"${(pkgs.formats.yaml { }).generate "pre-commit-config.yaml" modular.pre-commit.settings.rawConfig}";
|
||||||
|
|
29
package.nix
29
package.nix
|
@ -199,7 +199,6 @@ in {
|
||||||
;
|
;
|
||||||
|
|
||||||
buildInputs = lib.optionals doBuild [
|
buildInputs = lib.optionals doBuild [
|
||||||
boost
|
|
||||||
brotli
|
brotli
|
||||||
bzip2
|
bzip2
|
||||||
curl
|
curl
|
||||||
|
@ -227,33 +226,12 @@ in {
|
||||||
;
|
;
|
||||||
|
|
||||||
propagatedBuildInputs = [
|
propagatedBuildInputs = [
|
||||||
|
boost
|
||||||
nlohmann_json
|
nlohmann_json
|
||||||
] ++ lib.optional enableGC boehmgc;
|
] ++ lib.optional enableGC boehmgc;
|
||||||
|
|
||||||
dontBuild = !attrs.doBuild;
|
dontBuild = !attrs.doBuild;
|
||||||
|
|
||||||
disallowedReferences = [ boost ];
|
|
||||||
|
|
||||||
preConfigure = lib.optionalString (doBuild && ! stdenv.hostPlatform.isStatic) (
|
|
||||||
''
|
|
||||||
# Copy libboost_context so we don't get all of Boost in our closure.
|
|
||||||
# https://github.com/NixOS/nixpkgs/issues/45462
|
|
||||||
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
|
|
||||||
''
|
|
||||||
);
|
|
||||||
|
|
||||||
configureFlags = [
|
configureFlags = [
|
||||||
(lib.enableFeature doBuild "build")
|
(lib.enableFeature doBuild "build")
|
||||||
(lib.enableFeature doInstallCheck "functional-tests")
|
(lib.enableFeature doInstallCheck "functional-tests")
|
||||||
|
@ -295,11 +273,6 @@ in {
|
||||||
lib.optionalString stdenv.hostPlatform.isStatic ''
|
lib.optionalString stdenv.hostPlatform.isStatic ''
|
||||||
mkdir -p $out/nix-support
|
mkdir -p $out/nix-support
|
||||||
echo "file binary-dist $out/bin/nix" >> $out/nix-support/hydra-build-products
|
echo "file binary-dist $out/bin/nix" >> $out/nix-support/hydra-build-products
|
||||||
'' + lib.optionalString stdenv.isDarwin ''
|
|
||||||
install_name_tool \
|
|
||||||
-change ${boost}/lib/libboost_context.dylib \
|
|
||||||
$out/lib/libboost_context.dylib \
|
|
||||||
$out/lib/libnixutil.dylib
|
|
||||||
''
|
''
|
||||||
) + lib.optionalString enableManual ''
|
) + lib.optionalString enableManual ''
|
||||||
mkdir -p ''${!outputDoc}/nix-support
|
mkdir -p ''${!outputDoc}/nix-support
|
||||||
|
|
|
@ -26,23 +26,6 @@ in
|
||||||
nix-expr-test = callPackage ../src/libexpr-test/package.nix { };
|
nix-expr-test = callPackage ../src/libexpr-test/package.nix { };
|
||||||
nix-expr-c = callPackage ../src/libexpr-c/package.nix { };
|
nix-expr-c = callPackage ../src/libexpr-c/package.nix { };
|
||||||
|
|
||||||
nix-flake = callPackage ../src/libflake/package.nix { };
|
|
||||||
nix-flake-c = callPackage ../src/libflake-c/package.nix { };
|
|
||||||
|
|
||||||
nix-store = callPackage ../src/libstore/package.nix { };
|
|
||||||
nix-store-test-support = callPackage ../src/libstore-test-support/package.nix { };
|
|
||||||
nix-store-test = callPackage ../src/libstore-test/package.nix { };
|
|
||||||
nix-store-c = callPackage ../src/libstore-c/package.nix { };
|
|
||||||
|
|
||||||
nix-fetchers = callPackage ../src/libfetchers/package.nix { };
|
|
||||||
nix-fetchers-test = callPackage ../src/libfetchers-test/package.nix { };
|
|
||||||
nix-fetchers-c = callPackage ../src/libfetchers-c/package.nix { };
|
|
||||||
|
|
||||||
nix-expr = callPackage ../src/libexpr/package.nix { };
|
|
||||||
nix-expr-test-support = callPackage ../src/libexpr-test-support/package.nix { };
|
|
||||||
nix-expr-test = callPackage ../src/libexpr-test/package.nix { };
|
|
||||||
nix-expr-c = callPackage ../src/libexpr-c/package.nix { };
|
|
||||||
|
|
||||||
nix-flake = callPackage ../src/libflake/package.nix { };
|
nix-flake = callPackage ../src/libflake/package.nix { };
|
||||||
|
|
||||||
nix-internal-api-docs = callPackage ../src/internal-api-docs/package.nix { };
|
nix-internal-api-docs = callPackage ../src/internal-api-docs/package.nix { };
|
||||||
|
|
|
@ -52,6 +52,19 @@ scope: {
|
||||||
enableLargeConfig = true;
|
enableLargeConfig = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Hack until https://github.com/NixOS/nixpkgs/issues/45462 is fixed.
|
||||||
|
boost = (pkgs.boost.override {
|
||||||
|
extraB2Args = [
|
||||||
|
"--with-container"
|
||||||
|
"--with-context"
|
||||||
|
"--with-coroutine"
|
||||||
|
];
|
||||||
|
}).overrideAttrs (old: {
|
||||||
|
# Need to remove `--with-*` to use `--with-libraries=...`
|
||||||
|
buildPhase = pkgs.lib.replaceStrings [ "--without-python" ] [ "" ] old.buildPhase;
|
||||||
|
installPhase = pkgs.lib.replaceStrings [ "--without-python" ] [ "" ] old.installPhase;
|
||||||
|
});
|
||||||
|
|
||||||
libgit2 = pkgs.libgit2.overrideAttrs (attrs: {
|
libgit2 = pkgs.libgit2.overrideAttrs (attrs: {
|
||||||
src = inputs.libgit2;
|
src = inputs.libgit2;
|
||||||
version = inputs.libgit2.lastModifiedDate;
|
version = inputs.libgit2.lastModifiedDate;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#include "network-proxy.hh"
|
#include "network-proxy.hh"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <boost/algorithm/string.hpp>
|
|
||||||
|
|
||||||
#include "environment-variables.hh"
|
#include "environment-variables.hh"
|
||||||
|
|
||||||
|
@ -13,7 +12,9 @@ static StringSet getAllVariables()
|
||||||
{
|
{
|
||||||
StringSet variables = lowercaseVariables;
|
StringSet variables = lowercaseVariables;
|
||||||
for (const auto & variable : lowercaseVariables) {
|
for (const auto & variable : lowercaseVariables) {
|
||||||
variables.insert(boost::to_upper_copy(variable));
|
std::string upperVariable;
|
||||||
|
std::transform(variable.begin(), variable.end(), upperVariable.begin(), [](unsigned char c) { return std::toupper(c); });
|
||||||
|
variables.insert(std::move(upperVariable));
|
||||||
}
|
}
|
||||||
return variables;
|
return variables;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,19 +70,14 @@ mkDerivation (finalAttrs: {
|
||||||
pkg-config
|
pkg-config
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = [
|
|
||||||
boost
|
|
||||||
];
|
|
||||||
|
|
||||||
propagatedBuildInputs = [
|
propagatedBuildInputs = [
|
||||||
nix-util
|
nix-util
|
||||||
nix-store
|
nix-store
|
||||||
nix-fetchers
|
nix-fetchers
|
||||||
|
boost
|
||||||
nlohmann_json
|
nlohmann_json
|
||||||
] ++ lib.optional enableGC boehmgc;
|
] ++ lib.optional enableGC boehmgc;
|
||||||
|
|
||||||
disallowedReferences = [ boost ];
|
|
||||||
|
|
||||||
preConfigure =
|
preConfigure =
|
||||||
# "Inline" .version so it's not a symlink, and includes the suffix
|
# "Inline" .version so it's not a symlink, and includes the suffix
|
||||||
''
|
''
|
||||||
|
@ -104,14 +99,6 @@ mkDerivation (finalAttrs: {
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
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-expr.pc" -e 's, ${lib.getLib boost}[^ ]*,,g'
|
|
||||||
'';
|
|
||||||
|
|
||||||
separateDebugInfo = !stdenv.hostPlatform.isStatic;
|
separateDebugInfo = !stdenv.hostPlatform.isStatic;
|
||||||
|
|
||||||
# TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564
|
# TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564
|
||||||
|
|
|
@ -400,6 +400,6 @@ this_library = library(
|
||||||
|
|
||||||
install_headers(headers, subdir : 'nix', preserve_path : true)
|
install_headers(headers, subdir : 'nix', preserve_path : true)
|
||||||
|
|
||||||
libraries_private = ['-lboost_container']
|
libraries_private = []
|
||||||
|
|
||||||
subdir('meson-utils/export')
|
subdir('meson-utils/export')
|
||||||
|
|
|
@ -86,8 +86,6 @@ mkDerivation (finalAttrs: {
|
||||||
nlohmann_json
|
nlohmann_json
|
||||||
];
|
];
|
||||||
|
|
||||||
disallowedReferences = [ boost ];
|
|
||||||
|
|
||||||
preConfigure =
|
preConfigure =
|
||||||
# "Inline" .version so it's not a symlink, and includes the suffix
|
# "Inline" .version so it's not a symlink, and includes the suffix
|
||||||
''
|
''
|
||||||
|
@ -112,14 +110,6 @@ mkDerivation (finalAttrs: {
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
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-store.pc" -e 's, ${lib.getLib boost}[^ ]*,,g'
|
|
||||||
'';
|
|
||||||
|
|
||||||
separateDebugInfo = !stdenv.hostPlatform.isStatic;
|
separateDebugInfo = !stdenv.hostPlatform.isStatic;
|
||||||
|
|
||||||
# TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564
|
# TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564
|
||||||
|
|
|
@ -254,12 +254,7 @@ this_library = library(
|
||||||
|
|
||||||
install_headers(headers, subdir : 'nix', preserve_path : true)
|
install_headers(headers, subdir : 'nix', preserve_path : true)
|
||||||
|
|
||||||
# Part of how we copy boost libraries to a separate installation to
|
libraries_private = []
|
||||||
# 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']
|
|
||||||
if host_machine.system() == 'windows'
|
if host_machine.system() == 'windows'
|
||||||
# `libraries_private` cannot contain ad-hoc dependencies (from
|
# `libraries_private` cannot contain ad-hoc dependencies (from
|
||||||
# `find_library), so we need to do this manually
|
# `find_library), so we need to do this manually
|
||||||
|
|
|
@ -65,7 +65,6 @@ mkMesonDerivation (finalAttrs: {
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
boost
|
|
||||||
brotli
|
brotli
|
||||||
libsodium
|
libsodium
|
||||||
openssl
|
openssl
|
||||||
|
@ -73,37 +72,17 @@ mkMesonDerivation (finalAttrs: {
|
||||||
;
|
;
|
||||||
|
|
||||||
propagatedBuildInputs = [
|
propagatedBuildInputs = [
|
||||||
boost.dev
|
boost
|
||||||
libarchive
|
libarchive
|
||||||
nlohmann_json
|
nlohmann_json
|
||||||
];
|
];
|
||||||
|
|
||||||
disallowedReferences = [ boost ];
|
|
||||||
|
|
||||||
preConfigure =
|
preConfigure =
|
||||||
# TODO: change release process to add `pre` in `.version`, remove it before tagging, and restore after.
|
# TODO: change release process to add `pre` in `.version`, remove it before tagging, and restore after.
|
||||||
''
|
''
|
||||||
chmod u+w ./.version
|
chmod u+w ./.version
|
||||||
echo ${version} > ../../.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 = [
|
mesonFlags = [
|
||||||
(lib.mesonEnable "cpuid" stdenv.hostPlatform.isx86_64)
|
(lib.mesonEnable "cpuid" stdenv.hostPlatform.isx86_64)
|
||||||
|
@ -120,20 +99,6 @@ mkMesonDerivation (finalAttrs: {
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
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;
|
separateDebugInfo = !stdenv.hostPlatform.isStatic;
|
||||||
|
|
||||||
# TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564
|
# TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564
|
||||||
|
|
|
@ -6,11 +6,6 @@
|
||||||
, ninja
|
, ninja
|
||||||
, pkg-config
|
, pkg-config
|
||||||
, nix-store
|
, nix-store
|
||||||
, curl
|
|
||||||
, bzip2
|
|
||||||
, xz
|
|
||||||
, boost
|
|
||||||
, libsodium
|
|
||||||
, darwin
|
, darwin
|
||||||
, versionSuffix ? ""
|
, versionSuffix ? ""
|
||||||
}:
|
}:
|
||||||
|
@ -45,14 +40,7 @@ perl.pkgs.toPerlModule (stdenv.mkDerivation (finalAttrs: {
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
nix-store
|
nix-store
|
||||||
curl
|
];
|
||||||
bzip2
|
|
||||||
xz
|
|
||||||
perl
|
|
||||||
boost
|
|
||||||
]
|
|
||||||
++ lib.optional (stdenv.isLinux || stdenv.isDarwin) libsodium
|
|
||||||
++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security;
|
|
||||||
|
|
||||||
# `perlPackages.Test2Harness` is marked broken for Darwin
|
# `perlPackages.Test2Harness` is marked broken for Darwin
|
||||||
doCheck = !stdenv.isDarwin;
|
doCheck = !stdenv.isDarwin;
|
||||||
|
|
Loading…
Reference in a new issue