mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-21 16:11:22 +00:00
nuspell: move to by-name, add withDict wrapper, finalAttrs (#442139)
This commit is contained in:
81
pkgs/by-name/nu/nuspell/package.nix
Normal file
81
pkgs/by-name/nu/nuspell/package.nix
Normal file
@@ -0,0 +1,81 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
callPackage,
|
||||
fetchFromGitHub,
|
||||
cmake,
|
||||
ctestCheckHook,
|
||||
buildPackages,
|
||||
pkg-config,
|
||||
icu,
|
||||
catch2_3,
|
||||
testers,
|
||||
enableManpages ? buildPackages.pandoc.compiler.bootstrapAvailable,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "nuspell";
|
||||
version = "5.1.6";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "nuspell";
|
||||
repo = "nuspell";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-U/lHSxpKsBnamf4ikE2aIjEPSU5fxjtuSmhZR0jxMAI=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
pkg-config
|
||||
]
|
||||
++ lib.optional enableManpages buildPackages.pandoc;
|
||||
|
||||
strictDeps = true;
|
||||
buildInputs = [ catch2_3 ];
|
||||
|
||||
propagatedBuildInputs = [ icu ];
|
||||
|
||||
cmakeFlags = lib.optional (!enableManpages) "-DBUILD_DOCS=OFF";
|
||||
|
||||
nativeCheckInputs = [
|
||||
ctestCheckHook
|
||||
];
|
||||
|
||||
doCheck = true;
|
||||
|
||||
outputs = [
|
||||
"out"
|
||||
"lib"
|
||||
"dev"
|
||||
];
|
||||
|
||||
passthru = {
|
||||
withDicts = callPackage ./wrapper.nix { nuspell = finalAttrs.finalPackage; };
|
||||
|
||||
tests = {
|
||||
wrapper = testers.testVersion {
|
||||
package = finalAttrs.finalPackage.withDicts (d: [ d.en_US ]);
|
||||
};
|
||||
|
||||
pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
|
||||
|
||||
cmake = testers.hasCmakeConfigModules {
|
||||
moduleNames = [ "Nuspell" ];
|
||||
package = finalAttrs.finalPackage;
|
||||
version = finalAttrs.version;
|
||||
versionCheck = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "Free and open source C++ spell checking library";
|
||||
mainProgram = "nuspell";
|
||||
pkgConfigModules = [ "nuspell" ];
|
||||
homepage = "https://nuspell.github.io/";
|
||||
platforms = lib.platforms.all;
|
||||
maintainers = with lib.maintainers; [ fpletz ];
|
||||
license = lib.licenses.lgpl3Plus;
|
||||
changelog = "https://github.com/nuspell/nuspell/blob/v${finalAttrs.version}/CHANGELOG.md";
|
||||
};
|
||||
})
|
||||
38
pkgs/by-name/nu/nuspell/wrapper.nix
Normal file
38
pkgs/by-name/nu/nuspell/wrapper.nix
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
lib,
|
||||
buildEnv,
|
||||
nuspell,
|
||||
hunspellDicts,
|
||||
makeBinaryWrapper,
|
||||
}:
|
||||
|
||||
lib.makeOverridable (
|
||||
dicts: f:
|
||||
buildEnv {
|
||||
inherit (lib.appendToName "with-dicts" nuspell) name version;
|
||||
|
||||
paths = f dicts;
|
||||
|
||||
pathsToLink = [ "/share/hunspell" ];
|
||||
|
||||
nativeBuildInputs = [ makeBinaryWrapper ];
|
||||
|
||||
postBuild = ''
|
||||
makeWrapper ${lib.getExe nuspell} $out/bin/nuspell \
|
||||
--prefix DICPATH : $out/share/hunspell
|
||||
'';
|
||||
|
||||
meta = {
|
||||
inherit (nuspell.meta)
|
||||
description
|
||||
longDescription
|
||||
homepage
|
||||
changelog
|
||||
license
|
||||
maintainers
|
||||
mainProgram
|
||||
platforms
|
||||
;
|
||||
};
|
||||
}
|
||||
) hunspellDicts
|
||||
@@ -1,60 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
cmake,
|
||||
buildPackages,
|
||||
pkg-config,
|
||||
icu,
|
||||
catch2_3,
|
||||
enableManpages ? buildPackages.pandoc.compiler.bootstrapAvailable,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "nuspell";
|
||||
version = "5.1.6";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "nuspell";
|
||||
repo = "nuspell";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-U/lHSxpKsBnamf4ikE2aIjEPSU5fxjtuSmhZR0jxMAI=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
pkg-config
|
||||
]
|
||||
++ lib.optionals enableManpages [
|
||||
buildPackages.pandoc
|
||||
];
|
||||
|
||||
buildInputs = [ catch2_3 ];
|
||||
|
||||
propagatedBuildInputs = [ icu ];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DBUILD_TESTING=YES"
|
||||
]
|
||||
++ lib.optionals (!enableManpages) [
|
||||
"-DBUILD_DOCS=OFF"
|
||||
];
|
||||
|
||||
doCheck = true;
|
||||
|
||||
outputs = [
|
||||
"out"
|
||||
"lib"
|
||||
"dev"
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Free and open source C++ spell checking library";
|
||||
mainProgram = "nuspell";
|
||||
homepage = "https://nuspell.github.io/";
|
||||
platforms = platforms.all;
|
||||
maintainers = with maintainers; [ fpletz ];
|
||||
license = licenses.lgpl3Plus;
|
||||
changelog = "https://github.com/nuspell/nuspell/blob/v${version}/CHANGELOG.md";
|
||||
};
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
stdenv,
|
||||
lib,
|
||||
nuspell,
|
||||
makeWrapper,
|
||||
dicts ? [ ],
|
||||
}:
|
||||
|
||||
let
|
||||
searchPath = lib.makeSearchPath "share/hunspell" dicts;
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
name = (lib.appendToName "with-dicts" nuspell).name;
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
buildCommand = ''
|
||||
makeWrapper ${nuspell}/bin/nuspell $out/bin/nuspell --prefix DICPATH : ${lib.escapeShellArg searchPath}
|
||||
'';
|
||||
meta = removeAttrs nuspell.meta [ "outputsToInstall" ];
|
||||
}
|
||||
@@ -8528,9 +8528,11 @@ with pkgs;
|
||||
nss = nss_esr;
|
||||
nssTools = nss.tools;
|
||||
|
||||
nuspell = callPackage ../development/libraries/nuspell { };
|
||||
nuspellWithDicts =
|
||||
dicts: callPackage ../development/libraries/nuspell/wrapper.nix { inherit dicts; };
|
||||
dicts:
|
||||
lib.warn "nuspellWithDicts is deprecated, please use nuspell.withDicts instead." nuspell.withDicts (
|
||||
_: dicts
|
||||
);
|
||||
|
||||
nv-codec-headers-9 = nv-codec-headers.override { majorVersion = "9"; };
|
||||
nv-codec-headers-10 = nv-codec-headers.override { majorVersion = "10"; };
|
||||
|
||||
Reference in New Issue
Block a user