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