commit:     f835773f9365d1f5fe46079df7cb7477f200f2ed
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 10 13:45:25 2015 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Thu Dec 10 13:45:25 2015 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=f835773f

Use fixed ".so" suffix for libphp instead of computing it.

The only supported way to run PHP/Apache these days is as a dynamic
shared object (DSO). The DSO will have an ".so" suffix, so we don't
need to probe to see if libphp*.a exists.

This also avoids a hidden dependency on libz, for whose static library
we were probing.

 src/php.eselect.in | 30 +++++++-----------------------
 1 file changed, 7 insertions(+), 23 deletions(-)

diff --git a/src/php.eselect.in b/src/php.eselect.in
index 363dc1d..5bbb491 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -65,22 +65,6 @@ get_active_libdir() {
        echo /usr/lib
 }
 
-get_libname() {
-       # probe on a well-known library
-       local lib ret=.so
-       for lib in "${EROOT}"$(get_active_libdir)/libz.* ; do
-               case "${lib##*/}" in
-                       libz.a)    ret=.a   ;; # some platforms use .a as ext
-                       libz.*.*)  continue ;;
-                       libz.*)
-                               ret=${lib##*libz}
-                               break
-                               ;;
-               esac
-       done
-       echo ${ret}
-}
-
 cleanup() {
        local target=$(find_targets_$1 | tail -n 1)
        [[ -z $target ]] &&
@@ -102,7 +86,7 @@ find_targets_apache2() {
        local libs target libdir
        for target in $(find_targets); do
                for libdir in $(get_libdirs); do
-                       
libs="${EROOT}${libdir}/$target/apache2/libphp[57]$(get_libname)"
+                       libs="${EROOT}${libdir}/$target/apache2/libphp[57].so"
                        for lib in $libs; do
                                [[ -f "${lib}" ]] && echo $target
                        done
@@ -161,12 +145,12 @@ get_active_fpm() {
 
 get_active_apache2() {
        local libs target ver
-       
libs="${EROOT}$(get_active_libdir)/apache2/modules/libphp[57]$(get_libname)"
+       libs="${EROOT}$(get_active_libdir)/apache2/modules/libphp[57].so"
 
        # This sed expression finds the "display name" of the PHP version
        # corresponding to a copy of libphp. For example, it parses the
        # string "php5.6" out of "/usr/lib64/php5.6/apache2/libphp5.so".
-       
ver="s:.*/usr/.*/\(php[0-9]\.[0-9]\)/apache2/libphp[57]$(get_libname):\1:p"
+       ver="s:.*/usr/.*/\(php[0-9]\.[0-9]\)/apache2/libphp[57].so:\1:p"
        for lib in $libs; do
                if [[ -L "${lib}" ]] ; then
                        target=$(canonicalise "${lib}")
@@ -254,10 +238,10 @@ set_apache2() {
        local libdir t=$(resolv_target apache2 $1)
        [[ -z $t ]] && die -q "Bad target"
        for libdir in $(get_libdirs); do
-               rm -f 
"${EROOT}${libdir}"/apache2/modules/libphp{5,7}$(get_libname)
-               @LN_S@ --force ../../$t/apache2/libphp${t:3:1}$(get_libname) \
-                       "${EROOT}"${libdir}/apache2/modules/ || \
-                       die -q "Failed to set symlink for 
${EPREFIX}${libdir}/apache2/modules/libphp${t:3:1}$(get_libname)"
+               rm -f "${EROOT}${libdir}/apache2/modules/libphp[57].so"
+               @LN_S@ --force "../../$t/apache2/libphp${t:3:1}.so" \
+                       "${EROOT}${libdir}/apache2/modules/" || \
+                       die -q "Failed to set symlink for 
${EPREFIX}${libdir}/apache2/modules/libphp${t:3:1}.so"
        done
        echo "You have to run \`${EPREFIX}/etc/init.d/apache2 restart' for the 
changes to take effect"
 }

Reply via email to