2023-01-20 10:41:00 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, buildPythonPackage
|
2024-01-13 08:15:51 +00:00
|
|
|
, fetchFromGitHub
|
2023-01-20 10:41:00 +00:00
|
|
|
, pythonOlder
|
|
|
|
, fonttools
|
|
|
|
, defcon
|
|
|
|
, lxml
|
|
|
|
, fs
|
|
|
|
, unicodedata2
|
|
|
|
, zopfli
|
|
|
|
, brotlipy
|
|
|
|
, fontpens
|
|
|
|
, brotli
|
|
|
|
, fontmath
|
|
|
|
, mutatormath
|
|
|
|
, booleanoperations
|
|
|
|
, ufoprocessor
|
|
|
|
, ufonormalizer
|
|
|
|
, tqdm
|
|
|
|
, setuptools-scm
|
|
|
|
, scikit-build
|
2021-12-26 17:43:05 +00:00
|
|
|
, cmake
|
2023-10-09 19:29:22 +00:00
|
|
|
, ninja
|
2021-12-26 17:43:05 +00:00
|
|
|
, antlr4_9
|
2022-07-14 12:49:19 +00:00
|
|
|
, libxml2
|
2020-12-25 13:55:36 +00:00
|
|
|
, pytestCheckHook
|
2021-12-26 17:43:05 +00:00
|
|
|
# Enables some expensive tests, useful for verifying an update
|
|
|
|
, runAllTests ? false
|
|
|
|
, afdko
|
2020-09-25 04:45:31 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "afdko";
|
2024-02-07 01:22:34 +00:00
|
|
|
version = "4.0.1";
|
2023-01-20 10:41:00 +00:00
|
|
|
format = "pyproject";
|
2020-09-25 04:45:31 +00:00
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
2020-09-25 04:45:31 +00:00
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "adobe-type-tools";
|
|
|
|
repo = pname;
|
2024-02-07 01:22:34 +00:00
|
|
|
rev = "refs/tags/${version}";
|
|
|
|
hash = "sha256-I5GKPkbyQX8QNSZgNB3wPKdWwpx8Xkklesu1M7nhgp8=";
|
2020-09-25 04:45:31 +00:00
|
|
|
};
|
|
|
|
|
2021-12-26 17:43:05 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
setuptools-scm
|
|
|
|
scikit-build
|
|
|
|
cmake
|
2023-10-09 19:29:22 +00:00
|
|
|
ninja
|
2021-12-26 17:43:05 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
antlr4_9.runtime.cpp
|
2022-07-14 12:49:19 +00:00
|
|
|
libxml2.dev
|
2021-12-26 17:43:05 +00:00
|
|
|
];
|
|
|
|
|
2020-10-16 20:44:37 +00:00
|
|
|
patches = [
|
2021-12-26 17:43:05 +00:00
|
|
|
# Don't try to install cmake and ninja using pip
|
|
|
|
./no-pypi-build-tools.patch
|
2022-02-10 20:34:41 +00:00
|
|
|
|
2021-12-26 17:43:05 +00:00
|
|
|
# Use antlr4 runtime from nixpkgs and link it dynamically
|
|
|
|
./use-dynamic-system-antlr4-runtime.patch
|
2020-10-16 20:44:37 +00:00
|
|
|
];
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
# Happy new year
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace tests/tx_data/expected_output/alt-missing-glif.pfb --replace 2023 2024
|
|
|
|
'';
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang (toString [
|
|
|
|
"-Wno-error=incompatible-function-pointer-types"
|
|
|
|
"-Wno-error=int-conversion"
|
|
|
|
]);
|
|
|
|
|
2021-12-26 17:43:05 +00:00
|
|
|
# setup.py will always (re-)execute cmake in buildPhase
|
|
|
|
dontConfigure = true;
|
2020-09-25 04:45:31 +00:00
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
booleanoperations
|
|
|
|
fonttools
|
|
|
|
lxml # fonttools[lxml], defcon[lxml] extra
|
|
|
|
fs # fonttools[ufo] extra
|
|
|
|
unicodedata2 # fonttools[unicode] extra
|
|
|
|
brotlipy # fonttools[woff] extra
|
|
|
|
zopfli # fonttools[woff] extra
|
|
|
|
fontpens
|
|
|
|
brotli
|
|
|
|
defcon
|
|
|
|
fontmath
|
|
|
|
mutatormath
|
|
|
|
ufoprocessor
|
|
|
|
ufonormalizer
|
2020-10-16 20:44:37 +00:00
|
|
|
tqdm
|
2020-09-25 04:45:31 +00:00
|
|
|
];
|
|
|
|
|
2023-01-20 10:41:00 +00:00
|
|
|
# Use system libxml2
|
|
|
|
FORCE_SYSTEM_LIBXML2 = true;
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ pytestCheckHook ];
|
2023-01-20 10:41:00 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
preCheck = ''
|
|
|
|
export PATH=$PATH:$out/bin
|
2024-01-13 08:15:51 +00:00
|
|
|
|
|
|
|
# Remove build artifacts to prevent them from messing with the tests
|
|
|
|
rm -rf _skbuild
|
2021-12-06 16:07:01 +00:00
|
|
|
'';
|
2023-01-20 10:41:00 +00:00
|
|
|
|
2021-12-26 17:43:05 +00:00
|
|
|
disabledTests = lib.optionals (!runAllTests) [
|
2020-12-25 13:55:36 +00:00
|
|
|
# Disable slow tests, reduces test time ~25 %
|
|
|
|
"test_report"
|
|
|
|
"test_post_overflow"
|
|
|
|
"test_cjk"
|
|
|
|
"test_extrapolate"
|
|
|
|
"test_filename_without_dir"
|
|
|
|
"test_overwrite"
|
|
|
|
"test_options"
|
2022-08-12 12:06:08 +00:00
|
|
|
] ++ lib.optionals (stdenv.hostPlatform.isAarch || stdenv.hostPlatform.isRiscV) [
|
2022-06-16 17:23:12 +00:00
|
|
|
# unknown reason so far
|
2021-12-26 17:43:05 +00:00
|
|
|
# https://github.com/adobe-type-tools/afdko/issues/1425
|
|
|
|
"test_spec"
|
2022-04-15 01:41:22 +00:00
|
|
|
] ++ lib.optionals (stdenv.hostPlatform.isi686) [
|
2023-05-24 13:37:59 +00:00
|
|
|
"test_dump_option"
|
2022-04-15 01:41:22 +00:00
|
|
|
"test_type1mm_inputs"
|
2020-12-25 13:55:36 +00:00
|
|
|
];
|
2020-09-25 04:45:31 +00:00
|
|
|
|
2021-12-26 17:43:05 +00:00
|
|
|
passthru.tests = {
|
|
|
|
fullTestsuite = afdko.override { runAllTests = true; };
|
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2023-01-20 10:41:00 +00:00
|
|
|
changelog = "https://github.com/adobe-type-tools/afdko/blob/${version}/NEWS.md";
|
2020-09-25 04:45:31 +00:00
|
|
|
description = "Adobe Font Development Kit for OpenType";
|
2023-01-20 10:41:00 +00:00
|
|
|
homepage = "https://adobe-type-tools.github.io/afdko";
|
2020-09-25 04:45:31 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = [ maintainers.sternenseemann ];
|
|
|
|
};
|
|
|
|
}
|