aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Kahn <jacobkahn1@gmail.com>2020-10-20 11:31:46 -0700
committerGitHub <noreply@github.com>2020-10-20 11:31:46 -0700
commit8ab8add3126b6aeb77f0dbc3e44a7b5ce16ee8e5 (patch)
treeef8867318f4f560a441d08915f0458cae61f583c
parent93eed24259c325e8bd1a9b88c864b6b64d24cc16 (diff)
downloadvcpkg-8ab8add3126b6aeb77f0dbc3e44a7b5ce16ee8e5.tar.gz
vcpkg-8ab8add3126b6aeb77f0dbc3e44a7b5ce16ee8e5.zip
[kenlm] New Port (#13692)
-rw-r--r--ports/kenlm/fix-boost.patch12
-rw-r--r--ports/kenlm/portfile.cmake48
-rw-r--r--ports/kenlm/vcpkg.json32
3 files changed, 92 insertions, 0 deletions
diff --git a/ports/kenlm/fix-boost.patch b/ports/kenlm/fix-boost.patch
new file mode 100644
index 000000000..3eded1c69
--- /dev/null
+++ b/ports/kenlm/fix-boost.patch
@@ -0,0 +1,12 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index bec81d4..44fd48a 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1,6 +1,6 @@
+ cmake_minimum_required(VERSION 3.1)
+
+-if (WIN32)
++if (WIN32 AND BUILD_SHARED_LIBS)
+ set(Boost_USE_STATIC_LIBS OFF)
+ # The auto-linking feature has problems with USE_STATIC_LIBS off, so we use
+ # BOOST_ALL_NO_LIB to turn it off.
diff --git a/ports/kenlm/portfile.cmake b/ports/kenlm/portfile.cmake
new file mode 100644
index 000000000..38fe9652f
--- /dev/null
+++ b/ports/kenlm/portfile.cmake
@@ -0,0 +1,48 @@
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO kpu/kenlm
+ REF 1f054617eca14eae921e987b4b4eeb2b1d91de6b
+ SHA512 c18f9c22fbbb1f54ebe9c3b771fb2d7c09d502141d1b3645cff9db44cc51b3c976311ff0db79b60f410622579d043f185c56a4c7386e1b0ba8708e433238968b
+ HEAD_REF master
+ PATCHES fix-boost.patch
+)
+
+file(REMOVE ${SOURCE_PATH}/cmake/modules/FindEigen3.cmake)
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ interpolate ENABLE_INTERPOLATE
+)
+
+if ("interpolate" IN_LIST FEATURES AND VCPKG_TARGET_IS_WINDOWS)
+ message(FATAL_ERROR "The interpolate feature does not support Windows.")
+endif()
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ OPTIONS
+ ${FEATURE_OPTIONS}
+ -DFORCE_STATIC=OFF #already handled by vcpkg
+ -DENABLE_PYTHON=OFF # kenlm.lib(bhiksha.cc.obj) : fatal error LNK1000: Internal error during IMAGE::Pass2
+ -DCOMPILE_TESTS=OFF
+)
+vcpkg_install_cmake()
+
+set(KENLM_TOOLS count_ngrams filter fragment kenlm_benchmark lmplz phrase_table_vocab query build_binary)
+if (NOT VCPKG_TARGET_IS_WINDOWS)
+ list(APPEND KENLM_TOOLS probing_hash_table_benchmark)
+ if ("interpolate" IN_LIST FEATURES)
+ list(APPEND KENLM_TOOLS interpolate)
+ endif()
+endif()
+vcpkg_copy_tools(TOOL_NAMES ${KENLM_TOOLS} AUTO_CLEAN)
+
+vcpkg_copy_pdbs()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+# Copyright and License
+file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
+file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME license)
diff --git a/ports/kenlm/vcpkg.json b/ports/kenlm/vcpkg.json
new file mode 100644
index 000000000..0542aa6ed
--- /dev/null
+++ b/ports/kenlm/vcpkg.json
@@ -0,0 +1,32 @@
+{
+ "name": "kenlm",
+ "version-string": "20200924",
+ "description": "KenLM: Faster and Smaller Language Model Queries",
+ "supports": "!(arm64 & windows)",
+ "dependencies": [
+ "boost-interprocess",
+ "boost-program-options",
+ "boost-ptr-container",
+ "boost-system",
+ "boost-test",
+ "boost-thread",
+ "bzip2",
+ {
+ "name": "eigen3",
+ "platform": "!windows"
+ },
+ "liblzma",
+ "zlib"
+ ],
+ "features": {
+ "interpolate": {
+ "description": "Build interpolation program",
+ "dependencies": [
+ {
+ "name": "eigen3",
+ "platform": "!windows"
+ }
+ ]
+ }
+ }
+}