2018-07-21 01:44:44 +01:00
|
|
|
{ stdenv, fetchFromGitHub, lib
|
2016-10-05 18:04:03 +01:00
|
|
|
, autoconf, automake, gnum4, libtool, perl, gnulib, uthash, pkgconfig, gettext
|
2015-04-01 02:49:45 +01:00
|
|
|
, python, freetype, zlib, glib, libungif, libpng, libjpeg, libtiff, libxml2, pango
|
2017-02-01 13:59:35 +00:00
|
|
|
, withSpiro ? false, libspiro
|
2015-01-12 12:17:28 +00:00
|
|
|
, withGTK ? false, gtk2
|
2016-06-10 23:41:44 +01:00
|
|
|
, withPython ? true
|
2016-08-12 04:19:25 +01:00
|
|
|
, Carbon ? null, Cocoa ? null
|
2007-08-21 13:31:33 +01:00
|
|
|
}:
|
|
|
|
|
2016-06-10 23:41:44 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2015-01-12 12:17:28 +00:00
|
|
|
name = "fontforge-${version}";
|
2017-08-12 15:22:45 +01:00
|
|
|
version = "20170730";
|
|
|
|
|
2016-06-10 23:41:44 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "fontforge";
|
|
|
|
repo = "fontforge";
|
|
|
|
rev = version;
|
2017-08-12 15:22:45 +01:00
|
|
|
sha256 = "15k6x97383p8l40jvcivalhwgbbcdg5vciyjz6m9r0lrlnjqkv99";
|
2007-08-21 13:31:33 +01:00
|
|
|
};
|
2012-02-06 05:49:27 +00:00
|
|
|
|
2017-08-15 19:41:56 +01:00
|
|
|
patches = [ ./fontforge-20140813-use-system-uthash.patch ];
|
2017-08-12 15:22:45 +01:00
|
|
|
|
2017-08-15 19:41:56 +01: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 15:22:45 +01: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 12:17:28 +00:00
|
|
|
|
2017-09-14 20:24:37 +01:00
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
2015-01-12 12:17:28 +00:00
|
|
|
buildInputs = [
|
2017-09-14 20:24:37 +01:00
|
|
|
autoconf automake gnum4 libtool perl gettext uthash
|
2015-01-12 12:17:28 +00:00
|
|
|
python freetype zlib glib libungif libpng libjpeg libtiff libxml2
|
|
|
|
]
|
2017-02-01 13:59:35 +00:00
|
|
|
++ lib.optionals withSpiro [libspiro]
|
2016-08-29 21:27:34 +01:00
|
|
|
++ lib.optionals withGTK [ gtk2 pango ]
|
2016-09-04 04:38:23 +01:00
|
|
|
++ lib.optionals stdenv.isDarwin [ Carbon Cocoa ];
|
2015-01-12 12:17:28 +00:00
|
|
|
|
|
|
|
configureFlags =
|
|
|
|
lib.optionals (!withPython) [ "--disable-python-scripting" "--disable-python-extension" ]
|
2016-09-04 04:39:43 +01:00
|
|
|
++ lib.optional withGTK "--enable-gtk2-use"
|
|
|
|
++ lib.optional (!withGTK) "--without-x";
|
2012-02-06 05:49:27 +00:00
|
|
|
|
2016-10-05 18:04:03 +01:00
|
|
|
# work-around: git isn't really used, but configuration fails without it
|
2015-01-12 12:17:28 +00:00
|
|
|
preConfigure = ''
|
2017-08-12 23:53:29 +01: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 18:04:03 +01:00
|
|
|
export GIT="$(type -P true)"
|
2015-01-12 12:17:28 +00:00
|
|
|
cp -r "${gnulib}" ./gnulib
|
|
|
|
chmod +w -R ./gnulib
|
|
|
|
./bootstrap --skip-git --gnulib-srcdir=./gnulib
|
2008-03-26 12:57:30 +00:00
|
|
|
'';
|
2007-08-21 13:31:33 +01:00
|
|
|
|
2018-04-25 04:20:18 +01:00
|
|
|
doCheck = false; # tries to wget some fonts
|
|
|
|
doInstallCheck = doCheck;
|
|
|
|
|
2015-01-12 12:17:28 +00: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 14:10:34 +00:00
|
|
|
license = stdenv.lib.licenses.bsd3;
|
2015-01-12 12:17:28 +00:00
|
|
|
};
|
2007-08-21 13:31:33 +01:00
|
|
|
}
|