font-bitstream-type1: refactor, move to pkgs/by-name and rename from xorg.fontbitstreamtype1

the package output doesn't change
This commit is contained in:
quantenzitrone
2025-08-27 04:43:53 +02:00
parent 9549cb44ea
commit 4c4fd26ced
6 changed files with 69 additions and 60 deletions

View File

@@ -167,6 +167,11 @@ lib.mapAttrs mkLicense (
fullName = "Apache License 2.0";
};
bitstreamCharter = {
spdxId = "Bitstream-Charter";
fullName = "Bitstream Charter Font License";
};
bitstreamVera = {
spdxId = "Bitstream-Vera";
fullName = "Bitstream Vera Font License";

View File

@@ -0,0 +1,60 @@
{
lib,
stdenv,
fetchurl,
mkfontscale,
fontforge,
writeScript,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "font-bitstream-type1";
version = "1.0.4";
src = fetchurl {
url = "mirror://xorg/individual/font/font-bitstream-type1-${finalAttrs.version}.tar.xz";
hash = "sha256-3i8ji0zXLbQiigumeCnXait8A54imT1mpyLuOFJIxig=";
};
strictDeps = true;
nativeBuildInputs = [
mkfontscale
fontforge
];
configureFlags = [ "--with-fontrootdir=$(out)/lib/X11/fonts" ];
postBuild = ''
# convert Postscript (Type 1) font to otf
for i in $(find -type f -name '*.pfa' -o -name '*.pfb'); do
name=$(basename $i | cut -d. -f1)
fontforge -lang=ff -c "Open(\"$i\"); Generate(\"$name.otf\")"
done
'';
postInstall = ''
# install the otf fonts
fontDir="$out/lib/X11/fonts/misc"
install -Dm444 -t "$fontDir" *.otf
mkfontscale "$fontDir"
'';
passthru = {
updateScript = writeScript "update-${finalAttrs.pname}" ''
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p common-updater-scripts
version="$(list-directory-versions --pname ${finalAttrs.pname} \
--url https://xorg.freedesktop.org/releases/individual/font/ \
| sort -V | tail -n1)"
update-source-version ${finalAttrs.pname} "$version"
'';
};
meta = {
description = "Bitstream Charter PostScript Type 1 and OpenType fonts";
homepage = "https://gitlab.freedesktop.org/xorg/font/bitstream-type1";
license = lib.licenses.bitstreamCharter;
maintainers = [ ];
platforms = lib.platforms.unix;
};
})

View File

@@ -17,6 +17,7 @@
font-bh-type1,
font-bitstream-100dpi,
font-bitstream-75dpi,
font-bitstream-type1,
font-cronyx-cyrillic,
font-encodings,
font-isas-misc,
@@ -201,6 +202,7 @@ self: with self; {
fontbhtype1 = font-bh-type1;
fontbitstream100dpi = font-bitstream-100dpi;
fontbitstream75dpi = font-bitstream-75dpi;
fontbitstreamtype1 = font-bitstream-type1;
fontcronyxcyrillic = font-cronyx-cyrillic;
fontisasmisc = font-isas-misc;
fontmicromisc = font-micro-misc;
@@ -394,44 +396,6 @@ self: with self; {
})
) { };
# THIS IS A GENERATED FILE. DO NOT EDIT!
fontbitstreamtype1 = callPackage (
{
stdenv,
pkg-config,
fetchurl,
fontutil,
mkfontscale,
testers,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "font-bitstream-type1";
version = "1.0.4";
builder = ./builder.sh;
src = fetchurl {
url = "mirror://xorg/individual/font/font-bitstream-type1-1.0.4.tar.xz";
sha256 = "0a669193ivi2lxk3v692kq1pqavaswlpi9hbi8ib8bfp9j5j6byy";
};
hardeningDisable = [
"bindnow"
"relro"
];
strictDeps = true;
nativeBuildInputs = [
pkg-config
mkfontscale
];
buildInputs = [ fontutil ];
configureFlags = [ "--with-fontrootdir=$(out)/lib/X11/fonts" ];
postPatch = ''substituteInPlace configure --replace 'MAPFILES_PATH=`pkg-config' 'MAPFILES_PATH=`$PKG_CONFIG' '';
passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
meta = {
pkgConfigModules = [ ];
platforms = lib.platforms.unix;
};
})
) { };
# THIS IS A GENERATED FILE. DO NOT EDIT!
fontcursormisc = callPackage (
{

View File

@@ -340,6 +340,7 @@ print OUT <<EOF;
font-bh-type1,
font-bitstream-100dpi,
font-bitstream-75dpi,
font-bitstream-type1,
font-cronyx-cyrillic,
font-encodings,
font-isas-misc,
@@ -524,6 +525,7 @@ self: with self; {
fontbhtype1 = font-bh-type1;
fontbitstream100dpi = font-bitstream-100dpi;
fontbitstream75dpi = font-bitstream-75dpi;
fontbitstreamtype1 = font-bitstream-type1;
fontcronyxcyrillic = font-cronyx-cyrillic;
fontisasmisc = font-isas-misc;
fontmicromisc = font-micro-misc;

View File

@@ -866,27 +866,6 @@ self: super:
});
xwd = addMainProgram super.xwd { };
# convert Type1 vector fonts to OpenType fonts
fontbitstreamtype1 = super.fontbitstreamtype1.overrideAttrs (attrs: {
nativeBuildInputs = attrs.nativeBuildInputs ++ [ fontforge ];
postBuild = ''
# convert Postscript (Type 1) font to otf
for i in $(find -type f -name '*.pfa' -o -name '*.pfb'); do
name=$(basename $i | cut -d. -f1)
fontforge -lang=ff -c "Open(\"$i\"); Generate(\"$name.otf\")"
done
'';
postInstall = ''
# install the otf fonts
fontDir="$out/lib/X11/fonts/misc/"
install -D -m 644 -t "$fontDir" *.otf
mkfontscale "$fontDir"
'';
});
}
# mark some packages as unfree

View File

@@ -73,7 +73,6 @@ mirror://xorg/individual/driver/xf86-video-vmware-13.4.0.tar.xz
mirror://xorg/individual/driver/xf86-video-voodoo-1.2.6.tar.xz
mirror://xorg/individual/driver/xf86-video-wsfb-0.4.0.tar.bz2
mirror://xorg/individual/font/font-arabic-misc-1.0.4.tar.xz
mirror://xorg/individual/font/font-bitstream-type1-1.0.4.tar.xz
mirror://xorg/individual/font/font-cursor-misc-1.0.4.tar.xz
mirror://xorg/individual/font/font-daewoo-misc-1.0.4.tar.xz
mirror://xorg/individual/font/font-dec-misc-1.0.4.tar.xz