From 570c0b3a7292e62a9014e6a2a6ed77b47b8dd52d Mon Sep 17 00:00:00 2001 From: Daiderd Jordan Date: Fri, 22 Sep 2017 00:23:39 +0200 Subject: [PATCH] transfig: cleanup and fix darwin clang --- pkgs/tools/graphics/transfig/builder.sh | 38 -------------- pkgs/tools/graphics/transfig/default.nix | 67 +++++++++++++++++------- 2 files changed, 48 insertions(+), 57 deletions(-) delete mode 100644 pkgs/tools/graphics/transfig/builder.sh 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; };