From 7b5ee6d9275a26fdbcdbfc169cddab4d4a1d098a Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Sat, 2 Jul 2022 12:45:36 +0200 Subject: [PATCH] python3Packages.afdko: 3.8.3 -> 3.9.0 3.9.1 is problematic atm because it'll unconditionally use the libxml2 externalproject on linux: https://github.com/adobe-type-tools/afdko/pull/1527#issuecomment-1172872618 https://github.com/adobe-type-tools/afdko/blob/3.9.0/NEWS.md#390-released-2022-06-23 --- .../python-modules/afdko/default.nix | 8 ++++-- .../afdko/libxml2-cmake-find-package.patch | 22 ++++++++++++++++ .../use-dynamic-system-antlr4-runtime.patch | 26 ++++++++++++++----- 3 files changed, 47 insertions(+), 9 deletions(-) create mode 100644 pkgs/development/python-modules/afdko/libxml2-cmake-find-package.patch diff --git a/pkgs/development/python-modules/afdko/default.nix b/pkgs/development/python-modules/afdko/default.nix index 613ee89f276e..2ca94a2085a4 100644 --- a/pkgs/development/python-modules/afdko/default.nix +++ b/pkgs/development/python-modules/afdko/default.nix @@ -5,6 +5,7 @@ , setuptools-scm, scikit-build , cmake , antlr4_9 +, libxml2 , pytestCheckHook # Enables some expensive tests, useful for verifying an update , runAllTests ? false @@ -13,13 +14,13 @@ buildPythonPackage rec { pname = "afdko"; - version = "3.8.3"; + version = "3.9.0"; disabled = pythonOlder "3.7"; src = fetchPypi { inherit pname version; - sha256 = "0mplyla4zcai3qld7is7bl5wn2kzhp87w87yi13wpqnw06i6ij4b"; + sha256 = "1fjsaz6bp028fbmry6fzfcih78mdzycqmky1wsz5y0bg4kfk4shh"; }; format = "pyproject"; @@ -32,6 +33,7 @@ buildPythonPackage rec { buildInputs = [ antlr4_9.runtime.cpp + libxml2.dev ]; patches = [ @@ -40,6 +42,8 @@ buildPythonPackage rec { # Use antlr4 runtime from nixpkgs and link it dynamically ./use-dynamic-system-antlr4-runtime.patch + + ./libxml2-cmake-find-package.patch ]; # setup.py will always (re-)execute cmake in buildPhase diff --git a/pkgs/development/python-modules/afdko/libxml2-cmake-find-package.patch b/pkgs/development/python-modules/afdko/libxml2-cmake-find-package.patch new file mode 100644 index 000000000000..87604199d3e9 --- /dev/null +++ b/pkgs/development/python-modules/afdko/libxml2-cmake-find-package.patch @@ -0,0 +1,22 @@ +commit c423d1ddf0345aed7ecaf4c8b9e1fa5108aafc6f +Author: sternenseemann +Date: Sat Jul 2 12:35:56 2022 +0200 + + Force use of CMake-shipped FindLibXml2 module + + This is needed to work around a nixpkgs bug: + https://github.com/NixOS/nixpkgs/issues/125008 + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a75b6fb1..c1408283 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -42,7 +42,7 @@ set(ANTLR4_TAG tags/4.9.3) + find_path(ANTLR4_HEADER antlr4-runtime.h PATH_SUFFIXES antlr4-runtime) + set(ANTLR4_INCLUDE_DIRS ${ANTLR4_HEADER}) + +-FIND_PACKAGE(LibXml2) ++FIND_PACKAGE(LibXml2 REQUIRED MODULE) + IF (NOT ${LibXml2_FOUND}) + MESSAGE(STATUS "Could not locate LibXml2, will install externally.") + set(LIBXML2_TAG tags/v2.9.13) 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 8198751a1606..a8ecb02c3e78 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,4 +1,4 @@ -commit 1ccbf21a67da0fdbaad881a1f5c2a4df915e8c57 +commit 286b9c6e69691292dce4f2b4beaac8f886da184d Author: sternenseemann Date: Tue Oct 5 18:16:10 2021 +0200 @@ -9,7 +9,7 @@ Date: Tue Oct 5 18:16:10 2021 +0200 called antlr4-runtime, not antlr4_static). diff --git a/CMakeLists.txt b/CMakeLists.txt -index e9c8c08e..dc3a46da 100644 +index 9ce80598..a75b6fb1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,11 +36,11 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) @@ -24,10 +24,22 @@ index e9c8c08e..dc3a46da 100644 +find_path(ANTLR4_HEADER antlr4-runtime.h PATH_SUFFIXES antlr4-runtime) +set(ANTLR4_INCLUDE_DIRS ${ANTLR4_HEADER}) - # sanitizer support - # work around https://github.com/pypa/setuptools/issues/1928 with environment + FIND_PACKAGE(LibXml2) + IF (NOT ${LibXml2_FOUND}) +diff --git a/c/makeotf/lib/cffread/CMakeLists.txt b/c/makeotf/lib/cffread/CMakeLists.txt +index 9a400fde..5452d987 100644 +--- a/c/makeotf/lib/cffread/CMakeLists.txt ++++ b/c/makeotf/lib/cffread/CMakeLists.txt +@@ -13,6 +13,6 @@ else () + endif() + 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 82257bf2..02eb2e30 100644 +index 3cceceea..9695ea21 100644 --- a/c/makeotf/lib/hotconv/CMakeLists.txt +++ b/c/makeotf/lib/hotconv/CMakeLists.txt @@ -69,7 +69,7 @@ add_library(hotconv STATIC @@ -37,5 +49,5 @@ index 82257bf2..02eb2e30 100644 -target_link_libraries(hotconv PUBLIC antlr4_static) +target_link_libraries(hotconv PUBLIC antlr4-runtime) - if ( CMAKE_COMPILER_IS_GNUCC ) - target_compile_options(hotconv PRIVATE -Wall -Wno-attributes) + if (${LibXml2_FOUND}) + target_link_libraries(hotconv PUBLIC ${LIBXML2_LIBRARY})