core/pkgs/by-name/li/libstemmer/default.nix

44 lines
1.1 KiB
Nix
Raw Normal View History

2024-05-02 00:46:19 +00:00
{ lib, stdenv, fetchFromGitHub, perl, buildPackages }:
stdenv.mkDerivation rec {
pname = "libstemmer";
version = "2.2.0";
src = fetchFromGitHub {
owner = "snowballstem";
repo = "snowball";
rev = "v${version}";
sha256 = "sha256-qXrypwv/I+5npvGHGsHveijoui0ZnoGYhskCfLkewVE=";
};
nativeBuildInputs = [ perl ];
prePatch = ''
patchShebangs .
2024-05-13 21:24:10 +00:00
'' + lib.optionalString
(!stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
substituteInPlace GNUmakefile \
--replace './snowball' '${
lib.getBin buildPackages.libstemmer
}/bin/snowball'
'';
2024-05-02 00:46:19 +00:00
makeTarget = "libstemmer.a";
installPhase = ''
runHook preInstall
install -Dt $out/lib libstemmer.a
install -Dt $out/include include/libstemmer.h
install -Dt $out/bin {snowball,stemwords}
runHook postInstall
'';
meta = with lib; {
description = "Snowball Stemming Algorithms";
homepage = "https://snowballstem.org/";
license = licenses.bsd3;
maintainers = with maintainers; [ fpletz ];
platforms = platforms.all;
};
}