diff options
author | Remi Collet <fedora@famillecollet.com> | 2013-05-15 16:39:52 +0200 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2013-05-15 16:39:52 +0200 |
commit | 58212245d297d15a5c937bd0f8dba71cbcb11db7 (patch) | |
tree | 5b664f0f8f4388ce7e692612b29c1cc10f005350 | |
parent | 067e2b59aa8cb5239f974cc02df4d5ce15f3bba9 (diff) |
php-tcpdf: 6.0.014
-rw-r--r-- | php-tcpdf.spec | 119 | ||||
-rw-r--r-- | php-tcpdf_badpath.patch | 22 | ||||
-rw-r--r-- | php-tcpdf_config.patch | 64 | ||||
-rw-r--r-- | tcpdf_addfont.php | 78 |
4 files changed, 22 insertions, 261 deletions
diff --git a/php-tcpdf.spec b/php-tcpdf.spec index aa9b28a..0d2c63b 100644 --- a/php-tcpdf.spec +++ b/php-tcpdf.spec @@ -1,9 +1,9 @@ -%global dl_version 6_0_014 +%global dl_version 6_0_015 %global real_name tcpdf Name: php-tcpdf Summary: PHP class for generating PDF documents -Version: 6.0.014 +Version: 6.0.015 Release: 1%{?dist} URL: http://www.tcpdf.org @@ -11,10 +11,6 @@ License: LGPLv3+ Group: Development/Libraries Source0: http://downloads.sourceforge.net/%{real_name}/%{real_name}_%{dl_version}.zip -Source1: %{real_name}_addfont.php - -Patch0: %{name}_badpath.patch -Patch1: %{name}_config.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch @@ -109,6 +105,7 @@ Group: Development/Libraries BuildRequires: gnu-free-mono-fonts BuildRequires: gnu-free-sans-fonts BuildRequires: gnu-free-serif-fonts +Requires: %{name} = %{version}-%{release} Requires: gnu-free-mono-fonts Requires: gnu-free-sans-fonts Requires: gnu-free-serif-fonts @@ -124,12 +121,6 @@ This package allow to use system GNU FreeFonts in TCPDF. %prep %setup -qn %{real_name} -%patch0 -p1 -b .badpath -%patch1 -p1 -b .config - -: globally fix permissions, always broken... -find ./ -type d -exec chmod 755 {} \; -find ./ -type f -exec chmod 644 {} \; : remove bundled fonts rm -rf fonts/dejavu-fonts-ttf* fonts/freefont-* @@ -139,52 +130,6 @@ do done ls fonts | sed -e 's|^|%{_datadir}/php/%{real_name}/fonts/|' >corefonts.lst -: remove composer -rm -f composer.json - -: langs are not config... -mv config/lang . - -: move certs in examples -mv config/cert examples/ - -: 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}/%{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 \ - images/bug.eps \ - images/tiger.ai \ - images/pelican.ai - -: non UTF8 files -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 - -cat >README.cache <<EOF -This folder contains a sub-folder per user uid. - -If the user running PHP doesn't appear here, you need to create it. - mkdir <useruid> - chown <useruid> <useruid> - -EOF - %build : empty build section, nothing required @@ -195,57 +140,36 @@ rm -rf %{buildroot} # Library install -d %{buildroot}%{_datadir}/php/%{real_name} cp -a *.php %{buildroot}%{_datadir}/php/%{real_name}/ -cp -a images %{buildroot}%{_datadir}/php/%{real_name}/ cp -a include %{buildroot}%{_datadir}/php/%{real_name}/ cp -a fonts %{buildroot}%{_datadir}/php/%{real_name}/ -cp -a lang %{buildroot}%{_datadir}/php/%{real_name}/ # Config -install -d %{buildroot}%{_sysconfdir}/%{name} -cp -a config/*.php %{buildroot}%{_sysconfdir}/%{name} - -# Cache -install -d %{buildroot}%{_localstatedir}/cache/%{name} -install -m 0644 README.cache %{buildroot}%{_localstatedir}/cache/%{name}/README +install -d %{buildroot}%{_sysconfdir}/%{name} +install -m 0644 config/*.php \ + %{buildroot}%{_sysconfdir}/%{name} # Tools install -d %{buildroot}%{_bindir} -install -m 0755 %{SOURCE1} %{buildroot}%{_bindir}/%{real_name}_addfont.php +install -m 0755 tools/*php \ + %{buildroot}%{_bindir}/ # Fonts -sed -e 's|/etc/php-tcpdf/tcpdf_config.php|config/tcpdf_config.php|' \ - -i tcpdf.php - -php -d include_path=..:. \ - %{SOURCE1} \ +list="" +for ttf in \ /usr/share/fonts/dejavu/*ttf \ %if 0%{?fedora} >= 11 || 0%{?rhel} >= 6 /usr/share/fonts/gnu-free/*ttf \ %else /usr/share/fonts/freefont/*ttf \ %endif - --link \ - --out %{buildroot}%{_datadir}/php/%{real_name}/fonts - - -%post -# We don't want to require "httpd" in case PHP is used with some other web -# server or without any, but we do want the owner of this directory to default -# to apache for a working "out of the box" experience on the most common setup. - -for server in apache lighttpd nginx -do - uid=$(getent passwd $server | cut -d: -f3) - if [ -n "$uid" ] - then - cache=%{_var}/cache/%{name}/$uid - if [ ! -d $cache ] - then - mkdir -p $cache - chown $uid $cache - fi - fi +; do + list=$ttf${list:+,${list}} done +php -d include_path=. \ + tools/tcpdf_addfont.php \ + --fonts $list \ + --link \ + --outpath %{buildroot}%{_datadir}/php/%{real_name}/fonts/ %clean @@ -254,17 +178,14 @@ rm -rf %{buildroot} %files -f corefonts.lst %defattr(-,root,root,-) -%doc LICENSE.TXT README.TXT CHANGELOG.TXT doc/* examples +%doc LICENSE.TXT README.TXT CHANGELOG.TXT examples %{_bindir}/%{real_name}_addfont.php %dir %{_datadir}/php/%{real_name} %dir %{_datadir}/php/%{real_name}/fonts -%{_datadir}/php/%{real_name}/images %{_datadir}/php/%{real_name}/include -%{_datadir}/php/%{real_name}/lang %{_datadir}/php/%{real_name}/*php %dir %{_sysconfdir}/%{name} %config(noreplace) %{_sysconfdir}/%{name}/* -%{_localstatedir}/cache/%{name} %files dejavu-fonts %defattr(-,root,root,-) @@ -276,6 +197,10 @@ rm -rf %{buildroot} %changelog +* Wed May 15 2013 Remi Collet <remi@fedoraproject.org> - 6.0.015-1 +- update to 6.0.014 +- clean spec (upstream changes for packaging) + * Tue May 14 2013 Remi Collet <remi@fedoraproject.org> - 6.0.014-1 - update to 6.0.014 - drop patch merged upstream diff --git a/php-tcpdf_badpath.patch b/php-tcpdf_badpath.patch deleted file mode 100644 index a04987c..0000000 --- a/php-tcpdf_badpath.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff -up tcpdf/tcpdf.php.patch tcpdf/tcpdf.php ---- tcpdf/tcpdf.php.patch 2013-05-09 11:18:50.076930131 +0200 -+++ tcpdf/tcpdf.php 2013-05-09 11:21:06.140921148 +0200 -@@ -13427,8 +13427,7 @@ class TCPDF { - ++$this->n; // signature object ($this->sig_obj_id + 1) - $this->signature_data = array(); - if (strlen($signing_cert) == 0) { -- $signing_cert = 'file://'.dirname(__FILE__).'/config/cert/tcpdf.crt'; -- $private_key_password = 'tcpdfdemo'; -+ throw new RuntimeException('Please provide a certificate file and password!'); - } - if (strlen($private_key) == 0) { - $private_key = $signing_cert; -@@ -18811,7 +18810,7 @@ Putting 1 is equivalent to putting 0 and - if (isset($tag['attribute']['action'])) { - $this->form_action = $tag['attribute']['action']; - } else { -- $this->form_action = K_PATH_URL.$_SERVER['SCRIPT_NAME']; -+ throw new RuntimeException('Please explicitly set action attribute path!'); - } - if (isset($tag['attribute']['enctype'])) { - $this->form_enctype = $tag['attribute']['enctype']; diff --git a/php-tcpdf_config.patch b/php-tcpdf_config.patch deleted file mode 100644 index 10cd020..0000000 --- a/php-tcpdf_config.patch +++ /dev/null @@ -1,64 +0,0 @@ -diff -up tcpdf/config/tcpdf_config_alt.php.config tcpdf/config/tcpdf_config_alt.php ---- tcpdf/config/tcpdf_config_alt.php.config 2013-04-21 21:15:04.000000000 +0200 -+++ tcpdf/config/tcpdf_config_alt.php 2013-05-10 08:52:56.098202050 +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,12 @@ define ('K_PATH_FONTS', K_PATH_MAIN.'fon - /** - * cache directory for temporary files (full path) - */ --define ('K_PATH_CACHE', K_PATH_MAIN.'cache/'); -+$k_path_cache = '/var/cache/php-tcpdf/'.posix_getuid().'/'; -+if (is_dir($k_path_cache) && is_writable($k_path_cache)) { -+ define ('K_PATH_CACHE', $k_path_cache); -+} else { -+ define ('K_PATH_CACHE', sys_get_temp_dir().'/'); -+} - - /** - * cache directory for temporary files (url path) -diff -up tcpdf/config/tcpdf_config.php.config tcpdf/config/tcpdf_config.php ---- tcpdf/config/tcpdf_config.php.config 2013-04-21 21:15:04.000000000 +0200 -+++ tcpdf/config/tcpdf_config.php 2013-05-10 08:55:59.206957827 +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,12 @@ if (!defined('K_TCPDF_EXTERNAL_CONFIG')) - /** - * cache directory for temporary files (full path) - */ -- define ('K_PATH_CACHE', K_PATH_MAIN.'cache/'); -+ $k_path_cache = '/var/cache/php-tcpdf/'.posix_getuid().'/'; -+ if (is_dir($k_path_cache) && is_writable($k_path_cache)) { -+ define ('K_PATH_CACHE', $k_path_cache); -+ } else { -+ define ('K_PATH_CACHE', sys_get_temp_dir().'/'); -+ } - - /** - * cache directory for temporary files (url path) -diff -up tcpdf/tcpdf.php.config tcpdf/tcpdf.php ---- tcpdf/tcpdf.php.config 2013-05-10 08:52:06.656998071 +0200 -+++ tcpdf/tcpdf.php 2013-05-10 08:52:06.669998125 +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'); - } - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tcpdf_addfont.php b/tcpdf_addfont.php deleted file mode 100644 index b8f0883..0000000 --- a/tcpdf_addfont.php +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/php -<?php - -include "tcpdf/tcpdf.php"; - -function help() { - echo "usage ".$_SERVER['argv'][0]." [ options ] fontfile [ fontfile ... ]\n"; - - echo "\noptions:\n"; - echo "\t-t\n\t--type TrueTypeUnicode, TrueType, Type1, CID0JP = CID-0 Japanese, CID0KR = CID-0 Korean, CID0CS = CID-0 Chinese Simplified, CID0CT\n"; - echo "\t-o\n\t--out Output path\n"; - echo "\t-l\n\t--link Create link to original font (not a copy)\n"; -} - -$fontfiles = array(); -$type = ''; -$out = K_PATH_FONTS; -$enc = ''; -$flags = 32; -$platid = 3; -$encid = 1; -$addcbbox = false; -$link = false; - -$args = $_SERVER['argv']; -array_shift($args); - -while (count($args)) { - $arg = array_shift($args); - switch ($arg) { - case "-h": - case "--help": - help(); - exit(0); - break; - - case "-t": - case "--type": - if (count($args)) { - $type = array_shift($args); - } else { - die("Missing value for --type\n"); - } - break; - - case '-o': - case '--out': - if (count($args)) { - $out = realpath(array_shift($args)).'/'; - } else { - die("Missing value for --out\n"); - } - break; - - case '-l': - case '--link': - $link = true; - break; - - default: - if ($arg[0]=='-') { - die("unkown option $arg\n"); - } - $fontfiles[] = $arg; - } -} -if (!is_dir($out) || !is_writable($out)) { - die("Can't write to $out\n"); -} -echo "Output dir set to $out\n"; -if (count($fontfiles)) { - foreach ($fontfiles as $fontfile) { - $fontname = TCPDF_FONTS::addTTFfont($fontfile, $type, $enc, $flags, $out, $platid, $encid, $addcbbox, true); - echo "$fontfile added as $fontname\n"; - } -} else { - die("Missing fontfile (try --help for usage)\n"); -} |