python312Packages.libpwquality: fix build

fix build on python 3.12+
Have some old config to remove in the future via staging

+54 -12
+41 -12
pkgs/development/libraries/libpwquality/default.nix
··· 33 33 sha256 = "sha256-YjvHzd4iEBvg+qHOVJ7/y9HqyeT+QDalNE/jdNM9BNs="; 34 34 }; 35 35 36 - patches = [ 37 - # ensure python site-packages goes in $py output 38 - ./python-binding-prefix.patch 39 - 40 - (fetchpatch { 41 - name = "musl.patch"; 42 - url = "https://github.com/libpwquality/libpwquality/commit/b0fcd96954be89e8c318e5328dd27c40b401de96.patch"; 43 - hash = "sha256-ykN1hcRKyX3QAqWTH54kUjOxN6+IwRpqQVsujTd9XWs="; 44 - }) 45 - ]; 36 + patches = 37 + lib.optionals (!enablePython) [ 38 + # this patch isn't useful but keeping it to avoid rebuilds on !enablePython 39 + # before 24.11 fully lands 40 + ./python-binding-prefix.patch 41 + ] 42 + ++ [ 43 + # remove next release 44 + (fetchpatch { 45 + name = "musl.patch"; 46 + url = "https://github.com/libpwquality/libpwquality/commit/b0fcd96954be89e8c318e5328dd27c40b401de96.patch"; 47 + hash = "sha256-ykN1hcRKyX3QAqWTH54kUjOxN6+IwRpqQVsujTd9XWs="; 48 + }) 49 + ] 50 + ++ lib.optionals enablePython [ 51 + # remove next release 52 + (fetchpatch { 53 + name = "pr-74-use-setuptools-instead-of-distutils.patch"; 54 + url = "https://github.com/libpwquality/libpwquality/commit/509b0a744adf533b524daaa65f25dda144a6ff40.patch"; 55 + hash = "sha256-AxiynPVxv/gONujyj8y6b1XlsNkKszzW5TT9oINR/oo="; 56 + }) 57 + # remove next release 58 + (fetchpatch { 59 + name = "pr-80-respect-pythonsitedir.patch"; 60 + url = "https://github.com/libpwquality/libpwquality/commit/f92351b3998542e33d2b243fc446a4dd852dc972.patch"; 61 + hash = "sha256-1lmigZX/UiEFe9b0JXmlfw/371UYT4PF7Ev2Hv66v74="; 62 + }) 63 + # ensure python site-packages goes in $py output 64 + ./python-binding-root.patch 65 + ]; 46 66 47 67 nativeBuildInputs = [ 48 68 autoreconfHook 49 69 perl 50 - ] ++ lib.optionals enablePython [ (python.withPackages (ps: with ps; [ distutils ])) ]; 70 + ] ++ lib.optionals enablePython [ (python.withPackages (ps: with ps; [ setuptools ])) ]; 51 71 buildInputs = [ cracklib ] ++ lib.optionals enablePAM [ pam ]; 52 72 53 - configureFlags = lib.optionals (!enablePython) [ "--disable-python-bindings" ]; 73 + configureFlags = 74 + if enablePython then 75 + [ 76 + "--enable-python-bindings=yes" 77 + "--with-pythonsitedir=\"${python.sitePackages}\"" 78 + ] 79 + else 80 + # change to `--enable-python-bindings=no` in the future 81 + # leave for now to avoid rebuilds on !enablePython before 24.11 fully lands 82 + [ "--disable-python-bindings" ]; 54 83 55 84 meta = with lib; { 56 85 homepage = "https://github.com/libpwquality/libpwquality";
+13
pkgs/development/libraries/libpwquality/python-binding-root.patch
··· 1 + diff --git a/python/Makefile.am b/python/Makefile.am 2 + index 64d3892..365dc8e 100644 3 + --- a/python/Makefile.am 4 + +++ b/python/Makefile.am 5 + @@ -14,7 +14,7 @@ all-local: 6 + CFLAGS="${CFLAGS} -fno-strict-aliasing" @PYTHONBINARY@ setup.py build --build-base py$(PYTHONREV) 7 + 8 + install-exec-local: 9 + - CFLAGS="${CFLAGS} -fno-strict-aliasing" @PYTHONBINARY@ setup.py build --build-base py$(PYTHONREV) install --root ${DESTDIR} --prefix=${prefix} --install-lib=$(pythonsitedir) 10 + + CFLAGS="${CFLAGS} -fno-strict-aliasing" @PYTHONBINARY@ setup.py build --build-base py$(PYTHONREV) install --root ${py} --install-lib=$(pythonsitedir) 11 + 12 + clean-local: 13 + rm -rf py$(PYTHONREV)