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