From 0ac8f1f31c34a573689c1857cda5a1657029aee8 Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Mon, 10 Dec 2018 20:37:18 -0500 Subject: Patch dejavu-fonts to require a recent fontforge fontforge was not able to create fonts in a reproducible manner until upstream revision 69e561773b91e37096a855f0353b1d6781a61250 Requiring at minimum a fontforge built from source on 2017-12-20 (the date the aforementioned revision was made) ensures that dejavu fonts are reproducible in Libreboot's build system. --- ...re-a-recent-fontforge-for-reproducibility.patch | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 projects/dejavu-fonts/patches/0002-Require-a-recent-fontforge-for-reproducibility.patch diff --git a/projects/dejavu-fonts/patches/0002-Require-a-recent-fontforge-for-reproducibility.patch b/projects/dejavu-fonts/patches/0002-Require-a-recent-fontforge-for-reproducibility.patch new file mode 100644 index 00000000..c9449e0c --- /dev/null +++ b/projects/dejavu-fonts/patches/0002-Require-a-recent-fontforge-for-reproducibility.patch @@ -0,0 +1,51 @@ +From 7098e955d8d0a061132aaec1429fc032e3d2edab Mon Sep 17 00:00:00 2001 +From: Andrew Robbins +Date: Mon, 10 Dec 2018 20:31:42 -0500 +Subject: [PATCH] Require a recent fontforge for reproducibility + +The required version is set to 20171220 which is the earliest +date from which fontforge built from source was able to produce +fonts deterministically. "20171220" refers to upstream revision +69e561773b91e37096a855f0353b1d6781a61250 + +Note there was not an actual dejavu-fonts release made on 2017-12-20; +the date is intended to be both a reference point, as previously +described, and a mechanism to prevent non-deterministic fonts being +produced by Libreboot's build system due to an unsupported version +of fontforge being used. +--- + scripts/generate.pe | 4 ++-- + scripts/generate.py | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/scripts/generate.pe b/scripts/generate.pe +index 5d9d03d..144e8b1 100755 +--- a/scripts/generate.pe ++++ b/scripts/generate.pe +@@ -16,8 +16,8 @@ + def_gen_flags = 0x20 + 0x40 + 0x800 + exp_gen_flags = def_gen_flags + 8 + +-if ($version < "20080330") +- Error("Your version of FontForge is too old - 20080330 or newer is required"); ++if ($version < "20171220") ++ Error("Your version of FontForge is too old - 20171220 or newer is required"); + endif + # FoundryName is not used in TTF generation + SetPref("FoundryName", "DejaVu") +diff --git a/scripts/generate.py b/scripts/generate.py +index 467d52b..168a2be 100755 +--- a/scripts/generate.py ++++ b/scripts/generate.py +@@ -7,7 +7,7 @@ + # chmod +x generate.pe + # ./generate.pe *.sfd + import fontforge, sys; +-required_version = "20080330" ++required_version = "20171220" + + # font generation flags: + # omit-instructions => do not include TT instructions (for experimental typefaces) +-- +2.7.4 + -- cgit v1.2.3-70-g09d2 From b84efc5b838c48c2f36de9424ec103ed7f551e71 Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Mon, 10 Dec 2018 22:39:07 -0500 Subject: Pull in Unicode data for a specific UCD version Previously the dejavu-fonts script pulled in the latest versions of UnicodeData.txt and Blocks.txt files from https://www.unicode.org/Public/UNIDATA/ which are unversioned. This is an issue because the files at this URI will change over time as new UCD versions are released, making reproducible builds of dejavu-fonts impossible. The solution to this issue is to simply download the requisite files from https://www.unicode.org/Public/$ucd_version/ucd/ where $ucd_version is the version specified in projects/dejavu-fonts/configs/unicode/ucd-version --- projects/dejavu-fonts/configs/unicode/ucd-files | 2 ++ projects/dejavu-fonts/configs/unicode/ucd-version | 1 + projects/dejavu-fonts/dejavu-fonts | 21 ++++++++++------- projects/dejavu-fonts/dejavu-fonts-helper | 28 +++++++++++++++++++++++ 4 files changed, 44 insertions(+), 8 deletions(-) create mode 100644 projects/dejavu-fonts/configs/unicode/ucd-files create mode 100644 projects/dejavu-fonts/configs/unicode/ucd-version create mode 100644 projects/dejavu-fonts/dejavu-fonts-helper diff --git a/projects/dejavu-fonts/configs/unicode/ucd-files b/projects/dejavu-fonts/configs/unicode/ucd-files new file mode 100644 index 00000000..9b46bb9a --- /dev/null +++ b/projects/dejavu-fonts/configs/unicode/ucd-files @@ -0,0 +1,2 @@ +Blocks.txt +UnicodeData.txt diff --git a/projects/dejavu-fonts/configs/unicode/ucd-version b/projects/dejavu-fonts/configs/unicode/ucd-version new file mode 100644 index 00000000..275283a1 --- /dev/null +++ b/projects/dejavu-fonts/configs/unicode/ucd-version @@ -0,0 +1 @@ +11.0.0 diff --git a/projects/dejavu-fonts/dejavu-fonts b/projects/dejavu-fonts/dejavu-fonts index 037aa3d9..2c5f518b 100755 --- a/projects/dejavu-fonts/dejavu-fonts +++ b/projects/dejavu-fonts/dejavu-fonts @@ -26,17 +26,22 @@ usage() { download() { local repository="$project" + local sources_path="$(project_sources_path "$project" "$repository" "$@")" + local ucd_version="$(dejavu_fonts_ucd_version "$UNICODE" "$@")" + local ucd_files_path="$(dejavu_fonts_ucd_files_path "$UNICODE" "$@")" - project_download_git "$project" \ - "$repository" \ - 'https://github.com/dejavu-fonts/dejavu-fonts.git' \ - "$@" + local -a download_list + local -a ucd_files - local sources_path="$(project_sources_path "$project" "$repository" "$@")" + mapfile -t ucd_files < "$ucd_files_path" + + for file in "${ucd_files[@]}"; do + download_list+=("https://www.unicode.org/Public/$ucd_version/ucd/$file") + done + + project_download_git "$project" "$repository" https://github.com/dejavu-fonts/dejavu-fonts.git "$@" - download_wrapper "$sources_path/resources" \ - 'https://www.unicode.org/Public/UNIDATA/UnicodeData.txt' \ - 'https://www.unicode.org/Public/UNIDATA/Blocks.txt' + download_wrapper "$sources_path/resources" "${download_list[@]}" } download_check() { diff --git a/projects/dejavu-fonts/dejavu-fonts-helper b/projects/dejavu-fonts/dejavu-fonts-helper new file mode 100644 index 00000000..ff750588 --- /dev/null +++ b/projects/dejavu-fonts/dejavu-fonts-helper @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +# Copyright (C) 2018 Andrew Robbins +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +UCD_FILES='ucd-files' +UCD_VERSION='ucd-version' +UNICODE='unicode' + +dejavu_fonts_ucd_version() { + project_file_contents "$project" "$CONFIGS" "$UCD_VERSION" "$@" +} + +dejavu_fonts_ucd_files_path() { + project_file_path "$project" "$CONFIGS" "$UCD_FILES" "$@" +} -- cgit v1.2.3-70-g09d2 From c61b2d58889b6b02f838f11c85ec5cebf362b828 Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Mon, 10 Dec 2018 23:00:57 -0500 Subject: Link fontconfig orthography files in dejavu build The path contained in the symlink has been made relative for reproducibility reasons. Also, it just makes more sense to create the symlink during the download() action vs. build(). The `-f` flag was added to avoid an error if the link already exists (i.e., download() has been executed previously). --- projects/dejavu-fonts/dejavu-fonts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/projects/dejavu-fonts/dejavu-fonts b/projects/dejavu-fonts/dejavu-fonts index 2c5f518b..d380235f 100755 --- a/projects/dejavu-fonts/dejavu-fonts +++ b/projects/dejavu-fonts/dejavu-fonts @@ -40,8 +40,10 @@ download() { done project_download_git "$project" "$repository" https://github.com/dejavu-fonts/dejavu-fonts.git "$@" - download_wrapper "$sources_path/resources" "${download_list[@]}" + + # Create a symlink to fontconfig's orthography files + ln -fs ../../fontconfig/fc-lang "$sources_path/resources/fc-lang" } download_check() { @@ -88,9 +90,6 @@ build() { mkdir -p "$build_path" - # Create a symlink to the orthography files provided by fontconfig - ln -s "$root/$SOURCES/fontconfig/fc-lang" "$sources_path/resources/fc-lang" - make -C "$sources_path" -j"$TASKS" cp "$sources_path/build"/[!.]*.ttf "$build_path" make -C "$sources_path" clean -- cgit v1.2.3-70-g09d2 From e47add02756c58af18117fed9c76ea5a298f4a3b Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Mon, 10 Dec 2018 23:21:08 -0500 Subject: Update dejavu-fonts .gitignore patch The fc-lang symlink has been added to the .gitignore file in order to allow creating the symlink once after the initial download of dejavu-fonts. This avoids the otherwise necessary step of recreating the symlink before each build (as it could have been removed by the project's clean() action). --- ...re-fc-lang-UnicodeData.txt-and-Blocks.txt.patch | 28 ++++++++++++++++++++++ ...ve-unicode-source-files-thru-git-clean-df.patch | 24 ------------------- 2 files changed, 28 insertions(+), 24 deletions(-) create mode 100644 projects/dejavu-fonts/patches/0001-Ignore-fc-lang-UnicodeData.txt-and-Blocks.txt.patch delete mode 100644 projects/dejavu-fonts/patches/0001-Preserve-unicode-source-files-thru-git-clean-df.patch diff --git a/projects/dejavu-fonts/patches/0001-Ignore-fc-lang-UnicodeData.txt-and-Blocks.txt.patch b/projects/dejavu-fonts/patches/0001-Ignore-fc-lang-UnicodeData.txt-and-Blocks.txt.patch new file mode 100644 index 00000000..df92cfc0 --- /dev/null +++ b/projects/dejavu-fonts/patches/0001-Ignore-fc-lang-UnicodeData.txt-and-Blocks.txt.patch @@ -0,0 +1,28 @@ +From b5ece2b11361fdce57cab3e0504babc0b616c396 Mon Sep 17 00:00:00 2001 +From: Andrew Robbins +Date: Mon, 10 Dec 2018 23:18:26 -0500 +Subject: [PATCH] Ignore fc-lang, UnicodeData.txt, and Blocks.txt + +UnicodeData.txt and Blocks.txt should be preserved after a +`git clean -df` to avoid needless refetching of these resources. + +Additionally, the fc-lang symlink is kept in order to avoid +recreating it before each build. +--- + .gitignore | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/.gitignore b/.gitignore +index dedd2b5..74203a0 100644 +--- a/.gitignore ++++ b/.gitignore +@@ -2,3 +2,6 @@ build/ + dist/ + tmp/ + /src/*.sfd~ ++resources/Blocks.txt ++resources/UnicodeData.txt ++resources/fc-lang +-- +2.7.4 + diff --git a/projects/dejavu-fonts/patches/0001-Preserve-unicode-source-files-thru-git-clean-df.patch b/projects/dejavu-fonts/patches/0001-Preserve-unicode-source-files-thru-git-clean-df.patch deleted file mode 100644 index 52798b1e..00000000 --- a/projects/dejavu-fonts/patches/0001-Preserve-unicode-source-files-thru-git-clean-df.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 9ac03500773a1cc69b198ce1c43770a7fc66da98 Mon Sep 17 00:00:00 2001 -From: Andrew Robbins -Date: Tue, 5 Sep 2017 23:57:34 -0400 -Subject: [PATCH] Preserve unicode source files thru `git clean -df` - -UnicodeData.txt and Blocks.txt should be preserved after a -`git clean -df` to avoid needless refetching of these resources. ---- - .gitignore | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/.gitignore b/.gitignore -index dedd2b5..841e748 100644 ---- a/.gitignore -+++ b/.gitignore -@@ -2,3 +2,5 @@ build/ - dist/ - tmp/ - /src/*.sfd~ -+resources/Blocks.txt -+resources/UnicodeData.txt --- -1.9.1 - -- cgit v1.2.3-70-g09d2