summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--pdflib-php54.patch36
-rw-r--r--php-pecl-pdflib.spec204
-rw-r--r--xml2changelog43
4 files changed, 287 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..1e65467
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,4 @@
+SRCDIR := $(shell pwd)
+NAME := $(shell basename $(SRCDIR))
+include ../common/Makefile
+
diff --git a/pdflib-php54.patch b/pdflib-php54.patch
new file mode 100644
index 0000000..96f8c8e
--- /dev/null
+++ b/pdflib-php54.patch
@@ -0,0 +1,36 @@
+diff -up pdflib-2.1.8/pdf7.c.php54 pdflib-2.1.8/pdf7.c
+--- pdflib-2.1.8/pdf7.c.php54 2011-11-27 08:55:33.068642986 +0100
++++ pdflib-2.1.8/pdf7.c 2011-11-27 08:56:40.703860070 +0100
+@@ -332,10 +332,14 @@ pdflib_object_new_ex(zend_class_entry *c
+
+ ALLOC_HASHTABLE(intern->std.properties);
+ zend_hash_init(intern->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
++#if PHP_VERSION_ID < 50399
+ zend_hash_copy(intern->std.properties,
+ &class_type->default_properties,
+ (copy_ctor_func_t) zval_add_ref,
+ (void *) &tmp, sizeof(zval *));
++#else
++ object_properties_init( (zend_object*)intern, class_type );
++#endif
+
+ retval.handle = zend_objects_store_put(intern, NULL,
+ (zend_objects_free_object_storage_t)pdflib_object_dtor,
+diff -up pdflib-2.1.8/pdf.c.php54 pdflib-2.1.8/pdf.c
+--- pdflib-2.1.8/pdf.c.php54 2011-11-27 08:53:51.378310945 +0100
++++ pdflib-2.1.8/pdf.c 2011-11-27 08:56:31.184829597 +0100
+@@ -766,10 +766,14 @@ pdflib_object_new_ex(zend_class_entry *c
+
+ ALLOC_HASHTABLE(intern->std.properties);
+ zend_hash_init(intern->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
++#if PHP_VERSION_ID < 50399
+ zend_hash_copy(intern->std.properties,
+ &class_type->default_properties,
+ (copy_ctor_func_t) zval_add_ref,
+ (void *) &tmp, sizeof(zval *));
++#else
++ object_properties_init( (zend_object*)intern, class_type );
++#endif
+
+ retval.handle = zend_objects_store_put(intern, NULL,
+ (zend_objects_free_object_storage_t)pdflib_object_dtor,
diff --git a/php-pecl-pdflib.spec b/php-pecl-pdflib.spec
new file mode 100644
index 0000000..e50d1c5
--- /dev/null
+++ b/php-pecl-pdflib.spec
@@ -0,0 +1,204 @@
+%{!?__pecl: %{expand: %%global __pecl %{_bindir}/pecl}}
+%{!?php_inidir: %{expand: %%global php_inidir %{_sysconfdir}/php.d}}
+
+%global pecl_name pdflib
+%global extname pdf
+
+Summary: Package for generating PDF files
+Summary(fr): Extension pour générer des fichiers PDF
+Name: php-pecl-pdflib
+Version: 2.1.9
+Release: 1%{?dist}
+# https://bugs.php.net/60396 ask license file
+License: PHP
+Group: Development/Languages
+URL: http://pecl.php.net/package/pdflib
+
+Source: http://pecl.php.net/get/pdflib-%{version}.tgz
+Source2: xml2changelog
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildRequires: php-devel, pdflib-lite-devel, php-pear
+
+Requires(post): %{__pecl}
+Requires(postun): %{__pecl}
+Requires: php(zend-abi) = %{php_zend_api}
+Requires: php(api) = %{php_core_api}
+Provides: php-pecl(pdflib) = %{version}-%{release}
+Provides: php-pdflib = %{version}-%{release}
+
+# RPM 4.8
+%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$}
+%{?filter_setup}
+# RPM 4.9
+%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}%{_libdir}/.*\\.so$
+
+
+%description
+This PHP extension wraps the PDFlib programming library
+for processing PDF on the fly.
+
+More info on how to use PDFlib with PHP can be found at
+http://www.pdflib.com/developer-center/technical-documentation/php-howto
+
+
+%description -l fr
+Cette extension PHP fournit une interface sur la bibliothèque de développement
+PDFlib pour générer des fichiers PDF à la volée.
+
+Plus d'informations sur l'utilisation de PDFlib avec PHP sur
+http://www.pdflib.com/developer-center/technical-documentation/php-howto
+
+
+%prep
+%setup -c -q
+%{_bindir}/php -n %{SOURCE2} package.xml >CHANGELOG
+
+# Check version
+extver=$(sed -n '/#define PHP_PDFLIB_VERSION/{s/.* "//;s/".*$//;p}' %{pecl_name}-%{version}/php_pdflib.h)
+if test "x${extver}" != "x%{version}"; then
+ : Error: Upstream version is ${extver}, expecting %{version}.
+ exit 1
+fi
+
+cp -pr %{pecl_name}-%{version} %{pecl_name}-zts
+
+# Create the config file
+cat > %{extname}.ini << 'EOF'
+; Enable PDFlib extension module
+extension=%{extname}.so
+EOF
+
+
+%build
+cd %{pecl_name}-%{version}
+%{_bindir}/phpize
+%configure --with-php-config=%{_bindir}/php-config
+make %{?_smp_mflags}
+
+%if 0%{?__ztsphp:1}
+cd ../%{pecl_name}-zts
+%{_bindir}/zts-phpize
+%configure --with-php-config=%{_bindir}/zts-php-config
+make %{?_smp_mflags}
+%endif
+
+
+%install
+rm -rf %{buildroot}
+
+make -C %{pecl_name}-%{version} install-modules INSTALL_ROOT=%{buildroot}
+
+# Drop in the bit of configuration
+install -D -m 644 %{extname}.ini %{buildroot}%{php_inidir}/%{extname}.ini
+
+# Install XML package description
+install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml
+
+%if 0%{?__ztsphp:1}
+make -C %{pecl_name}-zts install-modules INSTALL_ROOT=%{buildroot}
+install -D -m 644 %{extname}.ini %{buildroot}%{php_ztsinidir}/%{extname}.ini
+%endif
+
+
+%check
+%{_bindir}/php -n \
+ -d extension_dir=%{pecl_name}-%{version}/modules \
+ -d extension=%{extname}.so \
+ -m | grep %{extname}
+
+%if 0%{?__ztsphp:1}
+%{__ztsphp} -n \
+ -d extension_dir=%{pecl_name}-zts/modules \
+ -d extension=%{extname}.so \
+ -m | grep %{extname}
+%endif
+
+
+%post
+%{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || :
+
+
+%postun
+if [ $1 -eq 0 ] ; then
+ %{pecl_uninstall} %{pecl_name} >/dev/null || :
+fi
+
+
+%clean
+rm -rf %{buildroot}
+
+
+%files
+%defattr(-, root, root, -)
+%doc CHANGELOG %{pecl_name}-%{version}/CREDITS
+%config(noreplace) %{php_inidir}/%{extname}.ini
+%{php_extdir}/%{extname}.so
+%{pecl_xmldir}/%{name}.xml
+
+%if 0%{?__ztsphp:1}
+%config(noreplace) %{php_ztsinidir}/%{extname}.ini
+%{php_ztsextdir}/%{extname}.so
+%endif
+
+
+%changelog
+* Sat Jun 09 2012 Remi Collet <RPMS@FamilleCollet.com> 2.1.9-1
+- update to 2.1.9
+
+* Sun Nov 27 2011 Remi Collet <RPMS@FamilleCollet.com> 2.1.8-3
+- php 5.4 build
+- add ZTS extension
+- add patch for PHP 5.4 https://bugs.php.net/60397
+- request upstream to provides LICENSE file https://bugs.php.net/60396
+
+* Sat Jul 23 2011 Remi Collet <rpmfusion@FamilleCollet.com> 2.1.8-2.1
+- fix %%check (php 5.1 doesnt have --modules)
+
+* Sat Jul 23 2011 Remi Collet <rpmfusion@FamilleCollet.com> 2.1.8-2
+- fix private-shared-object-provides rpmlint warning
+- fix macro usage
+- add %%check, minimal load test
+
+* Thu May 06 2010 Remi Collet <rpmfusion@FamilleCollet.com> 2.1.8-1
+- update to 2.1.8
+
+* Sat Oct 24 2009 Remi Collet <rpmfusion@FamilleCollet.com> 2.1.7-2
+- rebuild
+
+* Tue Jul 14 2009 Remi Collet <rpmfusion@FamilleCollet.com> 2.1.7-1
+- update to 2.1.7, rebuild against php 5.3.0
+
+* Sun Mar 29 2009 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 2.1.6-2
+- rebuild for new F11 features
+
+* Thu Mar 19 2009 Remi Collet <RPMS@FamilleCollet.com> 2.1.6-1
+- update to 2.1.6
+
+* Sun Sep 28 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info - 2.1.5-2
+- rebuild
+
+* Fri Mar 28 2008 Remi Collet <RPMS@FamilleCollet.com> 2.1.5-2
+- rebuild against pdflib-lite-7.0.3
+
+* Sat Mar 15 2008 Remi Collet <RPMS@FamilleCollet.com> 2.1.5-1
+- update to 2.1.5
+
+* Tue Sep 25 2007 Remi Collet <RPMS@FamilleCollet.com> 2.1.4-2
+- add missing BR php-pear
+
+* Tue Sep 25 2007 Remi Collet <RPMS@FamilleCollet.com> 2.1.4-1
+- update to 2.1.4
+- convert package from v1 to v2
+- register extension (new PHP Guidelines)
+- remove License file (not provided upstream)
+
+* Sat Mar 17 2007 Remi Collet <RPMS@FamilleCollet.com> 2.1.3-2
+- rebuild againt pdflib-lite-7.0.1
+
+* Fri Mar 9 2007 Remi Collet <RPMS@FamilleCollet.com> 2.1.3-1
+- requires php(zend-abi) and php(api) when available
+- update to 2.1.3
+
+* Sat Dec 09 2006 Remi Collet <RPMS@FamilleCollet.com> 2.1.2-1
+- initial spec for Livna
diff --git a/xml2changelog b/xml2changelog
new file mode 100644
index 0000000..3a31be6
--- /dev/null
+++ b/xml2changelog
@@ -0,0 +1,43 @@
+<?php
+$prog=array_shift($_SERVER['argv']);
+if ($_SERVER['argc']<2) die ("usage : " . $prog . " path_to_package.xml [ --debug ]\n");
+$file=array_shift($_SERVER['argv']);
+
+($xml=simplexml_load_file($file)) || die ($file . " not found !\n");
+if (in_array("--debug", $_SERVER['argv'])) print_r($xml);
+
+if ($xml['version'] >= "2"){ // Package.xml V 2.0
+ $new = "";
+ if (strlen(trim($xml->notes))>1) { // Ignore too short descr.
+ printf("*** Version %s (%s) - API %s (%s) - %s\n\n%s\n\n",
+ $xml->version->release, $xml->stability->release,
+ $xml->version->api, $xml->stability->api,
+ $xml->date, $xml->notes);
+ $new=$xml->version->release;
+ }
+
+ if (isset($xml->changelog->release) && count($xml->changelog->release)) {
+ $tab = array();
+ foreach($xml->changelog->release as $rel) {
+ $old=$rel->version->release;
+ if ("$old" != "$new") {
+ $tab[''.$rel->date] = $rel;
+ }
+ }
+ krsort($tab);
+ foreach($tab as $rel) {
+ printf("*** Version %s (%s) - API %s (%s) - %s\n\n%s\n\n",
+ $rel->version->release, $rel->stability->release,
+ $rel->version->api, $rel->stability->api,
+ $rel->date, $rel->notes);
+ }
+ }
+} else { // Package.xml V 1.0
+ printf("* Version %s (%s) - %s\n\n%s\n\n",
+ $xml->release->version, $xml->release->state, $xml->release->date, $xml->release->notes);
+
+ foreach($xml->changelog->release as $rel)
+ printf("* Version %s (%s) - %s\n\n%s\n\n",
+ $rel->version, $rel->state, $rel->date, $rel->notes);
+}
+?>