weechat: add PHP support

Add PHP support, but do not include it in the wrapper by default, because
- it doesn't build on Darwin,
- it doubles the closure size,
- there are no official scripts written in PHP,
- it's probably broken: the [example PHP
  script](https://weechat.org/files/doc/stable/weechat_scripting.en.html#register_function)
  from the manual fails to load.

Enable build-time tests (except on Darwin as they don't build).

Remove `-DENABLE_JAVASCRIPT=OFF`, which was made the default upstream [a long time
ago](340d6646a6).

Add myself as a maintainer.
This commit is contained in:
Naïm Favier 2022-10-09 16:26:53 +02:00
parent 86b0bec192
commit cea0c62688
No known key found for this signature in database
GPG Key ID: 95AFCE8211908325
2 changed files with 21 additions and 8 deletions

View File

@ -1,20 +1,25 @@
{ stdenv, fetchurl, lib { stdenv, fetchurl, lib
, ncurses, openssl, aspell, gnutls, gettext , ncurses, openssl, aspell, gnutls, gettext
, zlib, curl, pkg-config, libgcrypt , zlib, curl, pkg-config, libgcrypt
, cmake, makeWrapper, libobjc, libresolv, libiconv , cmake, libobjc, libresolv, libiconv
, asciidoctor # manpages , asciidoctor # manpages
, enableTests ? !stdenv.isDarwin, cpputest
, guileSupport ? true, guile , guileSupport ? true, guile
, luaSupport ? true, lua5 , luaSupport ? true, lua5
, perlSupport ? true, perl , perlSupport ? true, perl
, pythonSupport ? true, python3Packages , pythonSupport ? true, python3Packages
, rubySupport ? true, ruby , rubySupport ? true, ruby
, tclSupport ? true, tcl , tclSupport ? true, tcl
, phpSupport ? !stdenv.isDarwin, php, systemd, libxml2, pcre2, libargon2
, extraBuildInputs ? [] , extraBuildInputs ? []
, fetchpatch
}: }:
let let
inherit (python3Packages) python; inherit (python3Packages) python;
php-embed = php.override {
embedSupport = true;
apxs2Support = false;
};
plugins = [ plugins = [
{ name = "perl"; enabled = perlSupport; cmakeFlag = "ENABLE_PERL"; buildInputs = [ perl ]; } { name = "perl"; enabled = perlSupport; cmakeFlag = "ENABLE_PERL"; buildInputs = [ perl ]; }
{ name = "tcl"; enabled = tclSupport; cmakeFlag = "ENABLE_TCL"; buildInputs = [ tcl ]; } { name = "tcl"; enabled = tclSupport; cmakeFlag = "ENABLE_TCL"; buildInputs = [ tcl ]; }
@ -22,6 +27,9 @@ let
{ name = "guile"; enabled = guileSupport; cmakeFlag = "ENABLE_GUILE"; buildInputs = [ guile ]; } { name = "guile"; enabled = guileSupport; cmakeFlag = "ENABLE_GUILE"; buildInputs = [ guile ]; }
{ name = "lua"; enabled = luaSupport; cmakeFlag = "ENABLE_LUA"; buildInputs = [ lua5 ]; } { name = "lua"; enabled = luaSupport; cmakeFlag = "ENABLE_LUA"; buildInputs = [ lua5 ]; }
{ name = "python"; enabled = pythonSupport; cmakeFlag = "ENABLE_PYTHON3"; buildInputs = [ python ]; } { 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; enabledPlugins = builtins.filter (p: p.enabled) plugins;
@ -42,15 +50,14 @@ let
cmakeFlags = with lib; [ cmakeFlags = with lib; [
"-DENABLE_MAN=ON" "-DENABLE_MAN=ON"
"-DENABLE_DOC=OFF" # TODO: Documentation fails to build, was deactivated to push through security update "-DENABLE_DOC=OFF" # TODO(@ncfavier): 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_TESTS=${if enableTests then "ON" else "OFF"}"
"-DENABLE_PHP=OFF"
] ]
++ optionals stdenv.isDarwin ["-DICONV_LIBRARY=${libiconv}/lib/libiconv.dylib"] ++ optionals stdenv.isDarwin ["-DICONV_LIBRARY=${libiconv}/lib/libiconv.dylib"]
++ map (p: "-D${p.cmakeFlag}=" + (if p.enabled then "ON" else "OFF")) plugins ++ 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; [ buildInputs = with lib; [
ncurses openssl aspell gnutls gettext zlib curl ncurses openssl aspell gnutls gettext zlib curl
libgcrypt ] libgcrypt ]
@ -85,7 +92,7 @@ let
on https://nixos.org/nixpkgs/manual/#sec-weechat . on https://nixos.org/nixpkgs/manual/#sec-weechat .
''; '';
license = lib.licenses.gpl3; license = lib.licenses.gpl3;
maintainers = with lib.maintainers; [ lovek323 ]; maintainers = with lib.maintainers; [ ncfavier ];
platforms = lib.platforms.unix; platforms = lib.platforms.unix;
}; };
} }

View File

@ -7,7 +7,11 @@ weechat:
let let
wrapper = { wrapper = {
installManPages ? true 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 let
@ -21,6 +25,7 @@ let
''; '';
withPackages = pkgsFun: (python // { withPackages = pkgsFun: (python // {
extraEnv = '' extraEnv = ''
${python.extraEnv}
export PYTHONHOME="${python3Packages.python.withPackages pkgsFun}" export PYTHONHOME="${python3Packages.python.withPackages pkgsFun}"
''; '';
}); });
@ -40,6 +45,7 @@ let
ruby = simplePlugin "ruby"; ruby = simplePlugin "ruby";
guile = simplePlugin "guile"; guile = simplePlugin "guile";
lua = simplePlugin "lua"; lua = simplePlugin "lua";
php = simplePlugin "php";
}; };
config = configure { inherit availablePlugins; }; config = configure { inherit availablePlugins; };