app-eselect/eselect-php: update the live ebuild for recent repo changes.
[gentoo.git] / app-eselect / eselect-php / eselect-php-0.9.3.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 inherit systemd
7
8 DESCRIPTION="PHP eselect module"
9 HOMEPAGE="https://gitweb.gentoo.org/proj/eselect-php.git/"
10 SRC_URI="https://dev.gentoo.org/~mjo/distfiles/${P}.tar.xz"
11
12 LICENSE="GPL-2"
13 SLOT="0"
14 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
15 IUSE="fpm apache2"
16
17 # The "DirectoryIndex" line in 70_mod_php.conf requires mod_dir.
18 RDEPEND="app-admin/eselect
19         apache2? ( www-servers/apache[apache2_modules_dir] )
20         fpm? ( sys-apps/gentoo-functions )"
21
22 src_configure(){
23         # We expect localstatedir to be "var"ish, not "var/lib"ish, because
24         # that's what PHP upstream expects. See for example the FPM
25         # configuration where they put logs in @localstatedir@/log.
26         #
27         # The libdir is passed explicitly in case the /usr/lib symlink
28         # is not present (bug 624528).
29         econf --libdir="${EPREFIX}/usr/$(get_libdir)" \
30                   --localstatedir="${EPREFIX}/var" \
31                   --with-piddir="${EPREFIX}/run" \
32                   $(use_enable apache2) \
33                   $(use_enable fpm)
34 }
35
36 src_install() {
37         default
38
39         # This can be removed after a while...
40         if use apache2 ; then
41                 insinto /etc/apache2/modules.d
42                 newins "${FILESDIR}/70_mod_php5.backcompat.conf" 70_mod_php5.conf
43         fi
44
45         if use fpm ; then
46                 systemd_dotmpfilesd "${FILESDIR}/php-fpm.conf"
47                 exeinto /usr/libexec
48                 newexe "${FILESDIR}/php-fpm-launcher-r1" php-fpm-launcher
49         fi
50 }
51
52 pkg_postinst() {
53         if use apache2 ; then
54                 elog
55                 elog "If you are upgrading, be warned that our mod_php configuration"
56                 elog "file has changed! You should now define -DPHP for the apache2"
57                 elog "daemon, and inspect the new 70_mod_php.conf which has been"
58                 elog "installed. Module loading involves eselect as of this version."
59                 elog
60                 elog "You must run eselect at least once to choose your apache2 target"
61                 elog "before the new configuration will work. Afterwards, and after you"
62                 elog "have reviewed your new configuration, you are advised to remove"
63                 elog "the obsolete 70_mod_php5.conf file."
64                 elog
65         fi
66 }