]> git.pld-linux.org Git - packages/phpenv.git/blame - phpenv.spec
add phpenv system-php plugin: detect system php packages and create their
[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
89c77ea6 5# - adds phpenv system-php to add php versions from installed system (may be renamed if better name provided)
10b4395e
ER
6Summary: Thin Wrapper around rbenv for PHP version managment
7Name: phpenv
8Version: 0.4.0
9Release: 1
10License: MIT
11Group: Development/Languages/PHP
12Source0: https://github.com/sstephenson/rbenv/archive/v%{version}/rbenv-%{version}.tar.gz
13# Source0-md5: c4a15a4dccf3dc1d28d08e87fb7c7789
89c77ea6 14Source1: phpenv-system-php
10b4395e
ER
15URL: https://github.com/CHH/phpenv
16Requires: bash
17BuildArch: noarch
18# https://github.com/CHH/php-build
19Suggests: php-build
20BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
21
22%define _appdir %{_datadir}/%{name}
23
24%description
25Sets up a separate rbenv environment for PHP
26
27This environment is stored in the $HOME/.phpenv directory and contains
b4d329b4 28a phpenv executable which sets the PHPENV_ROOT environment variable to
10b4395e
ER
29$HOME/.phpenv.
30
31To install PHP versions, just put them to the $HOME/.phpenv/versions
32directory.
33
34%prep
35%setup -qc
36mv rbenv-%{version}/* .
37
38# deprecated as of rbenv 0.4.0, pointless in phpenv
39rm bin/ruby-local-exec
40
41# fully replace to rbenv -> phpenv
42# https://github.com/CHH/phpenv/pull/30
43# Create file phpenv prefixed copies of the original rbenv files
44for f in bin/rbenv* completions/rbenv* libexec/rbenv*; do
45 mv "$f" "${f/rbenv/phpenv}"
46done
47
48# Remove all rbenv/Ruby from phpenv prefixed files
c0a21694
ER
49sed -i \
50 -e 's/rbenv/phpenv/g' \
51 -e 's/RBENV/PHPENV/g' \
52 -e 's/Ruby/PHP/g' \
53 -e 's/ruby/php/g' \
54 completions/phpenv* libexec/phpenv*
10b4395e
ER
55
56# Fix the version
57cat <<'SH' > libexec/phpenv---version
58#!/bin/sh
59echo "phpenv %{version} - based on rbenv %{version}"
60SH
61chmod a+x libexec/phpenv---version
62
63# Fix link in help text:
64RBENV_REPO="https://github.com/sstephenson/rbenv"
65PHPENV_REPO="https://github.com/chh/phpenv"
66sed -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
67
0dcc60c1 68# use pld (not debian) version of hooks dir
8d81f91a 69# https://github.com/sstephenson/rbenv/pull/176
0dcc60c1
ER
70sed -i -e 's#/usr/lib/phpenv/hooks#%{_appdir}/hooks#' libexec/phpenv
71
8d81f91a
ER
72# cleanup backups after patching
73find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
74
10b4395e
ER
75%install
76rm -rf $RPM_BUILD_ROOT
0dcc60c1 77install -d $RPM_BUILD_ROOT{%{_bindir},%{_appdir}/hooks}
10b4395e
ER
78cp -a libexec completions $RPM_BUILD_ROOT%{_appdir}
79
89c77ea6
ER
80# phpenv system-php: detect system php packages and create their versions
81install -p %{SOURCE1} $RPM_BUILD_ROOT%{_appdir}/libexec
82
10b4395e
ER
83ln -s %{_appdir}/libexec/%{name} $RPM_BUILD_ROOT%{_bindir}/%{name}
84
85%clean
86rm -rf $RPM_BUILD_ROOT
87
88%files
89%defattr(644,root,root,755)
90%doc README.md LICENSE
91%attr(755,root,root) %{_bindir}/phpenv
92%dir %{_appdir}
93%dir %{_appdir}/libexec
94%attr(755,root,root) %{_appdir}/libexec/%{name}*
95%{_appdir}/completions
0dcc60c1 96%dir %{_appdir}/hooks
This page took 0.367759 seconds and 4 git commands to generate.