Merge pull request #209761 from anthonyroussel/cowsay

cowsay: 3.04 -> 3.7.0
This commit is contained in:
Jonas Heinrich 2023-01-10 17:18:36 +01:00 committed by GitHub
commit 0b418012b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,47 +1,47 @@
{ lib, stdenv, perl, installShellFiles, fetchFromGitHub }:
{ lib, stdenv, perl, fetchFromGitHub, fetchpatch, nix-update-script, testers, cowsay }:
stdenv.mkDerivation rec {
pname = "cowsay";
version = "3.04";
src = fetchFromGitHub {
owner = "tnalpgge";
repo = "rank-amateur-cowsay";
rev = "cowsay-${version}";
sha256 = "sha256-9jCaQ6Um6Nl9j0/urrMCRcsGeubRN3VWD3jDM/AshRg=";
};
buildInputs = [ perl ];
nativeBuildInputs = [ installShellFiles ];
# overriding buildPhase because we don't want to use the install.sh script
buildPhase = ''
runHook preBuild;
substituteInPlace cowsay --replace "%BANGPERL%" "!${perl}/bin/perl" \
--replace "%PREFIX%" "$out"
runHook postBuild;
'';
installPhase = ''
runHook preInstall
install -Dm755 cowsay $out/bin/cowsay
ln -s $out/bin/cowsay $out/bin/cowthink
installManPage cowsay.1
ln -s $man/share/man/man1/cowsay.1.gz $man/share/man/man1/cowthink.1.gz
install -Dm644 cows/* -t $out/share/cows/
runHook postInstall
'';
version = "3.7.0";
outputs = [ "out" "man" ];
src = fetchFromGitHub {
owner = "cowsay-org";
repo = "cowsay";
rev = "v${version}";
hash = "sha256-t1grmCPQhRgwS64RjEwkK61F2qxxMBKuv0/DzBTnL3s=";
};
patches = [
# Install cowthink as a symlink, not a copy
# See https://github.com/cowsay-org/cowsay/pull/18
(fetchpatch {
url = "https://github.com/cowsay-org/cowsay/commit/9e129fa0933cf1837672c97f5ae5ad4a1a10ec11.patch";
hash = "sha256-zAYEUAM5MkyMONAl5BXj8hBHRalQVAOdpxgiM+Ewmlw=";
})
];
buildInputs = [ perl ];
makeFlags = [
"prefix=${placeholder "out"}"
];
passthru = {
updateScript = nix-update-script { };
tests.version = testers.testVersion {
package = cowsay;
command = "cowsay --version";
};
};
meta = with lib; {
description = "A program which generates ASCII pictures of a cow with a message";
homepage = "https://github.com/tnalpgge/rank-amateur-cowsay";
homepage = "https://cowsay.diamonds";
changelog = "https://github.com/cowsay-org/cowsay/releases/tag/v${version}";
license = licenses.gpl3Only;
platforms = platforms.all;
maintainers = [ maintainers.rob ];
maintainers = with maintainers; [ rob anthonyroussel ];
};
}