summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2020-04-18 15:59:23 +0200
committerThomas Deutschmann <whissi@gentoo.org>2020-04-18 16:06:56 +0200
commit169f575b02bc02ac3a5396392b7386194a0ebf05 (patch)
tree3badd94436880b426410fee378cd640b5c2536e9 /dev-libs/redland-bindings
parentdev-python/python-gnupg: 0.4.6 (diff)
downloadgentoo-169f575b02bc02ac3a5396392b7386194a0ebf05.tar.gz
gentoo-169f575b02bc02ac3a5396392b7386194a0ebf05.tar.bz2
gentoo-169f575b02bc02ac3a5396392b7386194a0ebf05.zip
dev-libs/redland-bindings: fix PHP bindings
Closes: https://bugs.gentoo.org/717412 Closes: https://bugs.gentoo.org/685614 Package-Manager: Portage-2.3.99, Repoman-2.3.22 Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'dev-libs/redland-bindings')
-rw-r--r--dev-libs/redland-bindings/files/redland-bindings-1.0.17.1-add-PHP7-support.patch64
-rw-r--r--dev-libs/redland-bindings/files/redland-bindings-1.0.17.1-php-config-r1.patch77
-rw-r--r--dev-libs/redland-bindings/redland-bindings-1.0.17.1-r1.ebuild126
3 files changed, 267 insertions, 0 deletions
diff --git a/dev-libs/redland-bindings/files/redland-bindings-1.0.17.1-add-PHP7-support.patch b/dev-libs/redland-bindings/files/redland-bindings-1.0.17.1-add-PHP7-support.patch
new file mode 100644
index 000000000000..af8e3d560d7b
--- /dev/null
+++ b/dev-libs/redland-bindings/files/redland-bindings-1.0.17.1-add-PHP7-support.patch
@@ -0,0 +1,64 @@
+Origin: Based on patch from Petr Písař <ppisar@redhat.com>
+Date: Tue, 13 Jun 2017 15:29:15 +0200
+
+--- a/php/redland-post.i
++++ b/php/redland-post.i
+@@ -132,8 +132,11 @@ librdf_php_world_init(void)
+ exception_ce = zend_exception_get_default();
+ INIT_CLASS_ENTRY(ee_ce, "RedlandException", NULL);
+ redland_exception_ptr = zend_register_internal_class_ex(&ee_ce,
+- exception_ce,
+- NULL TSRMLS_CC);
++ exception_ce
++#if PHP_MAJOR_VERSION < 7
++ ,NULL TSRMLS_CC
++#endif
++ );
+ #endif
+
+ memset(&librdf_php_locator, '\0', sizeof(raptor_locator));
+--- a/php/redland-typemap.i
++++ b/php/redland-typemap.i
+@@ -1,17 +1,17 @@
+-%typemap(in) librdf_uri* %{
+- if(SWIG_ConvertPtr(*$input, (void **) &$1, SWIGTYPE_p_librdf_uri_s, 0) < 0) {
++%typemap(in) librdf_uri %{
++ if(SWIG_ConvertPtr($input, (void **) &$1, SWIGTYPE_p_librdf_uri_s, 0) < 0) {
+ /* Allow NULL from php for librdf_uri* */
+- if ((*$input)->type==IS_NULL)
++ if ($input->type==IS_NULL)
+ $1=NULL;
+ else
+ SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor");
+ }
+ %}
+
+-%typemap(in) librdf_node* %{
+- if(SWIG_ConvertPtr(*$input, (void **) &$1, SWIGTYPE_p_librdf_node_s, 0) < 0) {
++%typemap(in) librdf_node %{
++ if(SWIG_ConvertPtr($input, (void **) &$1, SWIGTYPE_p_librdf_node_s, 0) < 0) {
+ /* Allow NULL from php for librdf_node* */
+- if ((*$input)->type==IS_NULL)
++ if ($input->type==IS_NULL)
+ $1=NULL;
+ else
+ SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor");
+
+--- a/php/test.php
++++ b/php/test.php
+@@ -26,11 +26,9 @@
+ /* ------------------------------------------------------------------------ */
+
+ print "Testing Redland...\n";
+-$dlls = array("redland.so", "php_redland.dll", "redland.dylib", "redland.bundle");
+-foreach ($dlls as $dll) {
+- if(file_exists($dll)) {
+- dl($dll);
+- }
++if (extension_loaded('redland') !== true) {
++ print "Redland extension not loaded. Cannot run tests!" . PHP_EOL;
++ exit(1);
+ }
+
+ $world=librdf_php_get_world();
+
diff --git a/dev-libs/redland-bindings/files/redland-bindings-1.0.17.1-php-config-r1.patch b/dev-libs/redland-bindings/files/redland-bindings-1.0.17.1-php-config-r1.patch
new file mode 100644
index 000000000000..8f8dd409c0d3
--- /dev/null
+++ b/dev-libs/redland-bindings/files/redland-bindings-1.0.17.1-php-config-r1.patch
@@ -0,0 +1,77 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -58,7 +58,6 @@ AC_CHECK_PROGS(TAR, gnutar gtar tar)
+ AC_CHECK_PROGS(LUA, lua)
+ AC_CHECK_PROGS(PYTHON, python)
+ AC_CHECK_PROGS(PERL, perl)
+-AC_CHECK_PROGS(PHP, php)
+ AC_CHECK_PROGS(RUBY, ruby)
+ AC_CHECK_PROGS(SWIG, swig)
+ # Gnome
+@@ -153,15 +152,28 @@ if test "X$LUA_VERSION" != X; then
+ fi
+ fi
+
++dnl Find php-config script.
++AC_ARG_WITH([php-config],
++ [AS_HELP_STRING([--with-php-config=PATH], [Path to php-config [php-config]])],
++ [with_php_config=${withval}],
++ [with_php_config=php-config])
++
++if test "${with_php_config}" = "php-config"; then
++ AC_CHECK_PROG(PHP_CONFIG, php-config, php-config)
++elif test -x "${with_php_config}"; then
++ PHP_CONFIG=${with_php_config}
++ AC_SUBST(PHP_CONFIG)
++ AC_MSG_NOTICE([found ${PHP_CONFIG}])
++fi
+
+-AC_CHECK_PROG(PHP_CONFIG, php-config, php-config)
+ if test "X$PHP_CONFIG" != X ; then
++ PHP_VERSION=`${PHP_CONFIG} --version`
++ PHP_INCLUDES=`${PHP_CONFIG} --includes`
++ PHP_EXTENSION_DIR=`${PHP_CONFIG} --extension-dir`
+
+- PHP_VERSION=`$PHP_CONFIG --version`
+- PHP_INCLUDES=`$PHP_CONFIG --includes`
+- PHP_EXTENSION_DIR=`$PHP_CONFIG --extension-dir`
+-
+- if test $PHP_VERSION '>' 5.0.0; then
++ if test $PHP_VERSION '>' 7; then
++ PHP_SWIG="-php7"
++ elif test $PHP_VERSION '>' 5.0.0; then
+ PHP_SWIG="-php5"
+ else
+ PHP_SWIG="-php4"
+@@ -200,6 +212,8 @@ if test "X$PHP_CONFIG" != X ; then
+ AC_MSG_RESULT(compile '$PHP_CFLAGS' link '$PHP_LDFLAGS' suffix $PHP_SO_SUFFIX)
+
+ else
++ AC_MSG_WARN([php-config not found])
++
+ # This allows 'make clean' in the php directory to work when
+ # php isn't available
+ PHP=:
+@@ -445,13 +459,17 @@ if test "X$with_php" != Xno ; then
+ with_php=yes
+ fi
+
+-PHP_VERSION=`php-config --version 2>/dev/null`
+-if test "X$PHP_VERSION" != X; then
+- languages_available="$languages_available php($PHP_VERSION)"
+- if test $with_php = yes; then
+- languages="$languages php"
++if test "X${PHP_VERSION}" != "X"; then
++ languages_available="$languages_available php(${PHP_VERSION})"
++fi
++
++if test ${with_php} = yes; then
++ if test "X${PHP_VERSION}" = "X"; then
++ AC_MSG_ERROR([Failed to detect PHP version])
+ fi
++ languages="$languages php"
+ fi
++
+ AC_MSG_RESULT($with_php)
+ AC_SUBST(PHP_VERSION)
+
diff --git a/dev-libs/redland-bindings/redland-bindings-1.0.17.1-r1.ebuild b/dev-libs/redland-bindings/redland-bindings-1.0.17.1-r1.ebuild
new file mode 100644
index 000000000000..522be190cd48
--- /dev/null
+++ b/dev-libs/redland-bindings/redland-bindings-1.0.17.1-r1.ebuild
@@ -0,0 +1,126 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python2_7 python3_6 python3_7 python3_8 )
+
+USE_PHP="php7-2 php7-3 php7-4"
+PHP_EXT_ECONF_ARGS="--with-php=yes --without-lua --without-perl --without-python --without-ruby"
+PHP_EXT_NAME="redland"
+PHP_EXT_OPTIONAL_USE="php"
+PHP_EXT_SKIP_PATCHES="yes"
+PHP_EXT_SKIP_PHPIZE="yes"
+
+inherit php-ext-source-r3 python-single-r1 autotools
+
+DESCRIPTION="Language bindings for Redland"
+HOMEPAGE="http://librdf.org/bindings/"
+SRC_URI="http://download.librdf.org/source/${P}.tar.gz"
+
+LICENSE="Apache-2.0 GPL-2 LGPL-2.1"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-linux ~ppc-macos"
+IUSE="lua perl python php ruby"
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+BDEPEND="sys-apps/sed
+ virtual/pkgconfig"
+
+RDEPEND=">=dev-libs/redland-1.0.14
+ lua? ( >=dev-lang/lua-5.1 )
+ perl? ( dev-lang/perl:= )
+ python? ( ${PYTHON_DEPS} )
+ ruby? ( dev-lang/ruby dev-ruby/log4r )
+ php? (
+ php_targets_php7-2? ( dev-lang/php:7.2[-threads] )
+ php_targets_php7-3? ( dev-lang/php:7.3[-threads] )
+ php_targets_php7-4? ( dev-lang/php:7.4[-threads] )
+ )"
+
+DEPEND="${RDEPEND}
+ >=dev-lang/swig-2"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-bool.patch
+ "${FILESDIR}"/${PN}-1.0.17.1-php-config-r1.patch
+ "${FILESDIR}"/${PN}-1.0.17.1-add-PHP7-support.patch
+)
+
+pkg_setup() {
+ use python && python-single-r1_pkg_setup
+}
+
+src_prepare() {
+ default
+
+ eautoreconf
+
+ use php && php-ext-source-r3_src_prepare
+}
+
+src_configure() {
+ if use lua || use perl || use python || use ruby ; then
+ econf \
+ $(use_with lua) \
+ $(use_with perl) \
+ $(use_with python) \
+ --without-php \
+ $(use_with ruby)
+ fi
+
+ use php && php-ext-source-r3_src_configure
+}
+
+src_compile() {
+ if use lua || use perl || use python || use ruby ; then
+ default
+ fi
+
+ use php && php-ext-source-r3_src_compile
+}
+
+src_test() {
+ if use lua || use perl || use python || use ruby ; then
+ default
+ fi
+
+ if use php ; then
+ local slot
+ for slot in $(php_get_slots) ; do
+ php_init_slot_env "${slot}"
+ cd php || die
+ ${PHPCLI} -v
+ ${PHPCLI} -d "extension=./${PHP_EXT_NAME}.so" -f test.php || die "PHP tests for ${slot} failed!"
+ cd "${S}" || die
+ done
+ fi
+}
+
+src_install() {
+ if use lua || use perl || use python || use ruby ; then
+ emake DESTDIR="${D}" INSTALLDIRS=vendor luadir=/usr/$(get_libdir)/lua/5.1 install
+ fi
+
+ if use perl; then
+ find "${ED}" -type f -name perllocal.pod -delete
+ find "${ED}" -depth -mindepth 1 -type d -empty -delete
+ fi
+
+ use python && python_optimize
+
+ if use php; then
+ local slot
+ for slot in $(php_get_slots); do
+ php_init_slot_env "${slot}"
+ exeinto "${EXT_DIR#$EPREFIX}"
+ doexe "php/${PHP_EXT_NAME}.so"
+ done
+
+ php-ext-source-r3_createinifiles
+ fi
+
+ local DOCS=( AUTHORS ChangeLog NEWS README TODO )
+ local HTML_DOCS=( {NEWS,README,RELEASE,TODO}.html )
+ einstalldocs
+}