2019-03-26 22:22:03 +01:00
|
|
|
{ stdenv, fetchurl, lib
|
2016-10-05 19:04:03 +02:00
|
|
|
, autoconf, automake, gnum4, libtool, perl, gnulib, uthash, pkgconfig, gettext
|
2019-03-26 22:22:03 +01:00
|
|
|
, python, freetype, zlib, glib, libungif, libpng, libjpeg, libtiff, libxml2, cairo, pango
|
|
|
|
, readline, woff2, zeromq
|
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
|
2019-03-26 22:22:03 +01:00
|
|
|
, withExtras ? 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 {
|
2019-03-26 22:22:03 +01:00
|
|
|
pname = "fontforge";
|
2019-04-30 23:21:56 +02:00
|
|
|
version = "20190413";
|
2017-08-12 16:22:45 +02:00
|
|
|
|
2019-03-26 22:22:03 +01:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/${pname}/${pname}/releases/download/${version}/${pname}-${version}.tar.gz";
|
2019-04-30 23:21:56 +02:00
|
|
|
sha256 = "05v640mnk4fy4jzmxb6c4n4qm800x7hy4sl5gcdgzmm3md2s0qk7";
|
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
|
|
|
|
2019-03-26 22:22:03 +01:00
|
|
|
# use $SOURCE_DATE_EPOCH instead of non-deterministic timestamps
|
2017-08-15 20:41:56 +02:00
|
|
|
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
|
|
|
|
2019-03-26 22:22:03 +01:00
|
|
|
nativeBuildInputs = [ pkgconfig autoconf automake gnum4 libtool perl gettext ];
|
2015-01-12 13:17:28 +01:00
|
|
|
buildInputs = [
|
2019-03-26 22:22:03 +01:00
|
|
|
readline uthash woff2 zeromq
|
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]
|
2019-03-26 22:22:03 +01:00
|
|
|
++ lib.optionals withGTK [ gtk2 cairo pango ]
|
2016-09-04 05:38:23 +02:00
|
|
|
++ lib.optionals stdenv.isDarwin [ Carbon Cocoa ];
|
2015-01-12 13:17:28 +01:00
|
|
|
|
2019-03-26 22:22:03 +01:00
|
|
|
configureFlags = [ "--enable-woff2" ]
|
|
|
|
++ lib.optionals (!withPython) [ "--disable-python-scripting" "--disable-python-extension" ]
|
2016-09-04 05:39:43 +02:00
|
|
|
++ lib.optional withGTK "--enable-gtk2-use"
|
2019-03-26 22:22:03 +01:00
|
|
|
++ lib.optional (!withGTK) "--without-x"
|
|
|
|
++ lib.optional withExtras "--enable-fontforge-extras";
|
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
|
2019-03-26 22:22:03 +01:00
|
|
|
./bootstrap --skip-git --gnulib-srcdir=./gnulib --force
|
2008-03-26 13:57:30 +01:00
|
|
|
'';
|
2007-08-21 14:31:33 +02:00
|
|
|
|
2018-04-25 05:20:18 +02:00
|
|
|
doCheck = false; # tries to wget some fonts
|
|
|
|
doInstallCheck = doCheck;
|
|
|
|
|
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
|
|
|
}
|