2017-01-02 08:31:42 +08:00
|
|
|
include(vcpkg_common_functions)
|
2020-07-25 02:39:21 +08:00
|
|
|
set(BZIP2_VERSION 1.0.6) # TODO: Update to 1.0.8
|
|
|
|
vcpkg_download_distfile(ARCHIVE # TODO: switch to vcpkg_from_git with https://sourceware.org/git/?p=bzip2.git;a=summary
|
2018-11-09 15:46:54 +08:00
|
|
|
URLS "https://github.com/past-due/bzip2-mirror/releases/download/v${BZIP2_VERSION}/bzip2-${BZIP2_VERSION}.tar.gz"
|
|
|
|
FILENAME "bzip2-${BZIP2_VERSION}.tar.gz"
|
2017-01-02 08:31:42 +08:00
|
|
|
SHA512 00ace5438cfa0c577e5f578d8a808613187eff5217c35164ffe044fbafdfec9e98f4192c02a7d67e01e5a5ccced630583ad1003c37697219b0f147343a3fdd12)
|
|
|
|
|
2018-11-09 15:46:54 +08:00
|
|
|
vcpkg_extract_source_archive_ex(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
ARCHIVE ${ARCHIVE}
|
|
|
|
REF ${BZIP2_VERSION}
|
|
|
|
PATCHES
|
|
|
|
fix-import-export-macros.patch
|
2020-02-12 09:30:03 +08:00
|
|
|
fix-windows-include.patch
|
2018-11-09 15:46:54 +08:00
|
|
|
)
|
2017-01-02 08:31:42 +08:00
|
|
|
|
2020-07-25 02:39:21 +08:00
|
|
|
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
|
2017-01-02 08:31:42 +08:00
|
|
|
|
|
|
|
vcpkg_configure_cmake(
|
|
|
|
SOURCE_PATH ${SOURCE_PATH}
|
2017-05-11 00:18:37 +08:00
|
|
|
PREFER_NINJA
|
2017-01-02 08:31:42 +08:00
|
|
|
OPTIONS_DEBUG
|
|
|
|
-DBZIP2_SKIP_HEADERS=ON
|
2018-11-09 15:46:54 +08:00
|
|
|
-DBZIP2_SKIP_TOOLS=ON
|
|
|
|
)
|
2017-01-02 08:31:42 +08:00
|
|
|
|
|
|
|
vcpkg_install_cmake()
|
|
|
|
vcpkg_copy_pdbs()
|
|
|
|
|
2020-07-25 02:39:21 +08:00
|
|
|
file(READ "${CURRENT_PACKAGES_DIR}/include/bzlib.h" BZLIB_H)
|
2017-05-11 00:18:37 +08:00
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
|
|
|
string(REPLACE "defined(BZ_IMPORT)" "0" BZLIB_H "${BZLIB_H}")
|
|
|
|
else()
|
|
|
|
string(REPLACE "defined(BZ_IMPORT)" "1" BZLIB_H "${BZLIB_H}")
|
2017-01-02 08:31:42 +08:00
|
|
|
endif()
|
2020-07-25 02:39:21 +08:00
|
|
|
file(WRITE "${CURRENT_PACKAGES_DIR}/include/bzlib.h" "${BZLIB_H}")
|
2017-05-11 00:18:37 +08:00
|
|
|
|
2020-07-25 02:39:21 +08:00
|
|
|
file(COPY "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/bzip2")
|
|
|
|
file(RENAME "${CURRENT_PACKAGES_DIR}/share/bzip2/LICENSE" "${CURRENT_PACKAGES_DIR}/share/bzip2/copyright")
|
2017-11-17 15:54:55 +08:00
|
|
|
|
2020-07-25 02:39:21 +08:00
|
|
|
file(COPY "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
2018-08-31 08:07:14 +08:00
|
|
|
|
|
|
|
vcpkg_test_cmake(PACKAGE_NAME BZip2 MODULE)
|
2020-07-25 02:39:21 +08:00
|
|
|
|
|
|
|
set(BZIP2_PREFIX "${CURRENT_INSTALLED_DIR}")
|
|
|
|
set(bzname bz2)
|
|
|
|
configure_file("${CMAKE_CURRENT_LIST_DIR}/bzip2.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/bzip2.pc" @ONLY)
|
|
|
|
set(BZIP2_PREFIX "${CURRENT_INSTALLED_DIR}/debug")
|
|
|
|
set(bzname bz2d)
|
|
|
|
configure_file("${CMAKE_CURRENT_LIST_DIR}/bzip2.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/bzip2.pc" @ONLY)
|
|
|
|
vcpkg_fixup_pkgconfig()
|