Merge pull request #28212 from volth/fontforge-20170730

fontforge: 20160404 -> 20170730 + support reproducible builds of fonts
This commit is contained in:
Michael Raskin 2017-08-15 20:50:04 +02:00 committed by GitHub
commit 19a5e00985
3 changed files with 60 additions and 13 deletions

View File

@ -9,22 +9,28 @@
stdenv.mkDerivation rec {
name = "fontforge-${version}";
version = "20160404";
version = "20170730";
src = fetchFromGitHub {
owner = "fontforge";
repo = "fontforge";
rev = version;
sha256 = "15nacq84n9gvlzp3slpmfrrbh57kfb6lbdlc46i7aqgci4qv6fg0";
sha256 = "15k6x97383p8l40jvcivalhwgbbcdg5vciyjz6m9r0lrlnjqkv99";
};
patches = [(fetchpatch {
name = "use-system-uthash.patch";
url = "http://pkgs.fedoraproject.org/cgit/fontforge.git/plain/"
+ "fontforge-20140813-use-system-uthash.patch?id=8bdf933";
sha256 = "0n8i62qv2ygfii535rzp09vvjx4qf9zp5qq7qirrbzm1l9gykcjy";
})];
patchFlags = "-p0";
patches = [ ./fontforge-20140813-use-system-uthash.patch ];
# use $SOURCE_DATE_EPOCH instead of non-determenistic timestamps
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
'';
# 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" ];
buildInputs = [
autoconf automake gnum4 libtool perl pkgconfig gettext uthash
@ -41,6 +47,9 @@ stdenv.mkDerivation rec {
# 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)"
cp -r "${gnulib}" ./gnulib
chmod +w -R ./gnulib

View File

@ -0,0 +1,30 @@
--- a/Makefile.am.old 2014-08-12 10:07:32.000000000 +0530
+++ b/Makefile.am 2014-09-08 16:23:56.046996941 +0530
@@ -43,7 +43,6 @@
AM_CPPFLAGS =
AM_LDFLAGS =
-BUILT_SOURCES = uthash/src
EXTRA_DIST =
CLEANFILES =
MOSTLYCLEANFILES =
@@ -113,7 +112,6 @@
Packaging/FontForge-doc.spec \
Packaging/FontForge.spec \
Packaging/FontForge.static.spec \
- uthash/src \
$(NULL)
#--------------------------------------------------------------------------
@@ -129,11 +127,6 @@
#--------------------------------------------------------------------------
-uthash/src:
- if [ ! -e uthash/src ]; then \
- if [ -e uthash ] ; then rm -r uthash ; fi ; \
- git clone https://github.com/troydhanson/uthash ; \
- fi ;
# We import a selection of targets from Frank's standard packaging Makefile.

View File

@ -1,7 +1,15 @@
{stdenv, fontforge, zlib}:
{stdenv, fetchFromGitHub, zlib}:
stdenv.mkDerivation rec {
name = "fontforge-fonttools-${fontforge.version}";
src = fontforge.src;
version = "20160404";
name = "fontforge-fonttools-${version}";
src = fetchFromGitHub {
owner = "fontforge";
repo = "fontforge";
rev = version;
sha256 = "15nacq84n9gvlzp3slpmfrrbh57kfb6lbdlc46i7aqgci4qv6fg0";
};
buildInputs = [zlib];
@ -17,7 +25,7 @@ stdenv.mkDerivation rec {
meta = with stdenv.lib; {
description = ''Small font tools shipped in FontForge contrib'';
license = fontforge.meta.license;
license = licenses.bsd3;
maintainers = with maintainers; [ raskin ];
platforms = with platforms; unix;
};