lol
at 16.09-beta 145 lines 3.6 kB view raw
1{ system, allPackages ? import ../../.., config }: 2 3rec { 4 5 shell = 6 if system == "i686-freebsd" || system == "x86_64-freebsd" then "/usr/local/bin/bash" 7 else "/bin/bash"; 8 9 path = 10 (if system == "i686-solaris" then [ "/usr/gnu" ] else []) ++ 11 (if system == "i686-netbsd" then [ "/usr/pkg" ] else []) ++ 12 (if system == "x86_64-solaris" then [ "/opt/local/gnu" ] else []) ++ 13 ["/" "/usr" "/usr/local"]; 14 15 prehookBase = '' 16 # Disable purity tests; it's allowed (even needed) to link to 17 # libraries outside the Nix store (like the C library). 18 export NIX_ENFORCE_PURITY= 19 export NIX_ENFORCE_NO_NATIVE="''${NIX_ENFORCE_NO_NATIVE-1}" 20 ''; 21 22 prehookFreeBSD = '' 23 ${prehookBase} 24 25 alias make=gmake 26 alias tar=gtar 27 alias sed=gsed 28 export MAKE=gmake 29 shopt -s expand_aliases 30 ''; 31 32 prehookOpenBSD = '' 33 ${prehookBase} 34 35 alias make=gmake 36 alias grep=ggrep 37 alias mv=gmv 38 alias ln=gln 39 alias sed=gsed 40 alias tar=gtar 41 42 export MAKE=gmake 43 shopt -s expand_aliases 44 ''; 45 46 prehookNetBSD = '' 47 ${prehookBase} 48 49 alias make=gmake 50 alias sed=gsed 51 alias tar=gtar 52 export MAKE=gmake 53 shopt -s expand_aliases 54 ''; 55 56 # prevent libtool from failing to find dynamic libraries 57 prehookCygwin = '' 58 ${prehookBase} 59 60 shopt -s expand_aliases 61 export lt_cv_deplibs_check_method=pass_all 62 ''; 63 64 extraBuildInputsCygwin = [ 65 ../cygwin/all-buildinputs-as-runtimedep.sh 66 ../cygwin/wrap-exes-to-find-dlls.sh 67 ] ++ (if system == "i686-cygwin" then [ 68 ../cygwin/rebase-i686.sh 69 ] else if system == "x86_64-cygwin" then [ 70 ../cygwin/rebase-x86_64.sh 71 ] else []); 72 73 # A function that builds a "native" stdenv (one that uses tools in 74 # /usr etc.). 75 makeStdenv = 76 { cc, fetchurl, extraPath ? [], overrides ? (pkgs: { }) }: 77 78 import ../generic { 79 preHook = 80 if system == "i686-freebsd" then prehookFreeBSD else 81 if system == "x86_64-freebsd" then prehookFreeBSD else 82 if system == "i686-openbsd" then prehookOpenBSD else 83 if system == "i686-netbsd" then prehookNetBSD else 84 if system == "i686-cygwin" then prehookCygwin else 85 if system == "x86_64-cygwin" then prehookCygwin else 86 prehookBase; 87 88 extraBuildInputs = 89 if system == "i686-cygwin" then extraBuildInputsCygwin else 90 if system == "x86_64-cygwin" then extraBuildInputsCygwin else 91 []; 92 93 initialPath = extraPath ++ path; 94 95 fetchurlBoot = fetchurl; 96 97 inherit system shell cc overrides config; 98 }; 99 100 101 stdenvBoot0 = makeStdenv { 102 cc = null; 103 fetchurl = null; 104 }; 105 106 107 cc = import ../../build-support/cc-wrapper { 108 name = "cc-native"; 109 nativeTools = true; 110 nativeLibc = true; 111 nativePrefix = if system == "i686-solaris" then "/usr/gnu" else if system == "x86_64-solaris" then "/opt/local/gcc47" else "/usr"; 112 stdenv = stdenvBoot0; 113 }; 114 115 116 fetchurl = import ../../build-support/fetchurl { 117 stdenv = stdenvBoot0; 118 # Curl should be in /usr/bin or so. 119 curl = null; 120 }; 121 122 123 # First build a stdenv based only on tools outside the store. 124 stdenvBoot1 = makeStdenv { 125 inherit cc fetchurl; 126 } // {inherit fetchurl;}; 127 128 stdenvBoot1Pkgs = allPackages { 129 inherit system; 130 bootStdenv = stdenvBoot1; 131 }; 132 133 134 # Using that, build a stdenv that adds the ‘xz’ command (which most 135 # systems don't have, so we mustn't rely on the native environment 136 # providing it). 137 stdenvBoot2 = makeStdenv { 138 inherit cc fetchurl; 139 extraPath = [ stdenvBoot1Pkgs.xz ]; 140 overrides = pkgs: { inherit (stdenvBoot1Pkgs) xz; }; 141 }; 142 143 144 stdenv = stdenvBoot2; 145}