vcpkg/ports/libarchive/portfile.cmake
2017-07-12 18:26:28 +02:00

50 lines
1.7 KiB
CMake

# 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)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO libarchive/libarchive
REF v3.3.2
SHA512 7bc17d6f742080278e35f86b0233d70045df0ca1578cd427126e0acce183709bf33ecca689db65e2e67bdfaf687c04d36cae1202a926beeebc88076648aa40bc
HEAD_REF master)
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES
${CMAKE_CURRENT_LIST_DIR}/fix-buildsystem.patch
${CMAKE_CURRENT_LIST_DIR}/fix-dependencies.patch)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DENABLE_LZO=OFF
-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
-DPOSIX_REGEX_LIB=NONE)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
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()
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)