5 # boost derivation to use for the src and version.
6 # This is used by the boost derivation to build
7 # a b2 matching their version (by overriding this
8 # argument). Infinite recursion is not an issue
9 # since we only look at src and version of boost.
14 defaultVersion = "4.4.1";
18 pname = "boost-build";
21 then "boost-${useBoost.version}"
24 src = useBoost.src or (fetchFromGitHub {
28 sha256 = "1r4rwlq87ydmsdqrik4ly5iai796qalvw7603mridg2nwcbbnf54";
31 # b2 is in a subdirectory of boost source tarballs
32 postUnpack = lib.optionalString (useBoost ? src) ''
33 sourceRoot="$sourceRoot/tools/build"
36 patches = useBoost.boostBuildPatches or []
37 ++ lib.optional (useBoost ? version && lib.versionAtLeast useBoost.version "1.81") ./fix-clang-target.patch;
39 postPatch = lib.optionalString (useBoost ? version && lib.versionAtLeast useBoost.version "1.80") ''
40 # Upstream uses arm64, but nixpkgs uses aarch64.
41 substituteInPlace src/tools/clang.jam \
42 --replace-fail 'arch = arm64' 'arch = aarch64'
43 '' + lib.optionalString (useBoost ? version && lib.versionOlder useBoost.version "1.77") ''
44 substituteInPlace src/build-system.jam \
45 --replace-fail "default-toolset = darwin" "default-toolset = clang-darwin"
46 '' + lib.optionalString (useBoost ? version && lib.versionAtLeast useBoost.version "1.82") ''
47 patchShebangs --build src/engine/build.sh
63 ./b2 ${lib.optionalString (stdenv.cc.isClang) "toolset=clang "}install --prefix="$out"
65 # older versions of b2 created this symlink,
66 # which we want to support building via useBoost.
67 test -e "$out/bin/bjam" || ln -s b2 "$out/bin/bjam"
73 homepage = "https://www.boost.org/build/";
74 license = lib.licenses.boost;
75 platforms = platforms.unix;
76 maintainers = with maintainers; [ ivan-tkatchev ];