Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 79 lines 2.0 kB view raw
1{ 2 lib, 3 stdenv, 4 gprbuild-boot, 5 which, 6 gnat, 7 xmlada, 8}: 9 10stdenv.mkDerivation { 11 pname = "gprbuild"; 12 13 # See ./boot.nix for an explanation of the gprbuild setupHook, 14 # our custom knowledge base entry and the situation wrt a 15 # (future) gprbuild wrapper. 16 inherit (gprbuild-boot) 17 version 18 src 19 setupHooks 20 meta 21 ; 22 23 nativeBuildInputs = [ 24 gnat 25 gprbuild-boot 26 which 27 ]; 28 29 propagatedBuildInputs = [ 30 xmlada 31 ]; 32 33 makeFlags = [ 34 "ENABLE_SHARED=${if stdenv.hostPlatform.isStatic then "no" else "yes"}" 35 "PROCESSORS=$(NIX_BUILD_CORES)" 36 # confusingly, for gprbuild --target is autoconf --host 37 "TARGET=${stdenv.hostPlatform.config}" 38 "prefix=${placeholder "out"}" 39 ] 40 ++ lib.optionals (!stdenv.hostPlatform.isStatic) [ 41 "LIBRARY_TYPE=relocatable" 42 ]; 43 44 env = lib.optionalAttrs stdenv.hostPlatform.isDarwin { 45 # Ensure that there is enough space for the `fixDarwinDylibNames` hook to 46 # update the install names of the output dylibs. 47 NIX_LDFLAGS = "-headerpad_max_install_names"; 48 }; 49 50 # Fixes gprbuild being linked statically always. Based on the AUR's patch: 51 # https://aur.archlinux.org/cgit/aur.git/plain/0001-Makefile-build-relocatable-instead-of-static-binary.patch?h=gprbuild&id=bac524c76cd59c68fb91ef4dfcbe427357b9f850 52 patches = lib.optionals (!stdenv.hostPlatform.isStatic) [ 53 ./gprbuild-relocatable-build.patch 54 ]; 55 56 buildFlags = [ 57 "all" 58 "libgpr.build" 59 ]; 60 61 installFlags = [ 62 "all" 63 "libgpr.install" 64 ]; 65 66 # link gprconfig_kb db from gprbuild-boot into build dir, 67 # the install process copies its contents to $out 68 preInstall = '' 69 # Use PATH to discover spliced gprbuild-boot from buildPackages, 70 # since path interpolation would give us gprbuild-boot from pkgsHostTarget 71 gprbuild_boot="$(dirname "$(type -p gprbuild)")/.." 72 ln -sf "$gprbuild_boot/share/gprconfig" share/gprconfig 73 ''; 74 75 # no need for the install script 76 postInstall = '' 77 rm $out/doinstall 78 ''; 79}