2019-03-26 22:22:03 +01:00
|
|
|
{ stdenv, fetchurl, lib
|
2020-01-13 15:59:01 +01:00
|
|
|
, autoconf, automake, gnum4, libtool, perl, uthash, pkgconfig, gettext
|
2019-03-26 22:22:03 +01:00
|
|
|
, python, freetype, zlib, glib, libungif, libpng, libjpeg, libtiff, libxml2, cairo, pango
|
2020-01-13 15:59:01 +01:00
|
|
|
, readline, woff2, zeromq, libuninameslist
|
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";
|
2020-01-13 15:59:01 +01:00
|
|
|
version = "20190801";
|
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";
|
2020-01-13 15:59:01 +01:00
|
|
|
sha256 = "0lh8yx01asbzxm6car5cfi64njh5p4lxc7iv8dldr5rwg357a86r";
|
2007-08-21 14:31:33 +02:00
|
|
|
};
|
2012-02-06 06:49:27 +01: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
|
2019-10-30 00:53:51 +01:00
|
|
|
NIX_CFLAGS_COMPILE = lib.optionalString 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 = [
|
2020-01-13 15:59:01 +01:00
|
|
|
readline uthash woff2 zeromq libuninameslist
|
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)"
|
2020-01-13 15:59:01 +01:00
|
|
|
./bootstrap --skip-git --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";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "http://fontforge.github.io";
|
2015-01-12 13:17:28 +01:00
|
|
|
platforms = stdenv.lib.platforms.all;
|
2017-03-23 15:10:34 +01:00
|
|
|
license = stdenv.lib.licenses.bsd3;
|
2020-01-13 15:59:01 +01:00
|
|
|
maintainers = [ stdenv.lib.maintainers.erictapen ];
|
2015-01-12 13:17:28 +01:00
|
|
|
};
|
2007-08-21 14:31:33 +02:00
|
|
|
}
|