blob: 044589a9664b4e71bc9204c615475e68efe8f676 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
{ lib
, stdenv
, fetchFromGitHub
, bison
# boost derivation to use for the src and version.
# This is used by the boost derivation to build
# a b2 matching their version (by overriding this
# argument). Infinite recursion is not an issue
# since we only look at src and version of boost.
, useBoost ? {}
}:
let
defaultVersion = "4.4.1";
in
stdenv.mkDerivation {
pname = "boost-build";
version =
if useBoost ? version
then "boost-${useBoost.version}"
else defaultVersion;
src = useBoost.src or (fetchFromGitHub {
owner = "boostorg";
repo = "build";
rev = defaultVersion;
sha256 = "1r4rwlq87ydmsdqrik4ly5iai796qalvw7603mridg2nwcbbnf54";
});
# b2 is in a subdirectory of boost source tarballs
postUnpack = lib.optionalString (useBoost ? src) ''
sourceRoot="$sourceRoot/tools/build"
'';
# Upstream defaults to gcc on darwin, but we use clang.
postPatch = ''
substituteInPlace src/build-system.jam \
--replace "default-toolset = darwin" "default-toolset = clang-darwin"
'';
nativeBuildInputs = [
bison
];
buildPhase = ''
runHook preBuild
./bootstrap.sh
runHook postBuild
'';
installPhase = ''
runHook preInstall
./b2 install --prefix="$out"
# older versions of b2 created this symlink,
# which we want to support building via useBoost.
test -e "$out/bin/bjam" || ln -s b2 "$out/bin/bjam"
runHook postInstall
'';
meta = with lib; {
homepage = "https://www.boost.org/build/";
license = lib.licenses.boost;
platforms = platforms.unix;
maintainers = with maintainers; [ ivan-tkatchev ];
};
}
|