Unverified Commit 1de5c502 authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

Merge pull request #243967 from 999eagle/feat/nanoemoji

parents d75ba3d7 0e1c1dad
Loading
Loading
Loading
Loading
+72 −0
Original line number Diff line number Diff line
{ lib
, buildPythonPackage
, fetchFromGitHub
, fetchurl
, cmake
, setuptools-scm
, scikit-build
, pytestCheckHook
, pytest-virtualenv
}:
let
  # these must match NinjaUrls.cmake
  ninja_src_url = "https://github.com/Kitware/ninja/archive/v1.11.1.g95dee.kitware.jobserver-1.tar.gz";
  ninja_src_sha256 = "7ba84551f5b315b4270dc7c51adef5dff83a2154a3665a6c9744245c122dd0db";
  ninja_src = fetchurl {
    url = ninja_src_url;
    sha256 = ninja_src_sha256;
  };
in
buildPythonPackage rec {
  pname = "ninja";
  version = "1.11.1";
  format = "pyproject";

  src = fetchFromGitHub {
    owner = "scikit-build";
    repo = "ninja-python-distributions";
    rev = version;
    hash = "sha256-scCYsSEyN+u3qZhNhWYqHpJCl+JVJJbKz+T34gOXGJM=";
  };
  patches = [
    # make sure cmake doesn't try to download the ninja sources
    ./no-download.patch
  ];

  inherit ninja_src;
  postUnpack = ''
    # assume that if the hash matches, the source should be fine
    if ! grep "${ninja_src_sha256}" $sourceRoot/NinjaUrls.cmake; then
      echo "ninja_src_sha256 doesn't match the hash in NinjaUrls.cmake!"
      exit 1
    fi
    mkdir -p "$sourceRoot/Ninja-src"
    pushd "$sourceRoot/Ninja-src"
    tar -xavf ${ninja_src} --strip-components 1
    popd
  '';

  postPatch = ''
    sed -i '/cov/d' setup.cfg
  '';

  dontUseCmakeConfigure = true;

  nativeBuildInputs = [
    setuptools-scm
    scikit-build
    cmake
  ];

  nativeCheckInputs = [
    pytestCheckHook
    pytest-virtualenv
  ];

  meta = with lib; {
    description = "A small build system with a focus on speed";
    homepage = "https://github.com/scikit-build/ninja-python-distributions";
    license = licenses.asl20;
    maintainers = with maintainers; [ _999eagle ];
  };
}
+10 −0
Original line number Diff line number Diff line
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -64,6 +64,7 @@
   # Download selected source archive
   ExternalProject_add(download_ninja_source
     SOURCE_DIR ${Ninja_SOURCE_DIR}
+    DOWNLOAD_COMMAND ""
     URL ${${src_archive}_url}
     URL_HASH SHA256=${${src_archive}_sha256}
     DOWNLOAD_DIR ${ARCHIVE_DOWNLOAD_DIR}
+57 −0
Original line number Diff line number Diff line
{ lib
, stdenv
, buildPythonPackage
, fetchFromGitHub
, fetchpatch
, setuptools-scm
, absl-py
, lxml
, skia-pathops
, pytestCheckHook
}:
buildPythonPackage rec {
  pname = "picosvg";
  version = "0.22.0";

  src = fetchFromGitHub {
    owner = "googlefonts";
    repo = pname;
    rev = "v${version}";
    hash = "sha256-J06ijF1c3ZKPqKiQha6yqfj8EjFZoZzA6i6UCCrexi8=";
  };

  patches = [
    # see https://github.com/googlefonts/picosvg/issues/299
    # this patch fixed a failing test case after the update to skia-pathops 0.8
    # as soon as skia-pathops in nixpkgs is updated to 0.8, this patch should be removed
    (fetchpatch {
      url = "https://github.com/googlefonts/picosvg/commit/4e971ed6cd9afb412b2845d29296a0c24f086562.patch";
      hash = "sha256-OZEipNPCSuuqcy4XggBiuGv4HN604dI4N9wlznyAwF0=";
      revert = true;
    })
  ];

  nativeBuildInputs = [
    setuptools-scm
  ];

  propagatedBuildInputs = [
    absl-py
    lxml
    skia-pathops
  ];

  nativeCheckInputs = [
    pytestCheckHook
  ];

  # a few tests are failing on aarch64
  doCheck = !stdenv.isAarch64;

  meta = with lib; {
    description = "Tool to simplify SVGs";
    homepage = "https://github.com/googlefonts/picosvg";
    license = licenses.asl20;
    maintainers = with maintainers; [ _999eagle ];
  };
}
+72 −0
Original line number Diff line number Diff line
{ lib
, python3
, fetchFromGitHub
, resvg
, pngquant
}:
python3.pkgs.buildPythonApplication rec {
  pname = "nanoemoji";
  version = "0.15.1";

  src = fetchFromGitHub {
    owner = "googlefonts";
    repo = pname;
    rev = "v${version}";
    hash = "sha256-P/lT0PnjTdYzyttICzszu4OL5kj+X8GHZ8doL3tpXQM=";
  };
  patches = [
    # this is necessary because the tests clear PATH/PYTHONPATH otherwise
    ./test-pythonpath.patch
    # minor difference in the test output, most likely due to different dependency versions
    ./fix-test.patch
  ];

  nativeBuildInputs = with python3.pkgs; [
    setuptools-scm
    pythonRelaxDepsHook

    pngquant
    resvg
  ];

  # these two packages are just prebuilt wheels containing the respective binaries
  pythonRemoveDeps = [ "pngquant-cli" "resvg-cli" ];

  propagatedBuildInputs = with python3.pkgs; [
    absl-py
    fonttools
    lxml
    ninja-python
    picosvg
    pillow
    regex
    toml
    tomlkit
    ufo2ft
    ufoLib2
    zopfli
  ];

  nativeCheckInputs = with python3.pkgs; [
    pytestCheckHook

    ninja-python
    picosvg
  ];

  makeWrapperArgs = [
    "--prefix PATH : ${lib.makeBinPath [ pngquant resvg ]}"
  ];

  preCheck = ''
    # make sure the built binaries (nanoemoji/maximum_color) can be found by the test
    export PATH="$out/bin:$PATH"
  '';

  meta = with lib; {
    description = "A wee tool to build color fonts";
    homepage = "https://github.com/googlefonts/nanoemoji";
    license = licenses.asl20;
    maintainers = with maintainers; [ _999eagle ];
  };
}
+24 −0
Original line number Diff line number Diff line
--- a/tests/proportional_cbdt.ttx
+++ b/tests/proportional_cbdt.ttx
@@ -13,7 +13,7 @@
     <mtx name=".notdef" width="0" lsb="5"/>
     <mtx name=".space" width="0" lsb="0"/>
     <mtx name="e000" width="110" lsb="0"/>
-    <mtx name="e001" width="73" lsb="0"/>
+    <mtx name="e001" width="74" lsb="0"/>
   </hmtx>
 
   <cmap>
@@ -79,10 +79,10 @@
       <cbdt_bitmap_format_17 name="e001">
         <SmallGlyphMetrics>
           <height value="128"/>
-          <width value="85"/>
+          <width value="86"/>
           <BearingX value="0"/>
           <BearingY value="104"/>
-          <Advance value="85"/>
+          <Advance value="86"/>
         </SmallGlyphMetrics>
         <extfileimagedata value="e001.png"/>
       </cbdt_bitmap_format_17>
Loading