Skip to content

Commit

Permalink
libpsl-with-scripts: init
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rhelmot committed Nov 18, 2024
1 parent a2f60bb commit b99433f
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 15 deletions.
53 changes: 53 additions & 0 deletions pkgs/by-name/li/libpsl-with-scripts/package.nix
Original file line number Diff line number Diff line change
@@ -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;
}
24 changes: 9 additions & 15 deletions pkgs/by-name/li/libpsl/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
libunistring,
libxslt,
pkg-config,
python3,
buildPackages,
publicsuffix-list,
}:
Expand All @@ -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
Expand All @@ -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 = ''
Expand Down

0 comments on commit b99433f

Please sign in to comment.