]> git.pld-linux.org Git - packages/phpenv.git/blob - phpenv.spec
ed134333596bd88eca73ca500179fc96dc8a2232
[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 \
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*
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
66 # use pld (not debian) version of hooks dir
67 # https://github.com/sstephenson/rbenv/pull/176
68 sed -i -e 's#/usr/lib/phpenv/hooks#%{_appdir}/hooks#' libexec/phpenv
69
70 # cleanup backups after patching
71 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
72
73 %install
74 rm -rf $RPM_BUILD_ROOT
75 install -d $RPM_BUILD_ROOT{%{_bindir},%{_appdir}/hooks}
76 cp -a libexec completions $RPM_BUILD_ROOT%{_appdir}
77
78 ln -s %{_appdir}/libexec/%{name} $RPM_BUILD_ROOT%{_bindir}/%{name}
79
80 %clean
81 rm -rf $RPM_BUILD_ROOT
82
83 %files
84 %defattr(644,root,root,755)
85 %doc README.md LICENSE
86 %attr(755,root,root) %{_bindir}/phpenv
87 %dir %{_appdir}
88 %dir %{_appdir}/libexec
89 %attr(755,root,root) %{_appdir}/libexec/%{name}*
90 %{_appdir}/completions
91 %dir %{_appdir}/hooks
This page took 0.051386 seconds and 2 git commands to generate.