diff --git a/pkgs/tools/graphics/transfig/builder.sh b/pkgs/tools/graphics/transfig/builder.sh deleted file mode 100644 index c466f759446c..000000000000 --- a/pkgs/tools/graphics/transfig/builder.sh +++ /dev/null @@ -1,38 +0,0 @@ -source $stdenv/setup - -patchPhase() { - for i in $patches; do - header "applying patch $i" 3 - patch -p0 < $i - stopNest - done - - configureImakefiles "s:__PREFIX_PNG:$libpng:" - configureImakefiles "s:__PREFIX:$out:" -} - -configureImakefiles() { - local sedcmd=$1 - - sed "${sedcmd}" fig2dev/Imakefile > tmpsed - cp tmpsed fig2dev/Imakefile - - sed "${sedcmd}" fig2dev/dev/Imakefile > tmpsed - cp tmpsed fig2dev/dev/Imakefile - - sed "${sedcmd}" transfig/Imakefile > tmpsed - cp tmpsed transfig/Imakefile -} - -buildPhase() { - xmkmf - make Makefiles - make -} - -preInstall() { - mkdir -p $out - mkdir -p $out/lib -} - -genericBuild diff --git a/pkgs/tools/graphics/transfig/default.nix b/pkgs/tools/graphics/transfig/default.nix index 948bba6d459f..cb3f0edff0f8 100644 --- a/pkgs/tools/graphics/transfig/default.nix +++ b/pkgs/tools/graphics/transfig/default.nix @@ -2,34 +2,63 @@ stdenv.mkDerivation rec { name = "transfig-3.2.4"; - builder = ./builder.sh; src = fetchurl { url = ftp://ftp.tex.ac.uk/pub/archive/graphics/transfig/transfig.3.2.4.tar.gz; sha256 = "0429snhp5acbz61pvblwlrwv8nxr6gf12p37f9xxwrkqv4ir7dd4"; }; buildInputs = [zlib libjpeg libpng imake]; - inherit libpng; + + patches = [ + ./patch-fig2dev-dev-Imakefile + ./patch-fig2dev-Imakefile + ./patch-transfig-Imakefile + ./patch-fig2dev-fig2dev.h + ./patch-fig2dev-dev-gensvg.c + ]; + + patchPhase = '' + runHook prePatch + + configureImakefiles() { + local sedcmd=$1 + + sed "$sedcmd" fig2dev/Imakefile > tmpsed + cp tmpsed fig2dev/Imakefile + + sed "$sedcmd" fig2dev/dev/Imakefile > tmpsed + cp tmpsed fig2dev/dev/Imakefile + + sed "$sedcmd" transfig/Imakefile > tmpsed + cp tmpsed transfig/Imakefile + } + + for i in $patches; do + header "applying patch $i" 3 + patch -p0 < $i + stopNest + done + + configureImakefiles "s:__PREFIX_PNG:${libpng}:" + configureImakefiles "s:__PREFIX:$out:" + + runHook postPatch + ''; + + preBuild = '' + xmkmf + make Makefiles + ''; + + makeFlags = [ "CC=cc" ]; + + preInstall = '' + mkdir -p $out + mkdir -p $out/lib + ''; hardeningDisable = [ "format" ]; - patches = [prefixPatch1 prefixPatch2 prefixPatch3 varargsPatch gensvgPatch]; - - prefixPatch1 = - ./patch-fig2dev-dev-Imakefile; - - prefixPatch2 = - ./patch-fig2dev-Imakefile; - - prefixPatch3 = - ./patch-transfig-Imakefile; - - varargsPatch = - ./patch-fig2dev-fig2dev.h; - - gensvgPatch = - ./patch-fig2dev-dev-gensvg.c; - meta = { platforms = stdenv.lib.platforms.unix; };