From 4c4fd26ced7988897342f6386cc73af6d267c227 Mon Sep 17 00:00:00 2001 From: quantenzitrone Date: Wed, 27 Aug 2025 04:43:53 +0200 Subject: [PATCH] font-bitstream-type1: refactor, move to pkgs/by-name and rename from xorg.fontbitstreamtype1 the package output doesn't change --- lib/licenses.nix | 5 ++ .../fo/font-bitstream-type1/package.nix | 60 +++++++++++++++++++ pkgs/servers/x11/xorg/default.nix | 40 +------------ .../x11/xorg/generate-expr-from-tarballs.pl | 2 + pkgs/servers/x11/xorg/overrides.nix | 21 ------- pkgs/servers/x11/xorg/tarballs.list | 1 - 6 files changed, 69 insertions(+), 60 deletions(-) create mode 100644 pkgs/by-name/fo/font-bitstream-type1/package.nix diff --git a/lib/licenses.nix b/lib/licenses.nix index b736baf7c5fa..62796ef1963e 100644 --- a/lib/licenses.nix +++ b/lib/licenses.nix @@ -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"; diff --git a/pkgs/by-name/fo/font-bitstream-type1/package.nix b/pkgs/by-name/fo/font-bitstream-type1/package.nix new file mode 100644 index 000000000000..3e3d1eb6c35e --- /dev/null +++ b/pkgs/by-name/fo/font-bitstream-type1/package.nix @@ -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; + }; +}) diff --git a/pkgs/servers/x11/xorg/default.nix b/pkgs/servers/x11/xorg/default.nix index 1c2bdcede515..dc45ac9dc183 100644 --- a/pkgs/servers/x11/xorg/default.nix +++ b/pkgs/servers/x11/xorg/default.nix @@ -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 ( { diff --git a/pkgs/servers/x11/xorg/generate-expr-from-tarballs.pl b/pkgs/servers/x11/xorg/generate-expr-from-tarballs.pl index 9e968dfb4c5a..6e3c4e8b748a 100755 --- a/pkgs/servers/x11/xorg/generate-expr-from-tarballs.pl +++ b/pkgs/servers/x11/xorg/generate-expr-from-tarballs.pl @@ -340,6 +340,7 @@ print OUT <