]>
Commit | Line | Data |
---|---|---|
1 | # NOTE | |
2 | # - release tarballs: http://getcomposer.org/download/ | |
3 | ||
4 | # Conditional build: | |
5 | %bcond_with bootstrap # build boostrap | |
6 | ||
7 | %define php_min_version 5.3.4 | |
8 | %define githash b23a3cd | |
9 | %define rel 9 | |
10 | %include /usr/lib/rpm/macros.php | |
11 | Summary: Dependency Manager for PHP | |
12 | Name: composer | |
13 | Version: 1.0.0 | |
14 | Release: %{rel}.%{githash} | |
15 | License: MIT | |
16 | Group: Development/Languages/PHP | |
17 | Source0: https://github.com/composer/composer/archive/%{githash}/%{name}-%{version}-%{githash}.tar.gz | |
18 | # Source0-md5: d9e1c78c6032ebf50ed0b068f2af15ce | |
19 | %if %{with bootstrap} | |
20 | Source1: http://getcomposer.org/download/%{version}-alpha8/%{name}.phar | |
21 | # Source1-md5: df1001975035f07d09307bf1f1e62584 | |
22 | %endif | |
23 | Source2: https://raw.githubusercontent.com/iArren/%{name}-bash-completion/86a8129/composer | |
24 | # Source2-md5: cdeebf0a0da1fd07d0fd886d0461642e | |
25 | Patch0: nogit.patch | |
26 | Patch1: no-vendors.patch | |
27 | Patch2: autoload-config.patch | |
28 | Patch3: update-memory-limit.patch | |
29 | URL: http://www.getcomposer.org/ | |
30 | BuildRequires: %{php_name}-ctype | |
31 | BuildRequires: %{php_name}-hash | |
32 | BuildRequires: %{php_name}-json | |
33 | BuildRequires: %{php_name}-openssl | |
34 | BuildRequires: %{php_name}-phar | |
35 | BuildRequires: %{php_name}-program | |
36 | BuildRequires: %{php_name}-zip | |
37 | BuildRequires: %{php_name}-zlib | |
38 | BuildRequires: /usr/bin/phar | |
39 | BuildRequires: /usr/bin/php | |
40 | BuildRequires: rpm-php-pearprov >= 4.4.2-11 | |
41 | BuildRequires: rpmbuild(macros) >= 1.673 | |
42 | %if %{without bootstrap} | |
43 | BuildRequires: %{name} | |
44 | BuildRequires: php-symfony2-Console >= 2.3 | |
45 | BuildRequires: php-symfony2-Finder >= 2.2 | |
46 | %endif | |
47 | Requires: php(core) >= %{php_min_version} | |
48 | Requires: php(ctype) | |
49 | Requires: php(date) | |
50 | Requires: php(filter) | |
51 | Requires: php(hash) | |
52 | Requires: php(json) | |
53 | Requires: php(openssl) | |
54 | Requires: php(pcre) | |
55 | Requires: php(phar) | |
56 | Requires: php(posix) | |
57 | Requires: php(simplexml) | |
58 | Requires: php(spl) | |
59 | Requires: php(zip) | |
60 | Requires: php(zlib) | |
61 | %if %{without bootstrap} | |
62 | Requires: php-justinrainbow-json-schema >= 1.1.0 | |
63 | Requires: php-seld-jsonlint >= 1.1.2 | |
64 | Requires: php-symfony2-Console >= 2.3 | |
65 | Requires: php-symfony2-Finder >= 2.2 | |
66 | Requires: php-symfony2-Process >= 2.1 | |
67 | %endif | |
68 | Suggests: bash-completion-%{name} | |
69 | Suggests: git-core | |
70 | Suggests: mercurial | |
71 | Suggests: subversion | |
72 | BuildArch: noarch | |
73 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
74 | ||
75 | %define _appdir %{_datadir}/%{name} | |
76 | ||
77 | %description | |
78 | Composer is a tool for dependency management in PHP. | |
79 | ||
80 | Composer helps you declare, manage and install dependencies of PHP | |
81 | projects, ensuring you have the right stack everywhere. | |
82 | ||
83 | %package -n bash-completion-%{name} | |
84 | Summary: Bash completion for Composer | |
85 | Summary(pl.UTF-8): bashowe uzupełnianie nazw dla Composera | |
86 | Group: Applications/Shells | |
87 | Requires: %{name} | |
88 | Requires: bash-completion >= 2.0 | |
89 | ||
90 | %description -n bash-completion-%{name} | |
91 | Bash completion for Composer package and dependency manager. | |
92 | ||
93 | %description -n bash-completion-%{name} -l pl.UTF-8 | |
94 | Pakiet ten dostarcza bashowe uzupełnianie nazw dla Composera. | |
95 | ||
96 | %prep | |
97 | %setup -qc -n %{name}-%{version}-%{release} | |
98 | mv composer-*/* . | |
99 | %patch0 -p1 | |
100 | %{!?with_bootstrap:%patch1 -p1} | |
101 | %patch3 -p1 | |
102 | ||
103 | mv composer.lock{,.disabled} | |
104 | %{__sed} -i -e '1s,^#!.*env php,#!%{__php},' bin/* | |
105 | ||
106 | %build | |
107 | %if %{with bootstrap} | |
108 | composer='%{__php} %{SOURCE1}' | |
109 | phar extract -f "%{SOURCE1}" -i vendor . | |
110 | %else | |
111 | composer=composer | |
112 | %endif | |
113 | if [ ! -d vendor ]; then | |
114 | COMPOSER_HOME=${PWD:=$(pwd)} \ | |
115 | $composer dump-autoload -v | |
116 | %{__patch} -p1 < %{PATCH2} | |
117 | fi | |
118 | ||
119 | PACKAGE_VERSION=%{?githash} \ | |
120 | RELEASE_DATE=$(LC_ALL=C date) \ | |
121 | %{__php} -d phar.readonly=0 ./bin/compile | |
122 | ||
123 | # sanity check | |
124 | %{__php} composer.phar --version | |
125 | ||
126 | install -d build | |
127 | %{__php} -r '$phar = new Phar($argv[1]); $phar->extractTo($argv[2]);' composer.phar build | |
128 | ||
129 | %install | |
130 | rm -rf $RPM_BUILD_ROOT | |
131 | install -d $RPM_BUILD_ROOT{%{_bindir},%{_appdir},/var/cache/composer} | |
132 | cd build | |
133 | cp -a bin src res vendor $RPM_BUILD_ROOT%{_appdir} | |
134 | ln -s %{_appdir}/bin/%{name} $RPM_BUILD_ROOT%{_bindir}/%{name} | |
135 | chmod +x $RPM_BUILD_ROOT%{_appdir}/bin/* | |
136 | ||
137 | install -d $RPM_BUILD_ROOT%{bash_compdir} | |
138 | cp -p %{SOURCE2} $RPM_BUILD_ROOT%{bash_compdir}/composer | |
139 | ||
140 | %clean | |
141 | rm -rf $RPM_BUILD_ROOT | |
142 | ||
143 | %files | |
144 | %defattr(644,root,root,755) | |
145 | %doc README.md CHANGELOG.md LICENSE PORTING_INFO | |
146 | %attr(755,root,root) %{_bindir}/composer | |
147 | %dir %{_appdir} | |
148 | %dir %{_appdir}/bin | |
149 | %attr(755,root,root) %{_appdir}/bin/* | |
150 | %{_appdir}/res | |
151 | %{_appdir}/src | |
152 | %{_appdir}/vendor | |
153 | ||
154 | # top level cachedir, create user cache dirs here manually | |
155 | %dir %attr(711,root,http) /var/cache/composer | |
156 | ||
157 | %files -n bash-completion-%{name} | |
158 | %defattr(644,root,root,755) | |
159 | %{bash_compdir}/composer |