2019-03-26 21:22:03 +00:00
|
|
|
{ stdenv, fetchurl, lib
|
2020-01-13 14:59:01 +00:00
|
|
|
, autoconf, automake, gnum4, libtool, perl, uthash, pkgconfig, gettext
|
2019-03-26 21:22:03 +00:00
|
|
|
, python, freetype, zlib, glib, libungif, libpng, libjpeg, libtiff, libxml2, cairo, pango
|
2020-01-13 14:59:01 +00:00
|
|
|
, readline, woff2, zeromq, libuninameslist
|
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
|
2019-03-26 21:22:03 +00:00
|
|
|
, withExtras ? 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 {
|
2019-03-26 21:22:03 +00:00
|
|
|
pname = "fontforge";
|
2020-01-13 14:59:01 +00:00
|
|
|
version = "20190801";
|
2017-08-12 15:22:45 +01:00
|
|
|
|
2019-03-26 21:22:03 +00:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/${pname}/${pname}/releases/download/${version}/${pname}-${version}.tar.gz";
|
2020-01-13 14:59:01 +00:00
|
|
|
sha256 = "0lh8yx01asbzxm6car5cfi64njh5p4lxc7iv8dldr5rwg357a86r";
|
2007-08-21 13:31:33 +01:00
|
|
|
};
|
2012-02-06 05:49:27 +00:00
|
|
|
|
2019-03-26 21:22:03 +00:00
|
|
|
# use $SOURCE_DATE_EPOCH instead of non-deterministic timestamps
|
2017-08-15 19:41:56 +01: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 15:22:45 +01:00
|
|
|
|
|
|
|
# do not use x87's 80-bit arithmetic, rouding errors result in very different font binaries
|
2019-10-29 23:53:51 +00:00
|
|
|
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isi686 "-msse2 -mfpmath=sse";
|
2015-01-12 12:17:28 +00:00
|
|
|
|
2019-03-26 21:22:03 +00:00
|
|
|
nativeBuildInputs = [ pkgconfig autoconf automake gnum4 libtool perl gettext ];
|
2015-01-12 12:17:28 +00:00
|
|
|
buildInputs = [
|
2020-01-13 14:59:01 +00:00
|
|
|
readline uthash woff2 zeromq libuninameslist
|
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]
|
2019-03-26 21:22:03 +00:00
|
|
|
++ lib.optionals withGTK [ gtk2 cairo pango ]
|
2016-09-04 04:38:23 +01:00
|
|
|
++ lib.optionals stdenv.isDarwin [ Carbon Cocoa ];
|
2015-01-12 12:17:28 +00:00
|
|
|
|
2019-03-26 21:22:03 +00:00
|
|
|
configureFlags = [ "--enable-woff2" ]
|
|
|
|
++ lib.optionals (!withPython) [ "--disable-python-scripting" "--disable-python-extension" ]
|
2016-09-04 04:39:43 +01:00
|
|
|
++ lib.optional withGTK "--enable-gtk2-use"
|
2019-03-26 21:22:03 +00:00
|
|
|
++ lib.optional (!withGTK) "--without-x"
|
|
|
|
++ lib.optional withExtras "--enable-fontforge-extras";
|
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)"
|
2020-01-13 14:59:01 +00:00
|
|
|
./bootstrap --skip-git --force
|
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;
|
2020-01-13 14:59:01 +00:00
|
|
|
maintainers = [ stdenv.lib.maintainers.erictapen ];
|
2015-01-12 12:17:28 +00:00
|
|
|
};
|
2007-08-21 13:31:33 +01:00
|
|
|
}
|