mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-30 20:59:12 +08:00
add bzip2
This commit is contained in:
parent
31daeeb7f5
commit
044c07ece1
36
ports/bzip2/CMakeLists.txt
Normal file
36
ports/bzip2/CMakeLists.txt
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.0)
|
||||||
|
project(bzip2)
|
||||||
|
|
||||||
|
if(CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||||
|
add_definitions(-DBZ_DEBUG) # enable extra assertions
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(LIBBZ2_SOURCES
|
||||||
|
blocksort.c
|
||||||
|
huffman.c
|
||||||
|
crctable.c
|
||||||
|
randtable.c
|
||||||
|
compress.c
|
||||||
|
decompress.c
|
||||||
|
bzlib.c)
|
||||||
|
|
||||||
|
add_library(libbz2 ${LIBBZ2_SOURCES})
|
||||||
|
set_target_properties(libbz2 PROPERTIES ARCHIVE_OUTPUT_NAME bz2) # reqiured for FindBzip2 to work
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
|
target_compile_definitions(libbz2 PRIVATE -DBZ_BUILD_DLL)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
install(TARGETS libbz2
|
||||||
|
RUNTIME DESTINATION bin
|
||||||
|
ARCHIVE DESTINATION lib
|
||||||
|
LIBRARY DESTINATION lib)
|
||||||
|
|
||||||
|
if(NOT BZIP2_SKIP_TOOLS)
|
||||||
|
add_executable(bzip2 bzip2.c ${LIBBZ2_SOURCES})
|
||||||
|
add_executable(bzip2recover bzip2recover.c ${LIBBZ2_SOURCES})
|
||||||
|
install(TARGETS bzip2 bzip2recover DESTINATION tools)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT BZIP2_SKIP_HEADERS)
|
||||||
|
install(FILES bzlib.h DESTINATION include)
|
||||||
|
endif()
|
3
ports/bzip2/CONTROL
Normal file
3
ports/bzip2/CONTROL
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Source: bzip2
|
||||||
|
Version: 1.0.6
|
||||||
|
Description: High-quality data compressor.
|
13
ports/bzip2/auto-define-import-macro.patch
Normal file
13
ports/bzip2/auto-define-import-macro.patch
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
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
|
40
ports/bzip2/fix-import-export-macros.patch
Normal file
40
ports/bzip2/fix-import-export-macros.patch
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
diff --git a/bzlib.h b/bzlib.h
|
||||||
|
index 8277123..84fbd0a 100644
|
||||||
|
--- a/bzlib.h
|
||||||
|
+++ b/bzlib.h
|
||||||
|
@@ -65,29 +65,23 @@ typedef
|
||||||
|
}
|
||||||
|
bz_stream;
|
||||||
|
|
||||||
|
-
|
||||||
|
-#ifndef BZ_IMPORT
|
||||||
|
-#define BZ_EXPORT
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
#ifndef BZ_NO_STDIO
|
||||||
|
/* Need a definitition for FILE */
|
||||||
|
#include <stdio.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
-# include <windows.h>
|
||||||
|
# ifdef small
|
||||||
|
/* windows.h define small to char */
|
||||||
|
# undef small
|
||||||
|
# endif
|
||||||
|
-# ifdef BZ_EXPORT
|
||||||
|
-# define BZ_API(func) WINAPI func
|
||||||
|
-# define BZ_EXTERN extern
|
||||||
|
+# define BZ_API(func) func
|
||||||
|
+# if defined(BZ_BUILD_DLL)
|
||||||
|
+# define BZ_EXTERN __declspec(dllexport)
|
||||||
|
+# elif defined(BZ_IMPORT)
|
||||||
|
+# define BZ_EXTERN __declspec(dllimport)
|
||||||
|
# else
|
||||||
|
- /* import windows dll dynamically */
|
||||||
|
-# define BZ_API(func) (WINAPI * func)
|
||||||
|
-# define BZ_EXTERN
|
||||||
|
+# define BZ_EXTERN
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# define BZ_API(func) func
|
35
ports/bzip2/portfile.cmake
Normal file
35
ports/bzip2/portfile.cmake
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
|
||||||
|
include(vcpkg_common_functions)
|
||||||
|
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/bzip2-1.0.6)
|
||||||
|
vcpkg_download_distfile(ARCHIVE
|
||||||
|
URLS "http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz"
|
||||||
|
FILENAME "bzip2-1.0.6.tar.gz"
|
||||||
|
SHA512 00ace5438cfa0c577e5f578d8a808613187eff5217c35164ffe044fbafdfec9e98f4192c02a7d67e01e5a5ccced630583ad1003c37697219b0f147343a3fdd12)
|
||||||
|
|
||||||
|
vcpkg_extract_source_archive(${ARCHIVE})
|
||||||
|
|
||||||
|
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
|
||||||
|
|
||||||
|
vcpkg_apply_patches(
|
||||||
|
SOURCE_PATH ${SOURCE_PATH}
|
||||||
|
PATCHES
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/fix-import-export-macros.patch)
|
||||||
|
|
||||||
|
vcpkg_configure_cmake(
|
||||||
|
SOURCE_PATH ${SOURCE_PATH}
|
||||||
|
OPTIONS_DEBUG
|
||||||
|
-DBZIP2_SKIP_HEADERS=ON
|
||||||
|
-DBZIP2_SKIP_TOOLS=ON)
|
||||||
|
|
||||||
|
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)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
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)
|
Loading…
x
Reference in New Issue
Block a user