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 15cfedbdae893..b4dc270fbfda5 100644 --- a/pkgs/by-name/li/libpsl/package.nix +++ b/pkgs/by-name/li/libpsl/package.nix @@ -11,7 +11,6 @@ libunistring, libxslt, pkg-config, - python3, buildPackages, publicsuffix-list, }: @@ -25,13 +24,10 @@ stdenv.mkDerivation rec { hash = "sha256-mp9qjG7bplDPnqVUdc0XLdKEhzFoBOnHMgLZdXLNOi0="; }; - outputs = - [ - "out" - "dev" - ] - # bin/psl-make-dafsa brings a large runtime closure through python3 - ++ lib.optional (!stdenv.hostPlatform.isStatic) "bin"; + outputs = [ + "out" + "dev" + ]; nativeBuildInputs = [ autoreconfHook @@ -47,18 +43,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 = ''