summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--3_01.txt68
-rw-r--r--Makefile4
-rw-r--r--dbus-rpath.patch13
-rw-r--r--dbus-svn.patch208
-rw-r--r--php-pecl-dbus.spec199
5 files changed, 492 insertions, 0 deletions
diff --git a/3_01.txt b/3_01.txt
new file mode 100644
index 0000000..6059c80
--- /dev/null
+++ b/3_01.txt
@@ -0,0 +1,68 @@
+--------------------------------------------------------------------
+ The PHP License, version 3.01
+Copyright (c) 1999 - 2014 The PHP Group. All rights reserved.
+--------------------------------------------------------------------
+
+Redistribution and use in source and binary forms, with or without
+modification, is permitted provided that the following conditions
+are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ 3. The name "PHP" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact group@php.net.
+
+ 4. Products derived from this software may not be called "PHP", nor
+ may "PHP" appear in their name, without prior written permission
+ from group@php.net. You may indicate that your software works in
+ conjunction with PHP by saying "Foo for PHP" instead of calling
+ it "PHP Foo" or "phpfoo"
+
+ 5. The PHP Group may publish revised and/or new versions of the
+ license from time to time. Each version will be given a
+ distinguishing version number.
+ Once covered code has been published under a particular version
+ of the license, you may always continue to use it under the terms
+ of that version. You may also choose to use such covered code
+ under the terms of any subsequent version of the license
+ published by the PHP Group. No one other than the PHP Group has
+ the right to modify the terms applicable to covered code created
+ under this License.
+
+ 6. Redistributions of any form whatsoever must retain the following
+ acknowledgment:
+ "This product includes PHP software, freely available from
+ <http://www.php.net/software/>".
+
+THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
+ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP
+DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+OF THE POSSIBILITY OF SUCH DAMAGE.
+
+--------------------------------------------------------------------
+
+This software consists of voluntary contributions made by many
+individuals on behalf of the PHP Group.
+
+The PHP Group can be contacted via Email at group@php.net.
+
+For more information on the PHP Group and the PHP project,
+please see <http://www.php.net>.
+
+PHP includes the Zend Engine, freely available at
+<http://www.zend.com>.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..13af741
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,4 @@
+SRCDIR := $(shell pwd)
+NAME := $(shell basename $(SRCDIR))
+include ../../../common/Makefile
+
diff --git a/dbus-rpath.patch b/dbus-rpath.patch
new file mode 100644
index 0000000..cb9da29
--- /dev/null
+++ b/dbus-rpath.patch
@@ -0,0 +1,13 @@
+--- dbus-0.1.1/config.m4.old 2014-02-23 08:04:27.000000000 +0100
++++ dbus-0.1.1/config.m4 2014-02-23 08:13:18.000000000 +0100
+@@ -25,8 +25,8 @@
+
+ AC_MSG_CHECKING(for dbus)
+ if $PKG_CONFIG --exists dbus-1; then
+- AC_MSG_RESULT(found)
+- LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs dbus-1`"
++ LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs dbus-1 | sed -e s:-L/$PHP_LIBDIR:-L/usr/$PHP_LIBDIR:`"
++ AC_MSG_RESULT(found: $LDFLAGS)
+ CFLAGS="$CFLAGS `$PKG_CONFIG --cflags dbus-1`"
+ PHP_SETUP_LIBXML(DBUS_SHARED_LIBADD, [
+ AC_DEFINE(HAVE_DBUS, 1, [whether dbus exists in the system])
diff --git a/dbus-svn.patch b/dbus-svn.patch
new file mode 100644
index 0000000..9e8bd74
--- /dev/null
+++ b/dbus-svn.patch
@@ -0,0 +1,208 @@
+--- pecl/dbus/trunk/dbus.c 2011/08/03 16:10:11 314193
++++ pecl/dbus/trunk/dbus.c 2011/08/03 16:21:30 314194
+@@ -1031,7 +1031,7 @@
+ dbusobj->dbus = dbus;
+ dbusobj->destination = estrdup(destination);
+ dbusobj->path = estrdup(path);
+- dbusobj->interface = estrdup(interface);
++ dbusobj->interface = interface ? estrdup(interface) : NULL;
+
+ return 1;
+ }
+@@ -1099,7 +1099,7 @@
+ int destination_len, path_len, interface_len;
+
+ dbus_set_error_handling(EH_THROW, NULL TSRMLS_CC);
+- if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Osss",
++ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Osss!",
+ &object, dbus_ce_dbus,
+ &destination, &destination_len, &path, &path_len,
+ &interface, &interface_len))
+@@ -1127,7 +1127,7 @@
+ int destination_len, path_len, interface_len;
+
+ dbus_set_error_handling(EH_THROW, NULL TSRMLS_CC);
+- if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss",
++ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss!",
+ &destination, &destination_len, &path, &path_len,
+ &interface, &interface_len))
+ {
+@@ -1221,10 +1221,11 @@
+
+ static void php_dbus_accept_incoming_method_call(php_dbus_obj *dbus, DBusMessage *msg, zval **return_value TSRMLS_DC)
+ {
+- char *key, *class;
++ char *key, *class, *interface;
+
+ /* See if we can find a class mapping for this object */
+- spprintf(&key, 0, "%s:%s", dbus_message_get_path(msg), dbus_message_get_interface(msg));
++ interface = dbus_message_get_interface(msg);
++ spprintf(&key, 0, "%s:%s", dbus_message_get_path(msg), interface ? interface : "(null)");
+ if (zend_hash_find(&(dbus->objects), key, strlen(key) + 1, (void**) &class) == SUCCESS) {
+ zend_class_entry **pce;
+
+@@ -1336,14 +1337,17 @@
+
+ dbus_set_error_handling(EH_THROW, NULL TSRMLS_CC);
+ if (FAILURE == zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
+- "Osss", &object, dbus_ce_dbus, &path, &path_len, &interface, &interface_len,
++ "Oss!s", &object, dbus_ce_dbus, &path, &path_len, &interface, &interface_len,
+ &class, &class_len)) {
+ RETURN_FALSE;
+ }
+ dbus = (php_dbus_obj *) zend_object_store_get_object(object TSRMLS_CC);
+
+ /* Create the key out of the path and interface */
+- spprintf(&key, 0, "%s:%s", path, interface);
++ spprintf(&key, 0, "%s:%s", path, interface ? interface : "(null)");
++ if (interface == NULL) {
++ interface_len = 6;
++ }
+
+ /* Add class name to hash */
+ zend_hash_add(&(dbus->objects), key, path_len + interface_len + 2, (void*) estrdup(class), strlen(class)+1, NULL);
+--- pecl/dbus/trunk/dbus.c 2011/08/30 16:26:43 315793
++++ pecl/dbus/trunk/dbus.c 2011/08/30 16:29:53 315794
+@@ -26,6 +26,7 @@
+ #include "ext/standard/php_versioning.h"
+ #include "php_dbus.h"
+ #include "zend_extensions.h"
++#include "zend_exceptions.h"
+ #include "zend_interfaces.h"
+ #include "zend_hash.h"
+ #include "dbus/dbus.h"
+@@ -157,6 +158,7 @@
+ zend_class_entry *dbus_ce_dbus_array, *dbus_ce_dbus_dict, *dbus_ce_dbus_variant;
+ zend_class_entry *dbus_ce_dbus_variant, *dbus_ce_dbus_set, *dbus_ce_dbus_struct;
+ zend_class_entry *dbus_ce_dbus_object_path;
++zend_class_entry *dbus_ce_dbus_exception, *dbus_ce_dbus_exception_service, *dbus_ce_dbus_exception_method;
+
+ static zend_object_handlers dbus_object_handlers_dbus, dbus_object_handlers_dbus_object;
+ static zend_object_handlers dbus_object_handlers_dbus_signal;
+@@ -444,6 +446,7 @@
+ zend_class_entry ce_dbus, ce_dbus_object, ce_dbus_array, ce_dbus_dict;
+ zend_class_entry ce_dbus_variant, ce_dbus_signal, ce_dbus_set, ce_dbus_struct;
+ zend_class_entry ce_dbus_object_path;
++ zend_class_entry ce_dbus_exception, ce_dbus_exception_service, ce_dbus_exception_method;
+
+ INIT_CLASS_ENTRY(ce_dbus, "Dbus", dbus_funcs_dbus);
+ ce_dbus.create_object = dbus_object_new_dbus;
+@@ -470,6 +473,18 @@
+ zend_declare_class_constant_long(dbus_ce_dbus, "BUS_SESSION", sizeof("BUS_SESSION")-1, DBUS_BUS_SESSION TSRMLS_CC);
+ zend_declare_class_constant_long(dbus_ce_dbus, "BUS_SYSTEM", sizeof("BUS_SYSTEM")-1, DBUS_BUS_SYSTEM TSRMLS_CC);
+
++ INIT_CLASS_ENTRY(ce_dbus_exception, "DbusException", NULL);
++ dbus_ce_dbus_exception = zend_register_internal_class_ex(&ce_dbus_exception, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC);
++ dbus_ce_dbus_exception->ce_flags |= ZEND_ACC_FINAL;
++
++ INIT_CLASS_ENTRY(ce_dbus_exception_service, "DbusExceptionServiceUnknown", NULL);
++ dbus_ce_dbus_exception_service = zend_register_internal_class_ex(&ce_dbus_exception_service, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC);
++ dbus_ce_dbus_exception_service->ce_flags |= ZEND_ACC_FINAL;
++
++ INIT_CLASS_ENTRY(ce_dbus_exception_method, "DbusExceptionUnknownMethod", NULL);
++ dbus_ce_dbus_exception_method = zend_register_internal_class_ex(&ce_dbus_exception_method, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC);
++ dbus_ce_dbus_exception_method->ce_flags |= ZEND_ACC_FINAL;
++
+ INIT_CLASS_ENTRY(ce_dbus_object, "DbusObject", dbus_funcs_dbus_object);
+ ce_dbus_object.create_object = dbus_object_new_dbus_object;
+ dbus_ce_dbus_object = zend_register_internal_class_ex(&ce_dbus_object, NULL, NULL TSRMLS_CC);
+@@ -1883,12 +1898,23 @@
+
+ static int php_dbus_handle_reply(zval *return_value, DBusMessage *msg, int always_array TSRMLS_DC)
+ {
+- DBusMessageIter args;
+- dbus_int64_t stat;
+- zval *val;
++ zend_class_entry *exception_ce = NULL;
++ DBusMessageIter args;
++ dbus_int64_t stat;
++ zval *val;
+
+ if (dbus_message_get_type(msg) == DBUS_MESSAGE_TYPE_ERROR) {
+- dbus_set_error_handling(EH_THROW, NULL TSRMLS_CC);
++ const char* error_msg_str = dbus_message_get_error_name(msg);
++
++ if (!strcmp(error_msg_str, DBUS_ERROR_SERVICE_UNKNOWN)) {
++ exception_ce = dbus_ce_dbus_exception_service;
++ } else if (!strcmp(error_msg_str, DBUS_ERROR_UNKNOWN_METHOD)) {
++ exception_ce = dbus_ce_dbus_exception_method;
++ } else {
++ exception_ce = dbus_ce_dbus_exception;
++ }
++
++ dbus_set_error_handling(EH_THROW, exception_ce TSRMLS_CC);
+ if (!dbus_message_iter_init(msg, &args)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", dbus_message_get_error_name(msg));
+ return 0;
+--- pecl/dbus/trunk/dbus.c 2013/11/03 14:09:33 332054
++++ pecl/dbus/trunk/dbus.c 2013/11/03 15:36:02 332055
+@@ -2,7 +2,7 @@
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+- | Copyright (c) 1997-2008 The PHP Group |
++ | Copyright (c) 2008-2013 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+@@ -39,7 +39,7 @@
+ #endif
+
+ #if PHP_MINOR_VERSION > 3
+-# define INIT_OBJ_PROP object_properties_init(&intern->std, class_type);
++# define INIT_OBJ_PROP object_properties_init(&intern->std, class_type); if (!intern->std.properties) { rebuild_object_properties(&intern->std); };
+ #else
+ # define INIT_OBJ_PROP zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
+ #endif
+@@ -348,9 +348,9 @@
+
+ static int dbus_object_compare_dbus(zval *d1, zval *d2 TSRMLS_DC);
+
+-/* This is need to ensure that session extension request shutdown occurs 1st, because it uses the dbus extension */
+ static const zend_module_dep dbus_deps[] = {
+- {NULL, NULL, NULL}
++ ZEND_MOD_REQUIRED("libxml")
++ ZEND_MOD_END
+ };
+
+ #ifdef COMPILE_DL_DBUS
+@@ -2208,8 +2208,8 @@
+ zend_hash_update(props, "signature", 10, (void*)&sig, sizeof(zval *), NULL);
+ }
+
+- zend_hash_update(props, "array", 6, (void*)&array_obj->elements, sizeof(zval *), NULL);
+ Z_ADDREF_P(array_obj->elements);
++ zend_hash_update(props, "array", 6, (void*)&array_obj->elements, sizeof(zval *), NULL);
+
+ return props;
+ }
+@@ -2274,8 +2274,8 @@
+ zend_hash_update(props, "signature", 10, (void*)&sig, sizeof(zval *), NULL);
+ }
+
+- zend_hash_update(props, "dict", 5, (void*)&dict_obj->elements, sizeof(zval *), NULL);
+ Z_ADDREF_P(dict_obj->elements);
++ zend_hash_update(props, "dict", 5, (void*)&dict_obj->elements, sizeof(zval *), NULL);
+
+ return props;
+ }
+@@ -2328,8 +2328,8 @@
+
+ props = variant_obj->std.properties;
+
+- zend_hash_update(props, "variant", 8, (void*)&variant_obj->data, sizeof(zval *), NULL);
+ Z_ADDREF_P(variant_obj->data);
++ zend_hash_update(props, "variant", 8, (void*)&variant_obj->data, sizeof(zval *), NULL);
+
+ return props;
+ }
+@@ -2453,8 +2453,8 @@
+
+ props = struct_obj->std.properties;
+
+- zend_hash_update(props, "struct", 7, (void*)&struct_obj->elements, sizeof(zval *), NULL);
+ Z_ADDREF_P(struct_obj->elements);
++ zend_hash_update(props, "struct", 7, (void*)&struct_obj->elements, sizeof(zval *), NULL);
+
+ return props;
+ }
diff --git a/php-pecl-dbus.spec b/php-pecl-dbus.spec
new file mode 100644
index 0000000..dff2c34
--- /dev/null
+++ b/php-pecl-dbus.spec
@@ -0,0 +1,199 @@
+# spec file for php-pecl-dbus
+#
+# Copyright (c) 2014 Remi Collet
+# License: CC-BY-SA
+# http://creativecommons.org/licenses/by-sa/3.0/
+#
+# Please, preserve the changelog entries
+#
+%{?scl: %scl_package php-pecl-dbus}
+%{!?php_inidir: %global php_inidir %{_sysconfdir}/php.d}
+%{!?__pecl: %global __pecl %{_bindir}/pecl}
+%{!?__php: %global __php %{_bindir}/php}
+
+%global with_zts 0%{?__ztsphp:1}
+%global pecl_name dbus
+
+Summary: Extension for interaction with DBUS busses
+Name: %{?scl_prefix}php-pecl-%{pecl_name}
+Version: 0.1.1
+Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
+License: BSD
+Group: Development/Languages
+URL: http://pecl.php.net/package/%{pecl_name}
+Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz
+
+# Link from dbus.c header
+Source1: http://www.php.net/license/3_01.txt
+
+# Fix RPATH added because of "pkg-config --libs dbus-1"
+Patch0: %{pecl_name}-rpath.patch
+
+# http://svn.php.net/viewvc?view=revision&revision=332055
+# http://svn.php.net/viewvc?view=revision&revision=315794
+# http://svn.php.net/viewvc?view=revision&revision=314194
+Patch1: %{pecl_name}-svn.patch
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildRequires: %{?scl_prefix}php-devel > 5.2
+BuildRequires: %{?scl_prefix}php-pear
+BuildRequires: dbus-devel
+BuildRequires: libxml2-devel
+
+Requires(post): %{__pecl}
+Requires(postun): %{__pecl}
+Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api}
+Requires: %{?scl_prefix}php(api) = %{php_core_api}
+
+Provides: %{?scl_prefix}php-%{pecl_name} = %{version}
+Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version}
+Provides: %{?scl_prefix}php-pecl(%{pecl_name}) = %{version}
+Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version}
+
+%if 0%{!?scl:1}
+# Other third party repo stuff
+%if "%{php_version}" > "5.4"
+Obsoletes: php53-pecl-%{pecl_name}
+Obsoletes: php53u-pecl-%{pecl_name}
+Obsoletes: php54-pecl-%{pecl_name}
+%endif
+%if "%{php_version}" > "5.5"
+Obsoletes: php55u-pecl-%{pecl_name}
+%endif
+%endif
+
+%if 0%{?fedora} < 20
+# Filter shared private
+%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$}
+%{?filter_setup}
+%endif
+
+
+%description
+This extension allows you to talk to DBUS services on a system,
+and also act as a DBUS service.
+
+
+%prep
+%setup -q -c
+mv %{pecl_name}-%{version} NTS
+
+cd NTS
+%patch0 -p1 -b .rpath
+%patch1 -p3 -b .upstream
+
+cp %{SOURCE1} LICENSE
+
+# Fix version
+sed -e '/PHP_DBUS_VERSION/s/0.1.0/%{version}/' -i php_dbus.h
+
+# Sanity check, really often broken
+extver=$(sed -n '/#define PHP_DBUS_VERSION/{s/.* "//;s/".*$//;p}' php_dbus.h)
+if test "x${extver}" != "x%{version}"; then
+ : Error: Upstream extension version is ${extver}, expecting %{version}.
+ exit 1
+fi
+cd ..
+
+%if %{with_zts}
+# Duplicate source tree for NTS / ZTS build
+cp -pr NTS ZTS
+%endif
+
+# Create configuration file
+cat > %{pecl_name}.ini << 'EOF'
+; Enable %{pecl_name} extension module
+extension=%{pecl_name}.so
+EOF
+
+
+%build
+cd NTS
+%{_bindir}/phpize
+%configure \
+ --with-libdir=%{_lib} \
+ --with-php-config=%{_bindir}/php-config
+make %{?_smp_mflags}
+
+%if %{with_zts}
+cd ../ZTS
+%{_bindir}/zts-phpize
+%configure \
+ --with-libdir=%{_lib} \
+ --with-php-config=%{_bindir}/zts-php-config
+make %{?_smp_mflags}
+%endif
+
+
+%install
+rm -rf %{buildroot}
+
+make -C NTS \
+ install INSTALL_ROOT=%{buildroot}
+
+# install config file
+install -D -m 644 %{pecl_name}.ini %{buildroot}%{php_inidir}/%{pecl_name}.ini
+
+# Install XML package description
+install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml
+
+%if %{with_zts}
+make -C ZTS \
+ install INSTALL_ROOT=%{buildroot}
+
+install -D -m 644 %{pecl_name}.ini %{buildroot}%{php_ztsinidir}/%{pecl_name}.ini
+%endif
+
+# Documentation
+for i in LICENSE $(grep 'role="doc"' package.xml | sed -e 's/^.*name="//;s/".*$//')
+do install -Dpm 644 NTS/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i
+done
+
+
+%post
+%{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || :
+
+
+%postun
+if [ $1 -eq 0 ] ; then
+ %{pecl_uninstall} %{pecl_name} >/dev/null || :
+fi
+
+
+%check
+cd NTS
+: Minimal load test for NTS extension
+%{__php} --no-php-ini \
+ --define extension=modules/%{pecl_name}.so \
+ --modules | grep %{pecl_name}
+
+%if %{with_zts}
+cd ../ZTS
+: Minimal load test for ZTS extension
+%{__ztsphp} --no-php-ini \
+ --define extension=modules/%{pecl_name}.so \
+ --modules | grep %{pecl_name}
+%endif
+
+
+%clean
+rm -rf %{buildroot}
+
+
+%files
+%defattr(-,root,root,-)
+%doc %{pecl_docdir}/%{pecl_name}
+%{pecl_xmldir}/%{name}.xml
+%config(noreplace) %{php_inidir}/%{pecl_name}.ini
+%{php_extdir}/%{pecl_name}.so
+
+%if %{with_zts}
+%config(noreplace) %{php_ztsinidir}/%{pecl_name}.ini
+%{php_ztsextdir}/%{pecl_name}.so
+%endif
+
+
+%changelog
+* Sun Feb 23 2014 Remi Collet <remi@fedoraproject.org> - 0.1.1-1
+- initial package, version 0.1.1 (alpha)
+- upstream patches from SVN \ No newline at end of file