diff --git a/pkgs/stdenv/default.nix b/pkgs/stdenv/default.nix index c8482200393..79b69fabfae 100644 --- a/pkgs/stdenv/default.nix +++ b/pkgs/stdenv/default.nix @@ -73,12 +73,17 @@ rec { inherit genericStdenv gccWrapper; }; + # MinGW/MSYS standard environment. + stdenvMinGW = (import ./mingw) { + inherit system; + }; # Select the appropriate stdenv for the platform `system'. stdenv = if system == "i686-linux" then stdenvLinux else if system == "i686-freebsd" then stdenvFreeBSD else if system == "i686-cygwin" then stdenvCygwin + else if system == "i686-msys" then stdenvMinGW else if system == "powerpc-darwin" then stdenvDarwin else if system == "i686-darwin" then stdenvNix else stdenvNative; diff --git a/pkgs/stdenv/mingw/default.nix b/pkgs/stdenv/mingw/default.nix new file mode 100644 index 00000000000..54970acce4c --- /dev/null +++ b/pkgs/stdenv/mingw/default.nix @@ -0,0 +1,101 @@ +/** + * Initial stdenv should have: + * - shell + * - mkdir + * - gnu tar + * - curl + */ +{system} : + +let { + /** + * Initial standard environment based on native cygwin tools. + */ + stdenvInit1 = + import ./simple-stdenv { + inherit system; + name = "stdenv-initial-cygwin"; + shell = "/bin/bash"; + path = ["/usr/bin" "/bin"]; + }; + + /** + * Initial standard environment based on MSYS tools. + * From this point, cygwin should no longer by involved. + */ + stdenvInit2 = + import ./simple-stdenv { + name = "stdenv-initial-msys"; + inherit system; + shell = msys + /bin/sh + ".exe"; + path = [msys]; + + /** + * Instruct MSYS to change the uname + * The PATH manipulation in /etc/profile is not relevant for now: + * This will be overridden anyway. + */ + extraEnv = { + MSYSTEM = "MSYS"; + }; + }; + + /** + * Fetchurl, based on native curl in stdenvInit1 + */ + fetchurl = + import ../../build-support/fetchurl { + stdenv = stdenvInit1; + + /** + * use native curl in Cygwin. We could consider to use curl.exe, + * which is widely available (or we could bootstrap it ourselves) + */ + curl = null; + }; + + /** + * MSYS, installed using stdenvInit1 + */ + msys = + stdenvInit1.mkDerivation { + name = "msys-1.0.11"; + builder = ./msys-builder.sh; + src = fetchurl { + url = http://www.cs.uu.nl/people/martin/msys-1.0.11.tar.gz; + md5 = "7e76eec10a205ea63ada6a4e834cc468"; + }; + }; + + /** + * Complete standard environment + */ + body = + import ../generic { + name = "stdenv-mingw"; + # preHook = ./prehook.sh; + initialPath = [msys]; + stdenv = stdenvInit2; + shell = msys + /bin/sh + ".exe"; + gcc = msys; + }; +} + + + /* + + mingw = { + langC = true; + langCC = true; + langF77 = true; + }; + + gcc = + import ../../build-support/gcc-wrapper { + nativeTools = false; + nativeGlibc = false; + stdenv = stdenvInitial; + binutils = msys; + gcc = mingw; + shell = msys + /bin/sh; + }; */ diff --git a/pkgs/stdenv/mingw/msys-builder.sh b/pkgs/stdenv/mingw/msys-builder.sh new file mode 100644 index 00000000000..bfbe656bb11 --- /dev/null +++ b/pkgs/stdenv/mingw/msys-builder.sh @@ -0,0 +1,5 @@ +source $stdenv/setup + +mkdir $out +cd $out +tar zxvf $src diff --git a/pkgs/stdenv/mingw/simple-stdenv/builder.sh b/pkgs/stdenv/mingw/simple-stdenv/builder.sh new file mode 100644 index 00000000000..c59e2ad0620 --- /dev/null +++ b/pkgs/stdenv/mingw/simple-stdenv/builder.sh @@ -0,0 +1,26 @@ +setupPath= +for i in $initialPath; do + setupPath=$setupPath${setupPath:+:}$i +done + +PATH=$setupPath +echo $setupPath + +mkdir $out +cat > $out/setup <