2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv, fetchurl, perl
|
2019-10-31 10:23:49 +00:00
|
|
|
, bdftopcf, bdf2psf, mkfontdir
|
|
|
|
, fonttosfnt
|
|
|
|
, targetsDat ? null
|
|
|
|
, variantsDat ? null
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "uw-ttyp0";
|
|
|
|
version = "1.3";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://people.mpi-inf.mpg.de/~uwe/misc/${pname}/${pname}-${version}.tar.gz";
|
|
|
|
sha256 = "1vp053bwv8sr40p3pn4sjaiq570zp7knh99z9ynk30v7ml4cz2i8";
|
|
|
|
};
|
|
|
|
|
|
|
|
# remove for version >1.3
|
|
|
|
patches = [ ./determinism.patch ];
|
|
|
|
|
|
|
|
nativeBuildInputs = [ perl bdftopcf bdf2psf fonttosfnt mkfontdir ];
|
|
|
|
|
|
|
|
# configure sizes, encodings and variants
|
|
|
|
preConfigure =
|
|
|
|
(if targetsDat == null
|
|
|
|
then ''
|
|
|
|
cat << EOF > TARGETS.dat
|
|
|
|
SIZES = 11 12 13 14 15 16 17 18 22 \
|
|
|
|
11b 12b 13b 14b 15b 16b 17b 18b 22b 15i 16i 17i 18i
|
|
|
|
ENCODINGS = uni
|
|
|
|
EOF
|
|
|
|
''
|
|
|
|
else ''cp "${targetsDat}" TARGETS.dat'') +
|
|
|
|
(if variantsDat == null
|
|
|
|
then ''
|
|
|
|
cat << EOF > VARIANTS.dat
|
|
|
|
COPYTO AccStress PApostropheAscii
|
|
|
|
COPYTO PAmComma AccGraveAscii
|
|
|
|
COPYTO Digit0Slashed Digit0
|
|
|
|
EOF
|
|
|
|
''
|
|
|
|
else ''cp "${variantsDat}" VARIANTS.dat'');
|
|
|
|
|
|
|
|
postBuild = ''
|
2020-02-09 16:18:14 +00:00
|
|
|
# convert bdf fonts to psf
|
2019-10-31 10:23:49 +00:00
|
|
|
build=$(pwd)
|
|
|
|
mkdir {psf,otb}
|
|
|
|
cd ${bdf2psf}/share/bdf2psf
|
|
|
|
for i in $build/genbdf/*.bdf; do
|
|
|
|
name="$(basename $i .bdf)"
|
|
|
|
bdf2psf \
|
|
|
|
--fb "$i" standard.equivalents \
|
|
|
|
ascii.set+useful.set+linux.set 512 \
|
|
|
|
"$build/psf/$name.psf"
|
2020-02-09 16:18:14 +00:00
|
|
|
done
|
|
|
|
cd -
|
|
|
|
|
|
|
|
# convert unicode bdf fonts to otb
|
|
|
|
for i in $build/genbdf/*-uni.bdf; do
|
|
|
|
name="$(basename $i .bdf)"
|
2019-10-31 10:23:49 +00:00
|
|
|
fonttosfnt -v -o "$build/otb/$name.otb" "$i"
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
# install psf fonts
|
|
|
|
fontDir="$out/share/consolefonts"
|
2020-02-09 16:18:14 +00:00
|
|
|
install -m 644 -D psf/*.psf -t "$fontDir"
|
|
|
|
|
|
|
|
# install otb fonts
|
2020-08-21 12:18:18 +00:00
|
|
|
fontDir="$out/share/fonts/X11/misc"
|
2020-02-09 16:18:14 +00:00
|
|
|
install -m 644 -D otb/*.otb -t "$fontDir"
|
|
|
|
mkfontdir "$fontDir"
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Nix with multiple outputs adds several flags
|
|
|
|
# that the ./configure script doesn't understand.
|
|
|
|
configurePhase = ''
|
|
|
|
runHook preConfigure
|
|
|
|
./configure --prefix="$out"
|
|
|
|
runHook postConfigure
|
2019-10-31 10:23:49 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2019-10-31 10:23:49 +00:00
|
|
|
description = "Monospace bitmap screen fonts for X11";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://people.mpi-inf.mpg.de/~uwe/misc/uw-ttyp0/";
|
2019-10-31 10:23:49 +00:00
|
|
|
license = with licenses; [ free mit ];
|
|
|
|
maintainers = with maintainers; [ rnhmjoj ];
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|