]>
Commit | Line | Data |
---|---|---|
f21c5b27 ER |
1 | # NOTE |
2 | # - release tarballs: http://getcomposer.org/download/ | |
3 | ||
7e4a1874 ER |
4 | # Conditional build: |
5 | %bcond_with bootstrap # build boostrap | |
6 | ||
fc4ae5b5 | 7 | %define php_min_version 5.3.4 |
b3a11e21 | 8 | %define subver alpha8 |
a62cffcb | 9 | %define rel 1 |
fc4ae5b5 ER |
10 | %include /usr/lib/rpm/macros.php |
11 | Summary: Dependency Manager for PHP | |
734cea69 | 12 | Name: composer |
fc4ae5b5 ER |
13 | Version: 1.0.0 |
14 | Release: 0.%{subver}.%{rel} | |
15 | License: MIT | |
16 | Group: Development/Languages/PHP | |
b3a11e21 ER |
17 | Source0: https://github.com/composer/composer/archive/%{version}-%{subver}/%{name}-%{version}-%{subver}.tar.gz |
18 | # Source0-md5: a304aecf48b8406730d572e204afd6db | |
734cea69 | 19 | Source1: http://getcomposer.org/download/%{version}-%{subver}/%{name}.phar |
b3a11e21 | 20 | # Source1-md5: df1001975035f07d09307bf1f1e62584 |
7e4a1874 | 21 | Patch0: nogit.patch |
c9eae711 ER |
22 | Patch1: no-vendors.patch |
23 | Patch2: autoload-config.patch | |
fc4ae5b5 | 24 | URL: http://www.getcomposer.org/ |
27e7a28a | 25 | BuildRequires: /usr/bin/phar |
7e4a1874 | 26 | BuildRequires: /usr/bin/php |
fc1f03a9 ER |
27 | BuildRequires: php(ctype) |
28 | BuildRequires: php(hash) | |
29 | BuildRequires: php(json) | |
30 | BuildRequires: php(openssl) | |
7e4a1874 | 31 | BuildRequires: php(phar) |
89da5e62 | 32 | BuildRequires: php(zip) |
27e7a28a | 33 | BuildRequires: php(zlib) |
fc4ae5b5 ER |
34 | BuildRequires: rpm-php-pearprov >= 4.4.2-11 |
35 | BuildRequires: rpmbuild(macros) >= 1.461 | |
7e4a1874 ER |
36 | %if %{without bootstrap} |
37 | BuildRequires: %{name} | |
a62cffcb ER |
38 | BuildRequires: php-symfony2-Console >= 2.3 |
39 | BuildRequires: php-symfony2-Finder >= 2.2 | |
7e4a1874 | 40 | %endif |
fc4ae5b5 | 41 | Requires: php(core) >= %{php_min_version} |
fd5fce61 | 42 | Requires: php(hash) |
d0052d6c | 43 | Requires: php(phar) |
27e7a28a | 44 | %if %{without bootstrap} |
c09cb1dd ER |
45 | Requires: php-justinrainbow-json-schema >= 1.1.0 |
46 | Requires: php-seld-jsonlint >= 1.1.2 | |
1550ab9f ER |
47 | Requires: php-symfony2-Console >= 2.3 |
48 | Requires: php-symfony2-Finder >= 2.2 | |
f21c5b27 | 49 | Requires: php-symfony2-Process >= 2.1 |
27e7a28a | 50 | %endif |
a9025f5d ER |
51 | Suggests: git-core |
52 | Suggests: mercurial | |
a3c55e4e | 53 | Suggests: php(openssl) |
0cf8b9e3 | 54 | Suggests: php(zip) |
a9025f5d | 55 | Suggests: subversion |
fc4ae5b5 ER |
56 | BuildArch: noarch |
57 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
58 | ||
734cea69 | 59 | %define _appdir %{_datadir}/%{name} |
a2a560b6 | 60 | |
fc4ae5b5 ER |
61 | %description |
62 | Composer is a tool for dependency management in PHP. It allows you to | |
63 | declare the dependent libraries your project needs and it will install | |
64 | them in your project for you. | |
65 | ||
66 | %prep | |
ee5e3da9 ER |
67 | %setup -qc -n %{name}-%{version}-%{release} |
68 | mv composer-*/* . | |
b8c430b4 | 69 | %patch0 -p1 |
27e7a28a | 70 | %{!?with_bootstrap:%patch1 -p1} |
7e4a1874 | 71 | |
89da5e62 | 72 | mv composer.lock{,.disabled} |
a2a560b6 ER |
73 | %{__sed} -i -e '1s,^#!.*env php,#!%{__php},' bin/* |
74 | ||
7e4a1874 ER |
75 | %build |
76 | %if %{with bootstrap} | |
89da5e62 | 77 | composer='%{__php} %{SOURCE1}' |
27e7a28a | 78 | phar extract -f "%{SOURCE1}" -i vendor . |
7e4a1874 | 79 | %else |
f21c5b27 | 80 | composer=composer |
fc1f03a9 | 81 | %endif |
f21c5b27 | 82 | if [ ! -d vendor ]; then |
89da5e62 | 83 | COMPOSER_HOME=${PWD:=$(pwd)} \ |
a62cffcb | 84 | $composer dump-autoload -v |
f21c5b27 ER |
85 | %{__patch} -p1 < %{PATCH2} |
86 | fi | |
7e4a1874 | 87 | |
b3a11e21 | 88 | COMPOSER_VERSION=%{version}%{?subver:-%{subver}} \ |
7e4a1874 | 89 | %{__php} -d phar.readonly=0 ./bin/compile |
fc4ae5b5 | 90 | |
f21c5b27 ER |
91 | # sanity check |
92 | %{__php} composer.phar --version | |
93 | ||
94 | install -d build | |
95 | %{__php} -r '$phar = new Phar($argv[1]); $phar->extractTo($argv[2]);' composer.phar build | |
96 | ||
fc4ae5b5 ER |
97 | %install |
98 | rm -rf $RPM_BUILD_ROOT | |
a2a560b6 | 99 | install -d $RPM_BUILD_ROOT{%{_bindir},%{_appdir}} |
f21c5b27 | 100 | cd build |
055b7afe | 101 | cp -a bin src res vendor $RPM_BUILD_ROOT%{_appdir} |
734cea69 | 102 | ln -s %{_appdir}/bin/%{name} $RPM_BUILD_ROOT%{_bindir}/%{name} |
fc4ae5b5 ER |
103 | |
104 | %clean | |
105 | rm -rf $RPM_BUILD_ROOT | |
106 | ||
107 | %files | |
108 | %defattr(644,root,root,755) | |
7e4a1874 | 109 | %doc README.md CHANGELOG.md LICENSE PORTING_INFO |
fc4ae5b5 | 110 | %attr(755,root,root) %{_bindir}/composer |
a2a560b6 ER |
111 | %dir %{_appdir} |
112 | %dir %{_appdir}/bin | |
113 | %attr(755,root,root) %{_appdir}/bin/* | |
055b7afe | 114 | %{_appdir}/res |
a2a560b6 | 115 | %{_appdir}/src |
055b7afe | 116 | %{_appdir}/vendor |