summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2013-05-09 17:13:06 +0200
committerRemi Collet <fedora@famillecollet.com>2013-05-09 17:13:06 +0200
commit2860fea937acb75d5a5a22a40803fe89d08a4394 (patch)
treed651a500c7cc36dac954a4514fbd3ff051d67664
parentc363a0ee6270c55d80d8db8db3e98259bc5281e5 (diff)
php-tcpdf: more work
-rw-r--r--php-tcpdf.spec74
-rw-r--r--php-tcpdf_cachepath.patch24
-rw-r--r--php-tcpdf_config.patch54
3 files changed, 98 insertions, 54 deletions
diff --git a/php-tcpdf.spec b/php-tcpdf.spec
index 4b4dd00..5cd2d82 100644
--- a/php-tcpdf.spec
+++ b/php-tcpdf.spec
@@ -12,7 +12,7 @@ License: LGPLv3+
Group: Development/Libraries
Patch0: php-tcpdf_badpath.patch
-Patch1: php-tcpdf_cachepath.patch
+Patch1: php-tcpdf_config.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
@@ -74,44 +74,53 @@ PHP class for generating PDF documents.
* PDF/A-1b (ISO 19005-1:2005) support.
By default, TCPDF uses the GD library which is know as slower than ImageMagick
-solution. You can optionally install php-pecl(imagick); TCPDF will use it.
+solution. You can optionally install php-pecl-imagick; TCPDF will use it.
%prep
%setup -qn %{real_name}
-%patch0 -p1
-%patch1 -p1
+%patch0 -p1 -b .badpath
+%patch1 -p1 -b .config
+
: globally fix permissions, always broken...
-chmod 755 `find ./ -type d`
-chmod 644 `find ./ -type f`
+find ./ -type d -exec chmod 755 {} \;
+find ./ -type f -exec chmod 644 {} \;
+
: remove composer
rm -f composer.json
+
: langs are not config...
mv config/lang .
+
: move certs in examples
mv config/cert examples/
-: some files in config are relevant for examples only
-mv images examples/
-mkdir examples/cache
-mv cache/* examples/cache/
+
+: some files are relevant for examples only
+mv cache examples/cache
+mv config/tcpdf_config_alt.php examples/
+
+
: change examples include paths
sed -i examples/*.php examples/barcodes/*.php \
-e "s|../config/cert/|./cert/|" \
-e "s|../config/lang|%{_datadir}/php/%{real_name}/lang|g" \
- -e "s|../%{real_name}.php|%{real_name}.php|" \
- -e "s|../config/tcpdf_config_alt.php|%{_sysconfdir}/%{name}/%{real_name}_config_alt.php|" \
- -e "s|../cache/|./cache/|" \
- -e "s|../images/|./images/|" \
- -e "s|dirname(__FILE__).'/../../|'|"
+ -e "s|../%{real_name}.php|%{real_name}/%{real_name}.php|" \
+ -e "s|../config/%{real_name}_config_alt.php|%{real_name}_config_alt.php|" \
+ -e "s|../cache/|cache/|" \
+ -e "s|../images/|images/|" \
+ -e "s|dirname(__FILE__).'/../../|'%{real_name}/|"
+
: wrong end-of-line encoding
sed -i 's/\r//' \
lang/bul.php \
- examples/images/bug.eps \
- examples/images/tiger.ai \
- examples/images/pelican.ai
-pushd examples
+ images/bug.eps \
+ images/tiger.ai \
+ images/pelican.ai
+
: non UTF8 files
-iconv -f iso8859-1 -t utf-8 example_030.php > example_030.php.conv && mv -f example_030.php.conv example_030.php
+pushd examples
+iconv -f iso8859-1 -t utf-8 example_030.php > example_030.php.conv \
+ && mv -f example_030.php.conv example_030.php
popd
@@ -121,14 +130,19 @@ popd
%install
rm -rf $RPM_BUILD_ROOT
-# install
-install -d $RPM_BUILD_ROOT%{_datadir}/php/%{name}
-cp -a *.php $RPM_BUILD_ROOT%{_datadir}/php/%{name}/
-cp -a include $RPM_BUILD_ROOT%{_datadir}/php/%{name}/
-cp -a fonts $RPM_BUILD_ROOT%{_datadir}/php/%{name}/
-install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
-cp -a config/* $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
-ln -s ../../../..%{_sysconfdir}/%{name} $RPM_BUILD_ROOT%{_datadir}/php/%{name}/config
+# Library
+install -d $RPM_BUILD_ROOT%{_datadir}/php/%{real_name}
+cp -a *.php $RPM_BUILD_ROOT%{_datadir}/php/%{real_name}/
+cp -a images $RPM_BUILD_ROOT%{_datadir}/php/%{real_name}/
+cp -a include $RPM_BUILD_ROOT%{_datadir}/php/%{real_name}/
+cp -a fonts $RPM_BUILD_ROOT%{_datadir}/php/%{real_name}/
+cp -a lang $RPM_BUILD_ROOT%{_datadir}/php/%{real_name}/
+
+# Config
+install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
+cp -a config/*.php $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
+
+# Cache
install -d $RPM_BUILD_ROOT%{_localstatedir}/cache/%{name}
@@ -139,12 +153,12 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%doc LICENSE.TXT README.TXT CHANGELOG.TXT doc/* examples
-%{_datadir}/php/%{name}
+%{_datadir}/php/%{real_name}
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/*
%dir %attr(-,apache,apache) %{_localstatedir}/cache/%{name}
%changelog
-* Thu May 09 2013 Johan Cwiklinski <johan AT x-tnd DOt be> - 6.0.012-1.trashy
+* Thu May 09 2013 Johan Cwiklinski <johan AT x-tnd DOt be> - 6.0.012-1
- Initial packaging
diff --git a/php-tcpdf_cachepath.patch b/php-tcpdf_cachepath.patch
deleted file mode 100644
index 7b9f5d0..0000000
--- a/php-tcpdf_cachepath.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-diff -up tcpdf/config/tcpdf_config_alt.php.patch tcpdf/config/tcpdf_config_alt.php
---- tcpdf/config/tcpdf_config_alt.php.patch 2013-05-09 11:34:19.817868752 +0200
-+++ tcpdf/config/tcpdf_config_alt.php 2013-05-09 11:35:15.570865072 +0200
-@@ -89,7 +89,7 @@ define ('K_PATH_FONTS', K_PATH_MAIN.'fon
- /**
- * cache directory for temporary files (full path)
- */
--define ('K_PATH_CACHE', K_PATH_MAIN.'cache/');
-+define ('K_PATH_CACHE', '/var/cache/php-tcpdf/');
-
- /**
- * cache directory for temporary files (url path)
-diff -up tcpdf/config/tcpdf_config.php.patch tcpdf/config/tcpdf_config.php
---- tcpdf/config/tcpdf_config.php.patch 2013-05-09 11:34:10.705869354 +0200
-+++ tcpdf/config/tcpdf_config.php 2013-05-09 11:35:20.611864739 +0200
-@@ -94,7 +94,7 @@ if (!defined('K_TCPDF_EXTERNAL_CONFIG'))
- /**
- * cache directory for temporary files (full path)
- */
-- define ('K_PATH_CACHE', K_PATH_MAIN.'cache/');
-+ define ('K_PATH_CACHE', '/var/cache/php-tcpdf/');
-
- /**
- * cache directory for temporary files (url path)
diff --git a/php-tcpdf_config.patch b/php-tcpdf_config.patch
new file mode 100644
index 0000000..bb6f5a2
--- /dev/null
+++ b/php-tcpdf_config.patch
@@ -0,0 +1,54 @@
+diff -up ./config/tcpdf_config_alt.php.config ./config/tcpdf_config_alt.php
+--- ./config/tcpdf_config_alt.php.config 2013-04-21 21:15:04.000000000 +0200
++++ ./config/tcpdf_config_alt.php 2013-05-09 16:47:02.868144489 +0200
+@@ -61,7 +61,7 @@ if (substr($k_path_main, -1) != '/') {
+ * Installation path (/var/www/tcpdf/).
+ * By default it is automatically calculated but you can also set it as a fixed string to improve performances.
+ */
+-define ('K_PATH_MAIN', $k_path_main);
++define ('K_PATH_MAIN', '/usr/share/php/tcpdf/');
+
+ // Automatic calculation for the following K_PATH_URL constant
+ if (isset($_SERVER['HTTP_HOST']) AND (!empty($_SERVER['HTTP_HOST']))) {
+@@ -89,7 +89,7 @@ define ('K_PATH_FONTS', K_PATH_MAIN.'fon
+ /**
+ * cache directory for temporary files (full path)
+ */
+-define ('K_PATH_CACHE', K_PATH_MAIN.'cache/');
++define ('K_PATH_CACHE', '/var/cache/php-tcpdf/');
+
+ /**
+ * cache directory for temporary files (url path)
+diff -up ./config/tcpdf_config.php.config ./config/tcpdf_config.php
+--- ./config/tcpdf_config.php.config 2013-04-21 21:15:04.000000000 +0200
++++ ./config/tcpdf_config.php 2013-05-09 16:46:46.391084498 +0200
+@@ -65,7 +65,7 @@ if (!defined('K_TCPDF_EXTERNAL_CONFIG'))
+ * Installation path (/var/www/tcpdf/).
+ * By default it is automatically calculated but you can also set it as a fixed string to improve performances.
+ */
+- define ('K_PATH_MAIN', $k_path_main);
++ define ('K_PATH_MAIN', '/usr/share/php/tcpdf/');
+
+ // Automatic calculation for the following K_PATH_URL constant
+ $k_path_url = $k_path_main; // default value for console mode
+@@ -94,7 +94,7 @@ if (!defined('K_TCPDF_EXTERNAL_CONFIG'))
+ /**
+ * cache directory for temporary files (full path)
+ */
+- define ('K_PATH_CACHE', K_PATH_MAIN.'cache/');
++ define ('K_PATH_CACHE', '/var/cache/php-tcpdf/');
+
+ /**
+ * cache directory for temporary files (url path)
+diff -up ./tcpdf.php.config ./tcpdf.php
+--- ./tcpdf.php.config 2013-05-09 16:43:00.199254100 +0200
++++ ./tcpdf.php 2013-05-09 16:43:00.212254149 +0200
+@@ -144,7 +144,7 @@
+
+ if (!defined('K_TCPDF_EXTERNAL_CONFIG')) {
+ // Main configuration file. Define the K_TCPDF_EXTERNAL_CONFIG constant to skip this file.
+- require_once(dirname(__FILE__).'/config/tcpdf_config.php');
++ require_once('/etc/php-tcpdf/tcpdf_config.php');
+ }
+
+ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -