]> git.pld-linux.org Git - packages/phpenv.git/blob - phpenv.spec
current implementation uses only PHPENV_* vars
[packages/phpenv.git] / phpenv.spec
1 # NOTE:
2 # - use similar recipe as done by CHH (https://github.com/CHH/phpenv)
3 #   however, make it more rbenv compatible: code in /usr/share, env files in ~/.phpenv
4 # - actually don't need code from CHH/phpenv as all is inlined in this .spec
5 Summary:        Thin Wrapper around rbenv for PHP version managment
6 Name:           phpenv
7 Version:        0.4.0
8 Release:        1
9 License:        MIT
10 Group:          Development/Languages/PHP
11 Source0:        https://github.com/sstephenson/rbenv/archive/v%{version}/rbenv-%{version}.tar.gz
12 # Source0-md5:  c4a15a4dccf3dc1d28d08e87fb7c7789
13 URL:            https://github.com/CHH/phpenv
14 Requires:       bash
15 BuildArch:      noarch
16 # https://github.com/CHH/php-build
17 Suggests:       php-build
18 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
19
20 %define         _appdir                 %{_datadir}/%{name}
21
22 %description
23 Sets up a separate rbenv environment for PHP
24
25 This environment is stored in the $HOME/.phpenv directory and contains
26 a phpenv executable which sets the PHPENV_ROOT environment variable to
27 $HOME/.phpenv.
28
29 To install PHP versions, just put them to the $HOME/.phpenv/versions
30 directory.
31
32 %prep
33 %setup -qc
34 mv rbenv-%{version}/* .
35
36 # deprecated as of rbenv 0.4.0, pointless in phpenv
37 rm bin/ruby-local-exec
38
39 # fully replace to rbenv -> phpenv
40 # https://github.com/CHH/phpenv/pull/30
41 # Create file phpenv prefixed copies of the original rbenv files
42 for f in bin/rbenv* completions/rbenv* libexec/rbenv*; do
43         mv "$f" "${f/rbenv/phpenv}"
44 done
45
46 # Remove all rbenv/Ruby from phpenv prefixed files
47 sed -i -e 's/rbenv/phpenv/g' -e 's/RBENV/PHPENV/g' -e 's/Ruby/PHP/g' completions/phpenv* libexec/phpenv*
48
49 # Fix the version
50 cat <<'SH' > libexec/phpenv---version
51 #!/bin/sh
52 echo "phpenv %{version} - based on rbenv %{version}"
53 SH
54 chmod a+x libexec/phpenv---version
55
56 # Fix link in help text:
57 RBENV_REPO="https://github.com/sstephenson/rbenv"
58 PHPENV_REPO="https://github.com/chh/phpenv"
59 sed -i -e "s|^.*For full documentation.*\$|  echo \"For full documentation, see:\"\n  echo \" rbenv: ${RBENV_REPO}#readme\"\n  echo \" phpenv: ${PHPENV_REPO}#readme\"|" libexec/phpenv-help
60
61 %install
62 rm -rf $RPM_BUILD_ROOT
63 install -d $RPM_BUILD_ROOT{%{_bindir},%{_appdir}}
64 cp -a libexec completions $RPM_BUILD_ROOT%{_appdir}
65
66 ln -s %{_appdir}/libexec/%{name} $RPM_BUILD_ROOT%{_bindir}/%{name}
67
68 %clean
69 rm -rf $RPM_BUILD_ROOT
70
71 %files
72 %defattr(644,root,root,755)
73 %doc README.md LICENSE
74 %attr(755,root,root) %{_bindir}/phpenv
75 %dir %{_appdir}
76 %dir %{_appdir}/libexec
77 %attr(755,root,root) %{_appdir}/libexec/%{name}*
78 %{_appdir}/completions
This page took 0.076001 seconds and 3 git commands to generate.