summaryrefslogtreecommitdiffstats
path: root/php-mcnetic-zipstreamer.spec
blob: 420442d0c0754aeb9a81f1a49271ff718982774f (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
# remirepo/fedora spec file for php-mcnetic-zipstreamer
#
# Copyright (c) 2016 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#
%global gh_commit    44c99c659abf4dac92882437c1da68de824ca9d0
%global gh_short     %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner     McNetic
%global gh_project   PHPZipStreamer
%global with_tests   0%{!?_without_tests:1}
%global namespace    ZipStreamer

Name:           php-mcnetic-zipstreamer
Version:        1.7
Release:        1%{?dist}
Summary:        Stream zip files without i/o overhead

Group:          Development/Libraries
License:        GPLv3+
URL:            https://github.com/%{gh_owner}/%{gh_project}
Source0:        https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}-%{gh_short}.tar.gz

# See https://github.com/McNetic/PHPZipStreamer/issues/29
Patch1:         %{name}-warn.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch:      noarch
BuildRequires:  php-composer(theseer/autoload)
%if %{with_tests}
BuildRequires:  php(language) >= 5.3.0
BuildRequires:  php-date
BuildRequires:  php-hash
BuildRequires:  php-mbstring
BuildRequires:  php-pcre
BuildRequires:  php-spl
BuildRequires:  php-composer(phpunit/phpunit)
BuildRequires:  php-pecl(Xdebug)
BuildRequires:  php-pecl(pecl_http)
%endif

# From composer.json
#      "php": ">=5.3.0"
Requires:       php(language) >= 5.3.0
# From phpcompatinfo report for version0.7
Requires:       php-date
Requires:       php-hash
Requires:       php-mbstring
Requires:       php-spl
%if 0%{?fedora} > 21
# For compression
Recommends:     php-pecl(pecl_http)
%else
Requires:       php-pecl(pecl_http)
%endif

Provides:       php-composer(mcnetic/zipstreamer) = %{version}


%description
Simple Class to create zip files on the fly and stream directly to the
HTTP client as the content is added (without using temporary files).

Autoloader: %{_datadir}/php/%{namespace}/autoload.php


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

%patch1 -p0 -b .rpm
find . -name \*.rpm -exec rm {} \;


%build
%{_bindir}/phpab -o src/autoload.php src


%install
rm -rf     %{buildroot}
mkdir -p   %{buildroot}%{_datadir}/php
cp -pr src %{buildroot}%{_datadir}/php/%{namespace}


%check
%if %{with_tests}

: Run test suite
%{_bindir}/phpunit \
  --bootstrap %{buildroot}%{_datadir}/php/%{namespace}/autoload.php \
  --configuration test/phpunit.xml

if which php70; then
  php70 %{_bindir}/phpunit \
    --bootstrap %{buildroot}%{_datadir}/php/%{namespace}/autoload.php \
    --configuration test/phpunit.xml
fi
%else
: Test suite disabled
%endif


%clean
rm -rf %{buildroot}


%files
%defattr(-,root,root,-)
%{!?_licensedir:%global license %%doc}
%license COPYING
%doc *.md
%doc composer.json
%{_datadir}/php/%{namespace}


%changelog
* Fri Jan  8 2016 Remi Collet <remi@fedoraproject.org> - 1.7.1
- initial package
- add patch to workaround error raised by pecl_http
  see https://github.com/McNetic/PHPZipStreamer/issues/29