forked from mirrors/nixpkgs
change uulib to store all dependencies to package.conf
added ghc-wrapper to use a generated global package.conf added uuagc svn path=/nixpkgs/trunk/; revision=4608
This commit is contained in:
parent
69b41650ad
commit
8d4e61d096
32
pkgs/development/compilers/ghc-wrapper/builder.sh
Normal file
32
pkgs/development/compilers/ghc-wrapper/builder.sh
Normal file
|
@ -0,0 +1,32 @@
|
|||
source $stdenv/setup
|
||||
|
||||
makeWrapper() {
|
||||
wrapperBase="$1"
|
||||
wrapperName="$2"
|
||||
wrapper="$out/$wrapperName"
|
||||
shift; shift #the other arguments are passed to the source app
|
||||
echo '#!'"$SHELL" > "$wrapper"
|
||||
echo "exec \"$wrapperBase/$wrapperName\" $@" '"$@"' > "$wrapper"
|
||||
chmod +x "$wrapper"
|
||||
}
|
||||
|
||||
mkdir -p $out/nix-support $out/bin
|
||||
packages_db=$out/nix-support/package.conf
|
||||
|
||||
#create packages database (start with compiler base packages)
|
||||
cp $ghc/lib/ghc-*/package.conf $packages_db
|
||||
chmod +w $packages_db
|
||||
for lib in $libraries; do
|
||||
sh $lib/nix-support/register.sh $packages_db || exit 1
|
||||
done
|
||||
rm -f $packages_db.old
|
||||
|
||||
#create the wrappers
|
||||
#NB: The double dash for ghc-pkg is not a typo!
|
||||
makeWrapper $ghc "bin/ghc" "-package-conf" $packages_db
|
||||
makeWrapper $ghc "bin/ghci" "-package-conf" $packages_db
|
||||
makeWrapper $ghc "bin/runghc" "-package-conf" $packages_db
|
||||
makeWrapper $ghc "bin/runhaskell" "-package-conf" $packages_db
|
||||
makeWrapper $ghc "bin/ghc-pkg" "--global-conf" $packages_db
|
||||
|
||||
# todo: link all other binaries of ghc
|
7
pkgs/development/compilers/ghc-wrapper/default.nix
Normal file
7
pkgs/development/compilers/ghc-wrapper/default.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{stdenv, ghc, libraries}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = ghc.name;
|
||||
inherit ghc libraries;
|
||||
builder = ./builder.sh;
|
||||
}
|
|
@ -1,7 +1,8 @@
|
|||
source $stdenv/setup
|
||||
|
||||
#manual setup of ghc
|
||||
PATH=$ghc/bin:$PATH
|
||||
|
||||
#add ghc to search path
|
||||
test -n "$ghc" && PATH=$PATH:$ghc/bin
|
||||
|
||||
#unpack
|
||||
tar xzf "$src" &&
|
||||
|
@ -17,20 +18,31 @@ ghc --make Setup.hs -o setup -package Cabal &&
|
|||
#install
|
||||
./setup copy &&
|
||||
|
||||
#register package locally (might use wrapper instead of ugly sed)
|
||||
echo '[]' > package.conf &&
|
||||
# Create package database. If we can find the ghc version we might install the
|
||||
# package, like ghc does, in $out/lib/ghc-version/package.conf.
|
||||
|
||||
support=$out/nix-support &&
|
||||
packages_db=$out/nix-support/package.conf &&
|
||||
|
||||
mkdir $support &&
|
||||
cp $ghc/lib/ghc-*/package.conf $packages_db &&
|
||||
chmod +w $packages_db &&
|
||||
#echo '[]' > $packages_db &&
|
||||
|
||||
# We save a modified version of a register script. This gives a dependency on
|
||||
# ghc, but this should not be a problem as long as $out is a static library.
|
||||
|
||||
./setup register --gen-script &&
|
||||
sed "/ghc-pkg/ s|update -|-f package.conf update -|" register.sh > register-local.sh &&
|
||||
sh register-local.sh &&
|
||||
mv package.conf $out/ &&
|
||||
sed '/ghc-pkg/ s|update -|-f "$1" update -|' register.sh > register-pkg.sh &&
|
||||
sed '/ghc-pkg/ s|--auto-ghci-libs||' register-pkg.sh > $support/register.sh &&
|
||||
|
||||
#add dependencies
|
||||
#dependencies contains a FSO per line
|
||||
#for ghc : prefix each FSO with -package-conf
|
||||
#for ghc-pkg : prefix each FSO with -f or --package-conf (note the difference with ghc)
|
||||
#both : append with package.conf
|
||||
#
|
||||
#example: $(sort FSO1/dependencies FSO2/dependencies | uniq | sed 's|^|FSO/|; s|$|/package.conf|')
|
||||
# The package and its direct cabal dependencies are registered. This may result
|
||||
# in duplicate registrations attempts but hopefully that will not result in
|
||||
# errors.
|
||||
|
||||
#no dependencies
|
||||
touch $out/dependencies
|
||||
# uulib has no dependencies on other ghc libraries
|
||||
for dep in ; do
|
||||
sh $dep/nix-support/register.sh $packages_db || exit 1
|
||||
done &&
|
||||
sh register-pkg.sh $packages_db &&
|
||||
rm -f $package_db.old
|
||||
|
|
|
@ -7,5 +7,6 @@ stdenv.mkDerivation {
|
|||
md5 = "0cc9acc6a268e2bc5c8a954e67406e2d";
|
||||
};
|
||||
builder = ./builder.sh;
|
||||
#buildInputs = [ ghc ];
|
||||
inherit ghc;
|
||||
}
|
||||
|
|
19
pkgs/development/tools/haskell/uuagc/default.nix
Normal file
19
pkgs/development/tools/haskell/uuagc/default.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
{stdenv, fetchurl, ghc, uulib}:
|
||||
|
||||
#as long as cabal does not allow to specify which package.conf to use we create a wrapper
|
||||
|
||||
let {
|
||||
uulibGHC = (import ../../../compilers/ghc-wrapper) {
|
||||
libraries = [ uulib ];
|
||||
inherit stdenv ghc;
|
||||
};
|
||||
|
||||
body = stdenv.mkDerivation {
|
||||
name = "uuagc";
|
||||
src = fetchurl {
|
||||
url = http://abaris.zoo.cs.uu.nl:8080/wiki/pub/HUT/Download/uuagc-0.9.1-src.tar.gz;
|
||||
md5 = "0f29cad75bd759696edc61c24d1a5db9";
|
||||
};
|
||||
buildInputs = [uulibGHC];
|
||||
};
|
||||
}
|
|
@ -682,6 +682,16 @@ rec {
|
|||
m4 = gnum4;
|
||||
};
|
||||
|
||||
ghcWrapper = assert uulib.ghc == ghc;
|
||||
(import ../development/compilers/ghc-wrapper) {
|
||||
inherit stdenv ghc;
|
||||
libraries = [ uulib ];
|
||||
};
|
||||
|
||||
uuagc = (import ../development/tools/haskell/uuagc) {
|
||||
inherit fetchurl stdenv ghc uulib;
|
||||
};
|
||||
|
||||
helium = (import ../development/compilers/helium) {
|
||||
inherit fetchurl stdenv ghc;
|
||||
};
|
||||
|
|
|
@ -55,8 +55,10 @@ let {
|
|||
strategoxtUtils
|
||||
transformers
|
||||
|
||||
ghc
|
||||
# ghc
|
||||
ghcWrapper
|
||||
uulib
|
||||
uuagc
|
||||
# helium
|
||||
perl
|
||||
python
|
||||
|
|
Loading…
Reference in a new issue