at 25.11-pre 3.7 kB view raw
1{ 2 lib, 3 stdenv, 4 # Enables some expensive tests, useful for verifying an update 5 afdko, 6 antlr4_13, 7 booleanoperations, 8 buildPythonPackage, 9 cmake, 10 defcon, 11 fetchFromGitHub, 12 fetchpatch, 13 fontmath, 14 fontpens, 15 fonttools, 16 libxml2, 17 mutatormath, 18 ninja, 19 pytestCheckHook, 20 pythonOlder, 21 runAllTests ? false, 22 scikit-build, 23 setuptools-scm, 24 tqdm, 25 ufonormalizer, 26 ufoprocessor, 27}: 28 29buildPythonPackage rec { 30 pname = "afdko"; 31 version = "4.0.2"; 32 pyproject = true; 33 34 disabled = pythonOlder "3.8"; 35 36 src = fetchFromGitHub { 37 owner = "adobe-type-tools"; 38 repo = "afdko"; 39 tag = version; 40 hash = "sha256:0955dvbydifhgx9gswbf5drsmmghry7iyf6jwz6qczhj86clswcm"; 41 }; 42 43 build-system = [ setuptools-scm ]; 44 45 nativeBuildInputs = [ 46 scikit-build 47 cmake 48 ninja 49 ]; 50 51 buildInputs = [ 52 antlr4_13.runtime.cpp 53 libxml2.dev 54 ]; 55 56 patches = [ 57 # Don't try to install cmake and ninja using pip 58 ./no-pypi-build-tools.patch 59 60 # Use antlr4 runtime from nixpkgs and link it dynamically 61 ./use-dynamic-system-antlr4-runtime.patch 62 63 # Fix tests 64 # FIXME: remove in 5.0 65 (fetchpatch { 66 url = "https://github.com/adobe-type-tools/afdko/commit/3b78bea15245e2bd2417c25ba5c2b8b15b07793c.patch"; 67 excludes = [ 68 "CMakeLists.txt" 69 "requirements.txt" 70 ]; 71 hash = "sha256-Ao5AUVm1h4a3qidqlBFWdC7jiXyBfXQEnsT7XsXXXRU="; 72 }) 73 ]; 74 75 env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang (toString [ 76 "-Wno-error=incompatible-function-pointer-types" 77 "-Wno-error=int-conversion" 78 ]); 79 80 # setup.py will always (re-)execute cmake in buildPhase 81 dontConfigure = true; 82 83 dependencies = 84 [ 85 booleanoperations 86 defcon 87 fontmath 88 fontpens 89 fonttools 90 mutatormath 91 tqdm 92 ufonormalizer 93 ufoprocessor 94 ] 95 ++ defcon.optional-dependencies.lxml 96 ++ fonttools.optional-dependencies.lxml 97 ++ fonttools.optional-dependencies.ufo 98 ++ fonttools.optional-dependencies.unicode 99 ++ fonttools.optional-dependencies.woff; 100 101 # Use system libxml2 102 FORCE_SYSTEM_LIBXML2 = true; 103 104 nativeCheckInputs = [ pytestCheckHook ]; 105 106 preCheck = '' 107 export PATH=$PATH:$out/bin 108 109 # Remove build artifacts to prevent them from messing with the tests 110 rm -rf _skbuild 111 ''; 112 113 disabledTests = 114 [ 115 # broke in the fontforge 4.51 -> 4.53 update 116 "test_glyphs_2_7" 117 "test_hinting_data" 118 "test_waterfallplot" 119 # broke at some point 120 "test_type1_supported_hint" 121 ] 122 ++ lib.optionals (stdenv.cc.isGNU) [ 123 # broke in the gcc 13 -> 14 update 124 "test_dump" 125 "test_input_formats" 126 "test_other_input_formats" 127 ] 128 ++ lib.optionals (!runAllTests) [ 129 # Disable slow tests, reduces test time ~25 % 130 "test_report" 131 "test_post_overflow" 132 "test_cjk" 133 "test_extrapolate" 134 "test_filename_without_dir" 135 "test_overwrite" 136 "test_options" 137 ] 138 ++ lib.optionals (stdenv.hostPlatform.isAarch || stdenv.hostPlatform.isRiscV) [ 139 # unknown reason so far 140 # https://github.com/adobe-type-tools/afdko/issues/1425 141 "test_spec" 142 ] 143 ++ lib.optionals (stdenv.hostPlatform.isi686) [ 144 "test_dump_option" 145 "test_type1mm_inputs" 146 ]; 147 148 passthru.tests = { 149 fullTestsuite = afdko.override { runAllTests = true; }; 150 }; 151 152 meta = with lib; { 153 description = "Adobe Font Development Kit for OpenType"; 154 changelog = "https://github.com/adobe-type-tools/afdko/blob/${version}/NEWS.md"; 155 homepage = "https://adobe-type-tools.github.io/afdko"; 156 license = licenses.asl20; 157 maintainers = with maintainers; [ sternenseemann ]; 158 }; 159}