From bdfed652907f58013c63fa311671afeaeb5535bf Mon Sep 17 00:00:00 2001 From: Denis Rouzaud Date: Fri, 22 Mar 2024 07:18:55 +0100 Subject: [PATCH 1/3] fix auth method + vcpkg patch --- cmake/{32200.patch => 36556.patch} | 185 ++++++++++++++++++-- cmake/VcpkgToolchain.cmake | 2 +- src/auth/apiheader/CMakeLists.txt | 36 ++-- src/auth/awss3/CMakeLists.txt | 42 +++-- src/auth/esritoken/CMakeLists.txt | 28 +-- src/auth/identcert/CMakeLists.txt | 30 ++-- src/auth/maptiler_hmacsha256/CMakeLists.txt | 38 ++-- src/auth/oauth2/CMakeLists.txt | 59 +++---- src/auth/pkipaths/CMakeLists.txt | 40 ++--- src/auth/pkipkcs12/CMakeLists.txt | 40 ++--- 10 files changed, 320 insertions(+), 180 deletions(-) rename cmake/{32200.patch => 36556.patch} (70%) diff --git a/cmake/32200.patch b/cmake/36556.patch similarity index 70% rename from cmake/32200.patch rename to cmake/36556.patch index 81a9f2a4f28e..ebbeba10ac6b 100644 --- a/cmake/32200.patch +++ b/cmake/36556.patch @@ -1,7 +1,7 @@ -From 4fefba48aebc88b3619d2c34e6328ec598a406fb Mon Sep 17 00:00:00 2001 +From 0300f4f8d9fa7021e717551f68ad22a924af3d74 Mon Sep 17 00:00:00 2001 From: liviaerxin <1yue8haogaoqi@gmail.com> Date: Sat, 24 Jun 2023 22:10:03 +0800 -Subject: [PATCH 1/3] Fixup install name and rpath after building dynamic +Subject: [PATCH 1/7] Fixup install name and rpath after building dynamic libraries on osx --- @@ -13,7 +13,7 @@ Subject: [PATCH 1/3] Fixup install name and rpath after building dynamic diff --git a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake new file mode 100644 -index 000000000000..46510168cfe5 +index 0000000000000..46510168cfe56 --- /dev/null +++ b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake @@ -0,0 +1,404 @@ @@ -377,13 +377,13 @@ index 000000000000..46510168cfe5 + + # Iterate over the filtered dependencies and fix their install names + foreach(dep_install_name IN LISTS dep_install_names) -+ string(REGEX MATCH "[^/]+(.dylib|.so)" dep_install_short_name "${dep_install_name}") ++ string(REGEX MATCH "[^/]+(.dylib|.so)" dep_install_name "${dep_install_name}") + message(DEBUG "dep_install_name: ${dep_install_name}") + + if(type EQUAL 2) -+ file(GLOB_RECURSE dep_files LIST_DIRECTORIES FALSE "${CURRENT_PACKAGES_DIR}/lib/${dep_install_short_name}") ++ file(GLOB_RECURSE dep_files LIST_DIRECTORIES FALSE "${CURRENT_PACKAGES_DIR}/lib/${dep_install_name}") + else() -+ file(GLOB_RECURSE dep_files LIST_DIRECTORIES FALSE "${folder}/${dep_install_short_name}") ++ file(GLOB_RECURSE dep_files LIST_DIRECTORIES FALSE "${folder}/${dep_install_name}") + endif() + + if(NOT dep_files) @@ -423,12 +423,12 @@ index 000000000000..46510168cfe5 +z_vcpkg_fixup_install_name_rpath_in_dir() \ No newline at end of file diff --git a/scripts/ports.cmake b/scripts/ports.cmake -index ac0b64e6eb45..05ff31b15db0 100644 +index c6746a6662686..267ad325f7702 100644 --- a/scripts/ports.cmake +++ b/scripts/ports.cmake -@@ -149,6 +149,9 @@ if(CMD STREQUAL "BUILD") - if(VCPKG_FIXUP_ELF_RPATH) - include("${SCRIPTS}/cmake/z_vcpkg_fixup_rpath.cmake") +@@ -178,6 +178,9 @@ if(CMD STREQUAL "BUILD") + if(VCPKG_FIXUP_ELF_RPATH OR (VCPKG_TARGET_IS_LINUX AND NOT DEFINED VCPKG_FIXUP_ELF_RPATH)) + z_vcpkg_fixup_rpath_in_dir() endif() + if(VCPKG_FIXUP_MACHO_RPATH) + include("${SCRIPTS}/cmake/z_vcpkg_fixup_install_name_rpath.cmake") @@ -437,7 +437,7 @@ index ac0b64e6eb45..05ff31b15db0 100644 endif() elseif(CMD STREQUAL "CREATE") diff --git a/triplets/community/arm64-osx-dynamic.cmake b/triplets/community/arm64-osx-dynamic.cmake -index c9b1243c92cf..8f37d4024377 100644 +index c9b1243c92cfa..8f37d40243770 100644 --- a/triplets/community/arm64-osx-dynamic.cmake +++ b/triplets/community/arm64-osx-dynamic.cmake @@ -4,3 +4,5 @@ set(VCPKG_LIBRARY_LINKAGE dynamic) @@ -448,17 +448,17 @@ index c9b1243c92cf..8f37d4024377 100644 +set(VCPKG_FIXUP_MACHO_RPATH ON) \ No newline at end of file -From 2df07eac5d0efb6edfa698cc4cd4e9e1bf187843 Mon Sep 17 00:00:00 2001 +From fc41a9a218dfedee5f9e6b4a37cfc7ea57c96b3d Mon Sep 17 00:00:00 2001 From: liviaerxin <1yue8haogaoqi@gmail.com> Date: Sat, 24 Jun 2023 23:39:48 +0800 -Subject: [PATCH 2/3] Update comments +Subject: [PATCH 2/7] Update comments --- scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake -index 46510168cfe5..38fb716b3c22 100644 +index 46510168cfe56..38fb716b3c223 100644 --- a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake +++ b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake @@ -217,14 +217,14 @@ endfunction() @@ -481,17 +481,17 @@ index 46510168cfe5..38fb716b3c22 100644 find_program( install_name_tool_cmd -From b94dc25d372b8269095f3aff73fd344b6c96f207 Mon Sep 17 00:00:00 2001 +From 2f51fcee81cd2b8c30843805b6fe13efc7135839 Mon Sep 17 00:00:00 2001 From: liviaerxin <1yue8haogaoqi@gmail.com> Date: Mon, 26 Jun 2023 21:32:14 +0800 -Subject: [PATCH 3/3] chore: do fixup if necessary tools found +Subject: [PATCH 3/7] chore: do fixup if necessary tools found --- .../z_vcpkg_fixup_install_name_rpath.cmake | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake -index 38fb716b3c22..2f07720938ec 100644 +index 38fb716b3c223..2f07720938ece 100644 --- a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake +++ b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake @@ -229,10 +229,25 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) @@ -521,3 +521,154 @@ index 38fb716b3c22..2f07720938ec 100644 message(DEBUG "Start fix install name and rpath for Mach-O files") # Iterate over the folders. DON'T change order! + +From 20255d645e1a4e27b2e3c4a891aa7cfe9035baf8 Mon Sep 17 00:00:00 2001 +From: Matthias Kuhn +Date: Sat, 3 Feb 2024 16:11:03 +0100 +Subject: [PATCH 4/7] Fail if rpath fixups cannot be applied + +--- + .../z_vcpkg_fixup_install_name_rpath.cmake | 20 ++++++------------- + 1 file changed, 6 insertions(+), 14 deletions(-) + +diff --git a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake +index 2f07720938ece..f72927ad8a624 100644 +--- a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake ++++ b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake +@@ -230,24 +230,16 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) + install_name_tool_cmd + NAMES install_name_tool + DOC "Absolute path of install_name_tool cmd" ++ REQUIRED + ) + +- if(NOT install_name_tool_cmd) +- message(WARNING " install_name_tool not found!") +- return() +- endif() +- + find_program( + otool_cmd + NAMES otool + DOC "Absolute path of otool cmd" ++ REQUIRED + ) + +- if(NOT otool_cmd) +- message(WARNING "otool not found!") +- return() +- endif() +- + message(DEBUG "Start fix install name and rpath for Mach-O files") + + # Iterate over the folders. DON'T change order! +@@ -331,7 +323,7 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) + ) + + if(NOT set_install_name_rv EQUAL 0) +- message(WARNING "Failed, install_name_tool -id ${id_name} ${file}, \n${set_install_name_ov}") ++ message(FATAL_ERROR "Failed, install_name_tool -id ${id_name} ${file}, \n${set_install_name_ov}") + continue() + endif() + endif() +@@ -346,7 +338,7 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) + ) + + if(NOT set_rpath_rv EQUAL 0) +- message(WARNING "Failed, install_name_tool -add_rpath ${rpath} ${file}, \n${set_rpath_ov}") ++ message(FATAL_ERROR "Failed, install_name_tool -add_rpath ${rpath} ${file}, \n${set_rpath_ov}") + continue() + endif() + +@@ -400,7 +392,7 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) + ) + + if(NOT change_dep_install_name_rv EQUAL 0) +- message(WARNING "Failed, install_name_tool -change ${dep_install_name} ${id_name} ${file}, \n${change_dep_install_name_ov}") ++ message(FATAL_ERROR "Failed, install_name_tool -change ${dep_install_name} ${id_name} ${file}, \n${change_dep_install_name_ov}") + continue() + else() + message(DEBUG "Fix ${file}: ${dep_install_name} to ${id_name}") +@@ -416,4 +408,4 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) + endforeach() + endfunction() + +-z_vcpkg_fixup_install_name_rpath_in_dir() +\ No newline at end of file ++z_vcpkg_fixup_install_name_rpath_in_dir() + +From 7619e9e2e08317e3151e03f9947776c156a7dc3e Mon Sep 17 00:00:00 2001 +From: Matthias Kuhn +Date: Sat, 3 Feb 2024 16:11:53 +0100 +Subject: [PATCH 5/7] Remove extra function call + +--- + scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake +index f72927ad8a624..33e062efe18c8 100644 +--- a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake ++++ b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake +@@ -407,5 +407,3 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) + endforeach() + endforeach() + endfunction() +- +-z_vcpkg_fixup_install_name_rpath_in_dir() + +From 4fe55167a9218b69980e843d035265a7a9df1962 Mon Sep 17 00:00:00 2001 +From: Matthias Kuhn +Date: Sat, 3 Feb 2024 17:11:20 +0100 +Subject: [PATCH 6/7] Use original dep install name for fixup + +--- + scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake +index 33e062efe18c8..74a8691667ca1 100644 +--- a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake ++++ b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake +@@ -364,9 +364,9 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) + list(FILTER dep_install_names EXCLUDE REGEX "^/System/Library/.*(dylib|so)$") + + # Iterate over the filtered dependencies and fix their install names +- foreach(dep_install_name IN LISTS dep_install_names) +- string(REGEX MATCH "[^/]+(.dylib|.so)" dep_install_name "${dep_install_name}") +- message(DEBUG "dep_install_name: ${dep_install_name}") ++ foreach(orig_dep_install_name IN LISTS dep_install_names) ++ string(REGEX MATCH "[^/]+(.dylib|.so)" dep_install_name "${orig_dep_install_name}") ++ message(DEBUG "dep_install_name: ${dep_install_name} (${orig_dep_install_name})") + + if(type EQUAL 2) + file(GLOB_RECURSE dep_files LIST_DIRECTORIES FALSE "${CURRENT_PACKAGES_DIR}/lib/${dep_install_name}") +@@ -386,7 +386,7 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) + message(DEBUG "${dep_install_name} match with ${dep_file} of install name ${id_name}") + + execute_process( +- COMMAND "${install_name_tool_cmd}" -change "${dep_install_name}" "${id_name}" "${file}" ++ COMMAND "${install_name_tool_cmd}" -change "${orig_dep_install_name}" "${id_name}" "${file}" + OUTPUT_VARIABLE change_dep_install_name_ov + RESULT_VARIABLE change_dep_install_name_rv + ) + +From 3c48d0602efab400be375067a4160583628dd09d Mon Sep 17 00:00:00 2001 +From: Matthias Kuhn +Date: Tue, 12 Mar 2024 07:58:50 +0100 +Subject: [PATCH 7/7] Run fixups + +--- + scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake +index 74a8691667ca1..226d820ea7b28 100644 +--- a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake ++++ b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake +@@ -407,3 +407,5 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) + endforeach() + endforeach() + endfunction() ++ ++z_vcpkg_fixup_install_name_rpath_in_dir() diff --git a/cmake/VcpkgToolchain.cmake b/cmake/VcpkgToolchain.cmake index 74da5c01e19c..594a7ef4c564 100644 --- a/cmake/VcpkgToolchain.cmake +++ b/cmake/VcpkgToolchain.cmake @@ -15,7 +15,7 @@ if(NOT VCPKG_TAG STREQUAL VCPKG_INSTALLED_VERSION) FetchContent_Declare(vcpkg GIT_REPOSITORY https://github.com/microsoft/vcpkg.git GIT_TAG ${VCPKG_TAG} -# PATCH_COMMAND git apply --ignore-whitespace "${CMAKE_CURRENT_LIST_DIR}/32200.patch" + PATCH_COMMAND git apply --ignore-whitespace "${CMAKE_CURRENT_LIST_DIR}/36556.patch" ) FetchContent_MakeAvailable(vcpkg) else() diff --git a/src/auth/apiheader/CMakeLists.txt b/src/auth/apiheader/CMakeLists.txt index 35bb52c345e8..13a7879b3fed 100644 --- a/src/auth/apiheader/CMakeLists.txt +++ b/src/auth/apiheader/CMakeLists.txt @@ -25,26 +25,26 @@ endif() # static library -add_library(authmethod_apiheader_a STATIC ${AUTH_APIHEADER_SRCS} ${AUTH_APIHEADER_HDRS} ${AUTH_APIHEADER_UIS_H}) - -target_include_directories(authmethod_apiheader_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/apiheader/core) - -# require c++17 -target_compile_features(authmethod_apiheader_a PRIVATE cxx_std_17) - -target_link_libraries(authmethod_apiheader_a qgis_core) - -if (WITH_GUI) - target_include_directories(authmethod_apiheader_a PRIVATE - ${CMAKE_SOURCE_DIR}/src/auth/apiheader/gui - ${CMAKE_BINARY_DIR}/src/auth/apiheader - ) - target_link_libraries (authmethod_apiheader_a qgis_gui) -endif() +if (FORCE_STATIC_LIBS) + add_library(authmethod_apiheader_a STATIC ${AUTH_APIHEADER_SRCS} ${AUTH_APIHEADER_HDRS} ${AUTH_APIHEADER_UIS_H}) -target_compile_definitions(authmethod_apiheader_a PRIVATE "-DQT_NO_FOREACH") + target_include_directories(authmethod_apiheader_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/apiheader/core) + + # require c++17 + target_compile_features(authmethod_apiheader_a PRIVATE cxx_std_17) + + target_link_libraries(authmethod_apiheader_a qgis_core) + + if (WITH_GUI) + target_include_directories(authmethod_apiheader_a PRIVATE + ${CMAKE_SOURCE_DIR}/src/auth/apiheader/gui + ${CMAKE_BINARY_DIR}/src/auth/apiheader + ) + target_link_libraries (authmethod_apiheader_a qgis_gui) + endif() + + target_compile_definitions(authmethod_apiheader_a PRIVATE "-DQT_NO_FOREACH") -if (FORCE_STATIC_LIBS) # for (external) mobile apps to be able to pick up provider for linking install (TARGETS authmethod_apiheader_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR}) else() diff --git a/src/auth/awss3/CMakeLists.txt b/src/auth/awss3/CMakeLists.txt index 47ba61a9e52e..99a33dcbedc4 100644 --- a/src/auth/awss3/CMakeLists.txt +++ b/src/auth/awss3/CMakeLists.txt @@ -25,29 +25,27 @@ endif() # static library -add_library(authmethod_awss3_a STATIC ${AUTH_AWSS3_SRCS} ${AUTH_AWSS3_HDRS} ${AUTH_AWSS3_UIS_H}) - -target_include_directories(authmethod_awss3_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/awss3/core) - -# require c++17 -target_compile_features(authmethod_awss3_a PRIVATE cxx_std_17) - -target_link_libraries(authmethod_awss3_a qgis_core) - -if (WITH_GUI) - target_include_directories(authmethod_awss3_a PRIVATE - ${CMAKE_SOURCE_DIR}/src/auth/awss3/gui - ${CMAKE_BINARY_DIR}/src/auth/awss3 - ) - - target_link_libraries (authmethod_awss3_a qgis_gui) -endif() - -target_compile_definitions(authmethod_awss3_a PRIVATE "-DQT_NO_FOREACH") - - - if (FORCE_STATIC_LIBS) + add_library(authmethod_awss3_a STATIC ${AUTH_AWSS3_SRCS} ${AUTH_AWSS3_HDRS} ${AUTH_AWSS3_UIS_H}) + + target_include_directories(authmethod_awss3_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/awss3/core) + + # require c++17 + target_compile_features(authmethod_awss3_a PRIVATE cxx_std_17) + + target_link_libraries(authmethod_awss3_a qgis_core) + + if (WITH_GUI) + target_include_directories(authmethod_awss3_a PRIVATE + ${CMAKE_SOURCE_DIR}/src/auth/awss3/gui + ${CMAKE_BINARY_DIR}/src/auth/awss3 + ) + + target_link_libraries (authmethod_awss3_a qgis_gui) + endif() + + target_compile_definitions(authmethod_awss3_a PRIVATE "-DQT_NO_FOREACH") + # for (external) mobile apps to be able to pick up provider for linking install (TARGETS authmethod_awss3_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR}) else() diff --git a/src/auth/esritoken/CMakeLists.txt b/src/auth/esritoken/CMakeLists.txt index 5bc3f1fb681b..895f4d5db388 100644 --- a/src/auth/esritoken/CMakeLists.txt +++ b/src/auth/esritoken/CMakeLists.txt @@ -25,26 +25,26 @@ endif() # static library -add_library(authmethod_esritoken_a STATIC ${AUTH_ESRITOKEN_SRCS} ${AUTH_ESRITOKEN_HDRS} ${AUTH_ESRITOKEN_UIS_H}) +if (FORCE_STATIC_LIBS) + add_library(authmethod_esritoken_a STATIC ${AUTH_ESRITOKEN_SRCS} ${AUTH_ESRITOKEN_HDRS} ${AUTH_ESRITOKEN_UIS_H}) -target_include_directories(authmethod_esritoken_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/esritoken/core) + target_include_directories(authmethod_esritoken_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/esritoken/core) -# require c++17 -target_compile_features(authmethod_esritoken_a PRIVATE cxx_std_17) + # require c++17 + target_compile_features(authmethod_esritoken_a PRIVATE cxx_std_17) -target_link_libraries(authmethod_esritoken_a qgis_core) + target_link_libraries(authmethod_esritoken_a qgis_core) -if (WITH_GUI) - target_include_directories(authmethod_esritoken_a PRIVATE - ${CMAKE_SOURCE_DIR}/src/auth/esritoken/gui - ${CMAKE_BINARY_DIR}/src/auth/esritoken - ) - target_link_libraries (authmethod_esritoken_a qgis_gui) -endif() + if (WITH_GUI) + target_include_directories(authmethod_esritoken_a PRIVATE + ${CMAKE_SOURCE_DIR}/src/auth/esritoken/gui + ${CMAKE_BINARY_DIR}/src/auth/esritoken + ) + target_link_libraries (authmethod_esritoken_a qgis_gui) + endif() -target_compile_definitions(authmethod_esritoken_a PRIVATE "-DQT_NO_FOREACH") + target_compile_definitions(authmethod_esritoken_a PRIVATE "-DQT_NO_FOREACH") -if (FORCE_STATIC_LIBS) # for (external) mobile apps to be able to pick up provider for linking install (TARGETS authmethod_esritoken_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR}) else() diff --git a/src/auth/identcert/CMakeLists.txt b/src/auth/identcert/CMakeLists.txt index f6dda60f06c7..81b95024dfb5 100644 --- a/src/auth/identcert/CMakeLists.txt +++ b/src/auth/identcert/CMakeLists.txt @@ -25,28 +25,26 @@ endif() # static library -add_library(authmethod_identcert_a STATIC ${AUTH_IDENTCERT_SRCS} ${AUTH_IDENTCERT_HDRS} ${AUTH_IDENTCERT_UIS_H}) - -target_include_directories(authmethod_identcert_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/identcert/core) - -# require c++17 -target_compile_features(authmethod_identcert_a PRIVATE cxx_std_17) +if (FORCE_STATIC_LIBS) + add_library(authmethod_identcert_a STATIC ${AUTH_IDENTCERT_SRCS} ${AUTH_IDENTCERT_HDRS} ${AUTH_IDENTCERT_UIS_H}) -target_link_libraries(authmethod_identcert_a qgis_core) + target_include_directories(authmethod_identcert_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/identcert/core) -if (WITH_GUI) - target_include_directories(authmethod_identcert_a PRIVATE - ${CMAKE_SOURCE_DIR}/src/auth/identcert/gui - ${CMAKE_BINARY_DIR}/src/auth/identcert - ) - target_link_libraries (authmethod_identcert_a qgis_gui) -endif() + # require c++17 + target_compile_features(authmethod_identcert_a PRIVATE cxx_std_17) -target_compile_definitions(authmethod_identcert_a PRIVATE "-DQT_NO_FOREACH") + target_link_libraries(authmethod_identcert_a qgis_core) + if (WITH_GUI) + target_include_directories(authmethod_identcert_a PRIVATE + ${CMAKE_SOURCE_DIR}/src/auth/identcert/gui + ${CMAKE_BINARY_DIR}/src/auth/identcert + ) + target_link_libraries (authmethod_identcert_a qgis_gui) + endif() + target_compile_definitions(authmethod_identcert_a PRIVATE "-DQT_NO_FOREACH") -if (FORCE_STATIC_LIBS) # for (external) mobile apps to be able to pick up provider for linking install (TARGETS authmethod_identcert_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR}) else() diff --git a/src/auth/maptiler_hmacsha256/CMakeLists.txt b/src/auth/maptiler_hmacsha256/CMakeLists.txt index 5e7b988f82b2..37ea1c271c5a 100644 --- a/src/auth/maptiler_hmacsha256/CMakeLists.txt +++ b/src/auth/maptiler_hmacsha256/CMakeLists.txt @@ -25,26 +25,26 @@ endif() # static library -add_library(authmethod_maptilerhmacsha256_a STATIC ${AUTH_MAPTILER_HMACSHA256_SRCS} ${AUTH_MAPTILER_HMACSHA256_HDRS} ${AUTH_MAPTILER_HMACSHA256_UIS_H}) - -target_include_directories(authmethod_maptilerhmacsha256_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/hmacsha256/core) - -# require c++17 -target_compile_features(authmethod_maptilerhmacsha256_a PRIVATE cxx_std_17) - -target_link_libraries(authmethod_maptilerhmacsha256_a qgis_core) - -if (WITH_GUI) - target_include_directories(authmethod_maptilerhmacsha256_a PRIVATE - ${CMAKE_SOURCE_DIR}/src/auth/maptiler_hmacsha256/gui - ${CMAKE_BINARY_DIR}/src/auth/maptiler_hmacsha256 - ) - target_link_libraries (authmethod_maptilerhmacsha256_a qgis_gui) -endif() - -target_compile_definitions(authmethod_maptilerhmacsha256_a PRIVATE "-DQT_NO_FOREACH") - if (FORCE_STATIC_LIBS) + add_library(authmethod_maptilerhmacsha256_a STATIC ${AUTH_MAPTILER_HMACSHA256_SRCS} ${AUTH_MAPTILER_HMACSHA256_HDRS} ${AUTH_MAPTILER_HMACSHA256_UIS_H}) + + target_include_directories(authmethod_maptilerhmacsha256_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/hmacsha256/core) + + # require c++17 + target_compile_features(authmethod_maptilerhmacsha256_a PRIVATE cxx_std_17) + + target_link_libraries(authmethod_maptilerhmacsha256_a qgis_core) + + if (WITH_GUI) + target_include_directories(authmethod_maptilerhmacsha256_a PRIVATE + ${CMAKE_SOURCE_DIR}/src/auth/maptiler_hmacsha256/gui + ${CMAKE_BINARY_DIR}/src/auth/maptiler_hmacsha256 + ) + target_link_libraries (authmethod_maptilerhmacsha256_a qgis_gui) + endif() + + target_compile_definitions(authmethod_maptilerhmacsha256_a PRIVATE "-DQT_NO_FOREACH") + # for (external) mobile apps to be able to pick up provider for linking install (TARGETS authmethod_maptilerhmacsha256_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR}) else() diff --git a/src/auth/oauth2/CMakeLists.txt b/src/auth/oauth2/CMakeLists.txt index 15b3fb2588dc..419fcfe19694 100644 --- a/src/auth/oauth2/CMakeLists.txt +++ b/src/auth/oauth2/CMakeLists.txt @@ -98,42 +98,39 @@ if(WITH_INTERNAL_O2 AND CMAKE_GENERATOR MATCHES "Ninja") endif() # static library -add_library(authmethod_oauth2_a STATIC ${AUTH_OAUTH2_SRCS} ${AUTH_OAUTH2_HDRS} ${AUTH_OAUTH2_RCCS} ${AUTH_OAUTH2_UIS_H}) - -target_include_directories(authmethod_oauth2_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/oauth2/core) - -# require c++17 -target_compile_features(authmethod_oauth2_a PRIVATE cxx_std_17) -target_compile_definitions(authmethod_oauth2_a PRIVATE "CMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\"") - -target_link_libraries(authmethod_oauth2_a qgis_core) - -if(WITH_INTERNAL_O2) - target_include_directories(authmethod_oauth2_a SYSTEM PUBLIC ${O2_INCLUDE_DIR}) -else() - if(NOT "${O2_LIBRARY}" STREQUAL "") - # prefer dynamic linking - target_link_libraries(authmethod_oauth2_a ${O2_LIBRARY}) +if (FORCE_STATIC_LIBS) + add_library(authmethod_oauth2_a STATIC ${AUTH_OAUTH2_SRCS} ${AUTH_OAUTH2_HDRS} ${AUTH_OAUTH2_RCCS} ${AUTH_OAUTH2_UIS_H}) + + target_include_directories(authmethod_oauth2_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/oauth2/core) + + # require c++17 + target_compile_features(authmethod_oauth2_a PRIVATE cxx_std_17) + + target_link_libraries(authmethod_oauth2_a qgis_core) + + if(WITH_INTERNAL_O2) + target_include_directories(authmethod_oauth2_a SYSTEM PUBLIC ${O2_INCLUDE_DIR}) else() - target_link_libraries(authmethod_oauth2_a ${O2_LIBRARY_STATIC}) + if(NOT "${O2_LIBRARY}" STREQUAL "") + # prefer dynamic linking + target_link_libraries(authmethod_oauth2_a ${O2_LIBRARY}) + else() + target_link_libraries(authmethod_oauth2_a ${O2_LIBRARY_STATIC}) + endif() endif() -endif() - -target_include_directories(authmethod_oauth2_a PRIVATE - ${CMAKE_SOURCE_DIR}/external/qjsonwrapper - ${CMAKE_SOURCE_DIR}/src/auth/oauth2/core -) -if (WITH_GUI) + target_include_directories(authmethod_oauth2_a PRIVATE - ${CMAKE_SOURCE_DIR}/src/auth/oauth2/gui - ${CMAKE_BINARY_DIR}/src/auth/oauth2 + ${CMAKE_SOURCE_DIR}/external/qjsonwrapper + ${CMAKE_SOURCE_DIR}/src/auth/oauth2/core ) - target_link_libraries (authmethod_oauth2_a qgis_gui) -endif() - - + if (WITH_GUI) + target_include_directories(authmethod_oauth2_a PRIVATE + ${CMAKE_SOURCE_DIR}/src/auth/oauth2/gui + ${CMAKE_BINARY_DIR}/src/auth/oauth2 + ) + target_link_libraries (authmethod_oauth2_a qgis_gui) + endif() -if (FORCE_STATIC_LIBS) # for (external) mobile apps to be able to pick up provider for linking install (TARGETS authmethod_oauth2_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR}) else() diff --git a/src/auth/pkipaths/CMakeLists.txt b/src/auth/pkipaths/CMakeLists.txt index 8878344dc590..c49c4fb3840f 100644 --- a/src/auth/pkipaths/CMakeLists.txt +++ b/src/auth/pkipaths/CMakeLists.txt @@ -24,28 +24,26 @@ if (WITH_GUI) endif() # static library -add_library(authmethod_pkipaths_a STATIC ${AUTH_PKIPATHS_SRCS} ${AUTH_PKIPATHS_HDRS} ${AUTH_PKIPATHS_UIS_H}) - -target_include_directories(authmethod_pkipaths_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/pkipaths/core) - -# require c++17 -target_compile_features(authmethod_pkipaths_a PRIVATE cxx_std_17) - -target_link_libraries(authmethod_pkipaths_a qgis_core) - -if (WITH_GUI) - target_include_directories(authmethod_pkipaths_a PRIVATE - ${CMAKE_SOURCE_DIR}/src/auth/pkipaths/gui - ${CMAKE_BINARY_DIR}/src/auth/pkipaths - ) - target_link_libraries (authmethod_pkipaths_a qgis_gui) -endif() - -target_compile_definitions(authmethod_pkipaths_a PRIVATE "-DQT_NO_FOREACH") - - - if (FORCE_STATIC_LIBS) + add_library(authmethod_pkipaths_a STATIC ${AUTH_PKIPATHS_SRCS} ${AUTH_PKIPATHS_HDRS} ${AUTH_PKIPATHS_UIS_H}) + + target_include_directories(authmethod_pkipaths_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/pkipaths/core) + + # require c++17 + target_compile_features(authmethod_pkipaths_a PRIVATE cxx_std_17) + + target_link_libraries(authmethod_pkipaths_a qgis_core) + + if (WITH_GUI) + target_include_directories(authmethod_pkipaths_a PRIVATE + ${CMAKE_SOURCE_DIR}/src/auth/pkipaths/gui + ${CMAKE_BINARY_DIR}/src/auth/pkipaths + ) + target_link_libraries (authmethod_pkipaths_a qgis_gui) + endif() + + target_compile_definitions(authmethod_pkipaths_a PRIVATE "-DQT_NO_FOREACH") + # for (external) mobile apps to be able to pick up provider for linking install (TARGETS authmethod_pkipaths_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR}) else() diff --git a/src/auth/pkipkcs12/CMakeLists.txt b/src/auth/pkipkcs12/CMakeLists.txt index 3e0b8e9e6ce1..47d808c4a3e9 100644 --- a/src/auth/pkipkcs12/CMakeLists.txt +++ b/src/auth/pkipkcs12/CMakeLists.txt @@ -24,28 +24,26 @@ if (WITH_GUI) endif() # static library -add_library(authmethod_pkcs12_a STATIC ${AUTH_PKCS12_SRCS} ${AUTH_PKCS12_HDRS} ${AUTH_PKCS12_UIS_H}) - -target_include_directories(authmethod_pkcs12_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/pkipkcs12/core) - -# require c++17 -target_compile_features(authmethod_pkcs12_a PRIVATE cxx_std_17) - -target_link_libraries(authmethod_pkcs12_a qgis_core) - -if (WITH_GUI) - target_include_directories(authmethod_pkcs12_a PRIVATE - ${CMAKE_SOURCE_DIR}/src/auth/pkipkcs12/gui - ${CMAKE_BINARY_DIR}/src/auth/pkipkcs12 - ) - target_link_libraries (authmethod_pkcs12_a qgis_gui) -endif() - -target_compile_definitions(authmethod_pkcs12_a PRIVATE "-DQT_NO_FOREACH") - - - if (FORCE_STATIC_LIBS) + add_library(authmethod_pkcs12_a STATIC ${AUTH_PKCS12_SRCS} ${AUTH_PKCS12_HDRS} ${AUTH_PKCS12_UIS_H}) + + target_include_directories(authmethod_pkcs12_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/pkipkcs12/core) + + # require c++17 + target_compile_features(authmethod_pkcs12_a PRIVATE cxx_std_17) + + target_link_libraries(authmethod_pkcs12_a qgis_core) + + if (WITH_GUI) + target_include_directories(authmethod_pkcs12_a PRIVATE + ${CMAKE_SOURCE_DIR}/src/auth/pkipkcs12/gui + ${CMAKE_BINARY_DIR}/src/auth/pkipkcs12 + ) + target_link_libraries (authmethod_pkcs12_a qgis_gui) + endif() + + target_compile_definitions(authmethod_pkcs12_a PRIVATE "-DQT_NO_FOREACH") + # for (external) mobile apps to be able to pick up provider for linking install (TARGETS authmethod_pkcs12_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR}) else() From 3f6515c5fb7a6d8dc5c897e1619db0a2cfd3a2ac Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Sun, 24 Mar 2024 11:17:34 +0100 Subject: [PATCH 2/3] Adjust sip parts --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a72abe56bda..2aab4099eccb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1091,7 +1091,7 @@ if (WITH_CORE AND WITH_BINDINGS) include(SIPMacros) set(SIP_INCLUDES ${PYQT_SIP_DIR} ${CMAKE_SOURCE_DIR}/python) - set(SIP_CONCAT_PARTS 26) + set(SIP_CONCAT_PARTS 12) if (NOT BINDINGS_GLOBAL_INSTALL) set(Python_SITEARCH ${QGIS_DATA_DIR}/python) From f54ce2b995d30e35aff43d2c3db0ec840b0c122f Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Sun, 24 Mar 2024 11:17:46 +0100 Subject: [PATCH 3/3] qca with ossl --- vcpkg/.qt6/vcpkg.json | 5 +- vcpkg/ports/qca/0001-fix-path-for-vcpkg.patch | 72 +++ vcpkg/ports/qca/0002-fix-build-error.patch | 26 + ...-NOMINMAX-for-botan-plugin-with-MSVC.patch | 28 + vcpkg/ports/qca/mk-ca-bundle.pl | 554 ++++++++++++++++++ vcpkg/ports/qca/portfile.cmake | 102 ++++ vcpkg/ports/qca/vcpkg.json | 44 ++ 7 files changed, 830 insertions(+), 1 deletion(-) create mode 100644 vcpkg/ports/qca/0001-fix-path-for-vcpkg.patch create mode 100644 vcpkg/ports/qca/0002-fix-build-error.patch create mode 100644 vcpkg/ports/qca/0003-Define-NOMINMAX-for-botan-plugin-with-MSVC.patch create mode 100644 vcpkg/ports/qca/mk-ca-bundle.pl create mode 100644 vcpkg/ports/qca/portfile.cmake create mode 100644 vcpkg/ports/qca/vcpkg.json diff --git a/vcpkg/.qt6/vcpkg.json b/vcpkg/.qt6/vcpkg.json index 81cdce3cc44d..ed747ce31788 100644 --- a/vcpkg/.qt6/vcpkg.json +++ b/vcpkg/.qt6/vcpkg.json @@ -33,7 +33,10 @@ "jhasse-poly2tri", "proj", "protobuf", - "qca", + { + "name": "qca", + "features": ["ossl"] + }, "qtbase", "qtlocation", "qtsvg", diff --git a/vcpkg/ports/qca/0001-fix-path-for-vcpkg.patch b/vcpkg/ports/qca/0001-fix-path-for-vcpkg.patch new file mode 100644 index 000000000000..744fce107d51 --- /dev/null +++ b/vcpkg/ports/qca/0001-fix-path-for-vcpkg.patch @@ -0,0 +1,72 @@ +diff --git "a/CMakeLists.txt" "b/CMakeLists.txt" +index 1f84c2c9e..f72ee9d8d 100644 +--- "a/CMakeLists.txt" ++++ "b/CMakeLists.txt" +@@ -58,6 +58,7 @@ set(QCA_SUFFIX "qt5") + if(NOT BUILD_SHARED_LIBS OR QT_IS_STATIC) + set(STATIC_PLUGINS ON) + add_definitions(-DQT_STATICPLUGIN) ++ add_definitions(-DQCA_STATIC) + set(PLUGIN_TYPE "STATIC") + else() + set(PLUGIN_TYPE "MODULE") +@@ -266,10 +267,17 @@ if(DEVELOPER_MODE) + add_definitions(-DDEVELOPER_MODE) + + # To prefer plugins from build tree when run qca from build tree +- file(WRITE ${CMAKE_BINARY_DIR}/bin/qt.conf +-"[Paths] +-Plugins=${CMAKE_BINARY_DIR}/lib/${QCA_LIB_NAME} +-") ++ if(NOT BUILD_SHARED_LIBS OR QT_IS_STATIC) ++ file(WRITE ${CMAKE_BINARY_DIR}/bin/qt.conf ++ "[Paths] ++ Plugins=${CMAKE_BINARY_DIR}/lib/${QCA_LIB_NAME} ++ ") ++ else() ++ file(WRITE ${CMAKE_BINARY_DIR}/bin/qt.conf ++ "[Paths] ++ Plugins=${CMAKE_BINARY_DIR}/bin/${QCA_LIB_NAME} ++ ") ++ endif() + endif() + + if (APPLE) +@@ -309,7 +317,7 @@ else() + set( qca_CERTSTORE "${CMAKE_CURRENT_SOURCE_DIR}/certs/rootcerts.pem") + # note that INSTALL_FILES targets are relative to the current installation prefix... + if(NOT DEVELOPER_MODE) +- install(FILES "${qca_CERTSTORE}" DESTINATION "${QCA_PREFIX_INSTALL_DIR}/certs") ++ install(FILES "${qca_CERTSTORE}" DESTINATION "${QCA_PREFIX_INSTALL_DIR}/share/qca/certs") + endif() + endif() + message(STATUS "certstore path: " ${qca_CERTSTORE}) +@@ -390,10 +398,10 @@ endif() + include(CMakePackageConfigHelpers) + configure_package_config_file( + "${CMAKE_CURRENT_SOURCE_DIR}/QcaConfig.cmake.in" +- "${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/${QCA_CONFIG_NAME_BASE}/${QCA_CONFIG_NAME_BASE}Config.cmake" +- INSTALL_DESTINATION ${QCA_LIBRARY_INSTALL_DIR}/cmake/${QCA_CONFIG_NAME_BASE} ++ "${CMAKE_BINARY_DIR}/share/qca/cmake/${QCA_CONFIG_NAME_BASE}Config.cmake" ++ INSTALL_DESTINATION ${CMAKE_BINARY_DIR}/share/qca/cmake + ) +-write_basic_config_version_file("${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/${QCA_CONFIG_NAME_BASE}/${QCA_CONFIG_NAME_BASE}ConfigVersion.cmake" VERSION ${QCA_LIB_VERSION_STRING} COMPATIBILITY AnyNewerVersion) ++write_basic_config_version_file("${CMAKE_BINARY_DIR}/share/qca/cmake/${QCA_CONFIG_NAME_BASE}ConfigVersion.cmake" VERSION ${QCA_LIB_VERSION_STRING} COMPATIBILITY AnyNewerVersion) + + if(NOT DEVELOPER_MODE) + +@@ -461,10 +469,10 @@ if(NOT DEVELOPER_MODE) + endif() + endif() + +- install(EXPORT ${QCA_CONFIG_NAME_BASE}Targets DESTINATION ${QCA_LIBRARY_INSTALL_DIR}/cmake/${QCA_CONFIG_NAME_BASE} FILE ${QCA_CONFIG_NAME_BASE}Targets.cmake) ++ install(EXPORT ${QCA_CONFIG_NAME_BASE}Targets DESTINATION ${QCA_PREFIX_INSTALL_DIR}/share/qca/cmake FILE ${QCA_CONFIG_NAME_BASE}Targets.cmake) + install(FILES +- "${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/${QCA_CONFIG_NAME_BASE}/${QCA_CONFIG_NAME_BASE}Config.cmake" +- "${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/${QCA_CONFIG_NAME_BASE}/${QCA_CONFIG_NAME_BASE}ConfigVersion.cmake" +- DESTINATION ${QCA_LIBRARY_INSTALL_DIR}/cmake/${QCA_CONFIG_NAME_BASE} ++ "${CMAKE_BINARY_DIR}/share/qca/cmake/${QCA_CONFIG_NAME_BASE}Config.cmake" ++ "${CMAKE_BINARY_DIR}/share/qca/cmake/${QCA_CONFIG_NAME_BASE}ConfigVersion.cmake" ++ DESTINATION ${QCA_PREFIX_INSTALL_DIR}/share/qca/cmake + ) + endif() diff --git a/vcpkg/ports/qca/0002-fix-build-error.patch b/vcpkg/ports/qca/0002-fix-build-error.patch new file mode 100644 index 000000000000..5515d21f738a --- /dev/null +++ b/vcpkg/ports/qca/0002-fix-build-error.patch @@ -0,0 +1,26 @@ +From 8d67288a3dde7e535ff747715f96f98282a3bf67 Mon Sep 17 00:00:00 2001 +From: Matthias Kuhn +Date: Fri, 3 Dec 2021 15:17:25 +0100 +Subject: [PATCH] Ifdef codecs + +--- + cmake/modules/QcaMacro.cmake | 9 --------- + plugins/qca-ossl/qca-ossl.cpp | 6 ++++++ + 2 files changed, 6 insertions(+), 9 deletions(-) + +diff --git a/cmake/modules/QcaMacro.cmake b/cmake/modules/QcaMacro.cmake +index 80af6e84..ba86310d 100644 +--- a/cmake/modules/QcaMacro.cmake ++++ b/cmake/modules/QcaMacro.cmake +@@ -65,10 +65,6 @@ macro(add_qca_test TARGET DESCRIPTION) + endmacro(add_qca_test) + + macro(install_pdb TARGET INSTALL_PATH) +- if(MSVC) +- install(FILES $ DESTINATION ${INSTALL_PATH} CONFIGURATIONS Debug) +- install(FILES $ DESTINATION ${INSTALL_PATH} CONFIGURATIONS RelWithDebInfo) +- endif() + endmacro(install_pdb) + + macro(normalize_path PATH) + diff --git a/vcpkg/ports/qca/0003-Define-NOMINMAX-for-botan-plugin-with-MSVC.patch b/vcpkg/ports/qca/0003-Define-NOMINMAX-for-botan-plugin-with-MSVC.patch new file mode 100644 index 000000000000..d894000d617d --- /dev/null +++ b/vcpkg/ports/qca/0003-Define-NOMINMAX-for-botan-plugin-with-MSVC.patch @@ -0,0 +1,28 @@ +From f32f5ae8b8b49653bfff87f2f882862bcaa8c3f1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=D9=85=D9=87=D8=AF=D9=8A=20=D8=B4=D9=8A=D9=86=D9=88=D9=86?= + =?UTF-8?q?=20=28Mehdi=20Chinoune=29?= +Date: Mon, 20 Mar 2023 16:21:18 +0100 +Subject: [PATCH] Define NOMINMAX to fix building qca-botan plugin with MSVC + +--- + plugins/qca-botan/CMakeLists.txt | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/plugins/qca-botan/CMakeLists.txt b/plugins/qca-botan/CMakeLists.txt +index 11c0d20..9b8b978 100644 +--- a/plugins/qca-botan/CMakeLists.txt ++++ b/plugins/qca-botan/CMakeLists.txt +@@ -11,6 +11,10 @@ if(BOTAN_FOUND) + set(QCA_BOTAN_SOURCES qca-botan.cpp) + add_library(qca-botan ${PLUGIN_TYPE} ${QCA_BOTAN_SOURCES}) + ++ if(MSVC) ++ target_compile_definitions(qca-botan PRIVATE NOMINMAX) ++ endif() ++ + if(APPLE AND ${PLUGIN_TYPE} STREQUAL "MODULE") + set_property(TARGET qca-botan PROPERTY SUFFIX ".dylib") + endif() +-- +2.40.0.windows.1 + diff --git a/vcpkg/ports/qca/mk-ca-bundle.pl b/vcpkg/ports/qca/mk-ca-bundle.pl new file mode 100644 index 000000000000..9574f1dbf95b --- /dev/null +++ b/vcpkg/ports/qca/mk-ca-bundle.pl @@ -0,0 +1,554 @@ +#!/usr/bin/perl -w +# *************************************************************************** +# * _ _ ____ _ +# * Project ___| | | | _ \| | +# * / __| | | | |_) | | +# * | (__| |_| | _ <| |___ +# * \___|\___/|_| \_\_____| +# * +# * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. +# * +# * This software is licensed as described in the file COPYING, which +# * you should have received as part of this distribution. The terms +# * are also available at https://curl.haxx.se/docs/copyright.html. +# * +# * You may opt to use, copy, modify, merge, publish, distribute and/or sell +# * copies of the Software, and permit persons to whom the Software is +# * furnished to do so, under the terms of the COPYING file. +# * +# * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# * KIND, either express or implied. +# * +# *************************************************************************** +# This Perl script creates a fresh ca-bundle.crt file for use with libcurl. +# It downloads certdata.txt from Mozilla's source tree (see URL below), +# then parses certdata.txt and extracts CA Root Certificates into PEM format. +# These are then processed with the OpenSSL commandline tool to produce the +# final ca-bundle.crt file. +# The script is based on the parse-certs script written by Roland Krikava. +# This Perl script works on almost any platform since its only external +# dependency is the OpenSSL commandline tool for optional text listing. +# Hacked by Guenter Knauf. +# +use Encode; +use Getopt::Std; +use MIME::Base64; +use strict; +use vars qw($opt_b $opt_d $opt_f $opt_h $opt_i $opt_k $opt_l $opt_m $opt_n $opt_p $opt_q $opt_s $opt_t $opt_u $opt_v $opt_w); +use List::Util; +use Text::Wrap; +my $MOD_SHA = "Digest::SHA"; +eval "require $MOD_SHA"; +if ($@) { + $MOD_SHA = "Digest::SHA::PurePerl"; + eval "require $MOD_SHA"; +} +eval "require LWP::UserAgent"; + +my %urls = ( + 'nss' => + 'https://hg.mozilla.org/projects/nss/raw-file/tip/lib/ckfw/builtins/certdata.txt', + 'central' => + 'https://hg.mozilla.org/mozilla-central/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt', + 'aurora' => + 'https://hg.mozilla.org/releases/mozilla-aurora/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt', + 'beta' => + 'https://hg.mozilla.org/releases/mozilla-beta/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt', + 'release' => + 'https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt', +); + +$opt_d = 'release'; + +# If the OpenSSL commandline is not in search path you can configure it here! +my $openssl = 'openssl'; + +my $version = '1.27'; + +$opt_w = 76; # default base64 encoded lines length + +# default cert types to include in the output (default is to include CAs which may issue SSL server certs) +my $default_mozilla_trust_purposes = "SERVER_AUTH"; +my $default_mozilla_trust_levels = "TRUSTED_DELEGATOR"; +$opt_p = $default_mozilla_trust_purposes . ":" . $default_mozilla_trust_levels; + +my @valid_mozilla_trust_purposes = ( + "DIGITAL_SIGNATURE", + "NON_REPUDIATION", + "KEY_ENCIPHERMENT", + "DATA_ENCIPHERMENT", + "KEY_AGREEMENT", + "KEY_CERT_SIGN", + "CRL_SIGN", + "SERVER_AUTH", + "CLIENT_AUTH", + "CODE_SIGNING", + "EMAIL_PROTECTION", + "IPSEC_END_SYSTEM", + "IPSEC_TUNNEL", + "IPSEC_USER", + "TIME_STAMPING", + "STEP_UP_APPROVED" +); + +my @valid_mozilla_trust_levels = ( + "TRUSTED_DELEGATOR", # CAs + "NOT_TRUSTED", # Don't trust these certs. + "MUST_VERIFY_TRUST", # This explicitly tells us that it ISN'T a CA but is otherwise ok. In other words, this should tell the app to ignore any other sources that claim this is a CA. + "TRUSTED" # This cert is trusted, but only for itself and not for delegates (i.e. it is not a CA). +); + +my $default_signature_algorithms = $opt_s = "MD5"; + +my @valid_signature_algorithms = ( + "MD5", + "SHA1", + "SHA256", + "SHA384", + "SHA512" +); + +$0 =~ s@.*(/|\\)@@; +$Getopt::Std::STANDARD_HELP_VERSION = 1; +getopts('bd:fhiklmnp:qs:tuvw:'); + +if(!defined($opt_d)) { + # to make plain "-d" use not cause warnings, and actually still work + $opt_d = 'release'; +} + +# Use predefined URL or else custom URL specified on command line. +my $url; +if(defined($urls{$opt_d})) { + $url = $urls{$opt_d}; + if(!$opt_k && $url !~ /^https:\/\//i) { + die "The URL for '$opt_d' is not HTTPS. Use -k to override (insecure).\n"; + } +} +else { + $url = $opt_d; +} + +my $curl = `curl -V`; + +if ($opt_i) { + print ("=" x 78 . "\n"); + print "Script Version : $version\n"; + print "Perl Version : $]\n"; + print "Operating System Name : $^O\n"; + print "Getopt::Std.pm Version : ${Getopt::Std::VERSION}\n"; + print "MIME::Base64.pm Version : ${MIME::Base64::VERSION}\n"; + print "LWP::UserAgent.pm Version : ${LWP::UserAgent::VERSION}\n" if($LWP::UserAgent::VERSION); + print "LWP.pm Version : ${LWP::VERSION}\n" if($LWP::VERSION); + print "Digest::SHA.pm Version : ${Digest::SHA::VERSION}\n" if ($Digest::SHA::VERSION); + print "Digest::SHA::PurePerl.pm Version : ${Digest::SHA::PurePerl::VERSION}\n" if ($Digest::SHA::PurePerl::VERSION); + print ("=" x 78 . "\n"); +} + +sub warning_message() { + if ( $opt_d =~ m/^risk$/i ) { # Long Form Warning and Exit + print "Warning: Use of this script may pose some risk:\n"; + print "\n"; + print " 1) If you use HTTP URLs they are subject to a man in the middle attack\n"; + print " 2) Default to 'release', but more recent updates may be found in other trees\n"; + print " 3) certdata.txt file format may change, lag time to update this script\n"; + print " 4) Generally unwise to blindly trust CAs without manual review & verification\n"; + print " 5) Mozilla apps use additional security checks aren't represented in certdata\n"; + print " 6) Use of this script will make a security engineer grind his teeth and\n"; + print " swear at you. ;)\n"; + exit; + } else { # Short Form Warning + print "Warning: Use of this script may pose some risk, -d risk for more details.\n"; + } +} + +sub HELP_MESSAGE() { + print "Usage:\t${0} [-b] [-d] [-f] [-i] [-k] [-l] [-n] [-p] [-q] [-s] [-t] [-u] [-v] [-w] []\n"; + print "\t-b\tbackup an existing version of ca-bundle.crt\n"; + print "\t-d\tspecify Mozilla tree to pull certdata.txt or custom URL\n"; + print "\t\t Valid names are:\n"; + print "\t\t ", join( ", ", map { ( $_ =~ m/$opt_d/ ) ? "$_ (default)" : "$_" } sort keys %urls ), "\n"; + print "\t-f\tforce rebuild even if certdata.txt is current\n"; + print "\t-i\tprint version info about used modules\n"; + print "\t-k\tallow URLs other than HTTPS, enable HTTP fallback (insecure)\n"; + print "\t-l\tprint license info about certdata.txt\n"; + print "\t-m\tinclude meta data in output\n"; + print "\t-n\tno download of certdata.txt (to use existing)\n"; + print wrap("\t","\t\t", "-p\tlist of Mozilla trust purposes and levels for certificates to include in output. Takes the form of a comma separated list of purposes, a colon, and a comma separated list of levels. (default: $default_mozilla_trust_purposes:$default_mozilla_trust_levels)"), "\n"; + print "\t\t Valid purposes are:\n"; + print wrap("\t\t ","\t\t ", join( ", ", "ALL", @valid_mozilla_trust_purposes ) ), "\n"; + print "\t\t Valid levels are:\n"; + print wrap("\t\t ","\t\t ", join( ", ", "ALL", @valid_mozilla_trust_levels ) ), "\n"; + print "\t-q\tbe really quiet (no progress output at all)\n"; + print wrap("\t","\t\t", "-s\tcomma separated list of certificate signatures/hashes to output in plain text mode. (default: $default_signature_algorithms)\n"); + print "\t\t Valid signature algorithms are:\n"; + print wrap("\t\t ","\t\t ", join( ", ", "ALL", @valid_signature_algorithms ) ), "\n"; + print "\t-t\tinclude plain text listing of certificates\n"; + print "\t-u\tunlink (remove) certdata.txt after processing\n"; + print "\t-v\tbe verbose and print out processed CAs\n"; + print "\t-w \twrap base64 output lines after chars (default: ${opt_w})\n"; + exit; +} + +sub VERSION_MESSAGE() { + print "${0} version ${version} running Perl ${]} on ${^O}\n"; +} + +warning_message() unless ($opt_q || $url =~ m/^(ht|f)tps:/i ); +HELP_MESSAGE() if ($opt_h); + +sub report($@) { + my $output = shift; + + print STDERR $output . "\n" unless $opt_q; +} + +sub is_in_list($@) { + my $target = shift; + + return defined(List::Util::first { $target eq $_ } @_); +} + +# Parses $param_string as a case insensitive comma separated list with optional whitespace +# validates that only allowed parameters are supplied +sub parse_csv_param($$@) { + my $description = shift; + my $param_string = shift; + my @valid_values = @_; + + my @values = map { + s/^\s+//; # strip leading spaces + s/\s+$//; # strip trailing spaces + uc $_ # return the modified string as upper case + } split( ',', $param_string ); + + # Find all values which are not in the list of valid values or "ALL" + my @invalid = grep { !is_in_list($_,"ALL",@valid_values) } @values; + + if ( scalar(@invalid) > 0 ) { + # Tell the user which parameters were invalid and print the standard help message which will exit + print "Error: Invalid ", $description, scalar(@invalid) == 1 ? ": " : "s: ", join( ", ", map { "\"$_\"" } @invalid ), "\n"; + HELP_MESSAGE(); + } + + @values = @valid_values if ( is_in_list("ALL",@values) ); + + return @values; +} + +sub sha256 { + my $result; + if ($Digest::SHA::VERSION || $Digest::SHA::PurePerl::VERSION) { + open(FILE, $_[0]) or die "Can't open '$_[0]': $!"; + binmode(FILE); + $result = $MOD_SHA->new(256)->addfile(*FILE)->hexdigest; + close(FILE); + } else { + # Use OpenSSL command if Perl Digest::SHA modules not available + $result = `"$openssl" dgst -r -sha256 "$_[0]"`; + $result =~ s/^([0-9a-f]{64}) .+/$1/is; + } + return $result; +} + + +sub oldhash { + my $hash = ""; + open(C, "<$_[0]") || return 0; + while() { + chomp; + if($_ =~ /^\#\# SHA256: (.*)/) { + $hash = $1; + last; + } + } + close(C); + return $hash; +} + +if ( $opt_p !~ m/:/ ) { + print "Error: Mozilla trust identifier list must include both purposes and levels\n"; + HELP_MESSAGE(); +} + +(my $included_mozilla_trust_purposes_string, my $included_mozilla_trust_levels_string) = split( ':', $opt_p ); +my @included_mozilla_trust_purposes = parse_csv_param( "trust purpose", $included_mozilla_trust_purposes_string, @valid_mozilla_trust_purposes ); +my @included_mozilla_trust_levels = parse_csv_param( "trust level", $included_mozilla_trust_levels_string, @valid_mozilla_trust_levels ); + +my @included_signature_algorithms = parse_csv_param( "signature algorithm", $opt_s, @valid_signature_algorithms ); + +sub should_output_cert(%) { + my %trust_purposes_by_level = @_; + + foreach my $level (@included_mozilla_trust_levels) { + # for each level we want to output, see if any of our desired purposes are included + return 1 if ( defined( List::Util::first { is_in_list( $_, @included_mozilla_trust_purposes ) } @{$trust_purposes_by_level{$level}} ) ); + } + + return 0; +} + +my $crt = $ARGV[0] || 'ca-bundle.crt'; +(my $txt = $url) =~ s@(.*/|\?.*)@@g; + +my $stdout = $crt eq '-'; +my $resp; +my $fetched; + +my $oldhash = oldhash($crt); + +report "SHA256 of old file: $oldhash"; + +if(!$opt_n) { + report "Downloading $txt ..."; + + # If we have an HTTPS URL then use curl + if($url =~ /^https:\/\//i) { + if($curl) { + if($curl =~ /^Protocols:.* https( |$)/m) { + report "Get certdata with curl!"; + my $proto = !$opt_k ? "--proto =https" : ""; + my $quiet = $opt_q ? "-s" : ""; + my @out = `curl -w %{response_code} $proto $quiet -o "$txt" "$url"`; + if(@out && $out[0] == 200) { + $fetched = 1; + report "Downloaded $txt"; + } + else { + report "Failed downloading via HTTPS with curl"; + if(-e $txt && !unlink($txt)) { + report "Failed to remove '$txt': $!"; + } + } + } + else { + report "curl lacks https support"; + } + } + else { + report "curl not found"; + } + } + + # If nothing was fetched then use LWP + if(!$fetched) { + if($url =~ /^https:\/\//i) { + report "Falling back to HTTP"; + $url =~ s/^https:\/\//http:\/\//i; + } + if(!$opt_k) { + report "URLs other than HTTPS are disabled by default, to enable use -k"; + exit 1; + } + report "Get certdata with LWP!"; + if(!defined(${LWP::UserAgent::VERSION})) { + report "LWP is not available (LWP::UserAgent not found)"; + exit 1; + } + my $ua = new LWP::UserAgent(agent => "$0/$version"); + $ua->env_proxy(); + $resp = $ua->mirror($url, $txt); + if($resp && $resp->code eq '304') { + report "Not modified"; + exit 0 if -e $crt && !$opt_f; + } + else { + $fetched = 1; + report "Downloaded $txt"; + } + if(!$resp || $resp->code !~ /^(?:200|304)$/) { + report "Unable to download latest data: " + . ($resp? $resp->code . ' - ' . $resp->message : "LWP failed"); + exit 1 if -e $crt || ! -r $txt; + } + } +} + +my $filedate = $resp ? $resp->last_modified : (stat($txt))[9]; +my $datesrc = "as of"; +if(!$filedate) { + # mxr.mozilla.org gave us a time, hg.mozilla.org does not! + $filedate = time(); + $datesrc="downloaded on"; +} + +# get the hash from the download file +my $newhash= sha256($txt); + +if(!$opt_f && $oldhash eq $newhash) { + report "Downloaded file identical to previous run\'s source file. Exiting"; + exit; +} + +report "SHA256 of new file: $newhash"; + +my $currentdate = scalar gmtime($filedate); + +my $format = $opt_t ? "plain text and " : ""; +if( $stdout ) { + open(CRT, '> -') or die "Couldn't open STDOUT: $!\n"; +} else { + open(CRT,">$crt.~") or die "Couldn't open $crt.~: $!\n"; +} +print CRT <) { + if (/\*\*\*\*\* BEGIN LICENSE BLOCK \*\*\*\*\*/) { + print CRT; + print if ($opt_l); + while () { + print CRT; + print if ($opt_l); + last if (/\*\*\*\*\* END LICENSE BLOCK \*\*\*\*\*/); + } + } + elsif(/^# (Issuer|Serial Number|Subject|Not Valid Before|Not Valid After |Fingerprint \(MD5\)|Fingerprint \(SHA1\)):/) { + push @precert, $_; + next; + } + elsif(/^#|^\s*$/) { + undef @precert; + next; + } + chomp; + + # this is a match for the start of a certificate + if (/^CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE/) { + $start_of_cert = 1 + } + if ($start_of_cert && /^CKA_LABEL UTF8 \"(.*)\"/) { + $caname = $1; + } + my %trust_purposes_by_level; + if ($start_of_cert && /^CKA_VALUE MULTILINE_OCTAL/) { + my $data; + while () { + last if (/^END/); + chomp; + my @octets = split(/\\/); + shift @octets; + for (@octets) { + $data .= chr(oct); + } + } + # scan forwards until the trust part + while () { + last if (/^CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST/); + chomp; + } + # now scan the trust part to determine how we should trust this cert + while () { + last if (/^#/); + if (/^CKA_TRUST_([A-Z_]+)\s+CK_TRUST\s+CKT_NSS_([A-Z_]+)\s*$/) { + if ( !is_in_list($1,@valid_mozilla_trust_purposes) ) { + report "Warning: Unrecognized trust purpose for cert: $caname. Trust purpose: $1. Trust Level: $2"; + } elsif ( !is_in_list($2,@valid_mozilla_trust_levels) ) { + report "Warning: Unrecognized trust level for cert: $caname. Trust purpose: $1. Trust Level: $2"; + } else { + push @{$trust_purposes_by_level{$2}}, $1; + } + } + } + + if ( !should_output_cert(%trust_purposes_by_level) ) { + $skipnum ++; + } else { + my $encoded = MIME::Base64::encode_base64($data, ''); + $encoded =~ s/(.{1,${opt_w}})/$1\n/g; + my $pem = "-----BEGIN CERTIFICATE-----\n" + . $encoded + . "-----END CERTIFICATE-----\n"; + print CRT "\n$caname\n"; + print CRT @precert if($opt_m); + my $maxStringLength = length(decode('UTF-8', $caname, Encode::FB_CROAK)); + if ($opt_t) { + foreach my $key (keys %trust_purposes_by_level) { + my $string = $key . ": " . join(", ", @{$trust_purposes_by_level{$key}}); + $maxStringLength = List::Util::max( length($string), $maxStringLength ); + print CRT $string . "\n"; + } + } + print CRT ("=" x $maxStringLength . "\n"); + if (!$opt_t) { + print CRT $pem; + } else { + my $pipe = ""; + foreach my $hash (@included_signature_algorithms) { + $pipe = "|$openssl x509 -" . $hash . " -fingerprint -noout -inform PEM"; + if (!$stdout) { + $pipe .= " >> $crt.~"; + close(CRT) or die "Couldn't close $crt.~: $!"; + } + open(TMP, $pipe) or die "Couldn't open openssl pipe: $!"; + print TMP $pem; + close(TMP) or die "Couldn't close openssl pipe: $!"; + if (!$stdout) { + open(CRT, ">>$crt.~") or die "Couldn't open $crt.~: $!"; + } + } + $pipe = "|$openssl x509 -text -inform PEM"; + if (!$stdout) { + $pipe .= " >> $crt.~"; + close(CRT) or die "Couldn't close $crt.~: $!"; + } + open(TMP, $pipe) or die "Couldn't open openssl pipe: $!"; + print TMP $pem; + close(TMP) or die "Couldn't close openssl pipe: $!"; + if (!$stdout) { + open(CRT, ">>$crt.~") or die "Couldn't open $crt.~: $!"; + } + } + report "Parsing: $caname" if ($opt_v); + $certnum ++; + $start_of_cert = 0; + } + undef @precert; + } + +} +close(TXT) or die "Couldn't close $txt: $!\n"; +close(CRT) or die "Couldn't close $crt.~: $!\n"; +unless( $stdout ) { + if ($opt_b && -e $crt) { + my $bk = 1; + while (-e "$crt.~${bk}~") { + $bk++; + } + rename $crt, "$crt.~${bk}~" or die "Failed to create backup $crt.~$bk}~: $!\n"; + } elsif( -e $crt ) { + unlink( $crt ) or die "Failed to remove $crt: $!\n"; + } + rename "$crt.~", $crt or die "Failed to rename $crt.~ to $crt: $!\n"; +} +if($opt_u && -e $txt && !unlink($txt)) { + report "Failed to remove $txt: $!\n"; +} +report "Done ($certnum CA certs processed, $skipnum skipped)."; diff --git a/vcpkg/ports/qca/portfile.cmake b/vcpkg/ports/qca/portfile.cmake new file mode 100644 index 000000000000..c43a59bbce7f --- /dev/null +++ b/vcpkg/ports/qca/portfile.cmake @@ -0,0 +1,102 @@ +# This portfile adds the Qt Cryptographic Arcitecture +# Changes to the original build: +# No -qt5 suffix, which is recommended just for Linux +# Output directories according to vcpkg +# Updated certstore. See certstore.pem in the output dirs +# +vcpkg_find_acquire_program(PERL) +get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY) +vcpkg_add_to_path("${PERL_EXE_PATH}") + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO KDE/qca + REF "v${VERSION}" + SHA512 de06173aaea32aac19a24510b5dbb4bb79681217eb1e4256de36db9f7158ad485fa450ffba5e13c12a0425866923b54f9b4d6164d0eaf659fdf40e458f5ee017 + PATCHES + 0001-fix-path-for-vcpkg.patch + 0002-fix-build-error.patch + 0003-Define-NOMINMAX-for-botan-plugin-with-MSVC.patch +) + +vcpkg_find_acquire_program(PKGCONFIG) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + set(QCA_FEATURE_INSTALL_DIR_DEBUG ${CURRENT_PACKAGES_DIR}/debug/bin/Qca) + set(QCA_FEATURE_INSTALL_DIR_RELEASE ${CURRENT_PACKAGES_DIR}/bin/Qca) +else() + set(QCA_FEATURE_INSTALL_DIR_DEBUG ${CURRENT_PACKAGES_DIR}/debug/lib/Qca) + set(QCA_FEATURE_INSTALL_DIR_RELEASE ${CURRENT_PACKAGES_DIR}/lib/Qca) +endif() + +# According to: +# https://www.openssl.org/docs/faq.html#USER16 +# it is up to developers or admins to maintain CAs. +# So we do it here: +message(STATUS "Importing certstore") +file(REMOVE "${SOURCE_PATH}/certs/rootcerts.pem") + +# Using file(DOWNLOAD) to use https +file(DOWNLOAD https://raw.githubusercontent.com/mozilla/gecko-dev/master/security/nss/lib/ckfw/builtins/certdata.txt + "${CURRENT_BUILDTREES_DIR}/cert/certdata.txt" + TLS_VERIFY ON +) +vcpkg_execute_required_process( + COMMAND "${PERL}" "${CMAKE_CURRENT_LIST_DIR}/mk-ca-bundle.pl" -n "${SOURCE_PATH}/certs/rootcerts.pem" + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/cert" + LOGNAME ca-bundle +) +message(STATUS "Importing certstore done") + +set(PLUGINS logger softstore wincrypto) +if("botan" IN_LIST FEATURES) + list(APPEND PLUGINS botan) +endif() +if ("gnupg" IN_LIST FEATURES) + list(APPEND PLUGINS gnupg) +endif() +if ("ossl" IN_LIST FEATURES) + list(APPEND PLUGINS ossl) +endif() + +# Configure and build +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DUSE_RELATIVE_PATHS=ON + "-DBUILD_PLUGINS=${PLUGINS}" + -DBUILD_TESTS=OFF + -DBUILD_TOOLS=OFF + -DBUILD_WITH_QT6=ON + -DQCA_SUFFIX=OFF + -DQCA_FEATURE_INSTALL_DIR=share/qca/mkspecs/features + -DOSX_FRAMEWORK=OFF + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" + OPTIONS_DEBUG + -DQCA_PLUGINS_INSTALL_DIR=${QCA_FEATURE_INSTALL_DIR_DEBUG} + OPTIONS_RELEASE + -DQCA_PLUGINS_INSTALL_DIR=${QCA_FEATURE_INSTALL_DIR_RELEASE} +) + +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup(CONFIG_PATH share/qca/cmake) +file(READ "${CURRENT_PACKAGES_DIR}/share/${PORT}/QcaConfig.cmake" QCA_CONFIG_FILE) +string(REGEX REPLACE "PACKAGE_PREFIX_DIR \"(.*)\" ABSOLUTE" + [[PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../" ABSOLUTE]] + QCA_CONFIG_FILE "${QCA_CONFIG_FILE}" +) +file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/QcaConfig.cmake" "${QCA_CONFIG_FILE}") + +# Remove unneeded dirs +file(REMOVE_RECURSE + "${CURRENT_BUILDTREES_DIR}/share/man" + "${CURRENT_PACKAGES_DIR}/share/man" + "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/share" +) + +vcpkg_fixup_pkgconfig() + +# Handle copyright +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING") diff --git a/vcpkg/ports/qca/vcpkg.json b/vcpkg/ports/qca/vcpkg.json new file mode 100644 index 000000000000..95bf6379c217 --- /dev/null +++ b/vcpkg/ports/qca/vcpkg.json @@ -0,0 +1,44 @@ +{ + "name": "qca", + "version": "2.3.7", + "description": "Qt Cryptographic Architecture (QCA).", + "homepage": "https://userbase.kde.org/QCA", + "dependencies": [ + { + "name": "qt5compat", + "default-features": false + }, + { + "name": "qtbase", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "default-features": [ + "botan" + ], + "features": { + "botan": { + "description": "Build with botan", + "dependencies": [ + "botan" + ] + }, + "gnupg": { + "description": "Build with gnupg" + }, + "ossl": { + "description": "Build with openssl", + "dependencies": [ + "openssl" + ] + } + } +}