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