vcpkg/ports/libarchive/portfile.cmake

51 lines
1.9 KiB
CMake
Raw Normal View History

2017-01-06 04:22:32 +08:00
# libarchive uses winapi functions not available in WindowsStore
if (VCPKG_CMAKE_SYSTEM_NAME STREQUAL WindowsStore)
message(FATAL_ERROR "Error: UWP builds are not supported.")
endif()
include(vcpkg_common_functions)
2017-04-05 22:06:42 +08:00
set(ARCHIVE_VERSION 3.3.1)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libarchive-${ARCHIVE_VERSION})
2017-01-06 04:22:32 +08:00
vcpkg_download_distfile(ARCHIVE
2017-04-05 22:06:42 +08:00
URLS "https://github.com/libarchive/libarchive/archive/v${ARCHIVE_VERSION}.zip"
FILENAME "libarchive-${ARCHIVE_VERSION}.zip"
SHA512 a54fe3c5c24c83df244f3f2346212a6aa8d8945cf4ddc407e54c891ebbf8c98b93492e5652c9813a6d5dc654a32479e08a40bb0d2af7400a29ac027028e986f5)
2017-01-06 04:22:32 +08:00
vcpkg_extract_source_archive(${ARCHIVE})
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES
2017-05-11 00:20:37 +08:00
${CMAKE_CURRENT_LIST_DIR}/fix-buildsystem.patch
${CMAKE_CURRENT_LIST_DIR}/fix-dependencies.patch)
2017-01-06 04:22:32 +08:00
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
2017-04-05 22:06:42 +08:00
PREFER_NINJA
2017-01-06 04:22:32 +08:00
OPTIONS
2017-04-05 22:06:42 +08:00
-DENABLE_LZO=OFF
2017-01-06 04:22:32 +08:00
-DENABLE_NETTLE=OFF
-DENABLE_EXPAT=OFF
-DENABLE_LibGCC=OFF
-DENABLE_CNG=OFF
-DENABLE_TAR=OFF
-DENABLE_CPIO=OFF
-DENABLE_CAT=OFF
-DENABLE_XATTR=OFF
-DENABLE_ACL=OFF
-DENABLE_TEST=OFF
-DENABLE_ICONV=OFF
2017-04-05 22:06:42 +08:00
-DPOSIX_REGEX_LIB=NONE)
2017-01-06 04:22:32 +08:00
vcpkg_install_cmake()
vcpkg_copy_pdbs()
2017-04-05 22:06:42 +08:00
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
foreach(HEADER ${CURRENT_PACKAGES_DIR}/include/archive.h ${CURRENT_PACKAGES_DIR}/include/archive_entry.h)
file(READ ${HEADER} CONTENTS)
string(REPLACE "(!defined LIBARCHIVE_STATIC)" "0" CONTENTS "${CONTENTS}")
file(WRITE ${HEADER} "${CONTENTS}")
endforeach()
2017-01-06 04:22:32 +08:00
file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libarchive)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/libarchive/COPYING ${CURRENT_PACKAGES_DIR}/share/libarchive/copyright)