cygwin: stdenv

authored by Florian Friesdorf and committed by Rok Garbas 88e58a4f d2e364c6

+1
maintainers/scripts/hydra_eval_check
··· 6 6 --argstr system i686-linux \ 7 7 --argstr system x86_64-darwin \ 8 8 --argstr system i686-cygwin \ 9 + --argstr system x86_64-cygwin \ 9 10 --argstr system i686-freebsd \ 10 11 --arg officialRelease false \ 11 12 --arg nixpkgs "{ outPath = builtins.storePath ./. ; rev = 1234; }" \
+16
pkgs/stdenv/cygwin/all-buildinputs-as-runtimedep.sh
··· 1 + # On cygwin, automatic runtime dependency detection does not work 2 + # because the binaries do not contain absolute references to store 3 + # locations (yet) 4 + postFixupHooks+=(_cygwinAllBuildInputsAsRuntimeDep) 5 + 6 + _cygwinAllBuildInputsAsRuntimeDep() { 7 + if [ -n "$buildInputs" ]; then 8 + mkdir -p "$out/nix-support" 9 + echo "$buildInputs" >> "$out/nix-support/cygwin-buildinputs-as-runtime-deps" 10 + fi 11 + 12 + if [ -n "$nativeBuildInputs" ]; then 13 + mkdir -p "$out/nix-support" 14 + echo "$nativeBuildInputs" >> "$out/nix-support/cygwin-buildinputs-as-runtime-deps" 15 + fi 16 + }
+21
pkgs/stdenv/cygwin/rebase-i686.sh
··· 1 + postFixupHooks+=(_cygwinFixAutoImageBase) 2 + 3 + _cygwinFixAutoImageBase() { 4 + find $out -name "*.dll" | while read DLL; do 5 + if [ -f /etc/rebasenix.nextbase ]; then 6 + NEXTBASE="$(</etc/rebasenix.nextbase)" 7 + fi 8 + NEXTBASE=${NEXTBASE:-0x62000000} 9 + 10 + REBASE=(`/bin/rebase -i $DLL`) 11 + BASE=${REBASE[2]} 12 + SIZE=${REBASE[4]} 13 + SKIP=$(((($SIZE>>16)+1)<<16)) 14 + 15 + echo "REBASE FIX: $DLL $BASE -> $NEXTBASE" 16 + /bin/rebase -b $NEXTBASE $DLL 17 + NEXTBASE="0x`printf %x $(($NEXTBASE+$SKIP))`" 18 + 19 + echo $NEXTBASE > /etc/rebasenix.nextbase 20 + done 21 + }
+21
pkgs/stdenv/cygwin/rebase-x86_64.sh
··· 1 + postFixupHooks+=(_cygwinFixAutoImageBase) 2 + 3 + _cygwinFixAutoImageBase() { 4 + find $out -name "*.dll" | while read DLL; do 5 + if [ -f /etc/rebasenix.nextbase ]; then 6 + NEXTBASE="$(</etc/rebasenix.nextbase)" 7 + fi 8 + NEXTBASE=${NEXTBASE:-0x200000000} 9 + 10 + REBASE=(`/bin/rebase -i $DLL`) 11 + BASE=${REBASE[2]} 12 + SIZE=${REBASE[4]} 13 + SKIP=$(((($SIZE>>16)+1)<<16)) 14 + 15 + echo "REBASE FIX: $DLL $BASE -> $NEXTBASE" 16 + /bin/rebase -b $NEXTBASE $DLL 17 + NEXTBASE="0x`printf %x $(($NEXTBASE+$SKIP))`" 18 + 19 + echo $NEXTBASE > /etc/rebasenix.nextbase 20 + done 21 + }
+74
pkgs/stdenv/cygwin/wrap-exes-to-find-dlls.sh
··· 1 + postFixupHooks+=(_cygwinWrapExesToFindDlls) 2 + 3 + _cygwinWrapExesToFindDlls() { 4 + find $out -type l | while read LINK; do 5 + TARGET="$(readlink "${LINK}")" 6 + 7 + # fix all non .exe links that link explicitly to a .exe 8 + if [[ ${TARGET} == *.exe ]] && [[ ${LINK} != *.exe ]]; then 9 + mv "${LINK}" "${LINK}.exe" 10 + LINK="${LINK}.exe" 11 + fi 12 + 13 + # generate complementary filenames 14 + if [[ ${LINK} == *.exe ]]; then 15 + _LINK="${LINK%.exe}" 16 + _TARGET="${TARGET%.exe}" 17 + else 18 + _LINK="${LINK}.exe" 19 + _TARGET="${TARGET}.exe" 20 + fi 21 + 22 + # check if sould create complementary link 23 + DOLINK=1 24 + if [[ ${_TARGET} == *.exe ]]; then 25 + # the canonical target has to be a .exe 26 + CTARGET="$(readlink -f "${LINK}")" 27 + if [[ ${CTARGET} != *.exe ]]; then 28 + CTARGET="${CTARGET}.exe" 29 + fi 30 + 31 + if [ ! -e "${CTARGET}" ]; then 32 + unset DOLINK 33 + fi 34 + fi 35 + 36 + if [ -e "${_LINK}" ]; then 37 + # complementary link seems to exist 38 + # but could be cygwin smoke and mirrors 39 + INO=$(stat -c%i "${LINK}") 40 + _INO=$(stat -c%i "${_LINK}") 41 + if [ "${INO}" -ne "${_INO}" ]; then 42 + unset DOLINK 43 + fi 44 + fi 45 + 46 + # create complementary link 47 + if [ -n "${DOLINK}" ]; then 48 + ln -s "${_TARGET}" "${_LINK}.tmp" 49 + mv "${_LINK}.tmp" "${_LINK}" 50 + fi 51 + done 52 + 53 + find $out -type f -name "*.exe" | while read EXE; do 54 + WRAPPER="${EXE%.exe}" 55 + if [ -e "${WRAPPER}" ]; then 56 + # check if really exists or cygwin smoke and mirrors 57 + INO=$(stat -c%i "${EXE}") 58 + _INO=$(stat -c%i "${WRAPPER}") 59 + if [ "${INO}" -ne "${_INO}" ]; then 60 + continue 61 + fi 62 + fi 63 + 64 + mv "${EXE}" "${EXE}.tmp" 65 + 66 + cat >"${WRAPPER}" <<EOF 67 + #!/bin/sh 68 + export PATH=$_PATH${_PATH:+:}\${PATH} 69 + exec "\$0.exe" "\$@" 70 + EOF 71 + chmod +x "${WRAPPER}" 72 + mv "${EXE}.tmp" "${EXE}" 73 + done 74 + }
+2
pkgs/stdenv/default.nix
··· 50 50 if system == "powerpc-linux" then /* stdenvLinux */ stdenvNative else 51 51 if system == "x86_64-darwin" then stdenvDarwin else 52 52 if system == "x86_64-solaris" then stdenvNix else 53 + if system == "i686-cygwin" then stdenvNative else 54 + if system == "x86_64-cygwin" then stdenvNative else 53 55 stdenvNative; 54 56 }
+3
pkgs/stdenv/generic/default.nix
··· 210 210 || system == "i686-gnu" 211 211 || system == "i686-freebsd" 212 212 || system == "i686-openbsd" 213 + || system == "i686-cygwin" 213 214 || system == "i386-sunos"; 214 215 isx86_64 = system == "x86_64-linux" 215 216 || system == "x86_64-darwin" 216 217 || system == "x86_64-freebsd" 217 218 || system == "x86_64-openbsd" 219 + || system == "x86_64-cygwin" 218 220 || system == "x86_64-solaris"; 219 221 is64bit = system == "x86_64-linux" 220 222 || system == "x86_64-darwin" 221 223 || system == "x86_64-freebsd" 222 224 || system == "x86_64-openbsd" 225 + || system == "x86_64-cygwin" 223 226 || system == "x86_64-solaris" 224 227 || system == "mips64el-linux"; 225 228 isMips = system == "mips-linux"
+18 -5
pkgs/stdenv/native/default.nix
··· 52 52 shopt -s expand_aliases 53 53 ''; 54 54 55 + # prevent libtool from failing to find dynamic libraries 55 56 prehookCygwin = '' 56 57 ${prehookBase} 57 58 58 - if test -z "$cygwinConfigureEnableShared"; then 59 - export configureFlags="$configureFlags --disable-shared" 60 - fi 61 - 62 - PATH_DELIMITER=';' 59 + shopt -s expand_aliases 60 + export lt_cv_deplibs_check_method=pass_all 63 61 ''; 64 62 63 + extraBuildInputsCygwin = [ 64 + ../cygwin/all-buildinputs-as-runtimedep.sh 65 + ../cygwin/wrap-exes-to-find-dlls.sh 66 + ] ++ (if system == "i686-cygwin" then [ 67 + ../cygwin/rebase-i686.sh 68 + ] else if system == "x86_64-cygwin" then [ 69 + ../cygwin/rebase-x86_64.sh 70 + ] else []); 65 71 66 72 # A function that builds a "native" stdenv (one that uses tools in 67 73 # /usr etc.). ··· 74 80 if system == "x86_64-freebsd" then prehookFreeBSD else 75 81 if system == "i686-openbsd" then prehookOpenBSD else 76 82 if system == "i686-netbsd" then prehookNetBSD else 83 + if system == "i686-cygwin" then prehookCygwin else 84 + if system == "x86_64-cygwin" then prehookCygwin else 77 85 prehookBase; 86 + 87 + extraBuildInputs = 88 + if system == "i686-cygwin" then extraBuildInputsCygwin else 89 + if system == "x86_64-cygwin" then extraBuildInputsCygwin else 90 + []; 78 91 79 92 initialPath = extraPath ++ path; 80 93
+2
pkgs/top-level/release-lib.nix
··· 22 22 else if system == "x86_64-freebsd" then pkgs_x86_64_freebsd 23 23 else if system == "i686-freebsd" then pkgs_i686_freebsd 24 24 else if system == "i686-cygwin" then pkgs_i686_cygwin 25 + else if system == "x86_64-cygwin" then pkgs_x86_64_cygwin 25 26 else abort "unsupported system type: ${system}"; 26 27 27 28 pkgs_x86_64_linux = allPackages { system = "x86_64-linux"; }; ··· 30 31 pkgs_x86_64_freebsd = allPackages { system = "x86_64-freebsd"; }; 31 32 pkgs_i686_freebsd = allPackages { system = "i686-freebsd"; }; 32 33 pkgs_i686_cygwin = allPackages { system = "i686-cygwin"; }; 34 + pkgs_x86_64_cygwin = allPackages { system = "x86_64-cygwin"; }; 33 35 34 36 35 37 /* The working or failing mails for cross builds will be sent only to