lol
1{ stdenv, fetchFromGitHub, fetchpatch, lib
2, autoconf, automake, gnum4, libtool, git, perl, gnulib, uthash, pkgconfig, gettext
3, python, freetype, zlib, glib, libungif, libpng, libjpeg, libtiff, libxml2, pango
4, withGTK ? false, gtk2
5, withPython ? true
6, Carbon ? null, Cocoa ? null
7}:
8
9stdenv.mkDerivation rec {
10 name = "fontforge-${version}";
11 version = "20160404";
12
13 src = fetchFromGitHub {
14 owner = "fontforge";
15 repo = "fontforge";
16 rev = version;
17 sha256 = "15nacq84n9gvlzp3slpmfrrbh57kfb6lbdlc46i7aqgci4qv6fg0";
18 };
19
20 patches = [(fetchpatch {
21 name = "use-system-uthash.patch";
22 url = "http://pkgs.fedoraproject.org/cgit/fontforge.git/plain/"
23 + "fontforge-20140813-use-system-uthash.patch?id=8bdf933";
24 sha256 = "0n8i62qv2ygfii535rzp09vvjx4qf9zp5qq7qirrbzm1l9gykcjy";
25 })];
26 patchFlags = "-p0";
27
28 # FIXME: git isn't really used, but configuration fails without it
29 buildInputs = [
30 git autoconf automake gnum4 libtool perl pkgconfig gettext uthash
31 python freetype zlib glib libungif libpng libjpeg libtiff libxml2
32 ]
33 ++ lib.optionals withGTK [ gtk2 pango ]
34 ++ lib.optionals (withGTK && stdenv.isDarwin) [ Carbon Cocoa ];
35
36 configureFlags =
37 lib.optionals (!withPython) [ "--disable-python-scripting" "--disable-python-extension" ]
38 ++ lib.optional withGTK "--enable-gtk2-use";
39
40 preConfigure = ''
41 cp -r "${gnulib}" ./gnulib
42 chmod +w -R ./gnulib
43 ./bootstrap --skip-git --gnulib-srcdir=./gnulib
44 '';
45
46 postInstall =
47 # get rid of the runtime dependency on python
48 lib.optionalString (!withPython) ''
49 rm -r "$out/share/fontforge/python"
50 '';
51
52 enableParallelBuilding = true;
53
54 meta = {
55 description = "A font editor";
56 homepage = http://fontforge.github.io;
57 platforms = stdenv.lib.platforms.all;
58 };
59}
60