diff options
Diffstat (limited to 'vcpkg/ports/chmlib')
| -rw-r--r-- | vcpkg/ports/chmlib/CMakeLists.txt | 29 | ||||
| -rw-r--r-- | vcpkg/ports/chmlib/all-platforms.patch | 20 | ||||
| -rw-r--r-- | vcpkg/ports/chmlib/portfile.cmake | 34 | ||||
| -rw-r--r-- | vcpkg/ports/chmlib/strings_h.patch | 13 | ||||
| -rw-r--r-- | vcpkg/ports/chmlib/vcpkg.json | 14 |
5 files changed, 110 insertions, 0 deletions
diff --git a/vcpkg/ports/chmlib/CMakeLists.txt b/vcpkg/ports/chmlib/CMakeLists.txt new file mode 100644 index 0000000..296ed6a --- /dev/null +++ b/vcpkg/ports/chmlib/CMakeLists.txt @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 3.5)
+project(chm C)
+
+include (CheckIncludeFiles)
+check_include_files(strings.h HAVE_STRINGS_H) # for ffs
+
+add_library(chm src/lzx.c src/chm_lib.c)
+if(HAVE_STRINGS_H)
+ target_compile_definitions(chm PRIVATE CHMLIB_HAVE_STRINGS_H)
+endif()
+
+if(BUILD_TOOLS)
+ link_libraries(chm)
+ add_executable(enum_chmLib src/enum_chmLib.c)
+ add_executable(enumdir_chmLib src/enumdir_chmLib.c)
+ add_executable(extract_chmLib src/extract_chmLib.c)
+
+ install(TARGETS enum_chmLib extract_chmLib enumdir_chmLib
+ RUNTIME DESTINATION tools/chmlib
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+ )
+endif()
+
+install(TARGETS chm
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)
diff --git a/vcpkg/ports/chmlib/all-platforms.patch b/vcpkg/ports/chmlib/all-platforms.patch new file mode 100644 index 0000000..62dca58 --- /dev/null +++ b/vcpkg/ports/chmlib/all-platforms.patch @@ -0,0 +1,20 @@ +diff --git a/src/chm_lib.c b/src/chm_lib.c +index 6c6736c..d532691 100644 +--- a/src/chm_lib.c ++++ b/src/chm_lib.c +@@ -175,8 +175,13 @@ typedef unsigned long UInt64; + + #else + +-/* yielding an error is preferable to yielding incorrect behavior */ +-#error "Please define the sized types for your platform in chm_lib.c" ++typedef unsigned char UChar; ++typedef int16_t Int16; ++typedef uint16_t UInt16; ++typedef int32_t Int32; ++typedef uint32_t UInt32; ++typedef int64_t Int64; ++typedef uint64_t UInt64; + #endif + + /* GCC */ diff --git a/vcpkg/ports/chmlib/portfile.cmake b/vcpkg/ports/chmlib/portfile.cmake new file mode 100644 index 0000000..4a9c7d5 --- /dev/null +++ b/vcpkg/ports/chmlib/portfile.cmake @@ -0,0 +1,34 @@ +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +set(CHMLIB_VERSION chmlib-0.40) +set(CHMLIB_FILENAME ${CHMLIB_VERSION}.zip) +set(CHMLIB_URL http://www.jedrea.com/chmlib/${CHMLIB_FILENAME}) + +vcpkg_download_distfile( + ARCHIVE + URLS ${CHMLIB_URL} + FILENAME ${CHMLIB_FILENAME} + SHA512 ad3b0d49fcf99e724c0c38b9c842bae9508d0e4ad47122b0f489c113160f5344223d311abb79f25cbb0b662bb00e2925d338d60dd20a0c309bda2822cda4cd24 +) + +vcpkg_extract_source_archive( + SOURCE_PATH + ARCHIVE "${ARCHIVE}" + PATCHES + all-platforms.patch + strings_h.patch +) + +file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS_RELEASE -DBUILD_TOOLS=ON + OPTIONS_DEBUG -DBUILD_TOOLS=OFF +) + +vcpkg_cmake_install() + +file(INSTALL "${SOURCE_PATH}/src/chm_lib.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include") + +file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/vcpkg/ports/chmlib/strings_h.patch b/vcpkg/ports/chmlib/strings_h.patch new file mode 100644 index 0000000..e723392 --- /dev/null +++ b/vcpkg/ports/chmlib/strings_h.patch @@ -0,0 +1,13 @@ +diff --git a/src/chm_lib.c b/src/chm_lib.c +index 6c6736c..4a3f167 100644 +--- a/src/chm_lib.c ++++ b/src/chm_lib.c +@@ -62,7 +62,7 @@ + #include <stdio.h> + #endif + +-#if __sun || __sgi ++#ifdef CHMLIB_HAVE_STRINGS_H + #include <strings.h> + #endif + diff --git a/vcpkg/ports/chmlib/vcpkg.json b/vcpkg/ports/chmlib/vcpkg.json new file mode 100644 index 0000000..cf98990 --- /dev/null +++ b/vcpkg/ports/chmlib/vcpkg.json @@ -0,0 +1,14 @@ +{ + "name": "chmlib", + "version": "0.40", + "port-version": 8, + "description": "CHMLIB is a library for dealing with Microsoft ITSS/CHM format files. Right now, it is a very simple library, but sufficient for dealing with all of the .chm files I've come across. Due to the fairly well-designed indexing built into this particular file format, even a small library is able to gain reasonably good performance indexing into ITSS archives.", + "homepage": "http://www.jedrea.com/chmlib/", + "license": "LGPL-2.1-or-later", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + } + ] +} |