From be9121fbadcacf1734a8a6d58a5bdbd215f50aae Mon Sep 17 00:00:00 2001 From: Audrey Dutcher Date: Wed, 23 Oct 2024 17:01:52 -0700 Subject: [PATCH] libpsl-with-scripts: init psl-make-dafsa pulls in a runtime python3 dependency which seems to have given various build configurations no end of trouble. This solves the problem in the least subtle manner imaginable, by removing it for all platforms and re-adding it in a new package which currently has no dependants. Switch your dependency from libpsl to libpsl-with-scripts if you are impacted by this. --- .../li/libpsl-with-scripts/package.nix | 53 +++++++++++++++++++ pkgs/by-name/li/libpsl/package.nix | 17 +++--- 2 files changed, 59 insertions(+), 11 deletions(-) create mode 100644 pkgs/by-name/li/libpsl-with-scripts/package.nix diff --git a/pkgs/by-name/li/libpsl-with-scripts/package.nix b/pkgs/by-name/li/libpsl-with-scripts/package.nix new file mode 100644 index 0000000000000..cc31b95798f9c --- /dev/null +++ b/pkgs/by-name/li/libpsl-with-scripts/package.nix @@ -0,0 +1,53 @@ +{ + lib, + stdenv, + libpsl, + python3, + lzip, +}: + +stdenv.mkDerivation { + pname = "libpsl-with-scripts"; + inherit (libpsl) src version patches; + outputs = libpsl.outputs ++ [ "bin" ]; + + nativeBuildInputs = [ + lzip + ]; + + buildInputs = [ + python3 + ]; + + postPatch = '' + patchShebangs src/psl-make-dafsa + ''; + + dontConfigure = true; + dontBuild = true; + + installPhase = + let + linkOutput = oldOutput: newOutput: '' + cd ${oldOutput} + find . -type d -print0 | xargs -0 -I{} mkdir -p ${newOutput}/{} + find . \( -type f -o -type l \) -print0 | xargs -0 -I{} ln -s ${oldOutput}/{} ${newOutput}/{} + cd - + ''; + links = lib.concatMapStrings ( + output: linkOutput libpsl.${output} (builtins.placeholder output) + ) libpsl.outputs; + in + '' + runHook preInstall + + ${links} + + install -D src/psl-make-dafsa $bin/bin/psl-make-dafsa + install -D -m 555 src/psl-make-dafsa.1 $out/share/man/man1/psl-make-dafsa.1 + + runHook postInstall + ''; + + dontFixup = true; +} diff --git a/pkgs/by-name/li/libpsl/package.nix b/pkgs/by-name/li/libpsl/package.nix index 81dd87ded09ce..f919f8cb30ff0 100644 --- a/pkgs/by-name/li/libpsl/package.nix +++ b/pkgs/by-name/li/libpsl/package.nix @@ -12,7 +12,6 @@ libunistring, libxslt, pkg-config, - python3, buildPackages, publicsuffix-list, }: @@ -40,9 +39,7 @@ stdenv.mkDerivation rec { [ "out" "dev" - ] - # bin/psl-make-dafsa brings a large runtime closure through python3 - ++ lib.optional (!stdenv.hostPlatform.isStatic) "bin"; + ]; nativeBuildInputs = [ autoreconfHook @@ -58,18 +55,16 @@ stdenv.mkDerivation rec { libidn2 libunistring libxslt - ] ++ lib.optional ( - !stdenv.hostPlatform.isStatic - && !stdenv.hostPlatform.isWindows - && (stdenv.hostPlatform.isDarwin -> stdenv.buildPlatform == stdenv.hostPlatform) - ) python3; + ]; propagatedBuildInputs = [ publicsuffix-list ]; - postPatch = lib.optionalString (!stdenv.hostPlatform.isStatic) '' - patchShebangs src/psl-make-dafsa + # bin/psl-make-dafsa brings a large runtime closure through python3 + # use the libpsl-with-scripts package if you need this + postInstall = '' + rm $out/bin/psl-make-dafsa $out/share/man/man1/psl-make-dafsa* ''; preAutoreconf = ''