Unverified Commit 4c4fd26c authored by quantenzitrone's avatar quantenzitrone
Browse files

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

the package output doesn't change
parent 9549cb44
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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";
+60 −0
Original line number Diff line number Diff line
{
  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;
  };
})
+2 −38
Original line number Diff line number Diff line
@@ -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 (
    {
+2 −0
Original line number Diff line number Diff line
@@ -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;
+0 −21
Original line number Diff line number Diff line
@@ -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
Loading