2017-08-13 00:53:29 +02:00
|
|
|
{ stdenv, fetchFromGitHub, fetchpatch, lib
|
2016-10-05 19:04:03 +02:00
|
|
|
, autoconf, automake, gnum4, libtool, perl, gnulib, uthash, pkgconfig, gettext
|
2015-04-01 03:49:45 +02:00
|
|
|
, python, freetype, zlib, glib, libungif, libpng, libjpeg, libtiff, libxml2, pango
|
2017-02-01 14:59:35 +01:00
|
|
|
, withSpiro ? false, libspiro
|
2015-01-12 13:17:28 +01:00
|
|
|
, withGTK ? false, gtk2
|
2016-06-11 00:41:44 +02:00
|
|
|
, withPython ? true
|
2016-08-12 05:19:25 +02:00
|
|
|
, Carbon ? null, Cocoa ? null
|
2007-08-21 14:31:33 +02:00
|
|
|
}:
|
|
|
|
|
2016-06-11 00:41:44 +02:00
|
|
|
stdenv.mkDerivation rec {
|
2015-01-12 13:17:28 +01:00
|
|
|
name = "fontforge-${version}";
|
2017-08-12 16:22:45 +02:00
|
|
|
version = "20170730";
|
|
|
|
|
2016-06-11 00:41:44 +02:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "fontforge";
|
|
|
|
repo = "fontforge";
|
|
|
|
rev = version;
|
2017-08-12 16:22:45 +02:00
|
|
|
sha256 = "15k6x97383p8l40jvcivalhwgbbcdg5vciyjz6m9r0lrlnjqkv99";
|
2007-08-21 14:31:33 +02:00
|
|
|
};
|
2012-02-06 06:49:27 +01:00
|
|
|
|
2017-08-15 20:41:56 +02:00
|
|
|
patches = [ ./fontforge-20140813-use-system-uthash.patch ];
|
2017-08-12 16:22:45 +02:00
|
|
|
|
2017-08-15 20:41:56 +02:00
|
|
|
# use $SOURCE_DATE_EPOCH instead of non-determenistic timestamps
|
|
|
|
postPatch = ''
|
|
|
|
find . -type f -name '*.c' -exec sed -r -i 's#\btime\(&(.+)\)#if (getenv("SOURCE_DATE_EPOCH")) \1=atol(getenv("SOURCE_DATE_EPOCH")); else &#g' {} \;
|
|
|
|
sed -r -i 's#author\s*!=\s*NULL#& \&\& !getenv("SOURCE_DATE_EPOCH")#g' fontforge/cvexport.c fontforge/dumppfa.c fontforge/print.c fontforge/svg.c fontforge/splineutil2.c
|
|
|
|
sed -r -i 's#\bb.st_mtime#getenv("SOURCE_DATE_EPOCH") ? atol(getenv("SOURCE_DATE_EPOCH")) : &#g' fontforge/parsepfa.c fontforge/sfd.c fontforge/svg.c
|
|
|
|
sed -r -i 's#^\s*ttf_fftm_dump#if (!getenv("SOURCE_DATE_EPOCH")) ttf_fftm_dump#g' fontforge/tottf.c
|
|
|
|
sed -r -i 's#sprintf\(.+ author \);#if (!getenv("SOURCE_DATE_EPOCH")) &#g' fontforgeexe/fontinfo.c
|
|
|
|
'';
|
2017-08-12 16:22:45 +02:00
|
|
|
|
|
|
|
# do not use x87's 80-bit arithmetic, rouding errors result in very different font binaries
|
|
|
|
NIX_CFLAGS_COMPILE = lib.optionals stdenv.isi686 [ "-msse2" "-mfpmath=sse" ];
|
2015-01-12 13:17:28 +01:00
|
|
|
|
2017-09-14 21:24:37 +02:00
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
2015-01-12 13:17:28 +01:00
|
|
|
buildInputs = [
|
2017-09-14 21:24:37 +02:00
|
|
|
autoconf automake gnum4 libtool perl gettext uthash
|
2015-01-12 13:17:28 +01:00
|
|
|
python freetype zlib glib libungif libpng libjpeg libtiff libxml2
|
|
|
|
]
|
2017-02-01 14:59:35 +01:00
|
|
|
++ lib.optionals withSpiro [libspiro]
|
2016-08-29 22:27:34 +02:00
|
|
|
++ lib.optionals withGTK [ gtk2 pango ]
|
2016-09-04 05:38:23 +02:00
|
|
|
++ lib.optionals stdenv.isDarwin [ Carbon Cocoa ];
|
2015-01-12 13:17:28 +01:00
|
|
|
|
|
|
|
configureFlags =
|
|
|
|
lib.optionals (!withPython) [ "--disable-python-scripting" "--disable-python-extension" ]
|
2016-09-04 05:39:43 +02:00
|
|
|
++ lib.optional withGTK "--enable-gtk2-use"
|
|
|
|
++ lib.optional (!withGTK) "--without-x";
|
2012-02-06 06:49:27 +01:00
|
|
|
|
2016-10-05 19:04:03 +02:00
|
|
|
# work-around: git isn't really used, but configuration fails without it
|
2015-01-12 13:17:28 +01:00
|
|
|
preConfigure = ''
|
2017-08-13 00:53:29 +02:00
|
|
|
# The way $version propagates to $version of .pe-scripts (https://github.com/dejavu-fonts/dejavu-fonts/blob/358190f/scripts/generate.pe#L19)
|
|
|
|
export SOURCE_DATE_EPOCH=$(date -d ${version} +%s)
|
|
|
|
|
2016-10-05 19:04:03 +02:00
|
|
|
export GIT="$(type -P true)"
|
2015-01-12 13:17:28 +01:00
|
|
|
cp -r "${gnulib}" ./gnulib
|
|
|
|
chmod +w -R ./gnulib
|
|
|
|
./bootstrap --skip-git --gnulib-srcdir=./gnulib
|
2008-03-26 13:57:30 +01:00
|
|
|
'';
|
2007-08-21 14:31:33 +02:00
|
|
|
|
2015-01-12 13:17:28 +01:00
|
|
|
postInstall =
|
|
|
|
# get rid of the runtime dependency on python
|
|
|
|
lib.optionalString (!withPython) ''
|
|
|
|
rm -r "$out/share/fontforge/python"
|
|
|
|
'';
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "A font editor";
|
|
|
|
homepage = http://fontforge.github.io;
|
|
|
|
platforms = stdenv.lib.platforms.all;
|
2017-03-23 15:10:34 +01:00
|
|
|
license = stdenv.lib.licenses.bsd3;
|
2015-01-12 13:17:28 +01:00
|
|
|
};
|
2007-08-21 14:31:33 +02:00
|
|
|
}
|
2015-01-12 13:17:28 +01:00
|
|
|
|