at master 3.6 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 booleanoperations 85 defcon 86 fontmath 87 fontpens 88 fonttools 89 mutatormath 90 tqdm 91 ufonormalizer 92 ufoprocessor 93 ] 94 ++ defcon.optional-dependencies.lxml 95 ++ fonttools.optional-dependencies.lxml 96 ++ fonttools.optional-dependencies.ufo 97 ++ fonttools.optional-dependencies.unicode 98 ++ fonttools.optional-dependencies.woff; 99 100 # Use system libxml2 101 FORCE_SYSTEM_LIBXML2 = true; 102 103 nativeCheckInputs = [ pytestCheckHook ]; 104 105 preCheck = '' 106 export PATH=$PATH:$out/bin 107 108 # Remove build artifacts to prevent them from messing with the tests 109 rm -rf _skbuild 110 ''; 111 112 disabledTests = [ 113 # broke in the fontforge 4.51 -> 4.53 update 114 "test_glyphs_2_7" 115 "test_hinting_data" 116 "test_waterfallplot" 117 # broke at some point 118 "test_type1_supported_hint" 119 ] 120 ++ lib.optionals (stdenv.cc.isGNU) [ 121 # broke in the gcc 13 -> 14 update 122 "test_dump" 123 "test_input_formats" 124 "test_other_input_formats" 125 ] 126 ++ lib.optionals (!runAllTests) [ 127 # Disable slow tests, reduces test time ~25 % 128 "test_report" 129 "test_post_overflow" 130 "test_cjk" 131 "test_extrapolate" 132 "test_filename_without_dir" 133 "test_overwrite" 134 "test_options" 135 ] 136 ++ lib.optionals (stdenv.hostPlatform.isAarch || stdenv.hostPlatform.isRiscV) [ 137 # unknown reason so far 138 # https://github.com/adobe-type-tools/afdko/issues/1425 139 "test_spec" 140 ] 141 ++ lib.optionals (stdenv.hostPlatform.isi686) [ 142 "test_dump_option" 143 "test_type1mm_inputs" 144 ]; 145 146 passthru.tests = { 147 fullTestsuite = afdko.override { runAllTests = true; }; 148 }; 149 150 meta = with lib; { 151 description = "Adobe Font Development Kit for OpenType"; 152 changelog = "https://github.com/adobe-type-tools/afdko/blob/${version}/NEWS.md"; 153 homepage = "https://adobe-type-tools.github.io/afdko"; 154 license = licenses.asl20; 155 maintainers = with maintainers; [ sternenseemann ]; 156 }; 157}