Unverified Commit 3980e3a3 authored by rnhmjoj's avatar rnhmjoj
Browse files

uw-ttyp0: 1.3 -> 2.1

parent c718a7ec
Loading
Loading
Loading
Loading
+10 −40
Original line number Diff line number Diff line
@@ -12,16 +12,13 @@

stdenv.mkDerivation rec {
  pname = "uw-ttyp0";
  version = "1.3";
  version = "2.1";

  src = fetchurl {
    url = "https://people.mpi-inf.mpg.de/~uwe/misc/${pname}/${pname}-${version}.tar.gz";
    sha256 = "1vp053bwv8sr40p3pn4sjaiq570zp7knh99z9ynk30v7ml4cz2i8";
    hash = "sha256-mVBt2HlOGl1c1YEebB5V7u+Yn4w1Af25Jlvalyq6FjA=";
  };

  # remove for version >1.3
  patches = [ ./determinism.patch ];

  nativeBuildInputs = [
    perl
    bdftopcf
@@ -39,6 +36,9 @@ stdenv.mkDerivation rec {
          SIZES = 11 12 13 14 15 16 17 18 22 \
          11b 12b 13b 14b 15b 16b 17b 18b 22b 15i 16i 17i 18i
          ENCODINGS = uni
          GEN_PCF = 1
          GEN_OTB = 1
          GEN_CONS_LINUX = 1
          EOF
        ''
      else
@@ -57,43 +57,13 @@ stdenv.mkDerivation rec {
        ''cp "${variantsDat}" VARIANTS.dat''
    );

  postBuild = ''
    # convert bdf fonts to psf
    build=$(pwd)
    mkdir {psf,otb}
    cd ${bdf2psf}/share/bdf2psf
    for i in $build/genbdf/*.bdf; do
      name="$(basename $i .bdf)"
      bdf2psf \
        --fb "$i" standard.equivalents \
        ascii.set+useful.set+linux.set 512 \
        "$build/psf/$name.psf"
    done
    cd -

    # convert unicode bdf fonts to otb
    for i in $build/genbdf/*-uni.bdf; do
      name="$(basename $i .bdf)"
      fonttosfnt -v -o "$build/otb/$name.otb" "$i"
    done
  '';

  postInstall = ''
    # install psf fonts
    fontDir="$out/share/consolefonts"
    install -m 644 -D psf/*.psf -t "$fontDir"

    # install otb fonts
    fontDir="$out/share/fonts/X11/misc"
    install -m 644 -D otb/*.otb -t "$fontDir"
    mkfontdir "$fontDir"
  '';

  # Nix with multiple outputs adds several flags
  # that the ./configure script doesn't understand.
  configurePhase = ''
    runHook preConfigure
    ./configure --prefix="$out"
    ./configure \
      --prefix="$out" \
      --otbdir="$out/share/fonts/X11/misc" \
      --pcfdir="$out/share/fonts/X11/misc" \
      --conslinuxdir="$out/share/consolefonts"
    runHook postConfigure
  '';