Initial work on MinGW/MSYS standard environment

svn path=/nixpkgs/trunk/; revision=6122
This commit is contained in:
Martin Bravenboer 2006-08-15 14:46:41 +00:00
parent 3fd8841922
commit 56315425c9
5 changed files with 167 additions and 0 deletions

View File

@ -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;

View File

@ -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;
}; */

View File

@ -0,0 +1,5 @@
source $stdenv/setup
mkdir $out
cd $out
tar zxvf $src

View File

@ -0,0 +1,26 @@
setupPath=
for i in $initialPath; do
setupPath=$setupPath${setupPath:+:}$i
done
PATH=$setupPath
echo $setupPath
mkdir $out
cat > $out/setup <<EOF
PATH=$setupPath
export PATH
SHELL=$shell
export SHELL
# make fetchurl usable
header() {
echo "\$1"
}
stopNest() {
echo "Nothing to do"
}
EOF
chmod +x $out/setup

View File

@ -0,0 +1,30 @@
# Here we construct an absolutely trivial `initial' standard
# environment. It's not actually a functional stdenv, since there is
# not necessarily a working C compiler. We need this to build
# gcc-wrapper et al. for the native stdenv.
{system, name, shell, path, extraEnv ? {}}:
let {
body =
derivation {
inherit system name;
initialPath = path;
builder = shell;
args = ["-e" ./builder.sh];
}
// {
mkDerivation = attrs:
derivation ((removeAttrs attrs ["meta"]) // {
builder = shell;
args = ["-e" attrs.builder];
stdenv = body;
system = body.system;
}
// extraEnv);
inherit shell;
};
}