vcpkg/ports/libcap/portfile.cmake

86 lines
2.8 KiB
CMake
Raw Normal View History

[libsystemd] add new port (#31150) * add libsystemd, libcap, libxcrypt * baseline libsystemd, libcap, libxcrypt * versions tree libsystemd, libcap, libxcrypt * licenses for libsystemd, libcap, libxcrypt in vcpkg.json * update tree for libsystemd, libcap, libxcrypt * allow restricted header libxcrypt * tree allow restricted header libxcrypt * remove message Warning * use targets exist during configure, instead of configure_file variable to search for zstd * update git-tree * add quotes to full paths and remove messages in portfiles * update git-tree * remove extra spaces * update git-tree * remove extra line * update git tree * do configure hack differently and remove cross compile patch and override compiler during build_make * update git tree * try either gcc or clang for libcap and specify log file root for each build command * update git-tree * libcap use host dependency of self * libcap update git tree * libsystemd is LGPL2.1 * update libsystemd git-tree * change from find_package to find_dependency in unofficial cmake export of libsystemd * update libsystemd git-tree * update libxcrypt * update git tree libxcrypt * patch pkgconfig file of libsystemd * update libsystemd git-tree * update libsystemd to 254 * update git-tree libsystemd * * Copy of cap_names.h checked in for cross compilation * Decouple cap_names.h from libcap.* make targets * Use vcpkg_cmake_get_vars instead of ENV{CC} etc. * Remove unnecessary self dependency of libcap * Update libcap to 1.2.69 * Update git-tree * cleanup old versions from version jsons
2023-09-20 16:56:16 +00:00
vcpkg_from_git(
OUT_SOURCE_PATH SOURCE_PATH
URL git://git.kernel.org/pub/scm/libs/libcap/libcap.git
FETCH_REF "libcap-${VERSION}"
REF 3c7dda330bd9a154bb5b878d31fd591e4951fe17
PATCHES
cap_names.separation.patch
)
# Note: if libcap version is updated, the according cap_names.h should be updated if necessary.
# SKIP_CONFIGURE is broken https://github.com/microsoft/vcpkg/issues/14389
# so we use patch to create empty configure executable
file(COPY "${CMAKE_CURRENT_LIST_DIR}/configure" DESTINATION "${SOURCE_PATH}")
# This needs to be called before configure
vcpkg_cmake_get_vars(cmake_vars_file)
if(VCPKG_CROSSCOMPILING)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/cap_names.h" DESTINATION "${SOURCE_PATH}/libcap/")
endif ()
vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
COPY_SOURCE
)
include("${cmake_vars_file}")
list(APPEND libcap_OPTIONS "prefix=${CURRENT_INSTALLED_DIR}" "CC=${VCPKG_DETECTED_CMAKE_C_COMPILER}" "AR=${VCPKG_DETECTED_CMAKE_AR}" "RANLIB=${VCPKG_DETECTED_CMAKE_RANLIB}")
if (NOT VCPKG_CROSSCOMPILING)
# patch decouples cap_names.h target from libcap.* for cross compile compatibility,
# so for host=target build we manually make it
vcpkg_build_make(SUBPATH libcap
BUILD_TARGET cap_names.h
LOGFILE_ROOT "configure"
OPTIONS
${libcap_OPTIONS}
)
endif ()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
vcpkg_build_make(SUBPATH libcap
BUILD_TARGET libcap.a
LOGFILE_ROOT "build"
OPTIONS
${libcap_OPTIONS}
)
else()
vcpkg_build_make(SUBPATH libcap
BUILD_TARGET libcap.so
LOGFILE_ROOT "build"
OPTIONS
${libcap_OPTIONS}
)
endif()
vcpkg_build_make(SUBPATH libcap
BUILD_TARGET libcap.pc
LOGFILE_ROOT "pkgconfig"
OPTIONS
${libcap_OPTIONS}
)
file(INSTALL "${SOURCE_PATH}/libcap/include/" DESTINATION "${CURRENT_PACKAGES_DIR}/include" FILES_MATCHING PATTERN "*.h")
set(BUILD_DIR_RELEASE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(INSTALL "${BUILD_DIR_RELEASE}/libcap/libcap.a" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
else()
file(INSTALL "${BUILD_DIR_RELEASE}/libcap/libcap.so" DESTINATION "${CURRENT_PACKAGES_DIR}/lib" FOLLOW_SYMLINK_CHAIN)
endif()
set(BUILD_DIR_DEBUG "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(INSTALL "${BUILD_DIR_DEBUG}/libcap/libcap.a" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
else()
file(INSTALL "${BUILD_DIR_DEBUG}/libcap/libcap.so" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib" FOLLOW_SYMLINK_CHAIN)
endif()
file(INSTALL "${BUILD_DIR_RELEASE}/libcap/libcap.pc" DESTINATION "${CURRENT_PACKAGES_DIR}/lib/pkgconfig")
file(INSTALL "${BUILD_DIR_DEBUG}/libcap/libcap.pc" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/License")
vcpkg_fixup_pkgconfig()