]>
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 |
f21c5b27 | 10 | %define rel 0.13 |
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) |
fc4ae5b5 ER |
33 | BuildRequires: rpm-php-pearprov >= 4.4.2-11 |
34 | BuildRequires: rpmbuild(macros) >= 1.461 | |
7e4a1874 ER |
35 | %if %{without bootstrap} |
36 | BuildRequires: %{name} | |
37 | %endif | |
fc4ae5b5 | 38 | Requires: php(core) >= %{php_min_version} |
f21c5b27 ER |
39 | Requires: php-symfony2-Console >= 2.1 |
40 | Requires: php-symfony2-Finder >= 2.1 | |
41 | Requires: php-symfony2-Process >= 2.1 | |
a9025f5d ER |
42 | Suggests: git-core |
43 | Suggests: mercurial | |
a3c55e4e | 44 | Suggests: php(openssl) |
0cf8b9e3 | 45 | Suggests: php(zip) |
a9025f5d | 46 | Suggests: subversion |
fc4ae5b5 ER |
47 | BuildArch: noarch |
48 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
49 | ||
734cea69 | 50 | %define _appdir %{_datadir}/%{name} |
a2a560b6 | 51 | |
fc4ae5b5 ER |
52 | %description |
53 | Composer is a tool for dependency management in PHP. It allows you to | |
54 | declare the dependent libraries your project needs and it will install | |
55 | them in your project for you. | |
56 | ||
57 | %prep | |
f21c5b27 ER |
58 | %setup -qc |
59 | mv composer-composer-*/* . | |
b8c430b4 | 60 | %patch0 -p1 |
f21c5b27 | 61 | %patch1 -p1 |
7e4a1874 | 62 | |
a2a560b6 ER |
63 | %{__sed} -i -e '1s,^#!.*env php,#!%{__php},' bin/* |
64 | ||
7e4a1874 ER |
65 | %build |
66 | %if %{with bootstrap} | |
f21c5b27 | 67 | composer='env -i PATH="$PATH" %{__php} %{SOURCE1}' |
7e4a1874 | 68 | %else |
f21c5b27 | 69 | composer=composer |
fc1f03a9 | 70 | %endif |
f21c5b27 ER |
71 | if [ ! -d vendor ]; then |
72 | $composer install --prefer-dist -v | |
73 | %{__patch} -p1 < %{PATCH2} | |
74 | fi | |
7e4a1874 | 75 | |
f21c5b27 ER |
76 | V=$(echo composer-composer-*) |
77 | V=${V#composer-composer-} | |
78 | COMPOSER_VERSION=%{version}%{?subver:-%{subver}}${V:+-g$V} \ | |
7e4a1874 | 79 | %{__php} -d phar.readonly=0 ./bin/compile |
fc4ae5b5 | 80 | |
f21c5b27 ER |
81 | # sanity check |
82 | %{__php} composer.phar --version | |
83 | ||
84 | install -d build | |
85 | %{__php} -r '$phar = new Phar($argv[1]); $phar->extractTo($argv[2]);' composer.phar build | |
86 | ||
fc4ae5b5 ER |
87 | %install |
88 | rm -rf $RPM_BUILD_ROOT | |
a2a560b6 | 89 | install -d $RPM_BUILD_ROOT{%{_bindir},%{_appdir}} |
f21c5b27 | 90 | cd build |
055b7afe | 91 | cp -a bin src res vendor $RPM_BUILD_ROOT%{_appdir} |
734cea69 | 92 | ln -s %{_appdir}/bin/%{name} $RPM_BUILD_ROOT%{_bindir}/%{name} |
fc4ae5b5 ER |
93 | |
94 | %clean | |
95 | rm -rf $RPM_BUILD_ROOT | |
96 | ||
97 | %files | |
98 | %defattr(644,root,root,755) | |
7e4a1874 | 99 | %doc README.md CHANGELOG.md LICENSE PORTING_INFO |
fc4ae5b5 | 100 | %attr(755,root,root) %{_bindir}/composer |
a2a560b6 ER |
101 | %dir %{_appdir} |
102 | %dir %{_appdir}/bin | |
103 | %attr(755,root,root) %{_appdir}/bin/* | |
055b7afe | 104 | %{_appdir}/res |
a2a560b6 | 105 | %{_appdir}/src |
055b7afe | 106 | %{_appdir}/vendor |