[mapguide-commits] r9282 - in sandbox/jng/cmake_v2: . Oem

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Jan 5 08:23:18 PST 2018


Author: jng
Date: 2018-01-05 08:23:18 -0800 (Fri, 05 Jan 2018)
New Revision: 9282

Modified:
   sandbox/jng/cmake_v2/CMakeLists.txt
   sandbox/jng/cmake_v2/Oem/CMakeLists.txt
Log:
Add external project configuration for PHP

Modified: sandbox/jng/cmake_v2/CMakeLists.txt
===================================================================
--- sandbox/jng/cmake_v2/CMakeLists.txt	2018-01-05 14:39:01 UTC (rev 9281)
+++ sandbox/jng/cmake_v2/CMakeLists.txt	2018-01-05 16:23:18 UTC (rev 9282)
@@ -55,6 +55,7 @@
 
 # Override install directory to match what the automake build does (/usr/local, rather than /usr/local/lib)
 set(MG_INSTALL_PREFIX "/usr/local/mapguideopensource-${MG_VERSION}")
+set(MG_INSTALL_WEB_PREFIX "${MG_INSTALL_PREFIX}/webserverextensions")
 set(CMAKE_INSTALL_PREFIX "${MG_INSTALL_PREFIX}")
 
 set(MG_VERSION_SUFFIX "-${MG_VERSION}")

Modified: sandbox/jng/cmake_v2/Oem/CMakeLists.txt
===================================================================
--- sandbox/jng/cmake_v2/Oem/CMakeLists.txt	2018-01-05 14:39:01 UTC (rev 9281)
+++ sandbox/jng/cmake_v2/Oem/CMakeLists.txt	2018-01-05 16:23:18 UTC (rev 9282)
@@ -1,4 +1,4 @@
-# ExternalProject configuration for dbxml
+###### ExternalProject configuration for dbxml ######
 
 # Copy source to build area
 message (STATUS "Preparing dbxml source for build")
@@ -14,7 +14,7 @@
     SOURCE_DIR ${DbXml_WORKDIR}
     CONFIGURE_COMMAND ""
     INSTALL_COMMAND ""
-    BUILD_COMMAND ${CMAKE_COMMAND} -E chdir ${DbXml_WORKDIR} ./buildall.sh --with-xerces=/usr --have-system-xerces
+    BUILD_COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR> ./buildall.sh --with-xerces=/usr --have-system-xerces
     BUILD_IN_SOURCE 0
 )
 # This sounds dirty, but we need to communicate back to projects that use dbxml (in a different dir) where 
@@ -22,37 +22,94 @@
 set(MG_OEM_DBXML_INCLUDE_DIR "${DbXml_WORKDIR}/install/include" PARENT_SCOPE)
 set(MG_OEM_DBXML_LIB_DIR "${DbXml_WORKDIR}/install/lib" PARENT_SCOPE)
 
-# ExternalProject configuration for LinuxApt
+###### ExternalProject configuration for LinuxApt ######
 set(HTTPD_VER 2.4.18)
-set(TOMCAT_VER 7.0.68)
-set(CONNECTOR_VER 1.2.41)
 set(LinuxApt_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/LinuxApt")
 set(LinuxAptHttpd_WORKDIR_ROOT "${CMAKE_CURRENT_BINARY_DIR}/LinuxApt_Build/httpd")
 set(LinuxAptHttpd_WORKDIR "${LinuxAptHttpd_WORKDIR_ROOT}/httpd-${HTTPD_VER}")
 
 # Extract tarballs to build area
 if (NOT EXISTS ${LinuxAptHttpd_WORKDIR})
-    message (STATUS "Preparing httpd source for build")
+    message (STATUS "Preparing httpd (${HTTPD_VER}) source for build")
     file(MAKE_DIRECTORY ${LinuxAptHttpd_WORKDIR})
     execute_process(COMMAND tar -jxf ${LinuxApt_SOURCE}/httpd-${HTTPD_VER}.tar.bz2 WORKING_DIRECTORY ${LinuxAptHttpd_WORKDIR_ROOT})
     execute_process(COMMAND tar -jxf ${LinuxApt_SOURCE}/httpd-${HTTPD_VER}-deps.tar.bz2 WORKING_DIRECTORY ${LinuxAptHttpd_WORKDIR_ROOT})
 else (NOT EXISTS ${LinuxAptHttpd_WORKDIR})
-    message (STATUS "httpd source already prepared at: ${LinuxAptHttpd_WORKDIR}")
+    message (STATUS "httpd (${HTTPD_VER}) source already prepared at: ${LinuxAptHttpd_WORKDIR}")
 endif (NOT EXISTS ${LinuxAptHttpd_WORKDIR})
 
+# BOGUS: Are you ready for this BS? 
+#
+#   > PHP and tomcat connector need the apxs script from httpd
+#   > The apxs script from httpd does not work until I configure + `make` and `make install` httpd
+#   > If i set the normal install prefix, this means I need superuser access to `make install`
+#   > But this is the build phase of the whole thing that *should not* require superuser. I have not installed anything yet!
+#   > I can't even tell PHP/connector to use post-configure apxs in $SOURCE/support as it has been "configured" 
+#    as though it was already installed into the place that requires superuser
+#   So what is the solution?
+#    1. Configure httpd with a "fake install" prefix (inside the build dir), install there. No superuser required.
+#    2. Build PHP/connector using the apxs of the "fake install" location
+#    3. Now that PHP/connector have their working apxs script, re-configure and re-build httpd with the real prefix. 
+#      Hopefully as this is only a change of prefix "make" should be mostly quick.
+#
+# So long story short, we have 2 httpd targets. One being a build + "fake install". The other being a build with a deferred install
+# to the real location. The first one is merely to get PHP/connector building.
+#
+# Why can't you just ship a standalone apxs script? Why do I even do this?
+#
+# A major CMake selling point is out-of-source builds that leave your source tree in a pristine state. I am not going let this
+# inconvenience (not matter how annoying) make me compromise on this main selling point!
+set(LinuxAptHttpd_FAKEINSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/LinuxApt_Build/httpd_install")
+ExternalProject_Add(httpd-fake
+    DOWNLOAD_COMMAND ""
+    SOURCE_DIR ${LinuxAptHttpd_WORKDIR}
+    INSTALL_COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR> make install
+    CONFIGURE_COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR> ./configure --prefix=${LinuxAptHttpd_FAKEINSTALL_DIR} --enable-mods-shared-all --with-included-apr --with-port=${MG_HTTPD_PORT}
+    BUILD_COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR> make
+    BUILD_IN_SOURCE 0
+)
+set(APXS_TOOL_PATH "${LinuxAptHttpd_FAKEINSTALL_DIR}/bin/apxs")
 ExternalProject_Add(httpd
     DOWNLOAD_COMMAND ""
     SOURCE_DIR ${LinuxAptHttpd_WORKDIR}
     INSTALL_COMMAND ""
-    CONFIGURE_COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR> ./configure --prefix=${CMAKE_INSTALL_PREFIX}/webserverextensions/apache2 --enable-mods-shared-all --with-included-apr --with-port=${MG_HTTPD_PORT}
+    CONFIGURE_COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR> ./configure --prefix=${MG_INSTALL_WEB_PREFIX}/apache2 --enable-mods-shared-all --with-included-apr --with-port=${MG_HTTPD_PORT}
     BUILD_COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR> make
     BUILD_IN_SOURCE 0
 )
+add_dependencies(httpd httpd-fake)
 
 # This sounds dirty, but we need to communicate back to projects that use httpd (in a different dir) where 
 # the httpd headers are
-set(MG_OEM_HTTPD_SOURCE_DIR "${LinuxAptHttpd_WORKDIR}/httpd-${HTTPD_VER}" PARENT_SCOPE)
+set(MG_OEM_HTTPD_SOURCE_DIR "${LinuxAptHttpd_WORKDIR}" PARENT_SCOPE)
 
+###### External Project configuration for php ######
+set(PHP_VER 5.6.23)
+set(LinuxAptPhp_WORKDIR_ROOT "${CMAKE_CURRENT_BINARY_DIR}/LinuxApt_Build/php")
+set(LinuxAptPhp_WORKDIR "${LinuxAptPhp_WORKDIR_ROOT}/php-${PHP_VER}")
+
+# Extract tarballs to build area
+if (NOT EXISTS ${LinuxAptPhp_WORKDIR})
+    message (STATUS "Preparing PHP (${PHP_VER}) source for build")
+    file(MAKE_DIRECTORY ${LinuxAptPhp_WORKDIR})
+    execute_process(COMMAND tar -jxf ${LinuxApt_SOURCE}/php-${PHP_VER}.tar.bz2 WORKING_DIRECTORY ${LinuxAptPhp_WORKDIR_ROOT})
+else (NOT EXISTS ${LinuxAptPhp_WORKDIR})
+    message (STATUS "PHP (${PHP_VER}) source already prepared at: ${LinuxAptPhp_WORKDIR}")
+endif (NOT EXISTS ${LinuxAptPhp_WORKDIR})
+
+ExternalProject_Add(php
+    DOWNLOAD_COMMAND ""
+    SOURCE_DIR ${LinuxAptPhp_WORKDIR}
+    # This one we're deferring installation
+    INSTALL_COMMAND ""
+    CONFIGURE_COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR> ./configure --prefix=${MG_INSTALL_WEB_PREFIX}/php --with-apxs2=${APXS_TOOL_PATH} --with-openssl --with-curl --enable-xml --enable-wddx --enable-shared --with-zlib --enable-zip --enable-mbstring=all --with-xsl=/usr/lib --with-gd --with-png-dir=/usr/lib --with-jpeg-dir=/usr/lib --with-freetype-dir=/usr/lib
+    BUILD_COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR> make
+    BUILD_IN_SOURCE 0
+)
+add_dependencies(php httpd-fake)
+
+###### Everything else ######
+
 # TODO: We have geos in-tree, which is CMake-enabled, so if required we can use
 # the internal copy of geos if required through an option like INTERNAL_GEOS
 # at the moment, we are just using the system-provided version of GEOS



More information about the mapguide-commits mailing list