vcpkg/ports/qca/portfile.cmake

92 lines
3.1 KiB
CMake
Raw Normal View History

2016-12-01 20:43:36 +08:00
# This portfile adds the Qt Cryptographic Arcitecture
# Changes to the original build:
2016-12-01 20:43:36 +08:00
# No -qt5 suffix, which is recommended just for Linux
# Output directories according to vcpkg
# Updated certstore. See certstore.pem in the output dirs
2016-11-25 18:40:29 +08:00
#
vcpkg_find_acquire_program(PERL)
get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY)
vcpkg_add_to_path("${PERL_EXE_PATH}")
2016-11-25 18:40:29 +08:00
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO KDE/qca
2021-12-07 12:51:41 +08:00
REF v2.3.4
SHA512 04583da17531538fc2a7ae18a1a4f89f1e8d303e2bb390520a8f55a20bab17f8407ab07aefef2a75587e2a0521f41b37a9fdd8430ec483daf5d02c05556b8ddb
PATCHES
0001-fix-path-for-vcpkg.patch
0002-fix-build-error.patch
2016-11-25 18:40:29 +08:00
)
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:
2016-12-01 20:43:36 +08:00
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
2016-12-01 20:43:36 +08:00
)
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
)
2016-12-01 20:43:36 +08:00
message(STATUS "Importing certstore done")
2022-01-05 07:02:13 +08:00
if("botan" IN_LIST FEATURES)
2022-07-07 04:49:49 +08:00
list(APPEND QCA_OPTIONS -DWITH_botan_PLUGIN=yes)
2022-01-05 07:02:13 +08:00
else()
2022-07-07 04:49:49 +08:00
list(APPEND QCA_OPTIONS -DWITH_botan_PLUGIN=no)
2022-01-05 07:02:13 +08:00
endif()
# Configure and build
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
2016-11-25 18:40:29 +08:00
OPTIONS
-DUSE_RELATIVE_PATHS=ON
-DBUILD_TESTS=OFF
2016-12-01 20:43:36 +08:00
-DBUILD_TOOLS=OFF
2016-11-30 17:10:01 +08:00
-DQCA_SUFFIX=OFF
-DQCA_FEATURE_INSTALL_DIR=share/qca/mkspecs/features
-DOSX_FRAMEWORK=OFF
2022-01-05 07:02:13 +08:00
${QCA_OPTIONS}
2016-11-25 18:40:29 +08:00
OPTIONS_DEBUG
-DQCA_PLUGINS_INSTALL_DIR=${QCA_FEATURE_INSTALL_DIR_DEBUG}
2016-11-25 18:40:29 +08:00
OPTIONS_RELEASE
-DQCA_PLUGINS_INSTALL_DIR=${QCA_FEATURE_INSTALL_DIR_RELEASE}
2016-11-25 18:40:29 +08:00
)
vcpkg_cmake_install()
2016-11-25 18:40:29 +08:00
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}")
2016-11-25 18:40:29 +08:00
# 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"
2016-11-25 18:40:29 +08:00
)
2021-12-21 00:26:20 +08:00
vcpkg_fixup_pkgconfig()
2016-11-25 18:40:29 +08:00
# Handle copyright
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)