summaryrefslogtreecommitdiffstats
path: root/php-zetacomponents-graph.spec
blob: 628b4e42713db59b3e7b2fbed6026e8e2f844a0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# remirepo/fedora spec file for php-zetacomponents-graph
#
# Copyright (c) 2015-2019 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#

%global gh_commit    7efda09f967b92fe38a1fbf0c2090fc4fedb0c73
%global gh_short     %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner     zetacomponents
%global gh_project   Graph
%global cname        graph
%global ezcdir       %{_datadir}/php/ezc
%global with_tests   %{?_without_tests:0}%{!?_without_tests:1}

Name:           php-%{gh_owner}-%{cname}
Version:        1.5.2
Release:        12%{?dist}
Summary:        Zeta Graph Component

License:        ASL 2.0
URL:            http://zetacomponents.org/
Source0:        https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}-%{gh_short}.tar.gz

# https://github.com/zetacomponents/Graph/pull/16
Patch0:         %{name}-pr16.patch
# Upstream
Patch1:         %{name}-upstream.patch

BuildArch:      noarch
BuildRequires:  %{_bindir}/phpab
%if %{with_tests}
BuildRequires:  %{_bindir}/phpunit
BuildRequires:  php-gd
BuildRequires:  php-composer(%{gh_owner}/base) >= 1.8
BuildRequires:  php-composer(%{gh_owner}/unit-test)
%if 0%{?fedora} > 24
# Used for the test suite
BuildRequires:  glibc-langpack-en
BuildRequires:  glibc-langpack-de
%endif
%endif

# From composer.json, "require": {
#            "zetacomponents/base": "~1.8"
Requires:       php-composer(%{gh_owner}/base) >= 1.8
Requires:       php-composer(%{gh_owner}/base) <  2
# From composer.json, "suggest": {
#            "ext-gd": "Used by the GD driver, one of the choices for generating bitmap images."
Requires:       php-gd
# From phpcompatinfo report for 1.5.2
Requires:       php(language) > 5.3
Requires:       php-date
Requires:       php-dom
Requires:       php-gd
Requires:       php-pcre
Requires:       php-simplexml
Requires:       php-spl
Requires:       php-xml

Provides:       php-composer(%{gh_owner}/%{cname}) = %{version}


%description
A component for creating pie charts, line graphs and other kinds of diagrams.

Documentation is available in the %{name}-doc package.


%package doc
Summary:  Documentation for %{name}
# For License
Requires: %{name} = %{version}-%{release}

%description doc
%{summary}.


%prep
%setup -q -n %{gh_project}-%{gh_commit}

%patch0 -p1
%patch1 -p1

: Drop bundled fonts
rm docs/tutorial/tutorial_font.*
sed -e 's:tutorial_font.ttf:/usr/share/fonts/gnu-free/FreeSans.ttf:' \
    -i docs/tutorial/*php


%build
: Generate a simple autoloader
%{_bindir}/phpab \
   --output src/autoloader.php \
   src
cat <<EOF | tee -a  src/autoloader.php
# Dependencies
require_once '%{ezcdir}/Base/autoloader.php';
EOF


%install
mkdir -p %{buildroot}%{ezcdir}/autoload

: The library
cp -pr src \
       %{buildroot}%{ezcdir}/%{gh_project}
: For ezcBase autoloader
cp -pr src/*_autoload.php \
       %{buildroot}%{ezcdir}/autoload


%check
%if %{with_tests}
: Create test autoloader
mkdir vendor
cat <<EOF | tee vendor/autoload.php
<?php
require '%{ezcdir}/UnitTest/autoloader.php';
require '%{buildroot}%{ezcdir}/%{gh_project}/autoloader.php';
class_alias('PHPUnit_Framework_Constraint', 'PHPUnit\\Framework\\Constraint');
EOF

: Ignore test with erratic result
sed -e 's/testBarChartWithSingleDataPointNumericAxis/SKIP_testBarChartWithSingleDataPointNumericAxis/' \
    -i tests/chart_test.php

: Run test test suite
%{_bindir}/phpunit
%else
: Test suite disabled
%endif


%files
%{!?_licensedir:%global license %%doc}
%license LICENSE* CREDITS
%doc ChangeLog
%doc composer.json
%{ezcdir}/autoload/*
%{ezcdir}/%{gh_project}

%files doc
%doc docs design


%changelog
* Wed Sep 11 2019 Remi Collet <remi@remimrepo.net> - 1.5.2-12
- fix FTBFS #1736437

* Mon Feb 29 2016 Remi Collet <remi@fedoraproject.org> - 1.5.2-5
- add BR glibc-langpack-en, glibc-langpack-de for test suite
  FTBFS detected by Koschei
- ignore 1 test with erratic result

* Mon Jul 13 2015 Remi Collet <remi@fedoraproject.org> - 1.5.2-3
- create subpackage for documentation
- minor improvments, from review #1228090 comments

* Thu Jun  4 2015 Remi Collet <remi@fedoraproject.org> - 1.5.2-2
- add upstream patch for LICENSE file

* Wed Jun  3 2015 Remi Collet <remi@fedoraproject.org> - 1.5.2-1
- initial package
- open https://github.com/zetacomponents/Graph/pull/16