Skip to content

Instantly share code, notes, and snippets.

@patrickallaert
Created May 8, 2015 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patrickallaert/b8fd9da71e812a383430 to your computer and use it in GitHub Desktop.
Save patrickallaert/b8fd9da71e812a383430 to your computer and use it in GitHub Desktop.
phpdbg support on Gentoo
--- php-5.6.8.ebuild 2015-04-18 12:56:15.000000000 +0200
+++ php-5.6.8-r1.ebuild 2015-05-08 10:23:39.000000000 +0200
@@ -49,14 +49,14 @@
SRC_URI="${PHP_SRC_URI}"
-DESCRIPTION="The PHP language runtime engine: CLI, CGI, FPM/FastCGI, Apache2 and embed SAPIs"
+DESCRIPTION="The PHP language runtime engine: CLI, CGI, FPM/FastCGI, Apache2, phpdbg and embed SAPIs"
HOMEPAGE="http://php.net/"
LICENSE="PHP-3"
S="${WORKDIR}/${PHP_P}"
# We can build the following SAPIs in the given order
-SAPIS="embed cli cgi fpm apache2"
+SAPIS="embed cli cgi fpm apache2 phpdbg"
# SAPIs and SAPI-specific USE flags (cli SAPI is default on):
IUSE="${IUSE}
@@ -183,7 +183,7 @@
recode? ( !imap !mysql !mysqli )
sharedmem? ( !threads )
- !cli? ( !cgi? ( !fpm? ( !apache2? ( !embed? ( cli ) ) ) ) )"
+ !cli? ( !cgi? ( !fpm? ( !apache2? ( !embed? ( !phpdbg? ( cli ) ) ) ) ) )"
RDEPEND="${DEPEND}"
@@ -545,7 +545,7 @@
for sapi in $SAPIS ; do
case "$sapi" in
- cli|cgi|embed|fpm)
+ cli|cgi|embed|fpm|phpdbg)
if [[ "${one_sapi}" == "${sapi}" ]] ; then
sapi_conf="${sapi_conf} --enable-${sapi}"
else
@@ -635,6 +635,9 @@
fpm)
source="sapi/fpm/php-fpm"
;;
+ phpdbg)
+ source="sapi/phpdbg/phpdbg"
+ ;;
embed)
source="libs/libphp${PHP_MV}$(get_libname)"
;;
--- /usr/share/eselect/modules/php.eselect 2015-05-08 11:31:44.813395629 +0200
+++ /usr/share/eselect/modules/php.eselect 2015-05-08 11:38:12.362783587 +0200
@@ -8,11 +8,12 @@
DESCRIPTION="Manage php installations"
MAINTAINER="php-bugs@gentoo.org"
-MODULES="cli apache2 fpm cgi"
+MODULES="cli apache2 fpm cgi phpdbg"
cli_link="${EROOT}"/usr/bin/php
fpm_link="${EROOT}"/usr/bin/php-fpm
cgi_link="${EROOT}"/usr/bin/php-cgi
+phpdbg_link="${EROOT}"/usr/bin/phpdbg
cleanup_sapis() {
local m
@@ -138,6 +139,15 @@
done | sort -u
}
+find_targets_phpdbg() {
+ local target libdir
+ for target in $(find_targets); do
+ for libdir in $(get_libdirs); do
+ [[ -f ${EROOT}${libdir}/$target/bin/phpdbg ]] && echo $target
+ done
+ done | sort -u
+}
+
get_active_cli() {
readlink -e "${EROOT}"/usr/bin/php | sed -ne "s:.*/usr/.*/\(php[0-9]\.[0-9][0-9]*\)/bin/php:\1:p"
}
@@ -150,6 +160,10 @@
readlink -e "${EROOT}"/usr/bin/php-fpm | sed -ne "s:.*/usr/.*/\(php[0-9]\.[0-9]\)/bin/php-fpm:\1:p"
}
+get_active_phpdbg() {
+ readlink -e "${EROOT}"/usr/bin/phpdbg | sed -ne "s:.*/usr/.*/\(php[0-9]\.[0-9]\)/bin/phpdbg:\1:p"
+}
+
get_active_apache2() {
readlink -e "${EROOT}"$(get_active_libdir)/apache2/modules/libphp5$(get_libname) | sed -ne "s:.*/usr/.*/\(php[0-9]\.[0-9]\)/apache2/libphp5$(get_libname):\1:p"
}
@@ -213,6 +227,17 @@
write_numbered_list -m "(none found)" "${targets[@]}"
}
+list_phpdbg() {
+ local targets
+ local a
+ targets=( $(find_targets_phpdbg) )
+ a=$(get_active_phpdbg)
+ for (( i = 0; i < ${#targets[@]}; i++ )) ; do
+ [[ $a == ${targets[i]} ]] && targets[i]=$(highlight_marker "${targets[i]}")
+ done
+ write_numbered_list -m "(none found)" "${targets[@]}"
+}
+
set_apache2() {
local libdir t=$(resolv_target apache2 $1)
[[ -z $t ]] && die -q "Bad target"
@@ -239,6 +264,13 @@
die -q "Failed to create symlink for php-cgi"
}
+set_phpdbg() {
+ t=$(resolv_target phpdbg $1)
+ [[ -z $t ]] && die -q "Bad target"
+ ln -sf ../..$(get_active_libdir)/$t/bin/phpdbg "${EROOT}"/usr/bin/phpdbg || \
+ die -q "Failed to create symlink for phpdbg"
+}
+
set_fpm() {
local t=$(resolv_target fpm $1)
[[ -z $t ]] && die -q "Bad target"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment