diff options
| author | codicodi <rob.ceglinski@gmail.com> | 2017-01-02 01:31:42 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-01-02 01:31:42 +0100 |
| commit | 044c07ece1aa0e3e46e0c059cb5877b1bc18c76c (patch) | |
| tree | fdaa68387fd7b8b72bf6ab729668f713affadcf9 | |
| parent | 31daeeb7f585d0b64de78e31b4e0de8be8b5d213 (diff) | |
| download | vcpkg-044c07ece1aa0e3e46e0c059cb5877b1bc18c76c.tar.gz vcpkg-044c07ece1aa0e3e46e0c059cb5877b1bc18c76c.zip | |
add bzip2
| -rw-r--r-- | ports/bzip2/CMakeLists.txt | 36 | ||||
| -rw-r--r-- | ports/bzip2/CONTROL | 3 | ||||
| -rw-r--r-- | ports/bzip2/auto-define-import-macro.patch | 13 | ||||
| -rw-r--r-- | ports/bzip2/fix-import-export-macros.patch | 40 | ||||
| -rw-r--r-- | ports/bzip2/portfile.cmake | 35 |
5 files changed, 127 insertions, 0 deletions
diff --git a/ports/bzip2/CMakeLists.txt b/ports/bzip2/CMakeLists.txt new file mode 100644 index 000000000..9f9737da3 --- /dev/null +++ b/ports/bzip2/CMakeLists.txt @@ -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() diff --git a/ports/bzip2/CONTROL b/ports/bzip2/CONTROL new file mode 100644 index 000000000..365527454 --- /dev/null +++ b/ports/bzip2/CONTROL @@ -0,0 +1,3 @@ +Source: bzip2
+Version: 1.0.6
+Description: High-quality data compressor.
diff --git a/ports/bzip2/auto-define-import-macro.patch b/ports/bzip2/auto-define-import-macro.patch new file mode 100644 index 000000000..81492d3a5 --- /dev/null +++ b/ports/bzip2/auto-define-import-macro.patch @@ -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
diff --git a/ports/bzip2/fix-import-export-macros.patch b/ports/bzip2/fix-import-export-macros.patch new file mode 100644 index 000000000..e3ee8494b --- /dev/null +++ b/ports/bzip2/fix-import-export-macros.patch @@ -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
diff --git a/ports/bzip2/portfile.cmake b/ports/bzip2/portfile.cmake new file mode 100644 index 000000000..128cdee78 --- /dev/null +++ b/ports/bzip2/portfile.cmake @@ -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)
|
