Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at litex 74 lines 1.8 kB view raw
1{ lib 2, stdenv 3, fetchFromGitHub 4, bison 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. 10, useBoost ? {} 11}: 12 13let 14 defaultVersion = "4.4.1"; 15in 16 17stdenv.mkDerivation { 18 pname = "boost-build"; 19 version = 20 if useBoost ? version 21 then "boost-${useBoost.version}" 22 else defaultVersion; 23 24 src = useBoost.src or (fetchFromGitHub { 25 owner = "boostorg"; 26 repo = "build"; 27 rev = defaultVersion; 28 sha256 = "1r4rwlq87ydmsdqrik4ly5iai796qalvw7603mridg2nwcbbnf54"; 29 }); 30 31 # b2 is in a subdirectory of boost source tarballs 32 postUnpack = lib.optionalString (useBoost ? src) '' 33 sourceRoot="$sourceRoot/tools/build" 34 ''; 35 36 patches = useBoost.boostBuildPatches or []; 37 38 # Upstream defaults to gcc on darwin, but we use clang. 39 postPatch = '' 40 substituteInPlace src/build-system.jam \ 41 --replace "default-toolset = darwin" "default-toolset = clang-darwin" 42 '' + lib.optionalString (useBoost ? version && lib.versionAtLeast useBoost.version "1.82") '' 43 patchShebangs --build src/engine/build.sh 44 ''; 45 46 nativeBuildInputs = [ 47 bison 48 ]; 49 50 buildPhase = '' 51 runHook preBuild 52 ./bootstrap.sh 53 runHook postBuild 54 ''; 55 56 installPhase = '' 57 runHook preInstall 58 59 ./b2 install --prefix="$out" 60 61 # older versions of b2 created this symlink, 62 # which we want to support building via useBoost. 63 test -e "$out/bin/bjam" || ln -s b2 "$out/bin/bjam" 64 65 runHook postInstall 66 ''; 67 68 meta = with lib; { 69 homepage = "https://www.boost.org/build/"; 70 license = lib.licenses.boost; 71 platforms = platforms.unix; 72 maintainers = with maintainers; [ ivan-tkatchev ]; 73 }; 74}