File libkolabxml-1.1.6-PHP7.patch of Package libkolabxml
diff -Ppru libkolabxml-1.1.6.orig/CMakeLists.txt libkolabxml-1.1.6/CMakeLists.txt
--- libkolabxml-1.1.6.orig/CMakeLists.txt 2016-09-02 10:50:26.000000000 +0200
+++ libkolabxml-1.1.6/CMakeLists.txt 2018-10-27 18:55:53.036865500 +0200
@@ -11,7 +11,9 @@ option( BUILD_TESTS "Build the tests" TR
option( BUILD_UTILS "Build optional utils" FALSE )
option( DIST_ONLY "Build dist targets only (does not require a compiler)" FALSE )
option( PYTHON_BINDINGS "Build bindings for python" FALSE )
-option( PHP_BINDINGS "Build bindings for php" FALSE )
+option( PHP_BINDINGS "Build bindings for php5" FALSE )
+option( PHP5_BINDINGS "Build bindings for php5" FALSE )
+option( PHP7_BINDINGS "Build bindings for php7" FALSE )
option( CSHARP_BINDINGS "Build bindings for csharp" FALSE )
option( JAVA_BINDINGS "Build bindings for java" FALSE )
option( QT5_BUILD "Build libkolabxml using the Qt5 framework" FALSE)
diff -Ppru libkolabxml-1.1.6.orig/src/CMakeLists.txt libkolabxml-1.1.6/src/CMakeLists.txt
--- libkolabxml-1.1.6.orig/src/CMakeLists.txt 2016-09-02 10:50:26.000000000 +0200
+++ libkolabxml-1.1.6/src/CMakeLists.txt 2018-10-27 19:03:23.800851300 +0200
@@ -75,10 +75,15 @@ if (SWIG_FOUND)
message("building python bindings")
add_subdirectory(python)
endif(PYTHON_BINDINGS)
- if(PHP_BINDINGS)
- message("building php bindings")
+ if(PHP5_BINDINGS OR PHP_BINDINGS)
+ message("building php5 bindings")
+ set(PHP_MAJOR 5)
add_subdirectory(php)
- endif(PHP_BINDINGS)
+ elseif(PHP7_BINDINGS)
+ message("building php7 bindings")
+ set(PHP_MAJOR 7)
+ add_subdirectory(php)
+ endif()
else()
message(WARNING "Could not build SWIG bindings, because SWIG is missing.")
endif()
diff -Ppru libkolabxml-1.1.6.orig/src/php/CMakeLists.txt libkolabxml-1.1.6/src/php/CMakeLists.txt
--- libkolabxml-1.1.6.orig/src/php/CMakeLists.txt 2016-09-02 10:50:26.000000000 +0200
+++ libkolabxml-1.1.6/src/php/CMakeLists.txt 2018-10-27 21:15:36.919940000 +0200
@@ -3,8 +3,8 @@ include_directories(../)
set(KOLAB_SWIG_PHP_SOURCE_FILE php_kolabformat_wrapper.cpp)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${KOLAB_SWIG_PHP_SOURCE_FILE} ${CMAKE_CURRENT_BINARY_DIR}/kolabformat.php
- COMMAND ${SWIG} -v -c++ -php -o ${CMAKE_CURRENT_BINARY_DIR}/${KOLAB_SWIG_PHP_SOURCE_FILE} ../kolabformat.i
- COMMENT "Generating php bindings"
+ COMMAND ${SWIG} -v -c++ -php${PHP_MAJOR} -o ${CMAKE_CURRENT_BINARY_DIR}/${KOLAB_SWIG_PHP_SOURCE_FILE} ../kolabformat.i
+ COMMENT "Generating php${PHP_MAJOR} bindings"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ../kolabformat.i kolabxml
VERBATIM
@@ -21,8 +21,8 @@ if (APPLE)
endif()
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-variable -Wno-unused-label -Wno-maybe-uninitialized -Wno-unused-function" )
-# Try to find PHP5
-find_path(PHP_INCLUDE_DIR NAMES main/php.h PATH_SUFFIXES php php5)
+# Try to find PHP
+find_path(PHP_INCLUDE_DIR NAMES main/php.h PATH_SUFFIXES php php${PHP_MAJOR})
find_program(PHP_EXECUTABLE NAMES php)
# Libkolabxml needs PHP >= 5.3
diff -Ppru libkolabxml-1.1.6.orig/tests/CMakeLists.txt libkolabxml-1.1.6/tests/CMakeLists.txt
--- libkolabxml-1.1.6.orig/tests/CMakeLists.txt 2016-09-02 10:50:26.000000000 +0200
+++ libkolabxml-1.1.6/tests/CMakeLists.txt 2018-10-27 18:56:54.964882000 +0200
@@ -37,8 +37,11 @@ if (NOT APPLE)
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--no-undefined" )
endif()
-if(PHP_BINDINGS)
- add_test(phptest php -d enable_dl=On -d include_path='.:/usr/share/pear:${CMAKE_BINARY_DIR}/src/php' -d extension=${CMAKE_BINARY_DIR}/src/php/kolabformat.so ${CMAKE_SOURCE_DIR}/src/php/test.php --verbose)
+if(PHP5_BINDINGS OR PHP_BINDINGS)
+ add_test(phptest php5 -d enable_dl=On -d include_path='.:/usr/share/pear:${CMAKE_BINARY_DIR}/src/php' -d extension=${CMAKE_BINARY_DIR}/src/php/kolabformat.so ${CMAKE_SOURCE_DIR}/src/php/test.php --verbose)
+endif()
+if(PHP7_BINDINGS)
+ add_test(phptest php7 -d enable_dl=On -d include_path='.:/usr/share/pear:${CMAKE_BINARY_DIR}/src/php' -d extension=${CMAKE_BINARY_DIR}/src/php/kolabformat.so ${CMAKE_SOURCE_DIR}/src/php/test.php --verbose)
endif()
if (QT4_FOUND OR Qt5Core_FOUND)