transfig: cleanup and fix darwin clang

This commit is contained in:
Daiderd Jordan 2017-09-22 00:23:39 +02:00
parent ae4f2fbb41
commit 570c0b3a72
No known key found for this signature in database
GPG Key ID: D02435D05B810C96
2 changed files with 48 additions and 57 deletions

View File

@ -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

View File

@ -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;
};