Packaging Asymptote from scratch to get rid of builderDefsPackage

This commit is contained in:
Michael Raskin 2015-02-10 00:27:51 +03:00
parent 7c12355ee1
commit f6f3813b65
2 changed files with 26 additions and 56 deletions

View File

@ -1,12 +1,8 @@
a @ { {stdenv, fetchurl
freeglut,ghostscriptX,imagemagick,fftw, , freeglut, ghostscriptX, imagemagick, fftw
boehmgc,mesa,ncurses,readline,gsl,libsigsegv, , boehmgc, mesa, ncurses, readline, gsl, libsigsegv
python,zlib, perl, texLive, texinfo, xz, , python, zlib, perl, texLive, texinfo, xz
}:
noDepEntry, fullDepEntry, fetchUrlFromSrcInfo,
lib,
...}:
let let
s = # Generated upstream information s = # Generated upstream information
rec { rec {
@ -17,60 +13,37 @@ let
url="mirror://sourceforge/project/asymptote/2.32/asymptote-2.32.src.tgz"; url="mirror://sourceforge/project/asymptote/2.32/asymptote-2.32.src.tgz";
sha256="19cgn5158p42igjbp8lf6xdbh3yjhlkdm22m5lqrhibp09g06d90"; sha256="19cgn5158p42igjbp8lf6xdbh3yjhlkdm22m5lqrhibp09g06d90";
}; };
buildInputs = with a; [ buildInputs = [
freeglut ghostscriptX imagemagick fftw boehmgc freeglut ghostscriptX imagemagick fftw
mesa ncurses readline gsl libsigsegv python zlib boehmgc mesa ncurses readline gsl libsigsegv
perl texLive texinfo xz python zlib perl texLive texinfo xz
]; ];
in in
rec { stdenv.mkDerivation {
src = a.fetchUrlFromSrcInfo s; inherit (s) name version;
inherit (s) name;
inherit buildInputs; inherit buildInputs;
configureFlags = "--enable-gc=${a.boehmgc} --enable-offscreen"; src = fetchurl {
inherit (s) url sha256;
/* doConfigure should be removed if not needed */ };
phaseNames = ["setVars" "doUnpack" "fixPaths" "extractTexinfoTex" preConfigure = ''
"fixEpsWrite"
"doConfigure" "dumpRealVars" "doMakeInstall" "fixPathsResult"
"fixInfoDir"];
setVars = a.noDepEntry ''
export HOME="$PWD" export HOME="$PWD"
patchShebangs .
sed -e 's@epswrite@eps2write@g' -i runlabel.in
xz -d < ${texinfo.src} | tar --wildcards -x texinfo-'*'/doc/texinfo.tex
cp texinfo-*/doc/texinfo.tex doc/
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${boehmgc}/include/gc"
''; '';
postInstall = ''
dumpRealVars = a.noDepEntry ''
set > ../real-env-vars
'';
fixPaths = a.doPatchShebangs ''.'';
fixPathsResult = a.doPatchShebangs ''$out/bin'';
fixInfoDir = a.noDepEntry ''
mv -v "$out/share/info/asymptote/"*.info $out/share/info/ mv -v "$out/share/info/asymptote/"*.info $out/share/info/
sed -i -e 's|(asymptote/asymptote)|(asymptote)|' $out/share/info/asymptote.info sed -i -e 's|(asymptote/asymptote)|(asymptote)|' $out/share/info/asymptote.info
rmdir $out/share/info/asymptote rmdir $out/share/info/asymptote
rm $out/share/info/dir rm $out/share/info/dir
''; '';
extractTexinfoTex = a.fullDepEntry ''
xz -d < ${a.texinfo.src} | tar --wildcards -x texinfo-'*'/doc/texinfo.tex
cp texinfo-*/doc/texinfo.tex doc/
'' ["minInit" "addInputs" "doUnpack"];
fixEpsWrite = a.fullDepEntry ''
sed -e 's@epswrite@eps2write@g' -i runlabel.in
'' ["minInit" "addInputs" "doUnpack"];
meta = { meta = {
inherit (s) version; inherit (s) version;
description = "A tool for programming graphics intended to replace Metapost"; description = "A tool for programming graphics intended to replace Metapost";
maintainers = [ license = stdenv.lib.licenses.gpl3Plus;
a.lib.maintainers.raskin maintainers = [stdenv.lib.maintainers.raskin stdenv.lib.maintainers.simons];
a.lib.maintainers.simons platforms = stdenv.lib.platforms.linux;
];
platforms = with a.lib.platforms;
linux;
}; };
} }

View File

@ -523,10 +523,7 @@ let
ascii = callPackage ../tools/text/ascii { }; ascii = callPackage ../tools/text/ascii { };
asymptote = builderDefsPackage ../tools/graphics/asymptote { asymptote = callPackage ../tools/graphics/asymptote {
inherit freeglut ghostscriptX imagemagick fftw boehmgc
mesa ncurses readline gsl libsigsegv python zlib perl
texinfo xz;
texLive = texLiveAggregationFun { texLive = texLiveAggregationFun {
paths = [ texLive texLiveExtra texLiveCMSuper ]; paths = [ texLive texLiveExtra texLiveCMSuper ];
}; };