nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
fork

Configure Feed

Select the types of activity you want to include in your feed.

python3Packages.pypdfium2: fix cross, reduce closure size

+44
+19
pkgs/development/python-modules/pypdfium2/default.nix
··· 1 1 { 2 + stdenv, 2 3 lib, 3 4 pkgs, 4 5 buildPythonPackage, ··· 10 9 numpy, 11 10 pillow, 12 11 pytestCheckHook, 12 + removeReferencesTo, 13 + python, 14 + replaceVars, 13 15 }: 14 16 15 17 let ··· 41 37 hash = "sha256-3JA7cW/xaEj/DxMHEypROwrKGo7EwUEcipRqALTvydw="; 42 38 }; 43 39 40 + patches = [ 41 + (replaceVars ./fix-cc-detection.patch { 42 + cc = "${stdenv.cc.targetPrefix}cc"; 43 + }) 44 + ]; 45 + 44 46 build-system = [ 45 47 setuptools-scm 46 48 ]; ··· 70 60 build-system = [ 71 61 ctypesgen 72 62 setuptools-scm 63 + ]; 64 + 65 + nativeBuildInputs = [ 66 + removeReferencesTo 73 67 ]; 74 68 75 69 propagatedBuildInputs = [ ··· 117 103 '{"major": 133, "minor": 0, "build": ${pdfiumVersion}, "patch": 1}' 118 104 ''; 119 105 env.PDFIUM_PLATFORM = "system:${pdfiumVersion}"; 106 + 107 + # Remove references to stdenv in comments. 108 + postInstall = '' 109 + remove-references-to -t ${stdenv.cc.cc} $out/${python.sitePackages}/pypdfium2_raw/bindings.py 110 + ''; 120 111 121 112 nativeCheckInputs = [ 122 113 numpy
+25
pkgs/development/python-modules/pypdfium2/fix-cc-detection.patch
··· 1 + diff --git a/src/ctypesgen/__main__.py b/src/ctypesgen/__main__.py 2 + index 23ee014..2d0cfc1 100644 3 + --- a/src/ctypesgen/__main__.py 4 + +++ b/src/ctypesgen/__main__.py 5 + @@ -89,17 +89,9 @@ def main_impl(args, cmd_str): 6 + assert _is_relative_to(args.output, args.linkage_anchor) 7 + 8 + if args.cpp: 9 + - assert shutil.which(args.cpp[0]), f"Given pre-processor {args.cpp[0]!r} is not available." 10 + - else: 11 + - if shutil.which("gcc"): 12 + - args.cpp = ["gcc", "-E"] 13 + - elif shutil.which("cpp"): 14 + - args.cpp = ["cpp"] 15 + - elif shutil.which("clang"): 16 + - args.cpp = ["clang", "-E"] 17 + - else: 18 + - raise RuntimeError("C pre-processor auto-detection failed: neither gcc nor clang available.") 19 + - 20 + + print("cpp argument ignored for nix build") 21 + + args.cpp = ["@cc@", "-E"] 22 + + 23 + # Important: must not use +=, this would mutate the original object, which is problematic when default=[] is used and ctypesgen called repeatedly from within python 24 + args.compile_libdirs = args.compile_libdirs + args.universal_libdirs 25 + args.runtime_libdirs = args.runtime_libdirs + args.universal_libdirs