* added generic Cabal builder

* transformed zlib, vty, binary, X11 to use generic Cabal builder
* note that Cabal library packages are now by default prefixed with "haskell-"

svn path=/nixpkgs/trunk/; revision=10247
This commit is contained in:
Andres Löh
2008-01-22 16:26:57 +00:00
parent dffda95fdd
commit d8694e68eb
6 changed files with 118 additions and 152 deletions

View File

@@ -1,49 +1,13 @@
{stdenv, fetchurl, ghc, libX11, xineramaSupport ? true, libXinerama ? null, libXext ? null}:
{cabal, libX11, xineramaSupport ? true, libXinerama ? null, libXext ? null}:
assert xineramaSupport -> (libXinerama != null && libXext != null);
stdenv.mkDerivation (rec {
cabal.mkDerivation (self : {
pname = "X11";
version = "1.4.1";
name = "${pname}-${version}";
src = fetchurl {
url = "http://hackage.haskell.org/packages/archive/${pname}/${version}/${name}.tar.gz";
sha256 = "e51038541415686f0e278ccdbc0b2373cd11f212de99023b7b8f8e776aa09f79";
};
buildInputs = [ghc];
propagatedBuildInputs = [libX11] ++
(if xineramaSupport then [libXinerama libXext] else []);
sha256 = "e51038541415686f0e278ccdbc0b2373cd11f212de99023b7b8f8e776aa09f79";
propagatedBuildInputs = [libX11] ++ (if xineramaSupport then [libXinerama libXext] else []);
meta = {
description = "A Haskell binding to the X11 graphics library";
};
extraLibDirs = "${libX11}/lib" + (if xineramaSupport then " ${libXinerama}/lib ${libXext}/lib" else "");
configurePhase = ''
echo "extra-lib-dirs: ${extraLibDirs}" >> X11.buildinfo.in
ghc --make Setup.hs
./Setup configure --prefix="$out"
'';
buildPhase = ''
./Setup build
'';
installPhase = ''
./Setup copy
./Setup register --gen-script
mkdir $out/nix-support
sed -i 's/|.*\(ghc-pkg update\)/| \1/' register.sh
cp register.sh $out/nix-support/register-ghclib.sh
sed -i 's/\(ghc-pkg update\)/\1 --user/' register.sh
mkdir $out/bin
cp register.sh $out/bin/register-ghclib-${name}.sh
'';
})