dina,dina-pcf: unify packages

This commit is contained in:
rnhmjoj 2020-02-09 23:55:05 +01:00
parent f16019c58f
commit 7f7c94497a
No known key found for this signature in database
GPG Key ID: BFBAF4C975F76450
4 changed files with 43 additions and 78 deletions

View File

@ -1,64 +0,0 @@
{stdenv, fetchurl, unzip, bdftopcf, mkfontdir, mkfontscale}:
stdenv.mkDerivation {
version = "2.92";
pname = "dina-font-pcf";
src = fetchurl {
url = "http://www.donationcoder.com/Software/Jibz/Dina/downloads/Dina.zip";
sha256 = "1kq86lbxxgik82aywwhawmj80vsbz3hfhdyhicnlv9km7yjvnl8z";
};
nativeBuildInputs = [ unzip bdftopcf mkfontdir mkfontscale ];
dontBuild = true;
patchPhase = "sed -i 's/microsoft-cp1252/ISO8859-1/' *.bdf";
installPhase = ''
_get_font_size() {
_pt=$\{1%.bdf}
_pt=$\{_pt#*-}
echo $_pt
}
for i in Dina_i400-*.bdf; do
bdftopcf -t -o DinaItalic$(_get_font_size $i).pcf $i
done
for i in Dina_i700-*.bdf; do
bdftopcf -t -o DinaBoldItalic$(_get_font_size $i).pcf $i
done
for i in Dina_r400-*.bdf; do
bdftopcf -t -o DinaMedium$(_get_font_size $i).pcf $i
done
for i in Dina_r700-*.bdf; do
bdftopcf -t -o DinaBold$(_get_font_size $i).pcf $i
done
gzip -n *.pcf
fontDir="$out/share/fonts/misc"
mkdir -p "$fontDir"
mv *.pcf.gz "$fontDir"
cd "$fontDir"
mkfontdir
mkfontscale
'';
preferLocalBuild = true;
outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash = "0v0qn5zwq4j1yx53ypg6w6mqx6dk8l1xix0188b0k4z3ivgnflyb";
meta = with stdenv.lib; {
description = "A monospace bitmap font aimed at programmers";
longDescription = ''
Dina is a monospace bitmap font, primarily aimed at programmers. It is
relatively compact to allow a lot of code on screen, while (hopefully)
clear enough to remain readable even at high resolutions.
'';
homepage = https://www.donationcoder.com/Software/Jibz/Dina/;
downloadPage = https://www.donationcoder.com/Software/Jibz/Dina/;
license = licenses.free;
maintainers = [ maintainers.prikhi ];
};
}

View File

@ -1,20 +1,47 @@
{ stdenv, fetchzip }:
{ stdenv, fetchurl, unzip
, bdftopcf, mkfontscale
}:
let
stdenv.mkDerivation {
pname = "dina-font";
version = "2.92";
in fetchzip {
name = "dina-font-${version}";
# `meta.homepage` has no direct download link
url = "https://github.com/ProgrammingFonts/ProgrammingFonts/archive/b15ef365146be7eef4a46979cfe157c5aeefb7c0.zip";
src = fetchurl {
url = "http://www.donationcoder.com/Software/Jibz/Dina/downloads/Dina.zip";
sha256 = "1kq86lbxxgik82aywwhawmj80vsbz3hfhdyhicnlv9km7yjvnl8z";
};
postFetch = ''
mkdir -p $out/share/fonts
unzip -j $downloadedFile '*/Dina/*.bdf' -d $out/share/fonts
chmod u-x $out/share/fonts/*
nativeBuildInputs =
[ unzip bdftopcf mkfontscale ];
patchPhase = "sed -i 's/microsoft-cp1252/ISO8859-1/' *.bdf";
buildPhase = ''
newName() {
test "''${1:5:1}" = i && _it=Italic || _it=
case ''${1:6:3} in
400) test -z $it && _weight=Medium ;;
700) _weight=Bold ;;
esac
_pt=''${1%.bdf}
_pt=''${_pt#*-}
echo "Dina$_weight$_it$_pt"
}
# convert bdf fonts to pcf
for i in *.bdf; do
bdftopcf -t -o $(newName "$i").pcf "$i"
done
gzip -n -9 *.pcf
'';
sha256 = "02a6hqbq18sw69npylfskriqhvj1nsk65hjjyd05nl913ycc6jl7";
installPhase = ''
install -D -m 644 -t "$out/share/fonts/misc" *.pcf.gz
install -D -m 644 -t "$bdf/share/fonts/misc" *.bdf
mkfontdir "$out/share/fonts/misc"
'';
outputs = [ "out" "bdf" ];
meta = with stdenv.lib; {
description = "A monospace bitmap font aimed at programmers";

View File

@ -542,6 +542,9 @@ mapAliases ({
# added 2020-01-10
tor-browser-unwrapped = throw "tor-browser-unwrapped was removed because it was out of date and inadequately maintained. Please use tor-browser-bundle-bin instead. See #77452.";
# added 2020-02-09
dina-font-pcf = dina-font;
/* Cleanup before 20.09 */
llvm_4 = throw ''
The LLVM versions 3.5, 3.9 and 4.0 have been removed in NixOS 20.03

View File

@ -17378,9 +17378,8 @@ in
paths = [ dejavu_fonts.out ];
};
dina-font = callPackage ../data/fonts/dina { };
dina-font-pcf = callPackage ../data/fonts/dina-pcf { };
dina-font = callPackage ../data/fonts/dina
{ inherit (buildPackages.xorg) mkfontscale; };
dns-root-data = callPackage ../data/misc/dns-root-data { };