mirror of
https://github.com/weechat/weechat.git
synced 2026-07-05 07:25:42 +02:00
php: new php plugin
This plugin requires PHP >= 7.0.
This commit is contained in:
committed by
Sébastien Helleu
parent
8c046d9be9
commit
d032ee2159
+3
-1
@@ -19,10 +19,12 @@ before_script:
|
||||
# Workaround travis-ci/travis-ci#5326
|
||||
- export PATH=$(echo $PATH | tr ':' "\n" | sed '/\/opt\/python/d' | tr "\n" ":" | sed "s|::|:|g")
|
||||
- echo 'APT::Install-Recommends "false";' | sudo tee -a /etc/apt/apt.conf
|
||||
- sudo add-apt-repository -y ppa:ondrej/php
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get -y install devscripts equivs python-pip libenchant-dev autopoint cmake pkg-config libncursesw5-dev gem2deb libperl-dev python-dev python3-dev libaspell-dev liblua5.1-0-dev tcl8.5-dev guile-2.0-dev libv8-dev libcurl4-gnutls-dev libgcrypt11-dev libgnutls-dev zlib1g-dev curl libcpputest-dev
|
||||
- sudo apt-get -y install devscripts equivs python-pip libenchant-dev autopoint cmake pkg-config libncursesw5-dev gem2deb libperl-dev python-dev python3-dev libaspell-dev liblua5.1-0-dev tcl8.5-dev guile-2.0-dev libv8-dev libcurl4-gnutls-dev libgcrypt11-dev libgnutls-dev zlib1g-dev curl libcpputest-dev php7.0-dev libphp7.0-embed
|
||||
- sudo gem install asciidoctor
|
||||
- sudo pip install msgcheck pylint
|
||||
- phpenv local system
|
||||
|
||||
script:
|
||||
- ./tools/build-test.sh
|
||||
|
||||
@@ -107,6 +107,7 @@ option(ENABLE_LUA "Enable Lua scripting language" ON)
|
||||
option(ENABLE_TCL "Enable Tcl scripting language" ON)
|
||||
option(ENABLE_GUILE "Enable Scheme (guile) scripting language" ON)
|
||||
option(ENABLE_JAVASCRIPT "Enable JavaScript scripting language" ON)
|
||||
option(ENABLE_PHP "Enable PHP scripting language" ON)
|
||||
option(ENABLE_TRIGGER "Enable Trigger plugin" ON)
|
||||
option(ENABLE_XFER "Enable Xfer plugin" ON)
|
||||
option(ENABLE_MAN "Enable build of man page" OFF)
|
||||
|
||||
@@ -26,6 +26,7 @@ New features::
|
||||
* alias: add infolist "alias_default" (list of default aliases)
|
||||
* buflist: add option buflist.look.add_newline (issue #1027)
|
||||
* fset: new plugin "fset" (fast set of WeeChat and plugins options)
|
||||
* php: new plugin "php" (issue #909)
|
||||
|
||||
Improvements::
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
#
|
||||
# Copyright (C) 2003-2017 Adam Saponara <as@php.net>
|
||||
#
|
||||
# This file is part of WeeChat, the extensible chat client.
|
||||
#
|
||||
# WeeChat is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# WeeChat is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
if(PHP_FOUND)
|
||||
set(PHP_FIND_QUIETLY TRUE)
|
||||
endif()
|
||||
|
||||
find_package(PkgConfig)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_search_module(php7 php)
|
||||
endif()
|
||||
|
||||
if(NOT PHP_FOUND)
|
||||
find_program(PHP_CONFIG_EXECUTABLE NAMES
|
||||
php-config php-config7
|
||||
php-config7.2 php-config72
|
||||
php-config7.1 php-config71
|
||||
php-config7.0 php-config70)
|
||||
if (PHP_CONFIG_EXECUTABLE)
|
||||
execute_process(COMMAND ${PHP_CONFIG_EXECUTABLE} --prefix OUTPUT_VARIABLE PHP_LIB_PREFIX OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(COMMAND ${PHP_CONFIG_EXECUTABLE} --includes OUTPUT_VARIABLE PHP_INCLUDE_DIRS OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(COMMAND ${PHP_CONFIG_EXECUTABLE} --libs OUTPUT_VARIABLE PHP_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REPLACE "-I" "" PHP_INCLUDE_DIRS ${PHP_INCLUDE_DIRS})
|
||||
SEPARATE_ARGUMENTS(PHP_INCLUDE_DIRS)
|
||||
set(PHP_LDFLAGS "-L${PHP_LIB_PREFIX}/lib/ ${PHP_LIBS} -lphp7")
|
||||
set(PHP_FOUND 1)
|
||||
endif()
|
||||
endif()
|
||||
+110
File diff suppressed because it is too large
Load Diff
@@ -155,6 +155,13 @@ if(ENABLE_SCRIPTS AND ENABLE_JAVASCRIPT)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_SCRIPTS AND ENABLE_PHP)
|
||||
find_package(PHP)
|
||||
if(PHP_FOUND)
|
||||
add_subdirectory(php)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_TRIGGER)
|
||||
add_subdirectory(trigger)
|
||||
endif()
|
||||
|
||||
@@ -109,6 +109,10 @@ if PLUGIN_JAVASCRIPT
|
||||
javascript_dir = javascript
|
||||
endif
|
||||
|
||||
if PLUGIN_PHP
|
||||
php_dir = php
|
||||
endif
|
||||
|
||||
if PLUGIN_TRIGGER
|
||||
trigger_dir = trigger
|
||||
endif
|
||||
@@ -136,6 +140,7 @@ SUBDIRS = . \
|
||||
$(tcl_dir) \
|
||||
$(guile_dir) \
|
||||
$(javascript_dir) \
|
||||
$(php_dir) \
|
||||
$(trigger_dir) \
|
||||
$(xfer_dir)
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
#
|
||||
# Copyright (C) 2006-2017 Adam Saponara <as@php.net>
|
||||
#
|
||||
# This file is part of WeeChat, the extensible chat client.
|
||||
#
|
||||
# WeeChat is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# WeeChat is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
add_library(php MODULE weechat-php.c weechat-php.h weechat-php-api.c
|
||||
weechat-php-api.h)
|
||||
|
||||
set_target_properties(php PROPERTIES PREFIX "")
|
||||
|
||||
if(PHP_FOUND)
|
||||
include_directories(${PHP_INCLUDE_DIRS})
|
||||
target_link_libraries(php ${PHP_LDFLAGS} weechat_plugins_scripts)
|
||||
endif()
|
||||
|
||||
install(TARGETS php LIBRARY DESTINATION ${LIBDIR}/plugins)
|
||||
@@ -0,0 +1,33 @@
|
||||
#
|
||||
# Copyright (C) 2006-2017 Adam Saponara <as@php.net>
|
||||
#
|
||||
# This file is part of WeeChat, the extensible chat client.
|
||||
#
|
||||
# WeeChat is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# WeeChat is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
AM_CPPFLAGS = -DLOCALEDIR=\"$(datadir)/locale\" $(PHP_CFLAGS)
|
||||
|
||||
libdir = ${weechat_libdir}/plugins
|
||||
|
||||
lib_LTLIBRARIES = php.la
|
||||
|
||||
php_la_SOURCES = weechat-php.c \
|
||||
weechat-php.h \
|
||||
weechat-php-api.c \
|
||||
weechat-php-api.h
|
||||
php_la_LDFLAGS = -module -no-undefined
|
||||
php_la_LIBADD = ../lib_weechat_plugins_scripts.la $(PHP_LFLAGS)
|
||||
|
||||
EXTRA_DIST = CMakeLists.txt
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (C) 2006-2017 Adam Saponara <as@php.net>
|
||||
*
|
||||
* This file is part of WeeChat, the extensible chat client.
|
||||
*
|
||||
* WeeChat is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* WeeChat is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef WEECHAT_PHP_H
|
||||
#define WEECHAT_PHP_H 1
|
||||
|
||||
#define weechat_plugin weechat_php_plugin
|
||||
#define PHP_PLUGIN_NAME "php"
|
||||
#define PHP_WEECHAT_VERSION "0.1"
|
||||
|
||||
#define PHP_CURRENT_SCRIPT_NAME ((php_current_script) ? php_current_script->name : "-")
|
||||
|
||||
struct t_php_const
|
||||
{
|
||||
char *name;
|
||||
int int_value;
|
||||
char *str_value;
|
||||
};
|
||||
|
||||
extern int php_quiet;
|
||||
extern struct t_weechat_plugin *weechat_php_plugin;
|
||||
|
||||
extern struct t_hashtable *weechat_php_function_map;
|
||||
|
||||
extern struct t_plugin_script *php_scripts;
|
||||
extern struct t_plugin_script *last_php_script;
|
||||
extern struct t_plugin_script *php_current_script;
|
||||
extern struct t_plugin_script *php_registered_script;
|
||||
extern const char *php_current_script_filename;
|
||||
|
||||
extern void weechat_php_hashtable_to_array (struct t_hashtable *hashtable, zval *arr);
|
||||
extern struct t_hashtable *weechat_php_array_to_hashtable (zval* arr,
|
||||
int size,
|
||||
const char *type_keys,
|
||||
const char *type_values);
|
||||
extern void *weechat_php_exec (struct t_plugin_script *script,
|
||||
int ret_type,
|
||||
const char *function,
|
||||
const char *format, void **argv);
|
||||
|
||||
extern zval *weechat_php_func_map_get (const char *func_name);
|
||||
extern char *weechat_php_func_map_add (zval *ofunc);
|
||||
|
||||
#endif /* WEECHAT_PHP_H */
|
||||
Reference in New Issue
Block a user