diff options
-rw-r--r-- | php-tcpdf.spec | 24 | ||||
-rw-r--r-- | tcpdf-vendor.patch | 204 |
2 files changed, 224 insertions, 4 deletions
diff --git a/php-tcpdf.spec b/php-tcpdf.spec index c6cf9ed..f53bbc2 100644 --- a/php-tcpdf.spec +++ b/php-tcpdf.spec @@ -1,9 +1,9 @@ -%global dl_version 6_0_015 +%global dl_version 6_0_016 %global real_name tcpdf Name: php-tcpdf Summary: PHP class for generating PDF documents -Version: 6.0.015 +Version: 6.0.016 Release: 1%{?dist} URL: http://www.tcpdf.org @@ -12,6 +12,9 @@ Group: Development/Libraries Source0: http://downloads.sourceforge.net/%{real_name}/%{real_name}_%{dl_version}.zip +# Fix path for packaging (not upstreamable) +Patch0: tcpdf-vendor.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch BuildRequires: php-cli @@ -122,6 +125,12 @@ This package allow to use system GNU FreeFonts in TCPDF. %prep %setup -qn %{real_name} +%patch0 -p1 + +: fix barcode examples +sed -e "s:dirname(__FILE__).'/../../:'tcpdf/:" \ + -i examples/barcodes/*php + : remove bundled fonts rm -rf fonts/dejavu-fonts-ttf* fonts/freefont-* for fic in fonts/*.z @@ -142,6 +151,9 @@ install -d %{buildroot}%{_datadir}/php/%{real_name} cp -a *.php %{buildroot}%{_datadir}/php/%{real_name}/ cp -a include %{buildroot}%{_datadir}/php/%{real_name}/ cp -a fonts %{buildroot}%{_datadir}/php/%{real_name}/ +install -d %{buildroot}%{_datadir}/php/%{real_name}/images +install -m 0644 examples/images/_blank.png \ + %{buildroot}%{_datadir}/php/%{real_name}/images/ # Config install -d %{buildroot}%{_sysconfdir}/%{name} @@ -165,8 +177,7 @@ for ttf in \ ; do list=$ttf${list:+,${list}} done -php -d include_path=. \ - tools/tcpdf_addfont.php \ +php tools/tcpdf_addfont.php \ --fonts $list \ --link \ --outpath %{buildroot}%{_datadir}/php/%{real_name}/fonts/ @@ -183,6 +194,7 @@ rm -rf %{buildroot} %dir %{_datadir}/php/%{real_name} %dir %{_datadir}/php/%{real_name}/fonts %{_datadir}/php/%{real_name}/include +%{_datadir}/php/%{real_name}/images %{_datadir}/php/%{real_name}/*php %dir %{_sysconfdir}/%{name} %config(noreplace) %{_sysconfdir}/%{name}/* @@ -197,6 +209,10 @@ rm -rf %{buildroot} %changelog +* Thu May 16 2013 Remi Collet <remi@fedoraproject.org> - 6.0.016-1 +- update to 6.0.016 +- add /usr/share/php/tcpdf/images dir + * Wed May 15 2013 Remi Collet <remi@fedoraproject.org> - 6.0.015-1 - update to 6.0.015 - clean spec (upstream changes for packaging) diff --git a/tcpdf-vendor.patch b/tcpdf-vendor.patch new file mode 100644 index 0000000..44d8901 --- /dev/null +++ b/tcpdf-vendor.patch @@ -0,0 +1,204 @@ +diff -ru 016-2/config/tcpdf_config.php tcpdf/config/tcpdf_config.php +--- 016-2/config/tcpdf_config.php 2013-05-15 19:06:17.000000000 +0200 ++++ tcpdf/config/tcpdf_config.php 2013-05-16 13:42:59.000000000 +0200 +@@ -54,39 +54,16 @@ + // be sure that the end slash is present + $_SERVER['DOCUMENT_ROOT'] = str_replace('//', '/', $_SERVER['DOCUMENT_ROOT'].'/'); + +- // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +- // Try to automatically set the value for the following K_PATH_MAIN constant. +- // NOTE: delete this section and manually set the K_PATH_MAIN constant below for better performances. +- $tcpdf_install_dirs = array(); +- if ((strpos(dirname(__FILE__), '/config') !== false) OR (strpos(dirname(__FILE__), '\config') !== false)) { +- // default config file +- $k_path_main_default = str_replace( '\\', '/', realpath(substr(dirname(__FILE__), 0, 0-strlen('config')))); +- if (substr($k_path_main_default, -1) != '/') { +- $k_path_main_default .= '/'; +- } +- $tcpdf_install_dirs[] = $k_path_main_default; +- } +- $tcpdf_install_dirs += array('/usr/share/php/tcpdf/', '/usr/share/tcpdf/', '/usr/share/php-tcpdf/', '/var/www/tcpdf/', '/var/www/html/tcpdf/', '/usr/local/apache2/htdocs/tcpdf/'); +- foreach ($tcpdf_install_dirs as $k_path_main) { +- if (file_exists($k_path_main.'tcpdf.php')) { +- break; +- } +- } +- if (!file_exists($k_path_main)) { +- die('TCPDF ERROR: please set the correct path to TCPDF on the configuration file'); +- } +- // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +- + /** + * 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/'); + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // Try to automatically set the value for the following K_PATH_URL constant. + // NOTE: delete this section and manually set the K_PATH_URL constant below for better performances. +- $k_path_url = $k_path_main; // default value for console mode ++ $k_path_url = K_PATH_MAIN; // default value for console mode + if (isset($_SERVER['HTTP_HOST']) AND (!empty($_SERVER['HTTP_HOST']))) { + if(isset($_SERVER['HTTPS']) AND (!empty($_SERVER['HTTPS'])) AND (strtolower($_SERVER['HTTPS']) != 'off')) { + $k_path_url = 'https://'; +@@ -114,22 +91,11 @@ + */ + define ('K_PATH_FONTS', K_PATH_MAIN.'fonts/'); + +- // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +- // Try to automatically set the value for the following K_PATH_IMAGES constant. +- // NOTE: delete this section and manually set the K_PATH_IMAGES constant below for better performances. +- $tcpdf_images_dirs = array(K_PATH_MAIN.'examples/images/', '/usr/share/doc/tcpdf/examples/images/', '/usr/share/doc/php-tcpdf/examples/images/', '/usr/share/doc/php/tcpdf/examples/images/', '/var/www/tcpdf/images/', '/var/www/html/tcpdf/images/', '/usr/local/apache2/htdocs/tcpdf/images/', K_PATH_MAIN); +- foreach ($tcpdf_images_dirs as $tcpdf_images_path) { +- if (file_exists($tcpdf_images_path)) { +- break; +- } +- } +- // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +- + /** + * Default images directory. + * By default it is automatically set but you can also set it as a fixed string to improve performances. + */ +- define ('K_PATH_IMAGES', $tcpdf_images_path); ++ define ('K_PATH_IMAGES', K_PATH_MAIN.'images/'); + + /** + * Blank image. +@@ -166,20 +132,11 @@ + */ + define ('PDF_HEADER_STRING', "by Nicola Asuni - Tecnick.com\nwww.tcpdf.org"); + +- // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +- // Try to automatically set the value for the following K_PATH_IMAGES constant. +- // NOTE: delete this section and manually set the K_PATH_IMAGES constant below for better performances. +- $tcpdf_header_logo = ''; +- if (file_exists(K_PATH_IMAGES.'tcpdf_logo.jpg')) { +- $tcpdf_header_logo = 'tcpdf_logo.jpg'; +- } +- // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +- + /** + * Deafult image logo used be the default Header() method. + * Please set here your own logo or an empty string to disable it. + */ +- define ('PDF_HEADER_LOGO', $tcpdf_header_logo); ++ define ('PDF_HEADER_LOGO', ''); + + /** + * Header logo image width [mm]. +Seulement dans tcpdf/config: tcpdf_config.php~ +diff -ru 016-2/examples/config/tcpdf_config_alt.php tcpdf/examples/config/tcpdf_config_alt.php +--- 016-2/examples/config/tcpdf_config_alt.php 2013-05-15 19:06:17.000000000 +0200 ++++ tcpdf/examples/config/tcpdf_config_alt.php 2013-05-16 13:42:35.000000000 +0200 +@@ -53,39 +53,16 @@ + // be sure that the end slash is present + $_SERVER['DOCUMENT_ROOT'] = str_replace('//', '/', $_SERVER['DOCUMENT_ROOT'].'/'); + +-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +-// Try to automatically set the value for the following K_PATH_MAIN constant. +-// NOTE: delete this section and manually set the K_PATH_MAIN constant below for better performances. +-$tcpdf_install_dirs = array(); +-if ((strpos(dirname(__FILE__), '/config') !== false) OR (strpos(dirname(__FILE__), '\config') !== false)) { +- // default config file +- $k_path_main_default = str_replace( '\\', '/', realpath(substr(dirname(__FILE__), 0, 0-strlen('examples/config')))); +- if (substr($k_path_main_default, -1) != '/') { +- $k_path_main_default .= '/'; +- } +- $tcpdf_install_dirs[] = $k_path_main_default; +-} +-$tcpdf_install_dirs += array('/usr/share/php/tcpdf/', '/usr/share/tcpdf/', '/usr/share/php-tcpdf/', '/var/www/tcpdf/', '/var/www/html/tcpdf/', '/usr/local/apache2/htdocs/tcpdf/'); +-foreach ($tcpdf_install_dirs as $k_path_main) { +- if (file_exists($k_path_main.'tcpdf.php')) { +- break; +- } +-} +-if (!file_exists($k_path_main)) { +- die('TCPDF ERROR: please set the correct path to TCPDF on the configuration file'); +-} +-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +- + /** + * 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/'); + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // Try to automatically set the value for the following K_PATH_URL constant. + // NOTE: delete this section and manually set the K_PATH_URL constant below for better performances. +-$k_path_url = $k_path_main; // default value for console mode ++$k_path_url = K_PATH_MAIN; // default value for console mode + if (isset($_SERVER['HTTP_HOST']) AND (!empty($_SERVER['HTTP_HOST']))) { + if(isset($_SERVER['HTTPS']) AND (!empty($_SERVER['HTTPS'])) AND (strtolower($_SERVER['HTTPS']) != 'off')) { + $k_path_url = 'https://'; +@@ -128,7 +105,7 @@ + * Default images directory. + * By default it is automatically set but you can also set it as a fixed string to improve performances. + */ +-define ('K_PATH_IMAGES', $tcpdf_images_path); ++define ('K_PATH_IMAGES', dirname(__DIR__).'/images/'); + + /** + * Blank image. +@@ -165,20 +142,11 @@ + */ + define ('PDF_HEADER_STRING', "by Nicola Asuni - Tecnick.com\nwww.tcpdf.org"); + +-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +-// Try to automatically set the value for the following K_PATH_IMAGES constant. +-// NOTE: delete this section and manually set the K_PATH_IMAGES constant below for better performances. +-$tcpdf_header_logo = ''; +-if (file_exists(K_PATH_IMAGES.'tcpdf_logo.jpg')) { +- $tcpdf_header_logo = 'tcpdf_logo.jpg'; +-} +-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +- + /** + * Deafult image logo used be the default Header() method. + * Please set here your own logo or an empty string to disable it. + */ +-define ('PDF_HEADER_LOGO', $tcpdf_header_logo); ++define ('PDF_HEADER_LOGO', 'tcpdf_logo.jpg'); + + /** + * Header logo image width [mm]. +Seulement dans tcpdf/examples/config: tcpdf_config_alt.php~ +diff -ru 016-2/examples/tcpdf_include.php tcpdf/examples/tcpdf_include.php +--- 016-2/examples/tcpdf_include.php 2013-05-14 18:39:40.000000000 +0200 ++++ tcpdf/examples/tcpdf_include.php 2013-05-16 13:32:34.000000000 +0200 +@@ -23,14 +23,9 @@ + * @since 2013-05-14 + */ + +-// Include the main TCPDF library (search the library on the following directories). +-$tcpdf_include_dirs = array(realpath('../tcpdf.php'), '/usr/share/php/tcpdf/tcpdf.php', '/usr/share/tcpdf/tcpdf.php', '/usr/share/php-tcpdf/tcpdf.php', '/var/www/tcpdf/tcpdf.php', '/var/www/html/tcpdf/tcpdf.php', '/usr/local/apache2/htdocs/tcpdf/tcpdf.php'); +-foreach ($tcpdf_include_dirs as $tcpdf_include_path) { +- if (file_exists($tcpdf_include_path)) { +- require_once($tcpdf_include_path); +- break; +- } +-} ++// Include the main TCPDF library ++require_once(__DIR__.'/config/tcpdf_config_alt.php'); ++require_once('/usr/share/php/tcpdf/tcpdf.php'); + + //============================================================+ + // END OF FILE +Seulement dans tcpdf/examples: tcpdf_include.php~ +diff -ru 016-2/tools/tcpdf_addfont.php tcpdf/tools/tcpdf_addfont.php +--- 016-2/tools/tcpdf_addfont.php 2013-05-15 17:25:21.000000000 +0200 ++++ tcpdf/tools/tcpdf_addfont.php 2013-05-16 13:45:50.000000000 +0200 +@@ -47,7 +47,7 @@ + } + + // Include the main TCPDF library (search the library on the following directories). +-$tcpdf_include_dirs = array(realpath('../tcpdf.php'), '/usr/share/php/tcpdf/tcpdf.php', '/usr/share/tcpdf/tcpdf.php', '/usr/share/php-tcpdf/tcpdf.php', '/var/www/tcpdf/tcpdf.php', '/var/www/html/tcpdf/tcpdf.php', '/usr/local/apache2/htdocs/tcpdf/tcpdf.php'); ++$tcpdf_include_dirs = array(realpath(__DIR__.'/../tcpdf.php'), '/usr/share/php/tcpdf/tcpdf.php', '/usr/share/tcpdf/tcpdf.php', '/usr/share/php-tcpdf/tcpdf.php', '/var/www/tcpdf/tcpdf.php', '/var/www/html/tcpdf/tcpdf.php', '/usr/local/apache2/htdocs/tcpdf/tcpdf.php'); + foreach ($tcpdf_include_dirs as $tcpdf_include_path) { + if (file_exists($tcpdf_include_path)) { + require_once($tcpdf_include_path); +Seulement dans tcpdf/tools: tcpdf_addfont.php~ |