summaryrefslogtreecommitdiffstats
path: root/php-container-interop.spec
blob: 058f1a66e3bccc3257b1e3ffc708de32932eb5e8 (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
168
169
170
171
172
173
174
175
# remirepo spec file for php-container-interop, from:
#
# Fedora spec file for php-container-interop
#
# Copyright (c) 2016-2021 Shawn Iwinski <shawn@iwin.ski>
#
# License: MIT
# http://opensource.org/licenses/MIT
#
# Please preserve changelog entries
#

%global github_owner     container-interop
%global github_name      container-interop
%global github_version   1.2.0
%global github_commit    79cbf1341c22ec75643d841642dd5d6acd83bdb8

%global composer_vendor  container-interop
%global composer_project container-interop

# "psr/container": "~1.0"
%global psr_container_min_ver 1.0
%global psr_container_max_ver 2.0

# remirepo:5
%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
%global with_range_dependencies 1
%else
%global with_range_dependencies 0
%endif

%{!?phpdir:  %global phpdir  %{_datadir}/php}

Name:      php-%{composer_project}
Version:   %{github_version}
Release:   13%{?github_release}%{?dist}
Summary:   Promoting the interoperability of container objects (DIC, SL, etc.)

Group:     Development/Libraries
License:   MIT
URL:       https://github.com/%{github_owner}/%{github_name}
Source0:   %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz

BuildArch: noarch
# Tests
BuildRequires: php-cli
## composer.json
# remirepo:1
%if %{with_range_dependencies}
BuildRequires: (php-composer(psr/container) >= %{psr_container_min_ver} with php-composer(psr/container) <  %{psr_container_max_ver})
# remirepo:4
%else
BuildRequires: php-psr-container <  %{psr_container_max_ver}
BuildRequires: php-psr-container >= %{psr_container_min_ver}
%endif
## phpcompatinfo (computed from version 1.2.0)
BuildRequires: php(language) >= 5.3.0
## Autoloader
BuildRequires: php-composer(fedora/autoloader)

# composer.json
# remirepo:1
%if %{with_range_dependencies}
Requires: (php-composer(psr/container) >= %{psr_container_min_ver} with php-composer(psr/container) <  %{psr_container_max_ver})
# remirepo:4
%else
Requires:  php-psr-container <  %{psr_container_max_ver}
Requires:  php-psr-container >= %{psr_container_min_ver}
%endif
# phpcompatinfo (computed from version 1.2.0)
Requires:  php(language) >= 5.3.0
# Autoloader
Requires:  php-composer(fedora/autoloader)

# php-{COMPOSER_VENDOR}-{COMPOSER_PROJECT}
Provides:  php-%{composer_vendor}-%{composer_project} = %{version}-%{release}
# Composer
Provides:  php-composer(%{composer_vendor}/%{composer_project}) = %{version}


%description
container-interop tries to identify and standardize features in container
objects (service locators, dependency injection containers, etc.) to achieve
interopererability.

Through discussions and trials, we try to create a standard, made of common
interfaces but also recommendations.

If PHP projects that provide container implementations begin to adopt these
common standards, then PHP applications and projects that use containers can
depend on the common interfaces instead of specific implementations. This
facilitates a high-level of interoperability and flexibility that allows users
to consume any container implementation that can be adapted to these interfaces.

The work done in this project is not officially endorsed by the PHP-FIG [1],
but it is being worked on by members of PHP-FIG and other good developers. We
adhere to the spirit and ideals of PHP-FIG, and hope this project will pave the
way for one or more future PSRs.

Autoloader: %{phpdir}/Interop/Container/autoload.php

[1] http://www.php-fig.org/


%prep
%setup -qn %{github_name}-%{github_commit}

: Create autoloader
cat <<'AUTOLOAD' | tee src/Interop/Container/autoload.php
<?php
/**
 * Autoloader for %{name} and its' dependencies
 * (created by %{name}-%{version}-%{release}).
 *
 * @return \Symfony\Component\ClassLoader\ClassLoader
 */
require_once '%{phpdir}/Fedora/Autoloader/autoload.php';

\Fedora\Autoloader\Autoload::addPsr4('Interop\\Container\\', __DIR__);

\Fedora\Autoloader\Dependencies::required(array(
    '%{phpdir}/Psr/Container/autoload.php',
));
AUTOLOAD


%build
# Empty build section, nothing to build


%install
mkdir -p %{buildroot}%{phpdir}
cp -rp src/* %{buildroot}%{phpdir}/


%check
: Test autoloader
php -r '
require "%{buildroot}%{phpdir}/Interop/Container/autoload.php";
exit (interface_exists("Interop\\Container\\ContainerInterface") ? 0 : 1);
'


%files
# remirepo:1
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc *.md
%doc composer.json
%doc docs
%dir %{phpdir}/Interop
     %{phpdir}/Interop/Container


%changelog
* Wed Nov 10 2021 Remi Collet <remi@remirepo.net> - 1.2.0-13
- use range dependencies

* Sun Apr 02 2017 Shawn Iwinski <shawn@iwin.ski> - 1.2.0-3
- Add dependency version macros

* Sun Apr 02 2017 Shawn Iwinski <shawn@iwin.ski> - 1.2.0-2
- Update autoloader for PHP < 5.4 (i.e. EPEL 6)

* Thu Mar  2 2017 Remi Collet <remi@remirepo.net> - 1.2.0-1
- update to 1.2.0
- add dependency on psr/container
- switch to fedora/autoloader
- add minimal autoloader check

* Mon Jan 04 2016 Remi Collet <remi@remirepo.net> - 1.1.0-1
- backport for #remirepo

* Sun Jan 03 2016 Shawn Iwinski <shawn@iwin.ski> - 1.1.0-1
- Initial package