[bzip2] add debug suffix

This commit is contained in:
codicodi 2017-05-10 18:18:37 +02:00
parent add9255538
commit 43888ff91e
4 changed files with 13 additions and 21 deletions

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.0)
project(bzip2)
project(bzip2 C)
if(CMAKE_BUILD_TYPE STREQUAL Debug)
add_definitions(-DBZ_DEBUG) # enable extra assertions
@ -15,7 +15,9 @@ set(LIBBZ2_SOURCES
bzlib.c)
add_library(libbz2 ${LIBBZ2_SOURCES})
set_target_properties(libbz2 PROPERTIES ARCHIVE_OUTPUT_NAME bz2) # reqiured for FindBzip2 to work
set_target_properties(libbz2 PROPERTIES
ARCHIVE_OUTPUT_NAME bz2 # reqiured for FindBzip2 to work
DEBUG_POSTFIX d)
if(BUILD_SHARED_LIBS)
target_compile_definitions(libbz2 PRIVATE -DBZ_BUILD_DLL)
endif()

View File

@ -1,3 +1,3 @@
Source: bzip2
Version: 1.0.6
Version: 1.0.6-1
Description: High-quality data compressor.

View File

@ -1,13 +0,0 @@
diff --git a/bzlib.h b/bzlib.h
index e3ba1d6..d3bed44 100644
--- a/bzlib.h
+++ b/bzlib.h
@@ -26,6 +26,8 @@
extern "C" {
#endif
+#define BZ_IMPORT
+
#define BZ_RUN 0
#define BZ_FLUSH 1
#define BZ_FINISH 2

View File

@ -17,6 +17,7 @@ vcpkg_apply_patches(
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS_DEBUG
-DBZIP2_SKIP_HEADERS=ON
-DBZIP2_SKIP_TOOLS=ON)
@ -24,12 +25,14 @@ vcpkg_configure_cmake(
vcpkg_install_cmake()
vcpkg_copy_pdbs()
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
vcpkg_apply_patches(
SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include
PATCHES
${CMAKE_CURRENT_LIST_DIR}/auto-define-import-macro.patch)
file(READ ${CURRENT_PACKAGES_DIR}/include/bzlib.h BZLIB_H)
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}")
endif()
file(WRITE ${CURRENT_PACKAGES_DIR}/include/bzlib.h "${BZLIB_H}")
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)