[mapguide-commits] r10247 - branches/4.0/MgDev
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Mon Nov 2 17:40:23 PST 2026
Author: jng
Date: 2026-11-02 17:40:22 -0800 (Mon, 02 Nov 2026)
New Revision: 10247
Modified:
branches/4.0/MgDev/cmake_linuxapt.sh
Log:
Rework cmake_linuxapt.sh for more component flexibility
Modified: branches/4.0/MgDev/cmake_linuxapt.sh
===================================================================
--- branches/4.0/MgDev/cmake_linuxapt.sh 2026-11-03 00:30:53 UTC (rev 10246)
+++ branches/4.0/MgDev/cmake_linuxapt.sh 2026-11-03 01:40:22 UTC (rev 10247)
@@ -26,6 +26,7 @@
USE_CCACHE=0
USE_STATIC_OPENSSL=0
USE_PHP_SHARED_MBSTRING=0
+PHP_ONLY=0
while [ $# -gt 0 ]; do # Until you run out of parameters...
case "$1" in
--prefix)
@@ -46,6 +47,9 @@
--with-php-shared-mbstring)
USE_PHP_SHARED_MBSTRING=1
;;
+ --php-only)
+ PHP_ONLY=1
+ ;;
# "infecting" our ccache with root-elevated cached object files is probably a bad look
# especially if we need to non-elevated ccache builds further down the road
#--with-ccache)
@@ -59,6 +63,7 @@
echo " --working-dir [working directory, default: ~/mapguide_linuxapt_build]"
echo " --with-static-openssl [use static openssl]"
echo " --with-php-shared-mbstring [build PHP mbstring extension as a shared module]"
+ echo " --php-only [build and install only the PHP interpreter, then exit]"
echo " --help [Display usage]"
#echo " --with-ccache [Use ccache]"
exit
@@ -169,6 +174,86 @@
echo "Has PHP: ${HAS_PHP}"
echo "Has Tomcat Connector: ${HAS_TOMCAT_CONNECTOR}"
+# Builds and installs the PHP interpreter. Split out so that --php-only can run just this, for a
+# dev loop that needs an interpreter for the binding test suite without the rest of the web tier.
+build_php()
+{
+ # The configure flavour has to be decided before the reuse test below, which compares it with
+ # what an existing tree was configured with.
+ PHP_APXS_OPT=
+ if [ -x "${MG_INSTALL_WEB_PREFIX}/apache2/bin/apxs" ]; then
+ PHP_APXS_OPT="--with-apxs2=${MG_INSTALL_WEB_PREFIX}/apache2/bin/apxs"
+ fi
+ # The MapGuide extension is built against a thread-safe PHP, because the web tier it ships with
+ # runs Apache's threaded MPM. --with-apxs2 already implies that; a CLI-only PHP has to ask for
+ # it, or the extension refuses to load with "Module compiled with build ID=API...,TS / PHP
+ # compiled with build ID=API...,NTS".
+ PHP_ZTS_OPT=
+ if [ -z "$PHP_APXS_OPT" ]; then
+ PHP_ZTS_OPT="--enable-zts"
+ fi
+ if test $USE_PHP_SHARED_MBSTRING -eq 1; then
+ PHP_MBSTRING_OPT="--enable-mbstring=shared"
+ else
+ PHP_MBSTRING_OPT="--enable-mbstring"
+ fi
+
+ PHP_NEEDS_BUILD=0
+ if test $HAS_PHP -eq 0; then
+ PHP_NEEDS_BUILD=1
+ elif [ -f "${PHP_WORKDIR}/config.nice" ]; then
+ # An extracted tree is only reusable when it was configured the same way. A tree configured
+ # with --with-apxs2 cannot even `make install` while httpd's headers are absent (install
+ # rebuilds sapi/apache2handler), and one configured without it is an NTS PHP that the TS
+ # extension will not load.
+ if [ -n "$PHP_APXS_OPT" ] && ! grep -q -- "--with-apxs2" "${PHP_WORKDIR}/config.nice"; then
+ echo "PHP is configured without --with-apxs2 but httpd is installed; rebuilding with it"
+ PHP_NEEDS_BUILD=1
+ fi
+ if [ -z "$PHP_APXS_OPT" ] && grep -q -- "--with-apxs2" "${PHP_WORKDIR}/config.nice"; then
+ echo "PHP is configured with --with-apxs2 but httpd is not installed; rebuilding CLI-only"
+ PHP_NEEDS_BUILD=1
+ fi
+ if [ -n "$PHP_ZTS_OPT" ] && ! grep -q -- "--enable-zts" "${PHP_WORKDIR}/config.nice"; then
+ echo "PHP is configured without thread safety; rebuilding with --enable-zts"
+ PHP_NEEDS_BUILD=1
+ fi
+ fi
+ if [ -z "$PHP_APXS_OPT" ] && test $PHP_NEEDS_BUILD -eq 1; then
+ echo "No apxs at ${MG_INSTALL_WEB_PREFIX}/apache2/bin/apxs: building PHP without the Apache module"
+ fi
+
+ if test $PHP_NEEDS_BUILD -eq 1; then
+ # Reconfigure from clean sources rather than over a half-built tree with stale objects
+ if [ -d "${PHP_WORKDIR}" ] && [ -f "${PHP_WORKDIR}/config.nice" ]; then
+ rm -rf "${PHP_WORKDIR}"
+ fi
+ cd "$SOURCE_DIR/Oem/LinuxApt" || exit
+ if [ ! -d "${PHP_WORKDIR}" ]; then
+ echo "Extracting PHP tarball"
+ tar -jxf php-${PHP_VER}.tar.bz2 -C "${LA_WORKDIR}"
+ check_build
+ fi
+ echo "Configuring PHP"
+ cd "${PHP_WORKDIR}" || exit
+ ./configure --prefix="${MG_INSTALL_WEB_PREFIX}/php" $PHP_APXS_OPT $PHP_ZTS_OPT --with-openssl $PHP_MBSTRING_OPT --enable-gd --with-jpeg --with-libxml 2>&1 | tee "$LINUXAPT_WORK_DIR/configure_php.log"
+ check_build
+ echo "Building PHP. Please wait"
+ make 2>&1 | tee "$LINUXAPT_WORK_DIR/make_php.log"
+ check_build
+ fi
+
+ cd "${PHP_WORKDIR}" || exit
+ echo "Installing PHP"
+ make install 2>&1 | tee "$LINUXAPT_WORK_DIR/make_install_php.log"
+ check_build
+}
+
+if test $PHP_ONLY -eq 1; then
+ build_php
+ exit 0
+fi
+
if test $HAS_HTTPD -eq 0; then
cd "$SOURCE_DIR/Oem/LinuxApt" || exit
echo "Extracting httpd tarballs"
@@ -214,30 +299,8 @@
export MENTOR_DICTIONARY_PATH=${MG_INST_PREFIX}/share/gis/coordsys
END-OF-ENVVARS
-if test $HAS_PHP -eq 0; then
- cd "$SOURCE_DIR/Oem/LinuxApt" || exit
- echo "Extracting PHP tarball"
- tar -jxf php-${PHP_VER}.tar.bz2 -C "${LA_WORKDIR}"
- check_build
- echo "Configuring PHP"
- cd "${PHP_WORKDIR}" || exit
- if test $USE_PHP_SHARED_MBSTRING -eq 1; then
- ./configure --prefix="${MG_INSTALL_WEB_PREFIX}/php" --with-apxs2="${MG_INSTALL_WEB_PREFIX}/apache2/bin/apxs" --with-openssl --enable-mbstring=shared --enable-gd --with-jpeg --with-libxml 2>&1 | tee "$LINUXAPT_WORK_DIR/configure_php.log"
- check_build
- else
- ./configure --prefix="${MG_INSTALL_WEB_PREFIX}/php" --with-apxs2="${MG_INSTALL_WEB_PREFIX}/apache2/bin/apxs" --with-openssl --enable-mbstring --enable-gd --with-jpeg --with-libxml 2>&1 | tee "$LINUXAPT_WORK_DIR/configure_php.log"
- check_build
- fi
- echo "Building PHP. Please wait"
- make 2>&1 | tee "$LINUXAPT_WORK_DIR/make_php.log"
- check_build
-fi
+build_php
-cd "${PHP_WORKDIR}" || exit
-echo "Installing PHP"
-make install 2>&1 | tee "$LINUXAPT_WORK_DIR/make_install_php.log"
-check_build
-
if test $HAS_TOMCAT_CONNECTOR -eq 0; then
cd "$SOURCE_DIR/Oem/LinuxApt" || exit
echo "Extracting Tomcat Connector tarball"
More information about the mapguide-commits
mailing list