File libkolabxml-1.1.6-PHP7+8.patch of Package libkolabxml
diff -Ppru libkolabxml-1.1.6.orig/cmake/modules/FindLibkolabxmlDependencies.cmake libkolabxml-1.1.6/cmake/modules/FindLibkolabxmlDependencies.cmake
--- libkolabxml-1.1.6.orig/cmake/modules/FindLibkolabxmlDependencies.cmake 2016-09-02 10:50:26.000000000 +0200
+++ libkolabxml-1.1.6/cmake/modules/FindLibkolabxmlDependencies.cmake 2023-01-07 23:13:03.891773937 +0100
@@ -37,9 +37,9 @@ endif()
find_package_handle_standard_args(Curl DEFAULT_MSG
CURL CURL_INCLUDE_DIRS)
-find_program(SWIG swig /usr/bin/)
-if(SWIG)
- set(SWIG_FOUND ON)
+find_package(SWIG 2.0)
+if(SWIG_FOUND)
+ set(SWIG swig)
message("SWIG found")
endif()
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 2023-01-07 22:01:39.241750892 +0100
@@ -12,6 +12,7 @@ option( BUILD_UTILS "Build optional util
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_MAJOR "PHP major version to build with" 7 )
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/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 2023-01-07 23:32:04.251780070 +0100
@@ -2,9 +2,14 @@
include_directories(../)
set(KOLAB_SWIG_PHP_SOURCE_FILE php_kolabformat_wrapper.cpp)
+set(SWIG_PHP_MAJOR 7)
+if (PHP_MAJOR EQUAL 5)
+ set(SWIG_PHP_MAJOR 5)
+endif()
+
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${SWIG_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 +26,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
@@ -64,10 +69,12 @@ if(NOT PHP_VERSION_ID VERSION_LESS ${PHP
install(TARGETS phpbindings LIBRARY DESTINATION ${PHP_INSTALL_DIR})
- install( FILES
- ${CMAKE_CURRENT_BINARY_DIR}/kolabformat.php
- DESTINATION ${PHP_INSTALL_DIR}
- )
+ if (SWIG_VERSION VERSION_LESS 4.1.0)
+ install( FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/kolabformat.php
+ DESTINATION ${PHP_INSTALL_DIR}
+ )
+ endif()
else()
message(WARNING "not building php bindings because php was not found")