summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/php.eselect.in')
-rw-r--r--src/php.eselect.in38
1 files changed, 29 insertions, 9 deletions
diff --git a/src/php.eselect.in b/src/php.eselect.in
index 1288669..7acda64 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -36,6 +36,34 @@ sapi_active_link_names() {
esac
}
+# The link names obtained from sapi_active_link_names() all need to
+# point somewhere. Usually the target is the same as the link name
+# itself, but not always. This function returns the link-target for a
+# given sapi, sapi-target, and link name.
+#
+# INPUT:
+#
+# The first parameter is a SAPI name. The second parameter is the
+# SAPI-target name (for example, "php7.0"). The third parameter is a
+# link name.
+#
+# OUTPUT:
+#
+# The name of the target (that is, file) for the given link name.
+#
+sapi_link_name_target() {
+ local sapi="${1}"
+ local target_name="${2}"
+ local link_name="${3}"
+
+ # For now, only apache2's mod_php.so gets special treatment.
+ if [[ "${sapi}" == "apache2" && "${link_name}" == "mod_php.so" ]] ; then
+ local major=$(parse_target_major_version "${target_name}")
+ echo "libphp${major}.so"
+ else
+ echo "${link_name}"
+ fi
+}
# Each SAPI provides a few (one or more) "active" links in a
# predictable location. The target directory (where they point) is
@@ -426,15 +454,7 @@ set_sapi() {
local link_dir=$(sapi_active_link_dir "${sapi}")
for link_name in $(sapi_active_link_names "${sapi}"); do
- # Usually the link targets have the same name as the link itself...
- local link_target="${link_name}"
-
- if [[ "${link_name}" == "mod_php.so" ]] ; then
- # ...but apache2 needs special handling since we're not
- # linking from something named mod_php.so.
- local major=$(parse_target_major_version "${target_name}")
- link_target="libphp${major}.so"
- fi
+ local link_target=$(sapi_link_name_target "${sapi}" "${target_name}" "${link_name}")
@LN_S@ --force "${link_tgt_dir}/${link_target}" \
"${link_dir}/${link_name}" || \