summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2015-03-28 08:29:51 +0100
committerRemi Collet <fedora@famillecollet.com>2015-03-28 08:29:51 +0100
commit550527031eabea15edda7d42e2587e8ae1955213 (patch)
tree8b74034b808c06613bacfeac8e08e778705781d7
parent60792b1816a15c41395ca0357f53a1e9ebae2afc (diff)
php-pecl-uuid: add fix for PHP 7
-rw-r--r--php-pecl-uuid.spec54
-rw-r--r--uuid-build.patch35
-rw-r--r--uuid-php7.patch151
3 files changed, 221 insertions, 19 deletions
diff --git a/php-pecl-uuid.spec b/php-pecl-uuid.spec
index 4b7f3e2..a85f9c9 100644
--- a/php-pecl-uuid.spec
+++ b/php-pecl-uuid.spec
@@ -22,7 +22,7 @@
Summary: Universally Unique Identifier extension for PHP
Name: %{?scl_prefix}php-pecl-uuid
Version: 1.0.3
-Release: 10%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}.1
+Release: 11%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
License: LGPLv2+
Group: Development/Languages
URL: http://pecl.php.net/package/uuid
@@ -38,16 +38,18 @@ Patch0: %{pecl_name}-ereg.patch
# Fix build warnings
Patch1: %{pecl_name}-build.patch
# http://svn.php.net/viewvc?view=revision&revision=328261
+# http://svn.php.net/viewvc?view=revision&revision=336226
# Improves phpinfo() output
Patch2: %{pecl_name}-info.patch
+# http://svn.php.net/viewvc?view=revision&revision=336225
+# http://svn.php.net/viewvc?view=revision&revision=336227
+Patch3: %{pecl_name}-php7.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: %{?scl_prefix}php-devel
BuildRequires: %{?scl_prefix}php-pear
BuildRequires: libuuid-devel
-Requires(post): %{__pecl}
-Requires(postun): %{__pecl}
Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api}
Requires: %{?scl_prefix}php(api) = %{php_core_api}
%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}}
@@ -62,17 +64,17 @@ Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version}
%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1}
# Other third party repo stuff
-Obsoletes: php53-pecl-%{pecl_name}
-Obsoletes: php53u-pecl-%{pecl_name}
-Obsoletes: php54-pecl-%{pecl_name}
-Obsoletes: php54w-pecl-%{pecl_name}
+Obsoletes: php53-pecl-%{pecl_name} <= %{version}
+Obsoletes: php53u-pecl-%{pecl_name} <= %{version}
+Obsoletes: php54-pecl-%{pecl_name} <= %{version}
+Obsoletes: php54w-pecl-%{pecl_name} <= %{version}
%if "%{php_version}" > "5.5"
-Obsoletes: php55u-pecl-%{pecl_name}
-Obsoletes: php55w-pecl-%{pecl_name}
+Obsoletes: php55u-pecl-%{pecl_name} <= %{version}
+Obsoletes: php55w-pecl-%{pecl_name} <= %{version}
%endif
%if "%{php_version}" > "5.6"
-Obsoletes: php56u-pecl-%{pecl_name}
-Obsoletes: php56w-pecl-%{pecl_name}
+Obsoletes: php56u-pecl-%{pecl_name} <= %{version}
+Obsoletes: php56w-pecl-%{pecl_name} <= %{version}
%endif
%endif
@@ -90,6 +92,9 @@ A wrapper around Universally Unique Identifier library (libuuid).
%prep
%setup -q -c
+# Don't install/register tests
+sed -e 's/role="test"/role="src"/' -i package.xml
+
mv %{pecl_name}-%{version} NTS
cd NTS
cp %{SOURCE1} LICENSE
@@ -97,6 +102,7 @@ cp %{SOURCE1} LICENSE
%patch0 -p3 -b .ereg
%patch1 -p3 -b .build
%patch2 -p3 -b .info
+%patch3 -p3 -b .php7
# Sanity check, really often broken
extver=$(sed -n '/#define PHP_UUID_VERSION/{s/.* "//;s/".*$//;p}' php_uuid.h)
@@ -149,11 +155,8 @@ install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name}
# Install the package XML file
install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml
-# Test & Documentation
+# Documentation
cd NTS
-for i in $(grep 'role="test"' ../package.xml | sed -e 's/^.*name="//;s/".*$//')
-do install -Dpm 644 $i %{buildroot}%{pecl_testdir}/%{pecl_name}/$i
-done
for i in LICENSE $(grep 'role="doc"' ../package.xml | sed -e 's/^.*name="//;s/".*$//')
do install -Dpm 644 $i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i
done
@@ -179,12 +182,20 @@ REPORT_EXIT_STATUS=1 \
%endif
-%post
-%{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || :
+# when pear installed alone, after us
+%triggerin -- %{?scl_prefix}php-pear
+if [ -x %{__pecl} ] ; then
+ %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || :
+fi
+# posttrans as pear can be installed after us
+%posttrans
+if [ -x %{__pecl} ] ; then
+ %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || :
+fi
%postun
-if [ $1 -eq 0 ] ; then
+if [ $1 -eq 0 -a -x %{__pecl} ] ; then
%{pecl_uninstall} %{pecl_name} >/dev/null || :
fi
@@ -195,8 +206,8 @@ rm -rf %{buildroot}
%files
%defattr(-, root, root, 0755)
+%{?_licensedir:%license NTS/LICENSE}
%doc %{pecl_docdir}/%{pecl_name}
-%doc %{pecl_testdir}/%{pecl_name}
%{pecl_xmldir}/%{name}.xml
%config(noreplace) %{php_inidir}/%{ini_name}
@@ -209,6 +220,11 @@ rm -rf %{buildroot}
%changelog
+* Sat Mar 28 2015 Remi Collet <remi@fedoraproject.org> - 1.0.3-11
+- more upstream patches, fix for PHP 7
+- drop runtime dependency on pear, new scriptlets
+- don't provide the test suite
+
* Wed Dec 24 2014 Remi Collet <remi@fedoraproject.org> - 1.0.3-10.1
- Fedora 21 SCL mass rebuild
diff --git a/uuid-build.patch b/uuid-build.patch
index c1b0f7e..db6a999 100644
--- a/uuid-build.patch
+++ b/uuid-build.patch
@@ -9,3 +9,38 @@
uuid_type);
uuid_generate(uuid);
break;
+--- pecl/uuid/trunk/config.m4 2015/03/28 06:45:58 336225
++++ pecl/uuid/trunk/config.m4 2015/03/28 07:05:04 336226
+@@ -6,18 +6,28 @@
+
+
+ if test "$PHP_UUID" != "no"; then
+- PHP_CHECK_FUNC_LIB(uuid_type, uuid)
+- PHP_CHECK_FUNC_LIB(uuid_variant, uuid)
+-
+
++ AC_MSG_CHECKING([for the location of libuuid])
++ for dir in $PHP_UUID /usr/local /usr; do
++ if test -f "$dir/include/uuid/uuid.h"; then
++ PHP_UUID_DIR="$dir"
++ fi
++ done
++ if test -z "$PHP_UUID_DIR"; then
++ AC_MSG_ERROR(not found)
++ else
++ AC_MSG_RESULT(found in $PHP_UUID_DIR)
++ fi
+ PHP_ADD_INCLUDE($PHP_UUID_DIR/include)
++ PHP_CHECK_FUNC_LIB(uuid_type, uuid)
++ PHP_CHECK_FUNC_LIB(uuid_variant, uuid)
+
+ export OLD_CPPFLAGS="$CPPFLAGS"
+ export CPPFLAGS="$CPPFLAGS $INCLUDES -DHAVE_UUID"
+ AC_CHECK_HEADER([uuid/uuid.h], [], AC_MSG_ERROR('uuid/uuid.h' header not found))
+ PHP_SUBST(UUID_SHARED_LIBADD)
+
+- PHP_ADD_LIBRARY_WITH_PATH(uuid, $PHP_UUID_DIR/lib, UUID_SHARED_LIBADD)
++ PHP_ADD_LIBRARY_WITH_PATH(uuid, $PHP_UUID_DIR/$PHP_LIBDIR, UUID_SHARED_LIBADD)
+ export CPPFLAGS="$OLD_CPPFLAGS"
+
+ export OLD_CPPFLAGS="$CPPFLAGS"
diff --git a/uuid-php7.patch b/uuid-php7.patch
new file mode 100644
index 0000000..5c1f900
--- /dev/null
+++ b/uuid-php7.patch
@@ -0,0 +1,151 @@
+--- pecl/uuid/trunk/php_uuid.h 2015/03/27 16:21:02 336224
++++ pecl/uuid/trunk/php_uuid.h 2015/03/28 06:45:58 336225
+@@ -197,6 +197,17 @@
+
+ #endif /* PHP_HAVE_UUID */
+
++#if PHP_MAJOR_VERSION < 7
++typedef long zend_long;
++typedef int strsize;
++#define UUID_RETSTR(a) RETURN_STRING(a,1)
++#define UUID_RETSTRL(a,l) RETURN_STRINGL(a,l,1)
++#else
++typedef size_t strsize;
++#define UUID_RETSTR(a) RETURN_STRING(a)
++#define UUID_RETSTRL(a,l) RETURN_STRINGL(a,l)
++#endif
++
+ #endif /* PHP_UUID_H */
+
+
+--- pecl/uuid/trunk/uuid.c 2015/03/27 16:21:02 336224
++++ pecl/uuid/trunk/uuid.c 2015/03/28 06:45:58 336225
+@@ -152,7 +152,7 @@
+ PHP_FUNCTION(uuid_create)
+ {
+
+- long uuid_type = 0;
++ zend_long uuid_type = 0;
+
+
+
+@@ -185,7 +185,7 @@
+
+ uuid_unparse(uuid, uuid_str);
+
+- RETURN_STRING(uuid_str, 1);
++ UUID_RETSTR(uuid_str);
+ } while (0);
+ }
+ /* }}} uuid_create */
+@@ -197,7 +197,7 @@
+ {
+
+ const char * uuid = NULL;
+- int uuid_len = 0;
++ strsize uuid_len = 0;
+
+
+
+@@ -219,9 +219,9 @@
+ {
+
+ const char * uuid1 = NULL;
+- int uuid1_len = 0;
++ strsize uuid1_len = 0;
+ const char * uuid2 = NULL;
+- int uuid2_len = 0;
++ strsize uuid2_len = 0;
+
+
+
+@@ -247,7 +247,7 @@
+ {
+
+ const char * uuid = NULL;
+- int uuid_len = 0;
++ strsize uuid_len = 0;
+
+
+
+@@ -273,7 +273,7 @@
+ {
+
+ const char * uuid = NULL;
+- int uuid_len = 0;
++ strsize uuid_len = 0;
+
+
+
+@@ -302,7 +302,7 @@
+ {
+
+ const char * uuid = NULL;
+- int uuid_len = 0;
++ strsize uuid_len = 0;
+
+
+
+@@ -330,7 +330,7 @@
+ {
+
+ const char * uuid = NULL;
+- int uuid_len = 0;
++ strsize uuid_len = 0;
+
+
+
+@@ -361,7 +361,7 @@
+ {
+
+ const char * uuid = NULL;
+- int uuid_len = 0;
++ strsize uuid_len = 0;
+
+
+
+@@ -384,7 +384,7 @@
+ if(uuid[10] & 0x80) RETURN_FALSE; // invalid MAC
+
+ uuid_unparse(u, uuid_str);
+- RETURN_STRING((char *)(uuid_str + 24), 1);
++ UUID_RETSTR((char *)(uuid_str + 24));
+ } while (0);
+ }
+ /* }}} uuid_mac */
+@@ -396,7 +396,7 @@
+ {
+
+ const char * uuid = NULL;
+- int uuid_len = 0;
++ strsize uuid_len = 0;
+
+
+
+@@ -411,7 +411,7 @@
+ RETURN_FALSE;
+ }
+
+- RETURN_STRINGL((char *)uuid_bin, sizeof(uuid_t), 1);
++ UUID_RETSTRL((char *)uuid_bin, sizeof(uuid_t));
+ } while (0);
+ }
+ /* }}} uuid_parse */
+@@ -423,7 +423,7 @@
+ {
+
+ const char * uuid = NULL;
+- int uuid_len = 0;
++ strsize uuid_len = 0;
+
+
+
+@@ -440,7 +440,7 @@
+
+ uuid_unparse((unsigned char *)uuid, uuid_txt);
+
+- RETURN_STRINGL(uuid_txt, 36, 1);
++ UUID_RETSTRL(uuid_txt, 36);
+ } while (0);
+ }
+ /* }}} uuid_unparse */