Merge pull request #75163 from rnhmjoj/gohu
gohufont: generate opentype files
This commit is contained in:
commit
f8c3e15771
5 changed files with 99 additions and 27 deletions
|
@ -1,64 +1,69 @@
|
|||
{ stdenv, fetchurl, fetchFromGitHub
|
||||
, mkfontdir, mkfontscale, bdf2psf, bdftopcf
|
||||
, mkfontscale, bdf2psf, bdftopcf
|
||||
, fonttosfnt, libfaketime
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "gohufont";
|
||||
version = "2.1";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://font.gohu.org/${pname}-${version}.tar.gz";
|
||||
sha256 = "10dsl7insnw95hinkcgmp9rx39lyzb7bpx5g70vswl8d6p4n53bm";
|
||||
};
|
||||
|
||||
bdf = fetchFromGitHub {
|
||||
src = fetchFromGitHub {
|
||||
owner = "hchargois";
|
||||
repo = "gohufont";
|
||||
rev = "cc36b8c9fed7141763e55dcee0a97abffcf08224";
|
||||
sha256 = "1hmp11mrr01b29phw0xyj4h9b92qz19cf56ssf6c47c5j2c4xmbv";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ mkfontdir mkfontscale bdf2psf bdftopcf ];
|
||||
nativeBuildInputs =
|
||||
[ mkfontscale bdf2psf bdftopcf
|
||||
fonttosfnt libfaketime
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
# convert bdf to psf fonts
|
||||
# convert bdf fonts to psf
|
||||
build=$(pwd)
|
||||
mkdir psf
|
||||
cd ${bdf2psf}/share/bdf2psf
|
||||
for i in $bdf/*.bdf; do
|
||||
for i in $src/*.bdf; do
|
||||
name=$(basename $i .bdf)
|
||||
bdf2psf \
|
||||
--fb "$i" standard.equivalents \
|
||||
ascii.set+useful.set+linux.set 512 \
|
||||
"$build/psf/$(basename $i .bdf).psf"
|
||||
"$build/psf/$name.psf"
|
||||
done
|
||||
cd $build
|
||||
|
||||
# convert hidpi variant to pcf
|
||||
for i in $bdf/hidpi/*.bdf; do
|
||||
name=$(basename $i .bdf).pcf
|
||||
bdftopcf -o "$name" "$i"
|
||||
# convert bdf fonts to pcf
|
||||
for i in *.bdf $src/hidpi/*.bdf; do
|
||||
name=$(basename $i .bdf)
|
||||
bdftopcf -o "$name.pcf" "$i"
|
||||
done
|
||||
|
||||
# convert unicode bdf fonts to otb
|
||||
for i in *-uni*.bdf $src/hidpi/*-uni*.bdf; do
|
||||
name=$(basename $i .bdf)
|
||||
faketime -f "1970-01-01 00:00:01" \
|
||||
fonttosfnt -v -o "$name.otb" "$i"
|
||||
done
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
# install the psf fonts (for the virtual console)
|
||||
fontDir="$out/share/consolefonts"
|
||||
mkdir -p "$fontDir"
|
||||
mv -t "$fontDir" psf/*.psf
|
||||
install -D -m 644 -t "$fontDir" psf/*.psf
|
||||
|
||||
# install the pcf fonts (for xorg applications)
|
||||
fontDir="$out/share/fonts/misc"
|
||||
mkdir -p "$fontDir"
|
||||
mv -t "$fontDir" *.pcf.gz *.pcf
|
||||
install -D -m 644 -t "$fontDir" *.pcf
|
||||
mkfontdir "$fontDir"
|
||||
|
||||
cd "$fontDir"
|
||||
mkfontdir
|
||||
mkfontscale
|
||||
# install the otb fonts (for gtk applications)
|
||||
fontDir="$otb/share/fonts/misc"
|
||||
install -D -m 644 -t "$fontDir" *.otb
|
||||
mkfontdir "$fontDir"
|
||||
'';
|
||||
|
||||
outputHashAlgo = "sha256";
|
||||
outputHashMode = "recursive";
|
||||
outputHash = "0kl7k8idl0fnsap2c4j02i33z017p2s4gi2cgspy6ica46fczcc1";
|
||||
outputs = [ "out" "otb" ];
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = ''
|
||||
|
|
61
pkgs/servers/x11/xorg/fix-uninitialised-memory.patch
Normal file
61
pkgs/servers/x11/xorg/fix-uninitialised-memory.patch
Normal file
|
@ -0,0 +1,61 @@
|
|||
From 51e8117654fb092ae5412d7aa184bfc6b498c954 Mon Sep 17 00:00:00 2001
|
||||
From: rnhmjoj <rnhmjoj@inventati.org>
|
||||
Date: Fri, 7 Feb 2020 17:46:54 +0100
|
||||
Subject: [PATCH 1/2] Fix incorrect error handling in macTime()
|
||||
|
||||
mktime() and time() return (time_t -1) to signal an error.
|
||||
Checking for negative values will incorrectly assume an error
|
||||
happened for any calendar date before the unix epoch.
|
||||
---
|
||||
util.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/util.c b/util.c
|
||||
index bcbfa2f..4482c9a 100644
|
||||
--- a/util.c
|
||||
+++ b/util.c
|
||||
@@ -213,10 +213,10 @@ macTime(int *hi, unsigned *lo)
|
||||
tm.tm_isdst = -1;
|
||||
|
||||
macEpoch = mktime_gmt(&tm);
|
||||
- if(macEpoch < 0) return -1;
|
||||
+ if(macEpoch == -1) return -1;
|
||||
|
||||
current = time(NULL);
|
||||
- if(current < 0)
|
||||
+ if(current == -1)
|
||||
return -1;
|
||||
|
||||
if(current < macEpoch) {
|
||||
--
|
||||
2.23.0
|
||||
|
||||
From 81a61c049e6de80120531f0770b22e7637c9acb9 Mon Sep 17 00:00:00 2001
|
||||
From: rnhmjoj <rnhmjoj@inventati.org>
|
||||
Date: Fri, 7 Feb 2020 17:47:52 +0100
|
||||
Subject: [PATCH 2/2] Fix uninitialised memory write
|
||||
|
||||
If macTime() fails write zeros instead of unitialized memory to
|
||||
the date fields.
|
||||
---
|
||||
write.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/write.c b/write.c
|
||||
index 318adef..c8a86e4 100644
|
||||
--- a/write.c
|
||||
+++ b/write.c
|
||||
@@ -434,8 +434,8 @@ fixupChecksum(FILE *out, int full_length, int head_position)
|
||||
static int
|
||||
writehead(FILE* out, FontPtr font)
|
||||
{
|
||||
- int time_hi;
|
||||
- unsigned time_lo;
|
||||
+ int time_hi = 0;
|
||||
+ unsigned time_lo = 0;
|
||||
|
||||
macTime(&time_hi, &time_lo);
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
|
@ -22,6 +22,11 @@ self: super:
|
|||
buildInputs = attrs.buildInputs ++ [ self.xorgproto ];
|
||||
});
|
||||
|
||||
fonttosfnt = super.fonttosfnt.overrideAttrs (attrs: {
|
||||
# https://gitlab.freedesktop.org/xorg/app/fonttosfnt/merge_requests/6
|
||||
patches = [ ./fix-uninitialised-memory.patch ];
|
||||
});
|
||||
|
||||
bitmap = super.bitmap.overrideAttrs (attrs: {
|
||||
nativeBuildInputs = attrs.nativeBuildInputs ++ [ makeWrapper ];
|
||||
postInstall = ''
|
||||
|
|
|
@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
|
|||
sha256 = "10c0rbhqscizfa063m6mms31i0knh25bxr35s008b6mp5pxr33mc";
|
||||
};
|
||||
|
||||
buildInputs = [ dpkg ];
|
||||
nativeBuildInputs = [ dpkg ];
|
||||
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
|
|
|
@ -17525,7 +17525,8 @@ in
|
|||
|
||||
geolite-legacy = callPackage ../data/misc/geolite-legacy { };
|
||||
|
||||
gohufont = callPackage ../data/fonts/gohufont { };
|
||||
gohufont = callPackage ../data/fonts/gohufont
|
||||
{ inherit (buildPackages.xorg) fonttosfnt mkfontscale; };
|
||||
|
||||
gnome-user-docs = callPackage ../data/documentation/gnome-user-docs { };
|
||||
|
||||
|
|
Loading…
Reference in a new issue