From 8cadf94a4d3c521be5bda588ffcdb0b925395389 Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Sun, 30 Aug 2020 15:32:39 +0200 Subject: [PATCH 1/2] xorg.fontbitstreamtype1: generate .otf fonts --- pkgs/servers/x11/xorg/overrides.nix | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/pkgs/servers/x11/xorg/overrides.nix b/pkgs/servers/x11/xorg/overrides.nix index 092764a3d9d..a822ad989ac 100644 --- a/pkgs/servers/x11/xorg/overrides.nix +++ b/pkgs/servers/x11/xorg/overrides.nix @@ -1,7 +1,7 @@ { abiCompat ? null, stdenv, makeWrapper, fetchurl, fetchpatch, fetchFromGitLab, buildPackages, automake, autoconf, gettext, libiconv, libtool, intltool, - freetype, tradcpp, fontconfig, meson, ninja, ed, + freetype, tradcpp, fontconfig, meson, ninja, ed, fontforge, libGL, spice-protocol, zlib, libGLU, dbus, libunwind, libdrm, mesa, udev, bootstrap_cmds, bison, flex, clangStdenv, autoreconfHook, mcpp, epoxy, openssl, pkgconfig, llvm_6, python3, @@ -848,4 +848,25 @@ self: super: --set XAPPLRESDIR ${placeholder "out"}/share/X11/app-defaults ''; }); + + # 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" + ''; + }); + } From c45160366b824a2d7a70c14b9ef1f797718fdd45 Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Sun, 30 Aug 2020 15:33:26 +0200 Subject: [PATCH 2/2] xorg: mark fonts with proprietary licences as unfree --- pkgs/servers/x11/xorg/overrides.nix | 42 ++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/pkgs/servers/x11/xorg/overrides.nix b/pkgs/servers/x11/xorg/overrides.nix index a822ad989ac..80112755e6d 100644 --- a/pkgs/servers/x11/xorg/overrides.nix +++ b/pkgs/servers/x11/xorg/overrides.nix @@ -50,10 +50,6 @@ self: super: hardeningDisable = [ "format" ]; }); - fontbhttf = super.fontbhttf.overrideAttrs (attrs: { - meta = attrs.meta // { license = lib.licenses.unfreeRedistributable; }; - }); - fontmiscmisc = super.fontmiscmisc.overrideAttrs (attrs: { postInstall = '' @@ -870,3 +866,41 @@ self: super: }); } + +# mark some packages as unfree +// ( + let + # unfree but redistributable + redist = [ + "fontadobeutopiatype1" + "fontadobeutopia100dpi" + "fontadobeutopia75dpi" + "fontbhtype1" + "fontibmtype1" + "fontbhttf" + "fontbh100dpi" + "fontbh75dpi" + ]; + + # unfree, possibly not redistributable + unfree = [ + # no license, just a copyright notice + "fontbhlucidatypewriter100dpi" + "fontbhlucidatypewriter75dpi" + "fontdaewoomisc" + + # unclear license, "permission to use"? + "fontjismisc" + ]; + + setLicense = license: name: + super.${name}.overrideAttrs (attrs: { + meta = attrs.meta // { inherit license; }; + }); + mapNamesToAttrs = f: names: with lib; + listToAttrs (zipListsWith nameValuePair names (map f names)); + + in + mapNamesToAttrs (setLicense lib.licenses.unfreeRedistributable) redist // + mapNamesToAttrs (setLicense lib.licenses.unfree) unfree +)