Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xorg: convert type1 fonts and mark packages as unfree #96680

Merged
merged 2 commits into from
Sep 27, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 60 additions & 5 deletions pkgs/servers/x11/xorg/overrides.nix
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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 =
''
Expand Down Expand Up @@ -848,4 +844,63 @@ 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"
'';
});

}

# 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
)