diff options
| -rw-r--r-- | php-pecl-protocolbuffers.spec | 35 | ||||
| -rw-r--r-- | protocolbuffers-pr40.patch | 210 | 
2 files changed, 237 insertions, 8 deletions
diff --git a/php-pecl-protocolbuffers.spec b/php-pecl-protocolbuffers.spec index f20fa51..5d09579 100644 --- a/php-pecl-protocolbuffers.spec +++ b/php-pecl-protocolbuffers.spec @@ -13,16 +13,24 @@  %global with_zts  0%{?__ztsphp:1}  %global pecl_name protocolbuffers +%if "%{php_version}" < "5.6" +%global ini_name    %{pecl_name}.ini +%else +%global ini_name    40-%{pecl_name}.ini +%endif  Summary:        Protocol buffers in PHP  Name:           %{?scl_prefix}php-pecl-%{pecl_name} -Version:        0.2.2 +Version:        0.2.4  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 +# https://github.com/chobie/php-protocolbuffers/pull/40 +Patch0:         %{pecl_name}-pr40.patch +  BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)  BuildRequires:  %{?scl_prefix}php-devel > 5.2  BuildRequires:  %{?scl_prefix}php-pear @@ -71,6 +79,8 @@ are compiled against the "old" format.  mv %{pecl_name}-%{version} NTS  cd NTS +%patch0 -p1 -b .pr40 +  # Sanity check, really often broken  extver=$(sed -n '/#define PHP_PROTOCOLBUFFERS_VERSION/{s/.* "//;s/".*$//;p}' php_protocolbuffers.h)  if test "x${extver}" != "x%{version}"; then @@ -85,9 +95,13 @@ cp -pr NTS ZTS  %endif  # Create configuration file -cat > %{pecl_name}.ini << 'EOF' +cat > %{ini_name} << 'EOF'  ; Enable %{pecl_name} extension module  extension=%{pecl_name}.so + +; Configuration +;protocolbuffers.strict_mode=1 +;protocolbuffers.validate_string=1  EOF @@ -113,7 +127,7 @@ 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 -D -m 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name}  # Install XML package description  install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml @@ -121,7 +135,7 @@ 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 +install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name}  %endif  # Test & Documentation @@ -147,7 +161,7 @@ fi  cd NTS  : Minimal load test for NTS extension  %{__php} --no-php-ini \ -    --define extension= %{buildroot}%{php_extdir}/%{pecl_name}.so \ +    --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \      --modules | grep %{pecl_name}  : Upstream test suite  for NTS extension @@ -161,7 +175,7 @@ REPORT_EXIT_STATUS=1 \  cd ../ZTS  : Minimal load test for ZTS extension  %{__ztsphp} --no-php-ini \ -    --define extension= %{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ +    --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \      --modules | grep %{pecl_name}  : Upstream test suite  for ZTS extension @@ -182,16 +196,21 @@ rm -rf %{buildroot}  %doc %{pecl_docdir}/%{pecl_name}  %doc %{pecl_testdir}/%{pecl_name}  %{pecl_xmldir}/%{name}.xml -%config(noreplace) %{php_inidir}/%{pecl_name}.ini +%config(noreplace) %{php_inidir}/%{ini_name}  %{php_extdir}/%{pecl_name}.so  %if %{with_zts} -%config(noreplace) %{php_ztsinidir}/%{pecl_name}.ini +%config(noreplace) %{php_ztsinidir}/%{ini_name}  %{php_ztsextdir}/%{pecl_name}.so  %endif  %changelog +* Mon Apr 14 2014 Remi Collet <remi@fedoraproject.org> - 0.2.3-1 +- Update to 0.2.4 +- add numerical prefix to extension configuration file +- open https://github.com/chobie/php-protocolbuffers/pull/40 +  * Fri Feb 14 2014 Remi Collet <remi@fedoraproject.org> - 0.2.2-1  - Update to 0.2.2 (alpha) diff --git a/protocolbuffers-pr40.patch b/protocolbuffers-pr40.patch new file mode 100644 index 0000000..845a55b --- /dev/null +++ b/protocolbuffers-pr40.patch @@ -0,0 +1,210 @@ +From 9940a6576a89717a02e09d41a6cb5adf66577b70 Mon Sep 17 00:00:00 2001 +From: Remi Collet <fedora@famillecollet.com> +Date: Mon, 14 Apr 2014 10:45:13 +0200 +Subject: [PATCH 1/2] fix various build warning (cause test failure on x86_64) + +--- + json_serializer.c | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +diff --git a/json_serializer.c b/json_serializer.c +index b05e913..4f6d90d 100644 +--- a/json_serializer.c ++++ b/json_serializer.c +@@ -156,7 +156,7 @@ static int _json_serializer_sint64( + } +  + static int _json_serializer_fixed64( +-	int64_t value, ++	uint64_t value, + 	php_protocolbuffers_scheme *scheme, + 	php_protocolbuffers_scheme_container *container, + 	void *opaque TSRMLS_DC +@@ -403,7 +403,7 @@ static php_protocolbuffers_serializer2 json_serializer = { + }; +  +  +-static const char* php_protocolbuffers_get_property_name(php_protocolbuffers_scheme_container *container, php_protocolbuffers_scheme *scheme, size_t *name_len) ++static const char* php_protocolbuffers_get_property_name(php_protocolbuffers_scheme_container *container, php_protocolbuffers_scheme *scheme, int *name_len) + { + 	const char *name; + 	if (container->use_single_property < 1) { +@@ -634,7 +634,7 @@ static int php_protocolbuffers_json_encode_value(zval **element, php_protocolbuf + 			int32_t v; +  + 			zval_copy_ctor(&value_copy); +-			convert_to_int64(&value_copy, &v); ++			convert_to_int32(&value_copy, &v); + 			ser->serialize_sfixed32(v, scheme, container, outer TSRMLS_CC); + 			zval_dtor(&value_copy); + 			break; +@@ -751,13 +751,13 @@ int php_protocolbuffers_fetch_element2(php_protocolbuffers_scheme_container *con +  + 	if (zend_hash_find(hash, name, name_len, (void **)&tmp) == SUCCESS) { + 		*output = *tmp; +-		return 0; + 	} else { + 		if (scheme->required > 0) { + 			php_protocolbuffers_raise_error_or_exception(php_protocol_buffers_invalid_protocolbuffers_exception_class_entry, E_WARNING, 0, "the class does not declared required property `%s`. probably you missed declaration", scheme->name); + 			return 1; + 		} + 	} ++	return 0; + } +  +  +@@ -768,7 +768,6 @@ int php_protocolbuffers_encode_jsonserialize(zval *klass, php_protocolbuffers_sc + 	HashTable *hash = NULL; + 	zval **c = NULL; + 	zval *target = *result; +-	php_protocolbuffers_serializer2 *ser = &json_serializer; +  + 	if (container->use_single_property < 1) { + 		hash = Z_OBJPROP_P(klass); +--  +1.9.1 + + +From 38b24cce0ebce9485149fb611e00338b0a48b670 Mon Sep 17 00:00:00 2001 +From: Remi Collet <fedora@famillecollet.com> +Date: Mon, 14 Apr 2014 11:05:24 +0200 +Subject: [PATCH 2/2] fix more build warnings + +--- + enum.c                    | 6 +++--- + enum_descriptor_builder.c | 2 +- + helper.c                  | 6 +++--- + message.c                 | 2 -- + serializer.c              | 2 +- + unknown_field_set.c       | 2 +- + 6 files changed, 9 insertions(+), 11 deletions(-) + +diff --git a/enum.c b/enum.c +index 96c1005..058ebbd 100644 +--- a/enum.c ++++ b/enum.c +@@ -26,7 +26,7 @@ PHP_METHOD(protocolbuffers_enum, isValid) + 	return; + #else + 	long value; +-	zval *result, *result2; ++	zval *result; +  + 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, + 		"l", &value) == FAILURE) { +@@ -71,7 +71,7 @@ PHP_METHOD(protocolbuffers_enum, getName) + 	return; + #else + 	long value; +-	zval *result, *result2; ++	zval *result; +  + 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, + 		"l", &value) == FAILURE) { +@@ -79,7 +79,7 @@ PHP_METHOD(protocolbuffers_enum, getName) + 	} +  + 	if (zend_call_method_with_0_params(NULL, EG(called_scope), NULL, "getenumdescriptor", &result)) { +-		zval *values, **entry, **key; ++		zval *values, **entry; + 		HashPosition pos; +  + 		if (!instanceof_function_ex(Z_OBJCE_P(result), php_protocol_buffers_enum_descriptor_class_entry, 0 TSRMLS_CC)) { +diff --git a/enum_descriptor_builder.c b/enum_descriptor_builder.c +index 5207ab8..5f556b4 100644 +--- a/enum_descriptor_builder.c ++++ b/enum_descriptor_builder.c +@@ -27,7 +27,7 @@ PHP_METHOD(protocolbuffers_enum_descriptor_builder, __construct) + PHP_METHOD(protocolbuffers_enum_descriptor_builder, addValue) + { + 	zval *instance = getThis(); +-	zval *value, **fields, *name, *value2; ++	zval *value, **fields, *name; + 	zend_bool force = 0; + 	char *property; + 	int property_len; +diff --git a/helper.c b/helper.c +index 3daaf8d..1b89b97 100644 +--- a/helper.c ++++ b/helper.c +@@ -35,7 +35,7 @@ static void php_protocolbuffers_helper_debug_zval(zval **value TSRMLS_DC) + 	zval *val = *value; +  + 	php_printf("{\n"); +-	php_printf("  address: 0x%x,\n", (unsigned int)val); ++	php_printf("  address: 0x%lx,\n", (unsigned long)val); + 	php_printf("  type: %d,\n", val->type); + 	php_printf("  is_ref: %d,\n", PZVAL_IS_REF(val)); + 	php_printf("  refcount: %d,\n", Z_REFCOUNT_PP(value)); +@@ -44,14 +44,14 @@ static void php_protocolbuffers_helper_debug_zval(zval **value TSRMLS_DC) + 	php_printf("    double: %f,\n", val->value.dval); + 	if (val->type == 4) { + 		php_printf("    ht: {\n"); +-		php_printf("      address: 0x%x,\n", (unsigned int)val->value.ht); ++		php_printf("      address: 0x%lx,\n", (unsigned long)val->value.ht); + 		php_printf("      num_of_elements: %d,\n", (unsigned int)val->value.ht->nNumOfElements); + 		php_printf("      next_free_elements: %d,\n", (unsigned int)val->value.ht->nNextFreeElement); + 		php_printf("    },\n"); + 	} + 	php_printf("    object: {\n"); + 	php_printf("      handle: 0x%x,\n", val->value.obj.handle); +-	php_printf("      handlers: 0x%x,\n", (unsigned int)val->value.obj.handlers); ++	php_printf("      handlers: 0x%lx,\n", (unsigned long)val->value.obj.handlers); + 	php_printf("    },\n"); + 	php_printf("  }\n"); + 	php_printf("}\n"); +diff --git a/message.c b/message.c +index 58b38dc..d051963 100644 +--- a/message.c ++++ b/message.c +@@ -1571,7 +1571,6 @@ PHP_METHOD(protocolbuffers_message, clearExtension) +  + 	if (zend_hash_find(htt, n, n_len, (void **)&e) == SUCCESS) { + 		zval *tmp; +-		ulong hval; + 		if (is_mangled) { + 			efree(n); + 		} +@@ -1676,7 +1675,6 @@ PHP_METHOD(protocolbuffers_message, jsonSerialize) + PHP_METHOD(protocolbuffers_message, toArray) + { + 	zval *instance = getThis(), *result = NULL; +-	zend_class_entry **json; +  + 	if (php_protocolbuffers_jsonserialize(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1, Z_OBJCE_P(instance), instance, &result) == 0) { + 		RETURN_ZVAL(result, 0, 1); +diff --git a/serializer.c b/serializer.c +index 83cdebc..75dfaf8 100644 +--- a/serializer.c ++++ b/serializer.c +@@ -723,13 +723,13 @@ int php_protocolbuffers_fetch_element(INTERNAL_FUNCTION_PARAMETERS, php_protocol +  + 	if (zend_hash_find(hash, name, name_len, (void **)&tmp) == SUCCESS) { + 		*output = *tmp; +-		return 0; + 	} else { + 		if (scheme->required > 0) { + 			zend_throw_exception_ex(php_protocol_buffers_invalid_protocolbuffers_exception_class_entry, 0 TSRMLS_CC, "the class does not declared required property `%s`. probably you missed declaration", scheme->name); + 			return 1; + 		} + 	} ++	return 0; + } +  + int php_protocolbuffers_encode_message(INTERNAL_FUNCTION_PARAMETERS, zval *klass, php_protocolbuffers_scheme_container *container, php_protocolbuffers_serializer **serializer) +diff --git a/unknown_field_set.c b/unknown_field_set.c +index c437524..7cf2e9c 100644 +--- a/unknown_field_set.c ++++ b/unknown_field_set.c +@@ -66,7 +66,7 @@ void php_protocolbuffers_unknown_field_set_properties_init(zval *object TSRMLS_D +  + void php_protocolbuffers_unknown_field_clear(INTERNAL_FUNCTION_PARAMETERS, zval *instance) + { +-	zval *fields = NULL, **prior_fields = NULL; ++	zval *fields = NULL; + 	char *name = {0}; + 	int name_len = 0; +  +--  +1.9.1 +  | 
