]> git.pld-linux.org Git - packages/composer.git/blob - composer.spec
make build not to use network
[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             1
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 BuildRequires:  php-symfony2-Console >= 2.3
39 BuildRequires:  php-symfony2-Finder >= 2.2
40 %endif
41 Requires:       php(core) >= %{php_min_version}
42 Requires:       php(hash)
43 Requires:       php(phar)
44 %if %{without bootstrap}
45 Requires:       php-justinrainbow-json-schema >= 1.1.0
46 Requires:       php-seld-jsonlint >= 1.1.2
47 Requires:       php-symfony2-Console >= 2.3
48 Requires:       php-symfony2-Finder >= 2.2
49 Requires:       php-symfony2-Process >= 2.1
50 %endif
51 Suggests:       git-core
52 Suggests:       mercurial
53 Suggests:       php(openssl)
54 Suggests:       php(zip)
55 Suggests:       subversion
56 BuildArch:      noarch
57 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
58
59 %define         _appdir         %{_datadir}/%{name}
60
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
67 %setup -qc -n %{name}-%{version}-%{release}
68 mv composer-*/* .
69 %patch0 -p1
70 %{!?with_bootstrap:%patch1 -p1}
71
72 mv composer.lock{,.disabled}
73 %{__sed} -i -e '1s,^#!.*env php,#!%{__php},' bin/*
74
75 %build
76 %if %{with bootstrap}
77 composer='%{__php} %{SOURCE1}'
78 phar extract -f "%{SOURCE1}" -i vendor .
79 %else
80 composer=composer
81 %endif
82 if [ ! -d vendor ]; then
83         COMPOSER_HOME=${PWD:=$(pwd)} \
84         $composer dump-autoload -v
85         %{__patch} -p1 < %{PATCH2}
86 fi
87
88 COMPOSER_VERSION=%{version}%{?subver:-%{subver}} \
89 %{__php} -d phar.readonly=0 ./bin/compile
90
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
97 %install
98 rm -rf $RPM_BUILD_ROOT
99 install -d $RPM_BUILD_ROOT{%{_bindir},%{_appdir}}
100 cd build
101 cp -a bin src res vendor $RPM_BUILD_ROOT%{_appdir}
102 ln -s %{_appdir}/bin/%{name} $RPM_BUILD_ROOT%{_bindir}/%{name}
103
104 %clean
105 rm -rf $RPM_BUILD_ROOT
106
107 %files
108 %defattr(644,root,root,755)
109 %doc README.md CHANGELOG.md LICENSE PORTING_INFO
110 %attr(755,root,root) %{_bindir}/composer
111 %dir %{_appdir}
112 %dir %{_appdir}/bin
113 %attr(755,root,root) %{_appdir}/bin/*
114 %{_appdir}/res
115 %{_appdir}/src
116 %{_appdir}/vendor
This page took 0.080949 seconds and 4 git commands to generate.