]>
Commit | Line | Data |
---|---|---|
10b4395e ER |
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 | |
b4d329b4 | 26 | a phpenv executable which sets the PHPENV_ROOT environment variable to |
10b4395e ER |
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 | |
c0a21694 ER |
47 | sed -i \ |
48 | -e 's/rbenv/phpenv/g' \ | |
49 | -e 's/RBENV/PHPENV/g' \ | |
50 | -e 's/Ruby/PHP/g' \ | |
51 | -e 's/ruby/php/g' \ | |
52 | completions/phpenv* libexec/phpenv* | |
10b4395e ER |
53 | |
54 | # Fix the version | |
55 | cat <<'SH' > libexec/phpenv---version | |
56 | #!/bin/sh | |
57 | echo "phpenv %{version} - based on rbenv %{version}" | |
58 | SH | |
59 | chmod a+x libexec/phpenv---version | |
60 | ||
61 | # Fix link in help text: | |
62 | RBENV_REPO="https://github.com/sstephenson/rbenv" | |
63 | PHPENV_REPO="https://github.com/chh/phpenv" | |
64 | 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 | |
65 | ||
0dcc60c1 ER |
66 | # use pld (not debian) version of hooks dir |
67 | sed -i -e 's#/usr/lib/phpenv/hooks#%{_appdir}/hooks#' libexec/phpenv | |
68 | ||
10b4395e ER |
69 | %install |
70 | rm -rf $RPM_BUILD_ROOT | |
0dcc60c1 | 71 | install -d $RPM_BUILD_ROOT{%{_bindir},%{_appdir}/hooks} |
10b4395e ER |
72 | cp -a libexec completions $RPM_BUILD_ROOT%{_appdir} |
73 | ||
74 | ln -s %{_appdir}/libexec/%{name} $RPM_BUILD_ROOT%{_bindir}/%{name} | |
75 | ||
76 | %clean | |
77 | rm -rf $RPM_BUILD_ROOT | |
78 | ||
79 | %files | |
80 | %defattr(644,root,root,755) | |
81 | %doc README.md LICENSE | |
82 | %attr(755,root,root) %{_bindir}/phpenv | |
83 | %dir %{_appdir} | |
84 | %dir %{_appdir}/libexec | |
85 | %attr(755,root,root) %{_appdir}/libexec/%{name}* | |
86 | %{_appdir}/completions | |
0dcc60c1 | 87 | %dir %{_appdir}/hooks |