3
0
Fork 0
forked from mirrors/nixpkgs

Some refactorings in builderDefs. Psi is a simple showcase. TeXLive now works as far as English is concerned, and it is also updated up to newest builderDefs.

svn path=/nixpkgs/trunk/; revision=11235
This commit is contained in:
Michael Raskin 2008-03-20 15:40:26 +00:00
parent 95f0e6a1a7
commit 5f2bcdbdb6
6 changed files with 123 additions and 110 deletions

View file

@ -1,30 +1,20 @@
args : with args;
rec {
src = fetchurl {
url = ftp://ftp.ru.debian.org/debian/pool/main/p/psi/psi_0.11.orig.tar.gz;
sha256 = "1rgjahngari4pwhi0zz9mricaaqxkk8ry8w6s1vgsq3zwa2l5x57";
};
args : with args; with builderDefs {src="";} null; buildInputs = [aspell qt zlib sox openssl libX11 xproto
let localDefs = builderDefs (rec { libSM libICE];
src = /* put a fetchurl here */ configureFlags = [" --with-zlib-inc=${zlib}/include "
fetchurl { " --with-openssl-inc=${openssl}/include "
url = ftp://ftp.ru.debian.org/debian/pool/main/p/psi/psi_0.11.orig.tar.gz; ];
sha256 = "1rgjahngari4pwhi0zz9mricaaqxkk8ry8w6s1vgsq3zwa2l5x57";
};
buildInputs = [aspell qt zlib sox openssl libX11 xproto phaseNames = ["doConfigure" "doMakeInstall"];
libSM libICE];
configureFlags = [" --with-zlib-inc=${zlib}/include " name = "psi-" + version;
" --with-openssl-inc=${openssl}/include " meta = {
]; description = "Psi, an XMPP (Jabber) client";
}) args null; /* null is a terminator for sumArgs */ };
in with localDefs;
stdenv.mkDerivation rec {
name = "psi-"+version;
MAKE="make";
builder = writeScript (name + "-builder")
(textClosure localDefs
["doConfigure" "doMakeInstall" doForceShare doPropagate]);
meta = {
description = "
Psi, an XMPP (Jabber) client.
";
inherit src;
};
} }

View file

@ -1,73 +1,79 @@
args : with args; with builderDefs {src="";} null; args : with args;
let localDefs = builderDefs (rec { rec {
src = /* put a fetchurl here */ src = fetchurl {
fetchurl { url = mirror://debian/pool/main/t/texlive-bin/texlive-bin_2007.orig.tar.gz;
url = debian://pool/main/t/texlive-bin/texlive-bin_2007.orig.tar.gz; sha256 = "1fz5lqbigdrdg0pmaynissd7wn59p2yj9f203nl93dcpffrapxjv";
sha256 = "1fz5lqbigdrdg0pmaynissd7wn59p2yj9f203nl93dcpffrapxjv"; };
};
texmfSrc = texmfSrc = fetchurl {
fetchurl { url = mirror://debian/pool/main/t/texlive-base/texlive-base_2007.orig.tar.gz;
url = debian://pool/main/t/texlive-base/texlive-base_2007.orig.tar.gz; sha256 = "16a4dyliidk43qj0m4gpsl9ln7nqsdcdx1lkbk4wrm03xpx87zvh";
sha256 = "16a4dyliidk43qj0m4gpsl9ln7nqsdcdx1lkbk4wrm03xpx87zvh"; };
};
setupHook = ./setup-hook.sh; langTexmfSrc = fetchurl {
url = mirror://debian/pool/main/t/texlive-lang/texlive-lang_2007.orig.tar.gz;
sha256 = "0cmd9ryd57rzzg7g2gm3qn4ijakkacy810h5zncqd39p3i1yn6nx";
};
setupHook = ./setup-hook.sh;
doInstall = FullDepEntry ('' doPreConfigure = FullDepEntry (''
ensureDir $out ensureDir $out
ensureDir $out/nix-support ensureDir $out/nix-support
cp ${setupHook} $out/nix-support/setup-hook.sh cp ${setupHook} $out/nix-support/setup-hook.sh
ensureDir $out/share ensureDir $out/share
tar xf ${texmfSrc} -C $out/share --strip-components=1 tar xf ${texmfSrc} -C $out/share --strip-components=1
cd build/source tar xf ${langTexmfSrc} -C $out/share --strip-components=1
sed -e s@/usr/bin/@@g -i $(grep /usr/bin/ -rl . ) cp -r texmf* $out/share
sed -e '/ubidi_open/i#include <unicode/urename.h>' -i $(find . -name configure) cd build/source
sed -e s@ncurses/curses.h@curses.h@g -i $(grep ncurses/curses.h -rl . ) sed -e s@/usr/bin/@@g -i $(grep /usr/bin/ -rl . )
NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${freetype}/include/freetype2" sed -e '/ubidi_open/i#include <unicode/urename.h>' -i $(find . -name configure)
echo NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${icu}/include/unicode" sed -e s@ncurses/curses.h@curses.h@g -i $(grep ncurses/curses.h -rl . )
NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${icu}/include/layout"; sed -e 's/.*pyhyph.*/=&/' -i $out/share/texmf-config/tex/generic/config/language.dat
./configure --prefix=$out \
--with-x11 \ updmap --syncwithtrees
--with-system-zlib \
--with-system-freetype2 \ NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${freetype}/include/freetype2"
--with-system-t1lib \ NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${icu}/include/layout";
--with-system-pnglib \ '') ["minInit" "doUnpack" "addInputs" "defEnsureDir"];
--with-system-gd \
--with-system-icu \ doPostInstall = FullDepEntry(''
--with-system-ncurses \ mv $out/bin $out/libexec
--enable-ipc \ ensureDir $out/bin
--with-mktexfmt for i in $out/libexec/*/*; do
make echo -ne "#! /bin/sh\\n$i \"\$@\"" >$out/bin/$(basename $i)
make install chmod a+x $out/bin/$(basename $i)
mv $out/bin $out/libexec done
ensureDir $out/bin texmf_var=$(mktemp -d /var/tmp/texmf-varXXXXXXXX)
for i in $out/libexec/*/*; do mv $out/share/texmf-var/* $texmf_var/
echo -ne "#! /bin/sh\\n$i \"\$@\"" >$out/bin/$(basename $i) chmod -R a+rwX $texmf_var
chmod a+x $out/bin/$(basename $i) rm -r $out/share/texmf-var
done rm -r /var/tmp/texmf-var
texmf_var=$(mktemp -d /var/tmp/texmf-varXXXXXXXX) ln -sfT $texmf_var $out/share/texmf-var
mv $out/share/texmf-var/* $texmf_var/ ln -sfT $texmf_var /var/tmp/texmf-var
chmod -R a+rwX $texmf_var ln -s $out/share/texmf $out/share/texmf-config
ln -s $texmf_var $out/share/texmf-var PATH=$PATH:$out/bin mktexlsr $out/share/texmf*
ln -s $out/share/texmf $out/share/texmf-config '') ["minInit" "defEnsureDir" "doUnpack" "doMakeInstall"];
'') ["minInit" "defEnsureDir" "doUnpack" "addInputs"];
buildInputs = [zlib bzip2 ncurses libpng ed flex bison libX11 xproto buildInputs = [
freetype t1lib gd libXaw icu ghostscript zlib bzip2 ncurses libpng flex bison libX11 libICE
libXt libXpm libXmu libXext xextproto perl libSM xproto freetype t1lib gd libXaw icu ghostscript ed
libICE]; libXt libXpm libXmu libXext xextproto perl libSM
configureFlags = []; ];
}) args null; /* null is a terminator for sumArgs */
in with localDefs; configureFlags = [ "--with-x11" "--with-system-zlib"
stdenv.mkDerivation rec { "--with-system-freetype2" "--with-system-t1lib"
name = "TeXLive-core-2007"; "--with-system-pnglib" "--with-system-gd"
builder = writeScript (name + "-builder") "--with-system-icu" "--with-system-ncurses"
(textClosure localDefs "--enable-ipc" "--with-mktexfmt"
[doInstall doForceShare doPropagate]); ];
meta = {
description = " phaseNames = ["doPreConfigure" "doConfigure"
TeX distribution. "doMakeInstall" "doPostInstall"];
";
inherit src; name = "texlive-core-2007";
srcs = [texmfSrc]; meta = {
}; description = "A TeX distribution";
srcs = [texmfSrc langTexmfSrc];
};
} }

View file

@ -270,6 +270,9 @@ let pkgs = rec {
inherit stringsWithDeps lib stdenv writeScript fetchurl; inherit stringsWithDeps lib stdenv writeScript fetchurl;
}; };
builderDefsPackage = expr: lib.sumArgs
(((builderDefs null).builderDefsPackage builderDefs) expr);
stringsWithDeps = import ../lib/strings-with-deps.nix { stringsWithDeps = import ../lib/strings-with-deps.nix {
inherit stdenv lib; inherit stdenv lib;
}; };
@ -6076,11 +6079,13 @@ let pkgs = rec {
inherit fetchurl stdenv tetex lazylist; inherit fetchurl stdenv tetex lazylist;
}; };
psiFun = lib.sumArgs (selectVersion ../applications/networking/instant-messengers/psi "0.11") { psiFun = builderDefsPackage
inherit builderDefs zlib aspell sox openssl; (selectVersion ../applications/networking/instant-messengers/psi "0.11")
inherit (xlibs) xproto libX11 libSM libICE; {
qt = qt4; inherit builderDefs zlib aspell sox openssl;
}; inherit (xlibs) xproto libX11 libSM libICE;
qt = qt4;
};
psi = psiFun null; psi = psiFun null;
@ -6146,7 +6151,7 @@ let pkgs = rec {
inherit stdenv perl tetex graphviz ghostscript; inherit stdenv perl tetex graphviz ghostscript;
}; };
texLiveFun = lib.sumArgs (import ../misc/tex/texlive) { texLiveFun = builderDefsPackage (import ../misc/tex/texlive) {
inherit builderDefs zlib bzip2 ncurses libpng ed inherit builderDefs zlib bzip2 ncurses libpng ed
gd t1lib freetype icu perl; gd t1lib freetype icu perl;
inherit (xlibs) libXaw libX11 xproto libXt libXpm inherit (xlibs) libXaw libX11 xproto libXt libXpm

View file

@ -3,6 +3,8 @@ args: with args; with stringsWithDeps; with lib;
{ {
inherit writeScript; inherit writeScript;
src = getAttr ["src"] "" args;
addSbinPath = getAttr ["addSbinPath"] false args; addSbinPath = getAttr ["addSbinPath"] false args;
forceShare = if args ? forceShare then args.forceShare else ["man" "doc" "info"]; forceShare = if args ? forceShare then args.forceShare else ["man" "doc" "info"];
@ -385,4 +387,18 @@ args: with args; with stringsWithDeps; with lib;
GHC_PACKAGE_PATH=\$PACKAGE_DB ./register.sh GHC_PACKAGE_PATH=\$PACKAGE_DB ./register.sh
" ["defCreateEmptyPackageDatabaseAndSetupHook" "defCabalSetupCmd"]; " ["defCreateEmptyPackageDatabaseAndSetupHook" "defCabalSetupCmd"];
phaseNames = args.phaseNames ++
["doForceShare" "doPropagate"];
builderDefsPackage = bd: func: args: (
let localDefs = bd (func ((bd null) // args)) args null; in
stdenv.mkDerivation (rec {
inherit (localDefs) name;
builder = writeScript (name + "-builder")
(textClosure localDefs localDefs.phaseNames);
meta = localDefs.meta // {inherit src;};
})
);
}) // args }) // args

View file

@ -16,9 +16,7 @@ stdenv.mkDerivation rec {
builder = writeScript (name + "-builder") builder = writeScript (name + "-builder")
(textClosure localDefs [(abort "Check phases") doMakeInstall doForceShare doPropagate]); (textClosure localDefs [(abort "Check phases") doMakeInstall doForceShare doPropagate]);
meta = { meta = {
description = " description = "${(abort "Specify description")}";
${(abort "Specify description")}
";
inherit src; inherit src;
}; };
} }

View file

@ -1,4 +1,4 @@
args : with args; with builderDefs {src="";} null; args : with args; with builderDefs null;
let localDefs = builderDefs (rec { let localDefs = builderDefs (rec {
src = /* put a fetchurl here */ src = /* put a fetchurl here */
@ -12,9 +12,7 @@ stdenv.mkDerivation rec {
(textClosure localDefs (textClosure localDefs
[(abort "Specify phases - defined here or in builderDefs") doForceShare doPropagate]); [(abort "Specify phases - defined here or in builderDefs") doForceShare doPropagate]);
meta = { meta = {
description = " description = "${abort "Write a description"}";
${abort "Write a description"}
";
inherit src; inherit src;
}; };
} }