about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/tools/boost-build
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/tools/boost-build')
-rw-r--r--nixpkgs/pkgs/development/tools/boost-build/darwin-default-toolset.patch12
-rw-r--r--nixpkgs/pkgs/development/tools/boost-build/default.nix69
2 files changed, 81 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/tools/boost-build/darwin-default-toolset.patch b/nixpkgs/pkgs/development/tools/boost-build/darwin-default-toolset.patch
new file mode 100644
index 000000000000..ebe3f8d2e1ea
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/boost-build/darwin-default-toolset.patch
@@ -0,0 +1,12 @@
+diff --git a/src/build-system.jam b/src/build-system.jam
+index 60425c54..c6842217 100644
+--- a/src/build-system.jam
++++ b/src/build-system.jam
+@@ -644,7 +644,7 @@ local rule should-clean-project ( project )
+             }
+             else if [ os.name ] = MACOSX
+             {
+-                default-toolset = darwin ;
++                default-toolset = clang-darwin ;
+             }
+         }
diff --git a/nixpkgs/pkgs/development/tools/boost-build/default.nix b/nixpkgs/pkgs/development/tools/boost-build/default.nix
new file mode 100644
index 000000000000..c6c66d4d212d
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/boost-build/default.nix
@@ -0,0 +1,69 @@
+{ 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"
+  '';
+
+  patches = [
+    # Upstream defaults to gcc on darwin, but we use clang.
+    ./darwin-default-toolset.patch
+  ];
+
+  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 ];
+  };
+}