cygwin: stdenv
This commit is contained in:
parent
d2e364c678
commit
88e58a4fa2
|
@ -6,6 +6,7 @@ hydra_eval_jobs \
|
||||||
--argstr system i686-linux \
|
--argstr system i686-linux \
|
||||||
--argstr system x86_64-darwin \
|
--argstr system x86_64-darwin \
|
||||||
--argstr system i686-cygwin \
|
--argstr system i686-cygwin \
|
||||||
|
--argstr system x86_64-cygwin \
|
||||||
--argstr system i686-freebsd \
|
--argstr system i686-freebsd \
|
||||||
--arg officialRelease false \
|
--arg officialRelease false \
|
||||||
--arg nixpkgs "{ outPath = builtins.storePath ./. ; rev = 1234; }" \
|
--arg nixpkgs "{ outPath = builtins.storePath ./. ; rev = 1234; }" \
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
# On cygwin, automatic runtime dependency detection does not work
|
||||||
|
# because the binaries do not contain absolute references to store
|
||||||
|
# locations (yet)
|
||||||
|
postFixupHooks+=(_cygwinAllBuildInputsAsRuntimeDep)
|
||||||
|
|
||||||
|
_cygwinAllBuildInputsAsRuntimeDep() {
|
||||||
|
if [ -n "$buildInputs" ]; then
|
||||||
|
mkdir -p "$out/nix-support"
|
||||||
|
echo "$buildInputs" >> "$out/nix-support/cygwin-buildinputs-as-runtime-deps"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$nativeBuildInputs" ]; then
|
||||||
|
mkdir -p "$out/nix-support"
|
||||||
|
echo "$nativeBuildInputs" >> "$out/nix-support/cygwin-buildinputs-as-runtime-deps"
|
||||||
|
fi
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
postFixupHooks+=(_cygwinFixAutoImageBase)
|
||||||
|
|
||||||
|
_cygwinFixAutoImageBase() {
|
||||||
|
find $out -name "*.dll" | while read DLL; do
|
||||||
|
if [ -f /etc/rebasenix.nextbase ]; then
|
||||||
|
NEXTBASE="$(</etc/rebasenix.nextbase)"
|
||||||
|
fi
|
||||||
|
NEXTBASE=${NEXTBASE:-0x62000000}
|
||||||
|
|
||||||
|
REBASE=(`/bin/rebase -i $DLL`)
|
||||||
|
BASE=${REBASE[2]}
|
||||||
|
SIZE=${REBASE[4]}
|
||||||
|
SKIP=$(((($SIZE>>16)+1)<<16))
|
||||||
|
|
||||||
|
echo "REBASE FIX: $DLL $BASE -> $NEXTBASE"
|
||||||
|
/bin/rebase -b $NEXTBASE $DLL
|
||||||
|
NEXTBASE="0x`printf %x $(($NEXTBASE+$SKIP))`"
|
||||||
|
|
||||||
|
echo $NEXTBASE > /etc/rebasenix.nextbase
|
||||||
|
done
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
postFixupHooks+=(_cygwinFixAutoImageBase)
|
||||||
|
|
||||||
|
_cygwinFixAutoImageBase() {
|
||||||
|
find $out -name "*.dll" | while read DLL; do
|
||||||
|
if [ -f /etc/rebasenix.nextbase ]; then
|
||||||
|
NEXTBASE="$(</etc/rebasenix.nextbase)"
|
||||||
|
fi
|
||||||
|
NEXTBASE=${NEXTBASE:-0x200000000}
|
||||||
|
|
||||||
|
REBASE=(`/bin/rebase -i $DLL`)
|
||||||
|
BASE=${REBASE[2]}
|
||||||
|
SIZE=${REBASE[4]}
|
||||||
|
SKIP=$(((($SIZE>>16)+1)<<16))
|
||||||
|
|
||||||
|
echo "REBASE FIX: $DLL $BASE -> $NEXTBASE"
|
||||||
|
/bin/rebase -b $NEXTBASE $DLL
|
||||||
|
NEXTBASE="0x`printf %x $(($NEXTBASE+$SKIP))`"
|
||||||
|
|
||||||
|
echo $NEXTBASE > /etc/rebasenix.nextbase
|
||||||
|
done
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
postFixupHooks+=(_cygwinWrapExesToFindDlls)
|
||||||
|
|
||||||
|
_cygwinWrapExesToFindDlls() {
|
||||||
|
find $out -type l | while read LINK; do
|
||||||
|
TARGET="$(readlink "${LINK}")"
|
||||||
|
|
||||||
|
# fix all non .exe links that link explicitly to a .exe
|
||||||
|
if [[ ${TARGET} == *.exe ]] && [[ ${LINK} != *.exe ]]; then
|
||||||
|
mv "${LINK}" "${LINK}.exe"
|
||||||
|
LINK="${LINK}.exe"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# generate complementary filenames
|
||||||
|
if [[ ${LINK} == *.exe ]]; then
|
||||||
|
_LINK="${LINK%.exe}"
|
||||||
|
_TARGET="${TARGET%.exe}"
|
||||||
|
else
|
||||||
|
_LINK="${LINK}.exe"
|
||||||
|
_TARGET="${TARGET}.exe"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check if sould create complementary link
|
||||||
|
DOLINK=1
|
||||||
|
if [[ ${_TARGET} == *.exe ]]; then
|
||||||
|
# the canonical target has to be a .exe
|
||||||
|
CTARGET="$(readlink -f "${LINK}")"
|
||||||
|
if [[ ${CTARGET} != *.exe ]]; then
|
||||||
|
CTARGET="${CTARGET}.exe"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "${CTARGET}" ]; then
|
||||||
|
unset DOLINK
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e "${_LINK}" ]; then
|
||||||
|
# complementary link seems to exist
|
||||||
|
# but could be cygwin smoke and mirrors
|
||||||
|
INO=$(stat -c%i "${LINK}")
|
||||||
|
_INO=$(stat -c%i "${_LINK}")
|
||||||
|
if [ "${INO}" -ne "${_INO}" ]; then
|
||||||
|
unset DOLINK
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# create complementary link
|
||||||
|
if [ -n "${DOLINK}" ]; then
|
||||||
|
ln -s "${_TARGET}" "${_LINK}.tmp"
|
||||||
|
mv "${_LINK}.tmp" "${_LINK}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
find $out -type f -name "*.exe" | while read EXE; do
|
||||||
|
WRAPPER="${EXE%.exe}"
|
||||||
|
if [ -e "${WRAPPER}" ]; then
|
||||||
|
# check if really exists or cygwin smoke and mirrors
|
||||||
|
INO=$(stat -c%i "${EXE}")
|
||||||
|
_INO=$(stat -c%i "${WRAPPER}")
|
||||||
|
if [ "${INO}" -ne "${_INO}" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
mv "${EXE}" "${EXE}.tmp"
|
||||||
|
|
||||||
|
cat >"${WRAPPER}" <<EOF
|
||||||
|
#!/bin/sh
|
||||||
|
export PATH=$_PATH${_PATH:+:}\${PATH}
|
||||||
|
exec "\$0.exe" "\$@"
|
||||||
|
EOF
|
||||||
|
chmod +x "${WRAPPER}"
|
||||||
|
mv "${EXE}.tmp" "${EXE}"
|
||||||
|
done
|
||||||
|
}
|
|
@ -50,5 +50,7 @@ rec {
|
||||||
if system == "powerpc-linux" then /* stdenvLinux */ stdenvNative else
|
if system == "powerpc-linux" then /* stdenvLinux */ stdenvNative else
|
||||||
if system == "x86_64-darwin" then stdenvDarwin else
|
if system == "x86_64-darwin" then stdenvDarwin else
|
||||||
if system == "x86_64-solaris" then stdenvNix else
|
if system == "x86_64-solaris" then stdenvNix else
|
||||||
|
if system == "i686-cygwin" then stdenvNative else
|
||||||
|
if system == "x86_64-cygwin" then stdenvNative else
|
||||||
stdenvNative;
|
stdenvNative;
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,16 +210,19 @@ let
|
||||||
|| system == "i686-gnu"
|
|| system == "i686-gnu"
|
||||||
|| system == "i686-freebsd"
|
|| system == "i686-freebsd"
|
||||||
|| system == "i686-openbsd"
|
|| system == "i686-openbsd"
|
||||||
|
|| system == "i686-cygwin"
|
||||||
|| system == "i386-sunos";
|
|| system == "i386-sunos";
|
||||||
isx86_64 = system == "x86_64-linux"
|
isx86_64 = system == "x86_64-linux"
|
||||||
|| system == "x86_64-darwin"
|
|| system == "x86_64-darwin"
|
||||||
|| system == "x86_64-freebsd"
|
|| system == "x86_64-freebsd"
|
||||||
|| system == "x86_64-openbsd"
|
|| system == "x86_64-openbsd"
|
||||||
|
|| system == "x86_64-cygwin"
|
||||||
|| system == "x86_64-solaris";
|
|| system == "x86_64-solaris";
|
||||||
is64bit = system == "x86_64-linux"
|
is64bit = system == "x86_64-linux"
|
||||||
|| system == "x86_64-darwin"
|
|| system == "x86_64-darwin"
|
||||||
|| system == "x86_64-freebsd"
|
|| system == "x86_64-freebsd"
|
||||||
|| system == "x86_64-openbsd"
|
|| system == "x86_64-openbsd"
|
||||||
|
|| system == "x86_64-cygwin"
|
||||||
|| system == "x86_64-solaris"
|
|| system == "x86_64-solaris"
|
||||||
|| system == "mips64el-linux";
|
|| system == "mips64el-linux";
|
||||||
isMips = system == "mips-linux"
|
isMips = system == "mips-linux"
|
||||||
|
|
|
@ -52,16 +52,22 @@ rec {
|
||||||
shopt -s expand_aliases
|
shopt -s expand_aliases
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# prevent libtool from failing to find dynamic libraries
|
||||||
prehookCygwin = ''
|
prehookCygwin = ''
|
||||||
${prehookBase}
|
${prehookBase}
|
||||||
|
|
||||||
if test -z "$cygwinConfigureEnableShared"; then
|
shopt -s expand_aliases
|
||||||
export configureFlags="$configureFlags --disable-shared"
|
export lt_cv_deplibs_check_method=pass_all
|
||||||
fi
|
|
||||||
|
|
||||||
PATH_DELIMITER=';'
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
extraBuildInputsCygwin = [
|
||||||
|
../cygwin/all-buildinputs-as-runtimedep.sh
|
||||||
|
../cygwin/wrap-exes-to-find-dlls.sh
|
||||||
|
] ++ (if system == "i686-cygwin" then [
|
||||||
|
../cygwin/rebase-i686.sh
|
||||||
|
] else if system == "x86_64-cygwin" then [
|
||||||
|
../cygwin/rebase-x86_64.sh
|
||||||
|
] else []);
|
||||||
|
|
||||||
# A function that builds a "native" stdenv (one that uses tools in
|
# A function that builds a "native" stdenv (one that uses tools in
|
||||||
# /usr etc.).
|
# /usr etc.).
|
||||||
|
@ -74,8 +80,15 @@ rec {
|
||||||
if system == "x86_64-freebsd" then prehookFreeBSD else
|
if system == "x86_64-freebsd" then prehookFreeBSD else
|
||||||
if system == "i686-openbsd" then prehookOpenBSD else
|
if system == "i686-openbsd" then prehookOpenBSD else
|
||||||
if system == "i686-netbsd" then prehookNetBSD else
|
if system == "i686-netbsd" then prehookNetBSD else
|
||||||
|
if system == "i686-cygwin" then prehookCygwin else
|
||||||
|
if system == "x86_64-cygwin" then prehookCygwin else
|
||||||
prehookBase;
|
prehookBase;
|
||||||
|
|
||||||
|
extraBuildInputs =
|
||||||
|
if system == "i686-cygwin" then extraBuildInputsCygwin else
|
||||||
|
if system == "x86_64-cygwin" then extraBuildInputsCygwin else
|
||||||
|
[];
|
||||||
|
|
||||||
initialPath = extraPath ++ path;
|
initialPath = extraPath ++ path;
|
||||||
|
|
||||||
fetchurlBoot = fetchurl;
|
fetchurlBoot = fetchurl;
|
||||||
|
|
|
@ -22,6 +22,7 @@ rec {
|
||||||
else if system == "x86_64-freebsd" then pkgs_x86_64_freebsd
|
else if system == "x86_64-freebsd" then pkgs_x86_64_freebsd
|
||||||
else if system == "i686-freebsd" then pkgs_i686_freebsd
|
else if system == "i686-freebsd" then pkgs_i686_freebsd
|
||||||
else if system == "i686-cygwin" then pkgs_i686_cygwin
|
else if system == "i686-cygwin" then pkgs_i686_cygwin
|
||||||
|
else if system == "x86_64-cygwin" then pkgs_x86_64_cygwin
|
||||||
else abort "unsupported system type: ${system}";
|
else abort "unsupported system type: ${system}";
|
||||||
|
|
||||||
pkgs_x86_64_linux = allPackages { system = "x86_64-linux"; };
|
pkgs_x86_64_linux = allPackages { system = "x86_64-linux"; };
|
||||||
|
@ -30,6 +31,7 @@ rec {
|
||||||
pkgs_x86_64_freebsd = allPackages { system = "x86_64-freebsd"; };
|
pkgs_x86_64_freebsd = allPackages { system = "x86_64-freebsd"; };
|
||||||
pkgs_i686_freebsd = allPackages { system = "i686-freebsd"; };
|
pkgs_i686_freebsd = allPackages { system = "i686-freebsd"; };
|
||||||
pkgs_i686_cygwin = allPackages { system = "i686-cygwin"; };
|
pkgs_i686_cygwin = allPackages { system = "i686-cygwin"; };
|
||||||
|
pkgs_x86_64_cygwin = allPackages { system = "x86_64-cygwin"; };
|
||||||
|
|
||||||
|
|
||||||
/* The working or failing mails for cross builds will be sent only to
|
/* The working or failing mails for cross builds will be sent only to
|
||||||
|
|
Loading…
Reference in New Issue