at 24.11-pre 3.1 kB view raw
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 lib.optionals (!runAllTests) [ 113 # Disable slow tests, reduces test time ~25 % 114 "test_report" 115 "test_post_overflow" 116 "test_cjk" 117 "test_extrapolate" 118 "test_filename_without_dir" 119 "test_overwrite" 120 "test_options" 121 ] 122 ++ lib.optionals (stdenv.hostPlatform.isAarch || stdenv.hostPlatform.isRiscV) [ 123 # unknown reason so far 124 # https://github.com/adobe-type-tools/afdko/issues/1425 125 "test_spec" 126 ] 127 ++ lib.optionals (stdenv.hostPlatform.isi686) [ 128 "test_dump_option" 129 "test_type1mm_inputs" 130 ]; 131 132 passthru.tests = { 133 fullTestsuite = afdko.override { runAllTests = true; }; 134 }; 135 136 meta = with lib; { 137 changelog = "https://github.com/adobe-type-tools/afdko/blob/${version}/NEWS.md"; 138 description = "Adobe Font Development Kit for OpenType"; 139 homepage = "https://adobe-type-tools.github.io/afdko"; 140 license = licenses.asl20; 141 maintainers = [ maintainers.sternenseemann ]; 142 }; 143}