nixpkgs/pkgs/development/tools/boost-build/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

73 lines
1.6 KiB
Nix
Raw Normal View History

{ 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 ? {}
}:
2014-09-14 22:10:03 +00:00
let
defaultVersion = "4.4.1";
in
stdenv.mkDerivation {
pname = "boost-build";
version =
if useBoost ? version
then "boost-${useBoost.version}"
else defaultVersion;
2017-06-27 15:00:40 +00:00
src = useBoost.src or (fetchFromGitHub {
2017-06-27 15:00:40 +00:00
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"
'';
2014-09-14 22:10:03 +00:00
2022-02-14 15:37:55 +00:00
patches = useBoost.boostBuildPatches or [];
# Upstream defaults to gcc on darwin, but we use clang.
postPatch = ''
substituteInPlace src/build-system.jam \
--replace "default-toolset = darwin" "default-toolset = clang-darwin"
'';
2021-05-11 13:21:13 +00:00
nativeBuildInputs = [
bison
];
2014-09-14 22:10:03 +00:00
buildPhase = ''
runHook preBuild
2017-06-27 15:00:40 +00:00
./bootstrap.sh
runHook postBuild
2014-09-14 22:10:03 +00:00
'';
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
2014-09-14 22:10:03 +00:00
'';
meta = with lib; {
homepage = "https://www.boost.org/build/";
license = lib.licenses.boost;
2014-09-14 22:10:03 +00:00
platforms = platforms.unix;
2017-06-27 15:00:40 +00:00
maintainers = with maintainers; [ ivan-tkatchev ];
2014-09-14 22:10:03 +00:00
};
}