Skip to content

Commit

Permalink
fontforge: 20190801 -> 20200314
Browse files Browse the repository at this point in the history
This fixes the failing build.

Build system changed to cmake.

(cherry picked from commit e9848d1)
Reason: fixes CVE-2019-15785, CVE-2020-5395, CVE-2020-5496
  • Loading branch information
alyssais authored and davidak committed Jul 20, 2020
1 parent a7447ff commit 99b72d2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 21 deletions.
31 changes: 11 additions & 20 deletions pkgs/tools/misc/fontforge/default.nix
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{ stdenv, fetchurl, lib
, autoconf, automake, gnum4, libtool, perl, uthash, pkgconfig, gettext
, cmake, perl, uthash, pkgconfig, gettext
, python, freetype, zlib, glib, libungif, libpng, libjpeg, libtiff, libxml2, cairo, pango
, readline, woff2, zeromq, libuninameslist
, withSpiro ? false, libspiro
, withGTK ? false, gtk2
, withGTK ? false, gtk3
, withPython ? true
, withExtras ? true
, Carbon ? null, Cocoa ? null
}:

stdenv.mkDerivation rec {
pname = "fontforge";
version = "20190801";
version = "20200314";

src = fetchurl {
url = "https://github.com/${pname}/${pname}/releases/download/${version}/${pname}-${version}.tar.gz";
sha256 = "0lh8yx01asbzxm6car5cfi64njh5p4lxc7iv8dldr5rwg357a86r";
url = "https://github.com/${pname}/${pname}/releases/download/${version}/${pname}-${version}.tar.xz";
sha256 = "0qf88wd6riycq56d24brybyc93ns74s0nyyavm43zp2kfcihn6fd";
};

# use $SOURCE_DATE_EPOCH instead of non-deterministic timestamps
Expand All @@ -30,41 +30,32 @@ stdenv.mkDerivation rec {
# do not use x87's 80-bit arithmetic, rouding errors result in very different font binaries
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isi686 "-msse2 -mfpmath=sse";

nativeBuildInputs = [ pkgconfig autoconf automake gnum4 libtool perl gettext ];
nativeBuildInputs = [ pkgconfig cmake ];
buildInputs = [
readline uthash woff2 zeromq libuninameslist
python freetype zlib glib libungif libpng libjpeg libtiff libxml2
]
++ lib.optionals withSpiro [libspiro]
++ lib.optionals withGTK [ gtk2 cairo pango ]
++ lib.optionals withGTK [ gtk3 cairo pango ]
++ lib.optionals stdenv.isDarwin [ Carbon Cocoa ];

configureFlags = [ "--enable-woff2" ]
++ lib.optionals (!withPython) [ "--disable-python-scripting" "--disable-python-extension" ]
++ lib.optional withGTK "--enable-gtk2-use"
++ lib.optional (!withGTK) "--without-x"
++ lib.optional withExtras "--enable-fontforge-extras";
cmakeFlags = [ "-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON" ]
++ lib.optional (!withSpiro) "-DENABLE_LIBSPIRO=OFF"
++ lib.optional (!withGTK) "-DENABLE_GUI=OFF"
++ lib.optional withExtras "-DENABLE_FONTFORGE_EXTRAS=ON";

# work-around: git isn't really used, but configuration fails without it
preConfigure = ''
# 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)
export GIT="$(type -P true)"
./bootstrap --skip-git --force
'';

doCheck = false; # tries to wget some fonts
doInstallCheck = doCheck;

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;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3378,7 +3378,7 @@ in
fontforge-gtk = fontforge.override {
withSpiro = true;
withGTK = true;
gtk2 = gtk2-x11;
gtk3 = gtk3-x11;
inherit (darwin.apple_sdk.frameworks) Carbon Cocoa;
};

Expand Down

0 comments on commit 99b72d2

Please sign in to comment.