Merge pull request #195239 from ncfavier/weechat

This commit is contained in:
Martin Weinelt
2022-10-10 20:27:23 +02:00
committed by GitHub
2 changed files with 23 additions and 10 deletions
@@ -1,20 +1,25 @@
{ stdenv, fetchurl, lib
, ncurses, openssl, aspell, gnutls, gettext
, zlib, curl, pkg-config, libgcrypt
, cmake, makeWrapper, libobjc, libresolv, libiconv
, cmake, libobjc, libresolv, libiconv
, asciidoctor # manpages
, enableTests ? !stdenv.isDarwin, cpputest
, guileSupport ? true, guile
, luaSupport ? true, lua5
, perlSupport ? true, perl
, pythonSupport ? true, python3Packages
, rubySupport ? true, ruby
, tclSupport ? true, tcl
, phpSupport ? !stdenv.isDarwin, php, systemd, libxml2, pcre2, libargon2
, extraBuildInputs ? []
, fetchpatch
}:
let
inherit (python3Packages) python;
php-embed = php.override {
embedSupport = true;
apxs2Support = false;
};
plugins = [
{ name = "perl"; enabled = perlSupport; cmakeFlag = "ENABLE_PERL"; buildInputs = [ perl ]; }
{ name = "tcl"; enabled = tclSupport; cmakeFlag = "ENABLE_TCL"; buildInputs = [ tcl ]; }
@@ -22,35 +27,37 @@ let
{ name = "guile"; enabled = guileSupport; cmakeFlag = "ENABLE_GUILE"; buildInputs = [ guile ]; }
{ name = "lua"; enabled = luaSupport; cmakeFlag = "ENABLE_LUA"; buildInputs = [ lua5 ]; }
{ name = "python"; enabled = pythonSupport; cmakeFlag = "ENABLE_PYTHON3"; buildInputs = [ python ]; }
{ name = "php"; enabled = phpSupport; cmakeFlag = "ENABLE_PHP"; buildInputs = [
php-embed.unwrapped.dev libxml2 pcre2 libargon2
] ++ lib.optional stdenv.isLinux systemd; }
];
enabledPlugins = builtins.filter (p: p.enabled) plugins;
in
assert lib.all (p: p.enabled -> ! (builtins.elem null p.buildInputs)) plugins;
stdenv.mkDerivation rec {
version = "3.6";
version = "3.7";
pname = "weechat";
hardeningEnable = [ "pie" ];
src = fetchurl {
url = "https://weechat.org/files/src/weechat-${version}.tar.bz2";
sha256 = "sha256-GkYN/Y4LQQr7GdSDu0ucXXM9wWPAqKD1txJXkOhJMDc=";
hash = "sha256-n5kvC//h85c4IvkrCVTz+F0DcCC5rdRkvj8W3fUPXI8=";
};
outputs = [ "out" "man" ] ++ map (p: p.name) enabledPlugins;
cmakeFlags = with lib; [
"-DENABLE_MAN=ON"
"-DENABLE_DOC=OFF" # TODO: Documentation fails to build, was deactivated to push through security update
"-DENABLE_JAVASCRIPT=OFF" # Requires v8 <= 3.24.3, https://github.com/weechat/weechat/issues/360
"-DENABLE_PHP=OFF"
"-DENABLE_DOC=OFF" # TODO(@ncfavier): Documentation fails to build, was deactivated to push through security update
"-DENABLE_TESTS=${if enableTests then "ON" else "OFF"}"
]
++ optionals stdenv.isDarwin ["-DICONV_LIBRARY=${libiconv}/lib/libiconv.dylib"]
++ map (p: "-D${p.cmakeFlag}=" + (if p.enabled then "ON" else "OFF")) plugins
;
nativeBuildInputs = [ cmake pkg-config makeWrapper asciidoctor ];
nativeBuildInputs = [ cmake pkg-config asciidoctor ] ++ lib.optional enableTests cpputest;
buildInputs = with lib; [
ncurses openssl aspell gnutls gettext zlib curl
libgcrypt ]
@@ -85,7 +92,7 @@ let
on https://nixos.org/nixpkgs/manual/#sec-weechat .
'';
license = lib.licenses.gpl3;
maintainers = with lib.maintainers; [ lovek323 ];
maintainers = with lib.maintainers; [ ncfavier ];
platforms = lib.platforms.unix;
};
}
@@ -7,7 +7,11 @@ weechat:
let
wrapper = {
installManPages ? true
, configure ? { availablePlugins, ... }: { plugins = builtins.attrValues availablePlugins; }
, configure ? { availablePlugins, ... }: {
# Do not include PHP by default, because it bloats the closure, doesn't
# build on Darwin, and there are no official PHP scripts.
plugins = builtins.attrValues (builtins.removeAttrs availablePlugins [ "php" ]);
}
}:
let
@@ -21,6 +25,7 @@ let
'';
withPackages = pkgsFun: (python // {
extraEnv = ''
${python.extraEnv}
export PYTHONHOME="${python3Packages.python.withPackages pkgsFun}"
'';
});
@@ -40,6 +45,7 @@ let
ruby = simplePlugin "ruby";
guile = simplePlugin "guile";
lua = simplePlugin "lua";
php = simplePlugin "php";
};
config = configure { inherit availablePlugins; };