From deff7230186bd8b7253ae0f5b2b6860a5370cf5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Tue, 14 Apr 2026 14:25:26 -0700 Subject: [PATCH] python3Packages.afdko: 4.0.2 -> 5.0.1 Diff: https://github.com/adobe-type-tools/afdko/compare/4.0.2...5.0.1 Changelog: https://github.com/adobe-type-tools/afdko/blob/5.0.1/NEWS.md --- .../python-modules/afdko/default.nix | 84 +++++++------------ .../afdko/dont-fetch-third-party-libs.patch | 12 +++ .../afdko/no-pypi-build-tools.patch | 24 ------ .../use-dynamic-system-antlr4-runtime.patch | 67 +++++---------- 4 files changed, 62 insertions(+), 125 deletions(-) create mode 100644 pkgs/development/python-modules/afdko/dont-fetch-third-party-libs.patch delete mode 100644 pkgs/development/python-modules/afdko/no-pypi-build-tools.patch diff --git a/pkgs/development/python-modules/afdko/default.nix b/pkgs/development/python-modules/afdko/default.nix index c1df13372fc1..1053d44c328f 100644 --- a/pkgs/development/python-modules/afdko/default.nix +++ b/pkgs/development/python-modules/afdko/default.nix @@ -1,25 +1,28 @@ { lib, stdenv, + addBinToPathHook, antlr4_13, booleanoperations, buildPythonPackage, cmake, + cython, defcon, fetchFromGitHub, - fetchpatch, fontmath, fonttools, libxml2, lxml, + mypy, ninja, pytestCheckHook, runAllTests ? false, - scikit-build, + scikit-build-core, setuptools-scm, tqdm, ufonormalizer, ufoprocessor, + uharfbuzz, # passthru afdko, @@ -27,22 +30,33 @@ buildPythonPackage (finalAttrs: { pname = "afdko"; - version = "4.0.2"; + version = "5.0.1"; pyproject = true; src = fetchFromGitHub { owner = "adobe-type-tools"; repo = "afdko"; tag = finalAttrs.version; - hash = "sha256:0955dvbydifhgx9gswbf5drsmmghry7iyf6jwz6qczhj86clswcm"; + hash = "sha256:sha256-ts7vFfbPPrdooOH0JYrn3YKs7kRju4LbZ8Ypd3ExELc="; }; - build-system = [ setuptools-scm ]; + postPatch = '' + # https://github.com/NixOS/nixpkgs/pull/510112#issuecomment-4263642029 + substituteInPlace CMakeLists.txt \ + --replace-fail 'cmake_minimum_required(VERSION 3.16)' "cmake_minimum_required(VERSION 3.16) + find_package(LibXml2 REQUIRED)" + ''; - nativeBuildInputs = [ - scikit-build + build-system = [ cmake + cython ninja + scikit-build-core + setuptools-scm + ]; + + cmakeFlags = [ + "-DANTLR4_INCLUDE_DIRS=${lib.getDev antlr4_13.runtime.cpp}/include/antlr4-runtime" ]; buildInputs = [ @@ -51,37 +65,19 @@ buildPythonPackage (finalAttrs: { ]; patches = [ - # Don't try to install cmake and ninja using pip - ./no-pypi-build-tools.patch + ./dont-fetch-third-party-libs.patch # Use antlr4 runtime from nixpkgs and link it dynamically ./use-dynamic-system-antlr4-runtime.patch - - # Fix tests - # FIXME: remove in 5.0 - (fetchpatch { - url = "https://github.com/adobe-type-tools/afdko/commit/3b78bea15245e2bd2417c25ba5c2b8b15b07793c.patch"; - excludes = [ - "CMakeLists.txt" - "requirements.txt" - ]; - hash = "sha256-Ao5AUVm1h4a3qidqlBFWdC7jiXyBfXQEnsT7XsXXXRU="; - }) ]; env = { + FORCE_SYSTEM_ANTLR4 = true; # Use system libxml2 FORCE_SYSTEM_LIBXML2 = true; - } - // lib.optionalAttrs stdenv.cc.isClang { - NIX_CFLAGS_COMPILE = toString [ - "-Wno-error=incompatible-function-pointer-types" - "-Wno-error=int-conversion" - ]; }; - # setup.py will always (re-)execute cmake in buildPhase - dontConfigure = true; + dontUseCmakeConfigure = true; dependencies = [ booleanoperations @@ -100,34 +96,14 @@ buildPythonPackage (finalAttrs: { ++ fonttools.optional-dependencies.unicode ++ fonttools.optional-dependencies.woff; - postInstall = '' - # clean up the install directory - # 5.0.0 release revamps the build system and hopefully makes this unnecessary - rm -r $out/{_skbuild,c,tests} - ''; - - nativeCheckInputs = [ pytestCheckHook ]; - - preCheck = '' - export PATH=$PATH:$out/bin - - # Remove build artifacts to prevent them from messing with the tests - rm -r _skbuild - ''; + nativeCheckInputs = [ + addBinToPathHook + mypy + pytestCheckHook + uharfbuzz + ]; disabledTests = [ - # broke in the fontforge 4.51 -> 4.53 update - "test_glyphs_2_7" - "test_hinting_data" - "test_waterfallplot" - # broke at some point - "test_type1_supported_hint" - ] - ++ lib.optionals (stdenv.cc.isGNU) [ - # broke in the gcc 13 -> 14 update - "test_dump" - "test_input_formats" - "test_other_input_formats" ] ++ lib.optionals (!runAllTests) [ # Disable slow tests, reduces test time ~25 % diff --git a/pkgs/development/python-modules/afdko/dont-fetch-third-party-libs.patch b/pkgs/development/python-modules/afdko/dont-fetch-third-party-libs.patch new file mode 100644 index 000000000000..48e4ce99fcfe --- /dev/null +++ b/pkgs/development/python-modules/afdko/dont-fetch-third-party-libs.patch @@ -0,0 +1,12 @@ +diff --git a/third_party/LibXml2/CMakeLists.txt b/third_party/LibXml2/CMakeLists.txt +index 2549e5f0..8835658f 100644 +--- a/third_party/LibXml2/CMakeLists.txt ++++ b/third_party/LibXml2/CMakeLists.txt +@@ -12,6 +12,7 @@ FetchContent_Declare(LibXml2 + GIT_REPOSITORY https://gitlab.gnome.org/GNOME/libxml2.git + GIT_TAG ${LIBXML2_TAG} + EXCLUDE_FROM_ALL ++ ${fetch_content_args} + ) + + option(AFDKO_BUILD_LIBXML2_SHARED_LIB diff --git a/pkgs/development/python-modules/afdko/no-pypi-build-tools.patch b/pkgs/development/python-modules/afdko/no-pypi-build-tools.patch deleted file mode 100644 index a3ef7dd23b85..000000000000 --- a/pkgs/development/python-modules/afdko/no-pypi-build-tools.patch +++ /dev/null @@ -1,24 +0,0 @@ -commit a5fde72bd15e0baba008ea54270a1ffe017544a0 -Author: sternenseemann -Date: Tue Oct 5 18:17:20 2021 +0200 - - Don't use pypi distributions of build tools - - We want to use regular cmake and ninja and not the pypi projects which - somehow wrap and vendor a version of the proper tool. - -diff --git a/setup.py b/setup.py -index 973e2826..dba58766 100644 ---- a/setup.py -+++ b/setup.py -@@ -198,9 +198,7 @@ def main(): - setup_requires=[ - 'wheel', - 'setuptools_scm', -- 'scikit-build', -- 'cmake', -- 'ninja' -+ 'scikit-build' - ], - tests_require=[ - 'pytest', diff --git a/pkgs/development/python-modules/afdko/use-dynamic-system-antlr4-runtime.patch b/pkgs/development/python-modules/afdko/use-dynamic-system-antlr4-runtime.patch index d2184e8d2804..df574f96d89c 100644 --- a/pkgs/development/python-modules/afdko/use-dynamic-system-antlr4-runtime.patch +++ b/pkgs/development/python-modules/afdko/use-dynamic-system-antlr4-runtime.patch @@ -1,53 +1,26 @@ -commit 3560653d5d52bf30a52ce971ecfe262b1a09d7a3 -Author: sternenseemann -Date: Tue Oct 5 18:16:10 2021 +0200 - - Link against system antlr4 runtime, dynamically - - Instead of cloning a antlr4 version from git, use the system one. Also - don't link it statically, but dynamically by default (the library is - called antlr4-runtime, not antlr4_static). - diff --git a/CMakeLists.txt b/CMakeLists.txt -index 88e9cfd0..3df902b4 100644 +index e6b30c83..ec74fd5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -36,11 +36,10 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) - # https://www.antlr.org/download/antlr4-cpp-runtime-4.9.3-source.zip - # set(ANTLR4_ZIP_REPOSITORY "/path_to_antlr4_archive/a4.zip") +@@ -134,7 +134,7 @@ add_subdirectory(c/spot) + add_subdirectory(c/type1) + add_subdirectory(c/addfeatures) --add_definitions(-DANTLR4CPP_STATIC) - set(ANTLR4_WITH_STATIC_CRT OFF) --# 4.9.3 is the latest ANTLR4 version - set(ANTLR4_TAG tags/4.13.2) --include(ExternalAntlr4Cpp) -+find_path(ANTLR4_HEADER antlr4-runtime.h PATH_SUFFIXES antlr4-runtime) -+set(ANTLR4_INCLUDE_DIRS ${ANTLR4_HEADER}) +-target_link_libraries(_internal PRIVATE afdko_version detype1 type1 addfeatures spot sfntedit sfntdiff mergefonts rotatefont shared afdko::antlr4) ++target_link_libraries(_internal PRIVATE afdko_version detype1 type1 addfeatures spot sfntedit sfntdiff mergefonts rotatefont shared antlr4-runtime) + if(CMAKE_USE_PTHREADS_INIT) + target_link_libraries(_internal PRIVATE Threads::Threads) +diff --git a/c/addfeatures/hotconv/CMakeLists.txt b/c/addfeatures/hotconv/CMakeLists.txt +index 7e281af9..f7100558 100644 +--- a/c/addfeatures/hotconv/CMakeLists.txt ++++ b/c/addfeatures/hotconv/CMakeLists.txt +@@ -72,7 +72,7 @@ target_include_directories(hotconv BEFORE PRIVATE $<$:${AN + target_include_directories(hotconv AFTER PRIVATE ../include ../../shared/resource) + # Because hotconv is an object library, all this should do is + # establish the build dependency +-target_link_libraries(hotconv PUBLIC afdko::antlr4 shared) ++target_link_libraries(hotconv PUBLIC antlr4-runtime shared) - if (DEFINED ENV{FORCE_BUILD_LIBXML2}) -diff --git a/c/makeotf/lib/cffread/CMakeLists.txt b/c/makeotf/lib/cffread/CMakeLists.txt -index 2990035f..fab25a77 100644 ---- a/c/makeotf/lib/cffread/CMakeLists.txt -+++ b/c/makeotf/lib/cffread/CMakeLists.txt -@@ -8,6 +8,6 @@ if (${NEED_LIBXML2_DEPEND}) - add_dependencies(makeotf_cffread ${LIBXML2_TARGET}) - endif() - --target_link_libraries(makeotf_cffread PUBLIC antlr4_static) -+target_link_libraries(makeotf_cffread PUBLIC antlr4-runtime) - - target_compile_definitions(makeotf_cffread PRIVATE $<$:CFF_DEBUG=1> CFF_T13_SUPPORT=0) -diff --git a/c/makeotf/lib/hotconv/CMakeLists.txt b/c/makeotf/lib/hotconv/CMakeLists.txt -index 60e49458..ada728c0 100644 ---- a/c/makeotf/lib/hotconv/CMakeLists.txt -+++ b/c/makeotf/lib/hotconv/CMakeLists.txt -@@ -70,7 +70,7 @@ add_library(hotconv STATIC - set_property(TARGET hotconv PROPERTY C_STANDARD 99) - set_property(TARGET hotconv PROPERTY CXX_STANDARD 17) - target_include_directories(hotconv PRIVATE AFTER $<$:${ANTLR4_INCLUDE_DIRS}>) --target_link_libraries(hotconv PUBLIC antlr4_static) -+target_link_libraries(hotconv PUBLIC antlr4-runtime) - - target_link_libraries(hotconv PUBLIC ${CHOSEN_LIBXML2_LIBRARY}) - + if ( CMAKE_COMPILER_IS_GNUCC ) + set_property(TARGET hotconv APPEND PROPERTY