6 # boost derivation to use for the src and version.
7 # This is used by the boost derivation to build
8 # a b2 matching their version (by overriding this
9 # argument). Infinite recursion is not an issue
10 # since we only look at src and version of boost.
15 defaultVersion = "4.4.1";
19 pname = "boost-build";
20 version = if useBoost ? version then "boost-${useBoost.version}" else defaultVersion;
23 useBoost.src or (fetchFromGitHub {
27 sha256 = "1r4rwlq87ydmsdqrik4ly5iai796qalvw7603mridg2nwcbbnf54";
30 # b2 is in a subdirectory of boost source tarballs
31 postUnpack = lib.optionalString (useBoost ? src) ''
32 sourceRoot="$sourceRoot/tools/build"
36 useBoost.boostBuildPatches or [ ]
38 useBoost ? version && lib.versionAtLeast useBoost.version "1.81"
39 ) ./fix-clang-target.patch;
42 lib.optionalString (useBoost ? version && lib.versionAtLeast useBoost.version "1.80") ''
43 # Upstream uses arm64, but nixpkgs uses aarch64.
44 substituteInPlace src/tools/clang.jam \
45 --replace-fail 'arch = arm64' 'arch = aarch64'
47 + lib.optionalString (useBoost ? version && lib.versionOlder useBoost.version "1.77") ''
48 substituteInPlace src/build-system.jam \
49 --replace-fail "default-toolset = darwin" "default-toolset = clang-darwin"
51 + lib.optionalString (useBoost ? version && lib.versionAtLeast useBoost.version "1.82") ''
52 patchShebangs --build src/engine/build.sh
68 ./b2 ${lib.optionalString (stdenv.cc.isClang) "toolset=clang "}install --prefix="$out"
70 # older versions of b2 created this symlink,
71 # which we want to support building via useBoost.
72 test -e "$out/bin/bjam" || ln -s b2 "$out/bin/bjam"
78 homepage = "https://www.boost.org/build/";
79 license = lib.licenses.boost;
80 platforms = platforms.unix;
81 maintainers = with maintainers; [ ivan-tkatchev ];