diff options
| -rw-r--r-- | composer.json | 12 | ||||
| -rw-r--r-- | php-tecnickcom-tc-lib-pdf-font-rpm.patch | 26 | ||||
| -rw-r--r-- | php-tecnickcom-tc-lib-pdf-font.spec | 128 |
3 files changed, 138 insertions, 28 deletions
diff --git a/composer.json b/composer.json index 1f04da1..006cc25 100644 --- a/composer.json +++ b/composer.json @@ -25,15 +25,21 @@ "ext-json": "*", "ext-pcre": "*", "ext-zlib": "*", - "tecnickcom/tc-lib-file": "^2.1", + "tecnickcom/tc-lib-file": "^2.2", "tecnickcom/tc-lib-unicode-data": "^2.0", "tecnickcom/tc-lib-pdf-encrypt": "^2.1" }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } + }, "require-dev": { "pdepend/pdepend": "2.16.2", "phpmd/phpmd": "2.15.0", - "phpunit/phpunit": "12.0.1 || 11.5.7 || 10.5.40", - "squizlabs/php_codesniffer": "3.11.3" + "phpunit/phpunit": "12.4.4 || 11.5.44 || 10.5.58", + "squizlabs/php_codesniffer": "4.0.1", + "phpcompatibility/php-compatibility": "^10.0.0@dev" }, "autoload": { "psr-4": { diff --git a/php-tecnickcom-tc-lib-pdf-font-rpm.patch b/php-tecnickcom-tc-lib-pdf-font-rpm.patch index 2ef076e..4f76916 100644 --- a/php-tecnickcom-tc-lib-pdf-font-rpm.patch +++ b/php-tecnickcom-tc-lib-pdf-font-rpm.patch @@ -1,32 +1,32 @@ -diff -up util/bulk_convert.php.rpm util/bulk_convert.php ---- util/bulk_convert.php.rpm 2023-11-29 08:34:27.788544032 +0100 -+++ util/bulk_convert.php 2023-11-29 08:36:54.124053746 +0100 -@@ -86,7 +86,7 @@ if (!is_writable($options['outpath'])) { +diff -up ./util/bulk_convert.php.rpm ./util/bulk_convert.php +--- ./util/bulk_convert.php.rpm 2025-12-05 07:31:19.501111222 +0100 ++++ ./util/bulk_convert.php 2025-12-05 07:33:19.462370628 +0100 +@@ -86,7 +86,7 @@ if (!\is_writable($options['outpath'])) exit(2); } -$ttfdir = __DIR__.'/vendor/tecnickcom/tc-font-mirror/'; +$ttfdir = dirname(__DIR__).'/tc-font-mirror-2.1.0/'; if (!is_dir($ttfdir)) { - fwrite(STDERR, 'ERROR: The '.$ttfdir.' directory is empty, please execute \'make build\' before this command.'."\n\n"); + \fwrite(STDERR, 'ERROR: The '.$ttfdir.' directory is empty, please execute \'make build\' before this command.'."\n\n"); exit(3); -@@ -98,7 +98,7 @@ fwrite(STDOUT, "\n".'>>> Converting font +@@ -98,7 +98,7 @@ if (!is_dir($ttfdir)) { $convert_errors = 0; $convert_success = 0; --require_once (dirname(__DIR__).'/vendor/autoload.php'); +-require_once (\dirname(__DIR__).'/vendor/autoload.php'); +require_once (dirname(__DIR__).'/src/autoload.php'); - $fontdir = array_diff(scandir($ttfdir), array('.', '..', '.git')); + $fontdir = \array_diff(\scandir($ttfdir), array('.', '..', '.git')); -diff -up util/convert.php.rpm util/convert.php ---- util/convert.php.rpm 2023-11-29 13:46:32.380588175 +0100 -+++ util/convert.php 2023-11-29 13:46:34.960688370 +0100 -@@ -224,7 +224,7 @@ fwrite(STDOUT, "\n".'>>> Converting font +diff -up ./util/convert.php.rpm ./util/convert.php +--- ./util/convert.php.rpm 2025-12-05 07:31:19.501170686 +0100 ++++ ./util/convert.php 2025-12-05 07:33:51.032586961 +0100 +@@ -224,7 +224,7 @@ if (empty($options['fonts'])) { $convert_errors = 0; $convert_success = 0; --require_once (dirname(dirname(__DIR__)).'/vendor/autoload.php'); +-require_once (\dirname(\dirname(__DIR__)).'/vendor/autoload.php'); +require_once ('/usr/share/php/Com/Tecnick/Pdf/Font/autoload.php'); foreach ($options['fonts'] as $font) { diff --git a/php-tecnickcom-tc-lib-pdf-font.spec b/php-tecnickcom-tc-lib-pdf-font.spec index 55fb90f..5fe88ae 100644 --- a/php-tecnickcom-tc-lib-pdf-font.spec +++ b/php-tecnickcom-tc-lib-pdf-font.spec @@ -6,18 +6,25 @@ # # Please, preserve the changelog entries # -%global gh_commit 316bdc5bdf820a564be05d7efcb194254f8982c3 +%global gh_commit 8b5015e3d2896481e15cdfa529d332bda08e0d29 %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) %global c_vendor tecnickcom %global gh_owner tecnickcom %global gh_project tc-lib-pdf-font %global php_project %{_datadir}/php/Com/Tecnick/Pdf/Font -%global with_tests 0%{!?_without_tests:1} %global font_version 2.1.0 +%bcond_without tests + +%if 0%{?fedora} +%bcond_without unifont +%else +%bcond_with unifont +%endif + Name: php-%{gh_owner}-%{gh_project} -Version: 2.6.6 -Release: 1%{?dist} +Version: 2.6.22 +Release: 3%{?dist} Summary: PHP library containing PDF page formats and definitions License: LGPL-3.0-or-later @@ -29,27 +36,37 @@ Source1: https://github.com/tecnickcom/tc-font-mirror/archive/refs/tags/% Patch0: %{name}-rpm.patch BuildArch: noarch -%if %{with_tests} +%if %{with tests} # For tests %global phpunit %{_bindir}/phpunit10 -BuildRequires: phpunit10 >= 10.5.40 +BuildRequires: phpunit10 >= 10.5.58 BuildRequires: php(language) >= 8.1 BuildRequires: php-json BuildRequires: php-pcre BuildRequires: php-spl BuildRequires: php-zlib -BuildRequires: (php-composer(%{c_vendor}/tc-lib-file) >= 2.1 with php-composer(%{c_vendor}/tc-lib-file) < 3) +BuildRequires: (php-composer(%{c_vendor}/tc-lib-file) >= 2.2 with php-composer(%{c_vendor}/tc-lib-file) < 3) BuildRequires: (php-composer(%{c_vendor}/tc-lib-unicode-data) >= 2.0 with php-composer(%{c_vendor}/tc-lib-unicode-data) < 3) BuildRequires: (php-composer(%{c_vendor}/tc-lib-pdf-encrypt) >= 2.1 with php-composer(%{c_vendor}/tc-lib-pdf-encrypt) < 3) %endif BuildRequires: php-fedora-autoloader-devel +# System fonts +BuildRequires: dejavu-serif-fonts +BuildRequires: dejavu-sans-fonts +BuildRequires: dejavu-sans-mono-fonts +BuildRequires: gnu-free-mono-fonts +BuildRequires: gnu-free-sans-fonts +BuildRequires: gnu-free-serif-fonts +%if %{with unifont} +BuildRequires: unifont-ttf-fonts +%endif # From composer.json, "require": { # "php": ">=8.1", # "ext-json": "*", # "ext-pcre": "*", # "ext-zlib": "*", -# "tecnickcom/tc-lib-file": "^2.1", +# "tecnickcom/tc-lib-file": "^2.2", # "tecnickcom/tc-lib-unicode-data": "^2.0", # "tecnickcom/tc-lib-pdf-encrypt": "^2.1" Requires: php(language) >= 8.1 @@ -57,12 +74,22 @@ Requires: php-json Requires: php-pcre Requires: php-spl Requires: php-zlib -Requires: (php-composer(%{c_vendor}/tc-lib-file) >= 2.1 with php-composer(%{c_vendor}/tc-lib-file) < 3) +Requires: (php-composer(%{c_vendor}/tc-lib-file) >= 2.2 with php-composer(%{c_vendor}/tc-lib-file) < 3) Requires: (php-composer(%{c_vendor}/tc-lib-unicode-data) >= 2.0 with php-composer(%{c_vendor}/tc-lib-unicode-data) < 3) Requires: (php-composer(%{c_vendor}/tc-lib-pdf-encrypt) >= 2.1 with php-composer(%{c_vendor}/tc-lib-pdf-encrypt) < 3) # From phpcompatinfo report for version 2.0.8 # none Requires: php-composer(fedora/autoloader) +# System fonts +Requires: dejavu-serif-fonts +Requires: dejavu-sans-fonts +Requires: dejavu-sans-mono-fonts +Requires: gnu-free-mono-fonts +Requires: gnu-free-sans-fonts +Requires: gnu-free-serif-fonts +%if %{with unifont} +Requires: unifont-ttf-fonts +%endif # Composer Provides: php-composer(%{c_vendor}/%{gh_project}) = %{version} @@ -101,14 +128,52 @@ mkdir -p $(dirname %{buildroot}%{php_project}) cp -pr src %{buildroot}%{php_project} cd util +install -Dpm 755 convert.php %{buildroot}%{_bindir}/%{name}-convert + +# Remove TTF available in system fonts +mv ../tc-font-mirror-%{font_version}/{dejavu,freefont} . +%if %{with unifont} +mv ../tc-font-mirror-%{font_version}/unifont . +%endif + mkdir -p %{buildroot}/%{_datadir}/%{name} php bulk_convert.php --outpath=%{buildroot}%{_datadir}/%{name}/ -install -Dpm 755 convert.php %{buildroot}%{_bindir}/%{name}-convert +# Restore TTF for tests +mv {dejavu,freefont} ../tc-font-mirror-%{font_version} +%if %{with unifont} +mv unifont ../tc-font-mirror-%{font_version} +%endif + +# Fix autoloader +sed -e 's:%{_datadir}:%{buildroot}%{_datadir}:' convert.php >_convert.php + +# System fonts +mkdir %{buildroot}%{_datadir}/%{name}/{dejavu,freefont} +for ttf in \ + /usr/share/fonts/dejav*/*ttf \ +; do php -d memory_limit=1G _convert.php \ + --fonts=$ttf --linked --outpath=%{buildroot}%{_datadir}/%{name}/dejavu/ +done +for ttf in \ + /usr/share/fonts/gnu-free/*ttf \ +; do php -d memory_limit=1G _convert.php \ + --fonts=$ttf --linked --outpath=%{buildroot}%{_datadir}/%{name}/freefont/ +done +%if %{with unifont} +mkdir %{buildroot}%{_datadir}/%{name}/unifont +for ttf in \ + /usr/share/fonts/unifont/*ttf \ +; do php -d memory_limit=1G _convert.php \ + --fonts=$ttf --linked --outpath=%{buildroot}%{_datadir}/%{name}/unifont/ +done +%endif + +# TODO fix absolute links to /usr/share/fonts %check -%if %{with_tests} +%if %{with tests} mkdir vendor cat << 'EOF' | tee vendor/autoload.php <?php @@ -119,7 +184,7 @@ EOF sed -e 's:/util/vendor/tecnickcom/tc-font-mirror/:/tc-font-mirror-2.1.0/:' -i test/*php ret=0 -for cmdarg in php php81 php82 php83 php84; do +for cmdarg in php php81 php82 php83 php84 php85; do if which $cmdarg; then set $cmdarg cp phpunit.xml.dist phpunit.xml @@ -143,6 +208,45 @@ exit $ret %changelog +* Fri Dec 12 2025 Remi Collet <remi@remirepo.net> - 2.6.22-3 +- Fedora only: use system fonts (unifont) + +* Fri Dec 12 2025 Remi Collet <remi@remirepo.net> - 2.6.22-2 +- use system fonts (dejavu and gnu-free) + +* Thu Dec 11 2025 Remi Collet <remi@remirepo.net> - 2.6.22-1 +- update to 2.6.22 (no change) + +* Thu Dec 11 2025 Remi Collet <remi@remirepo.net> - 2.6.21-1 +- update to 2.6.21 (no change) + +* Tue Dec 9 2025 Remi Collet <remi@remirepo.net> - 2.6.19-1 +- update to 2.6.19 (no change) + +* Fri Dec 5 2025 Remi Collet <remi@remirepo.net> - 2.6.18-1 +- update to 2.6.18 + +* Thu Dec 4 2025 Remi Collet <remi@remirepo.net> - 2.6.16-1 +- update to 2.6.16 (no change) + +* Sat Nov 29 2025 Remi Collet <remi@remirepo.net> - 2.6.15-1 +- update to 2.6.15 + +* Sun Jun 8 2025 Remi Collet <remi@remirepo.net> - 2.6.12-1 +- update to 2.6.12 (no change) + +* Sat May 31 2025 Remi Collet <remi@remirepo.net> - 2.6.10-1 +- update to 2.6.10 (no change) +- raise dependency on tecnickcom/tc-lib-file 2.2 + +* Wed May 14 2025 Remi Collet <remi@remirepo.net> - 2.6.9-1 +- update to 2.6.9 (no change) + +* Mon Apr 28 2025 Remi Collet <remi@remirepo.net> - 2.6.7-1 +- update to 2.6.7 +- raise dependency on tecnickcom/tc-lib-file 2.1.4 + see https://github.com/tecnickcom/tc-lib-pdf-font/pull/10 + * Fri Feb 7 2025 Remi Collet <remi@remirepo.net> - 2.6.6-1 - update to 2.6.6 |
