From ca3a6ab0fea53a49a241772f6f383b0fe6b808b7 Mon Sep 17 00:00:00 2001 From: LazyHamster Date: Thu, 30 Nov 2017 12:39:19 +0300 Subject: [PATCH] [libmspack] Initial port. --- ports/libmspack/CMakeLists.txt | 52 ++++++++++++++++++++++++++++++++++ ports/libmspack/CONTROL | 4 +++ ports/libmspack/config.h | 8 ++++++ ports/libmspack/libmspack.def | 32 +++++++++++++++++++++ ports/libmspack/portfile.cmake | 30 ++++++++++++++++++++ 5 files changed, 126 insertions(+) create mode 100644 ports/libmspack/CMakeLists.txt create mode 100644 ports/libmspack/CONTROL create mode 100644 ports/libmspack/config.h create mode 100644 ports/libmspack/libmspack.def create mode 100644 ports/libmspack/portfile.cmake diff --git a/ports/libmspack/CMakeLists.txt b/ports/libmspack/CMakeLists.txt new file mode 100644 index 0000000000..4591d3e045 --- /dev/null +++ b/ports/libmspack/CMakeLists.txt @@ -0,0 +1,52 @@ +cmake_minimum_required(VERSION 3.8) + +project(libmspack C) + +set(CMAKE_DEBUG_POSTFIX "d") + +add_definitions(-DHAVE_CONFIG_H) + +if(MSVC) + add_definitions(-D_CRT_SECURE_NO_DEPRECATE) + add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) +endif() + +# List the source files +set(LIB_SRC mspack/cabc.c + mspack/cabd.c + mspack/chmc.c + mspack/chmd.c + mspack/crc32.c + mspack/hlpc.c + mspack/hlpd.c + mspack/kwajc.c + mspack/kwajd.c + mspack/litc.c + mspack/litd.c + mspack/lzssd.c + mspack/lzxc.c + mspack/lzxd.c + mspack/mszipc.c + mspack/mszipd.c + mspack/oabc.c + mspack/oabd.c + mspack/qtmd.c + mspack/system.c + mspack/szddc.c + mspack/szddd.c +) + +if(BUILD_SHARED_LIBS) + set(LIB_DEF libmspack.def) +endif() + +add_library(libmspack ${LIB_SRC} ${LIB_DEF}) + +target_include_directories(libmspack PRIVATE . ./mspack) + +install(TARGETS libmspack + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + +install(FILES mspack/mspack.h DESTINATION include) diff --git a/ports/libmspack/CONTROL b/ports/libmspack/CONTROL new file mode 100644 index 0000000000..b881f614f9 --- /dev/null +++ b/ports/libmspack/CONTROL @@ -0,0 +1,4 @@ +Source: libmspack +Version: 0.6 +Build-Depends: +Description: libmspack is a portable library for some loosely related Microsoft compression formats. diff --git a/ports/libmspack/config.h b/ports/libmspack/config.h new file mode 100644 index 0000000000..ebe95831ce --- /dev/null +++ b/ports/libmspack/config.h @@ -0,0 +1,8 @@ +#define HAVE_LIMITS_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STRING_H 1 +#define HAVE_CTYPE_H 1 + +#define HAVE_MEMCMP 1 +#define HAVE_TOWLOWER 1 +#define HAVE_TOLOWER 1 diff --git a/ports/libmspack/libmspack.def b/ports/libmspack/libmspack.def new file mode 100644 index 0000000000..6a1a43d750 --- /dev/null +++ b/ports/libmspack/libmspack.def @@ -0,0 +1,32 @@ +EXPORTS + +mspack_create_cab_compressor +mspack_create_chm_compressor +mspack_create_lit_compressor +mspack_create_hlp_compressor +mspack_create_szdd_compressor +mspack_create_kwaj_compressor +mspack_create_oab_compressor + +mspack_create_cab_decompressor +mspack_create_chm_decompressor +mspack_create_lit_decompressor +mspack_create_hlp_decompressor +mspack_create_szdd_decompressor +mspack_create_kwaj_decompressor +mspack_create_oab_decompressor + +mspack_destroy_cab_compressor +mspack_destroy_cab_decompressor +mspack_destroy_chm_compressor +mspack_destroy_chm_decompressor +mspack_destroy_lit_compressor +mspack_destroy_lit_decompressor +mspack_destroy_hlp_compressor +mspack_destroy_hlp_decompressor +mspack_destroy_szdd_compressor +mspack_destroy_szdd_decompressor +mspack_destroy_kwaj_compressor +mspack_destroy_kwaj_decompressor +mspack_destroy_oab_compressor +mspack_destroy_oab_decompressor diff --git a/ports/libmspack/portfile.cmake b/ports/libmspack/portfile.cmake new file mode 100644 index 0000000000..fe75e2edd4 --- /dev/null +++ b/ports/libmspack/portfile.cmake @@ -0,0 +1,30 @@ +include(vcpkg_common_functions) + +set(LIB_NAME libmspack) +set(LIB_VERSION 0.6alpha) +set(LIB_FILENAME ${LIB_NAME}-${LIB_VERSION}.tar.gz) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/${LIB_NAME}-${LIB_VERSION}) + +vcpkg_download_distfile(ARCHIVE + URLS "https://www.cabextract.org.uk/libmspack/${LIB_FILENAME}" + FILENAME "${LIB_FILENAME}" + SHA512 7ba4a584d335c2d703628a3c179bc0d323574632357cdfe04622f960dcc4ef970b5739799397b6802d44a312f7ed9d589b4be223facf044bbfdbfd76d9c7405d +) +vcpkg_extract_source_archive(${ARCHIVE}) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/config.h DESTINATION ${SOURCE_PATH}) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/libmspack.def DESTINATION ${SOURCE_PATH}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} +) + +vcpkg_install_cmake() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# License and man +file(INSTALL ${SOURCE_PATH}/COPYING.LIB DESTINATION ${CURRENT_PACKAGES_DIR}/share/${LIB_NAME} RENAME copyright) + +vcpkg_copy_pdbs()