]> git.pld-linux.org Git - packages/phpenv.git/blame - phpenv.spec
add system hooks dir support
[packages/phpenv.git] / phpenv.spec
CommitLineData
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
5Summary: Thin Wrapper around rbenv for PHP version managment
6Name: phpenv
7Version: 0.4.0
8Release: 1
9License: MIT
10Group: Development/Languages/PHP
11Source0: https://github.com/sstephenson/rbenv/archive/v%{version}/rbenv-%{version}.tar.gz
12# Source0-md5: c4a15a4dccf3dc1d28d08e87fb7c7789
13URL: https://github.com/CHH/phpenv
14Requires: bash
15BuildArch: noarch
16# https://github.com/CHH/php-build
17Suggests: php-build
18BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
19
20%define _appdir %{_datadir}/%{name}
21
22%description
23Sets up a separate rbenv environment for PHP
24
25This environment is stored in the $HOME/.phpenv directory and contains
b4d329b4 26a phpenv executable which sets the PHPENV_ROOT environment variable to
10b4395e
ER
27$HOME/.phpenv.
28
29To install PHP versions, just put them to the $HOME/.phpenv/versions
30directory.
31
32%prep
33%setup -qc
34mv rbenv-%{version}/* .
35
36# deprecated as of rbenv 0.4.0, pointless in phpenv
37rm 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
42for f in bin/rbenv* completions/rbenv* libexec/rbenv*; do
43 mv "$f" "${f/rbenv/phpenv}"
44done
45
46# Remove all rbenv/Ruby from phpenv prefixed files
c0a21694
ER
47sed -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
55cat <<'SH' > libexec/phpenv---version
56#!/bin/sh
57echo "phpenv %{version} - based on rbenv %{version}"
58SH
59chmod a+x libexec/phpenv---version
60
61# Fix link in help text:
62RBENV_REPO="https://github.com/sstephenson/rbenv"
63PHPENV_REPO="https://github.com/chh/phpenv"
64sed -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
67sed -i -e 's#/usr/lib/phpenv/hooks#%{_appdir}/hooks#' libexec/phpenv
68
10b4395e
ER
69%install
70rm -rf $RPM_BUILD_ROOT
0dcc60c1 71install -d $RPM_BUILD_ROOT{%{_bindir},%{_appdir}/hooks}
10b4395e
ER
72cp -a libexec completions $RPM_BUILD_ROOT%{_appdir}
73
74ln -s %{_appdir}/libexec/%{name} $RPM_BUILD_ROOT%{_bindir}/%{name}
75
76%clean
77rm -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
This page took 0.077745 seconds and 4 git commands to generate.