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