%global datecommit 20190324 %global commit db2d3feb771762953d571cfd3c2b76499f26c23d %global shortcommit %(c=%{commit}; echo ${c:0:7}) %global gitrev %{datecommit}git%{shortcommit} %global fontname hack %global fontconf 45-%{fontname}.conf # To allow switching from upstream commit to upstream release %global fontsrcdir %{fontname}-%{shortcommit} Name: %{fontname}-fonts Version: 3.003 #Release: 1%{?dist} Release: 1.%{gitrev}.1%{?dist} Summary: A typeface designed for source code License: Bitstream Vera, Public Domain, and MIT URL: https://sourcefoundry.org/hack/ #Source0: https://github.com/source-foundry/Hack/archive/v%{version}/Hack-v%{version}.tar.gz Source0: %{fontsrcdir}.tar.gz Source1: %{fontname}.metainfo.xml BuildArch: noarch BuildRequires: fontpackages-devel BuildRequires: libappstream-glib # To build Hack BuildRequires: python3 BuildRequires: python3-devel BuildRequires: ttfautohint Requires: fontpackages-filesystem %description Hack is a typeface designed for source code, expanding on the works of Bitstream Vera and DejaVu. %prep %autosetup -v -n %{fontsrcdir} # BUG-1441023: Currently there isn't a fontmake package in the Fedora # repository, rather than installing it the packager's system - use virtual # environment :) python3 -m venv venv venv/bin/python3 -m pip install fontmake venv/bin/python3 -m pip install fonttools # Python doesn't seem to resolve the following (:S) venv/bin/python3 -m pip install fs #venv/bin/python3 -m pip install ttfautohint-py venv/bin/python3 -m pip install ttfautohint-py==0.4.0 %build # Rather than patch 'build-ttf.sh', it is re-implemented here - this allows # the virtual environments to be used easier BUT it does mean that it needs # to be reviewed EVERY update to reproduce Source Foundry's build process. # The same would also be true of a patch, but there is not validation with # this. # First pass with fontmake venv/bin/python3 -m fontmake -u "%{_builddir}/%{fontsrcdir}/source/Hack-Regular.ufo" -o ttf venv/bin/python3 -m fontmake -u "%{_builddir}/%{fontsrcdir}/source/Hack-Bold.ufo" -o ttf venv/bin/python3 -m fontmake -u "%{_builddir}/%{fontsrcdir}/source/Hack-Italic.ufo" -o ttf venv/bin/python3 -m fontmake -u "%{_builddir}/%{fontsrcdir}/source/Hack-BoldItalic.ufo" -o ttf # Second pass with fontbakery venv/bin/python3 "%{_builddir}/%{fontsrcdir}/postbuild_processing/fixes/fix-dsig.py" master_ttf/*.ttf venv/bin/python3 "%{_builddir}/%{fontsrcdir}/postbuild_processing/fixes/fix-fstype.py" master_ttf/*.ttf # Third pass with ttfautohint mkdir master_ttf/hinted venv/bin/python3 -m ttfautohint -l 6 -r 50 -x 10 -H 181 -D latn -f latn -w G -W -t -X "" -I -m "%{_builddir}/%{fontsrcdir}/postbuild_processing/tt-hinting/Hack-Regular-TA.txt" "master_ttf/Hack-Regular.ttf" "master_ttf/hinted/Hack-Regular.ttf" ttfautohint -l 6 -r 50 -x 10 -H 260 -D latn -f latn -w G -W -t -X "" -I -m "%{_builddir}/%{fontsrcdir}/postbuild_processing/tt-hinting/Hack-Bold-TA.txt" "master_ttf/Hack-Bold.ttf" "master_ttf/hinted/Hack-Bold.ttf" ttfautohint -l 6 -r 50 -x 10 -H 145 -D latn -f latn -w G -W -t -X "" -I -m "%{_builddir}/%{fontsrcdir}/postbuild_processing/tt-hinting/Hack-Italic-TA.txt" "master_ttf/Hack-Italic.ttf" "master_ttf/hinted/Hack-Italic.ttf" ttfautohint -l 6 -r 50 -x 10 -H 265 -D latn -f latn -w G -W -t -X "" -I -m "%{_builddir}/%{fontsrcdir}/postbuild_processing/tt-hinting/Hack-BoldItalic-TA.txt" "master_ttf/Hack-BoldItalic.ttf" "master_ttf/hinted/Hack-BoldItalic.ttf" %install install -m 0755 -d %{buildroot}%{_fontdir} install -m 0644 -p master_ttf/hinted/*.ttf %{buildroot}%{_fontdir} install -m 0755 -d %{buildroot}%{_fontconfig_templatedir} \ %{buildroot}%{_fontconfig_confdir} install -m 0644 -p config/fontconfig/45-Hack.conf \ %{buildroot}%{_fontconfig_templatedir}/%{fontconf} ln -s %{_fontconfig_templatedir}/%{fontconf} \ %{buildroot}%{_fontconfig_confdir}/%{fontconf} # Add AppStream metadata file install -Dm 0644 -p %{SOURCE1} \ %{buildroot}%{_datadir}/metainfo/%{fontname}.metainfo.xml # Rebuild font cache /usr/bin/fc-cache -f -v %check appstream-util validate-relax --nonet \ %{buildroot}%{_datadir}/metainfo/%{fontname}.metainfo.xml %_font_pkg -f %{fontconf} *.ttf %license LICENSE.md %doc README.md %{_datadir}/metainfo/%{fontname}.metainfo.xml %changelog * Wed Oct 31 2018 Jamie Mansfield - 3.003-1 - Initial package