vcpkg/ports/qca/portfile.cmake

97 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
#
include(vcpkg_common_functions)
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
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
if(EXISTS "${CURRENT_BUILDTREES_DIR}/src/.git")
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/src)
2016-11-25 18:40:29 +08:00
endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO KDE/qca
REF 19ec49f89a0a560590ec733c549b92e199792837
SHA512 6a83ee6715a9a922f4fde5af571e2aad043ac5cbd522f57365038dd31879b44eb57a099ff797793d7ee19e320e0a151e5beacdff3bed525d39ea0b8e46efca9a
PATCHES 0001-fix-path-for-vcpkg.patch
2016-11-25 18:40:29 +08:00
)
# 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")
# Configure and build
2016-11-25 18:40:29 +08:00
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
2016-11-25 18:40:29 +08:00
OPTIONS
-DUSE_RELATIVE_PATHS=ON
-DQT4_BUILD=OFF
-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=${CURRENT_PACKAGES_DIR}/share/qca/mkspecs/features
2016-11-25 18:40:29 +08:00
OPTIONS_DEBUG
2016-11-30 17:10:01 +08:00
-DQCA_PLUGINS_INSTALL_DIR=${CURRENT_PACKAGES_DIR}/debug/bin/Qca
2016-11-25 18:40:29 +08:00
OPTIONS_RELEASE
2016-11-30 17:10:01 +08:00
-DQCA_PLUGINS_INSTALL_DIR=${CURRENT_PACKAGES_DIR}/bin/Qca
2016-11-25 18:40:29 +08:00
)
vcpkg_install_cmake()
# Patch and copy cmake files
2016-11-25 18:40:29 +08:00
message(STATUS "Patching files")
file(READ
${CURRENT_PACKAGES_DIR}/debug/share/qca/cmake/QcaTargets-debug.cmake
QCA_DEBUG_CONFIG
2016-11-25 18:40:29 +08:00
)
string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" QCA_DEBUG_CONFIG "${QCA_DEBUG_CONFIG}")
file(WRITE
${CURRENT_PACKAGES_DIR}/share/qca/cmake/QcaTargets-debug.cmake
"${QCA_DEBUG_CONFIG}"
)
2016-11-25 18:40:29 +08:00
file(READ ${CURRENT_PACKAGES_DIR}/share/qca/cmake/QcaTargets.cmake
QCA_TARGET_CONFIG
)
2016-11-25 18:40:29 +08:00
string(REPLACE "packages/qca_" "installed/" QCA_TARGET_CONFIG "${QCA_TARGET_CONFIG}")
file(WRITE ${CURRENT_PACKAGES_DIR}/share/qca/cmake/QcaTargets.cmake
"${QCA_TARGET_CONFIG}"
)
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
)
message(STATUS "Patching files done")
# Handle copyright
file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/qca)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/qca/COPYING ${CURRENT_PACKAGES_DIR}/share/qca/copyright)