src/php

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Fri Sep 7 16:36:25 CEST 2012


 src/php/CMakeLists.txt |   17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

New commits:
commit c0ffa7a021db64c8f1a4a6ead4e58f6b5a6b783d
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Fri Sep 7 15:35:19 2012 +0100

    Untwist the Debian Wheezy twists wrt. PHP headers in /usr/include/php5 referring to themselves in the wrong way, and the standard installation paths for a variety of headers having been modified from the defacto standard locations.

diff --git a/src/php/CMakeLists.txt b/src/php/CMakeLists.txt
index aec9cd6..20647a5 100644
--- a/src/php/CMakeLists.txt
+++ b/src/php/CMakeLists.txt
@@ -20,10 +20,19 @@ if (APPLE)
     set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flat_namespace -undefined suppress" )
 endif()
 
-find_package(PHP4 5.3 REQUIRED)
+# Debian (Wheezy) won't be able to find PHP using find_package. In packaging libkolabxml
+# for it, we define the include path and executable during the build.
+if (NOT PHP4_INCLUDE_PATH OR NOT PHP4_EXECUTABLE)
+    find_package(PHP4 5.3 REQUIRED)
+endif (NOT PHP4_INCLUDE_PATH OR NOT PHP4_EXECUTABLE)
 
-if (PHP4_FOUND)
+if (PHP4_FOUND OR (PHP4_INCLUDE_PATH AND PHP4_EXECUTABLE))
     include_directories(${PHP4_INCLUDE_PATH})
+
+    # In an additional twist on Debian (Wheezy) - the PHP headers are fubar. php.h is in main/,
+    # TSRM/TSRM.h includes <tsrm_config.h> instead of "tsrm_config.h", and we require
+    # Zend/zend.h (included, of course, as "zend.h" without -I/usr/include/php5/Zend)
+    include_directories("${PHP4_INCLUDE_PATH}/Zend" "${PHP4_INCLUDE_PATH}/TSRM" "${PHP4_INCLUDE_PATH}/main")
     add_library(phpbindings SHARED ${KOLAB_SWIG_PHP_SOURCE_FILE})
     target_link_libraries(phpbindings kolabxml)
     SET_TARGET_PROPERTIES(phpbindings PROPERTIES OUTPUT_NAME "kolabformat")
@@ -39,6 +48,6 @@ if (PHP4_FOUND)
             ${CMAKE_CURRENT_BINARY_DIR}/kolabformat.php
             DESTINATION ${PHP_INSTALL_DIR}
         )
-else(PHP4_FOUND)
+else(PHP4_FOUND OR (PHP4_INCLUDE_PATH AND PHP4_EXECUTABLE))
     message(WARNING "not building php bindings because php was not found")
-endif (PHP4_FOUND)
+endif (PHP4_FOUND OR (PHP4_INCLUDE_PATH AND PHP4_EXECUTABLE))





More information about the commits mailing list