* update jsoncpp

* fix bzip2

* update libarchive

* update tesseract
pull/705/head
Hoildkv 3 years ago committed by GitHub
parent f2611d5a19
commit a0028a92a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 26
      packages/b/bzip2/patches/dllexport.patch
  2. 88
      packages/b/bzip2/port/xmake.lua
  3. 16
      packages/b/bzip2/xmake.lua
  4. 25
      packages/j/jsoncpp/xmake.lua
  5. 15
      packages/l/leptonica/xmake.lua
  6. 1
      packages/l/libarchive/xmake.lua
  7. 12
      packages/t/tesseract/xmake.lua

@ -1,26 +0,0 @@
--- bzlib.h 2019-07-13 19:50:05.000000000 +0200
+++ bzlib.h 2021-09-08 10:18:55.838440200 +0200
@@ -75,19 +75,13 @@
#include <stdio.h>
#endif
-#ifdef _WIN32
-# include <windows.h>
-# ifdef small
- /* windows.h define small to char */
-# undef small
-# endif
+#if defined(_WIN32) && !defined(BZ_STATIC)
+# define BZ_API(func) func
# ifdef BZ_EXPORT
-# define BZ_API(func) WINAPI func
-# define BZ_EXTERN extern
+# define BZ_EXTERN __declspec(dllexport)
# else
/* import windows dll dynamically */
-# define BZ_API(func) (WINAPI * func)
-# define BZ_EXTERN
+# define BZ_EXTERN __declspec(dllimport)
# endif
#else
# define BZ_API(func) func

@ -1,18 +1,12 @@
add_rules("mode.debug", "mode.release") add_rules("mode.debug", "mode.release")
option("build_bin") option("enable_tools")
set_default(true) set_default(false)
set_showmenu(true) set_showmenu(true)
target("bz2") target("bz2")
set_kind("$(kind)") set_kind("$(kind)")
set_languages("c89") set_languages("c89")
if is_kind("static") then
add_defines("BZ_STATIC", {public = true})
else
add_defines("BZ_EXPORT")
end
add_headerfiles("bzlib.h") add_headerfiles("bzlib.h")
add_files("blocksort.c") add_files("blocksort.c")
add_files("bzlib.c") add_files("bzlib.c")
@ -21,43 +15,47 @@ target("bz2")
add_files("decompress.c") add_files("decompress.c")
add_files("huffman.c") add_files("huffman.c")
add_files("randtable.c") add_files("randtable.c")
if is_plat("windows") and is_kind("shared") then
set_filename("libbz2.dll")
add_files("libbz2.def")
end
if has_config("build_bin") then if has_config("enable_tools") then
target("bzip2") target("bzip2")
set_kind("binary") set_kind("binary")
add_deps("bz2") add_deps("bz2")
add_files("bzip2.c") add_files("bzip2.c")
after_install(function (target) after_install(function (target)
-- copy/link additional executables/scripts (behavior is altered by checking the program name) -- copy/link additional executables/scripts (behavior is altered by checking the program name)
if target:is_plat("windows", "mingw") then if target:is_plat("windows", "mingw") then
local binarydir = path.join(target:installdir(), "bin") local binarydir = path.join(target:installdir(), "bin")
os.vcp(path.join(binarydir, "bzip2.exe"), path.join(binarydir, "bzcat.exe")) os.vcp(path.join(binarydir, "bzip2.exe"), path.join(binarydir, "bzcat.exe"))
os.vcp(path.join(binarydir, "bzip2.exe"), path.join(binarydir, "bunzip2.exe")) os.vcp(path.join(binarydir, "bzip2.exe"), path.join(binarydir, "bunzip2.exe"))
else else
local binarydir = path.join(target:installdir(), "bin") local binarydir = path.join(target:installdir(), "bin")
os.ln(path.join(binarydir, "bzip2"), path.join(binarydir, "bzcat")) os.ln(path.join(binarydir, "bzip2"), path.join(binarydir, "bzcat"))
os.ln(path.join(binarydir, "bzip2"), path.join(binarydir, "bunzip2")) os.ln(path.join(binarydir, "bzip2"), path.join(binarydir, "bunzip2"))
-- copy shell scripts -- copy shell scripts
os.vcp("bzdiff", binarydir) os.vcp("bzdiff", binarydir)
os.vcp("bzgrep", binarydir) os.vcp("bzgrep", binarydir)
os.vcp("bzmore", binarydir) os.vcp("bzmore", binarydir)
-- and renamed copies -- and renamed copies
os.ln(path.join(binarydir, "bzdiff"), path.join(binarydir, "bzcmp")) os.ln(path.join(binarydir, "bzdiff"), path.join(binarydir, "bzcmp"))
os.ln(path.join(binarydir, "bzgrep"), path.join(binarydir, "bzegrep")) os.ln(path.join(binarydir, "bzgrep"), path.join(binarydir, "bzegrep"))
os.ln(path.join(binarydir, "bzgrep"), path.join(binarydir, "bzfgrep")) os.ln(path.join(binarydir, "bzgrep"), path.join(binarydir, "bzfgrep"))
os.ln(path.join(binarydir, "bzmore"), path.join(binarydir, "bzless")) os.ln(path.join(binarydir, "bzmore"), path.join(binarydir, "bzless"))
end end
end) end)
target("bzip2recover") target("bzip2recover")
set_kind("binary") set_kind("binary")
add_deps("bz2") add_deps("bz2")
add_files("bzip2recover.c") add_files("bzip2recover.c")
end end

@ -5,21 +5,13 @@ package("bzip2")
add_urls("https://sourceware.org/pub/bzip2/bzip2-$(version).tar.gz") add_urls("https://sourceware.org/pub/bzip2/bzip2-$(version).tar.gz")
add_versions("1.0.8", "ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269") add_versions("1.0.8", "ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269")
add_patches("1.0.8", path.join(os.scriptdir(), "patches", "dllexport.patch"), "f72679b2ad55262bbc9da49f352f6cf128db85047aaa04ca42126c839b709461")
on_load(function (package)
package:addenv("PATH", "bin")
if not package:config("shared") then
package:add("defines", "BZ_STATIC")
end
end)
on_install(function (package) on_install(function (package)
local configs = {} local configs = {}
configs.kind = package:config("shared") and "shared" or "static" if not package:is_plat("cross", "iphoneos", "android") then
configs.mode = package:debug() and "debug" or "release" configs.enable_tools = true
configs.build_bin = not package:is_plat("cross", "iphoneos", "android") package:addenv("PATH", "bin")
end
os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua") os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
import("package.tools.xmake").install(package, configs) import("package.tools.xmake").install(package, configs)

@ -3,17 +3,23 @@ package("jsoncpp")
set_homepage("https://github.com/open-source-parsers/jsoncpp/wiki") set_homepage("https://github.com/open-source-parsers/jsoncpp/wiki")
set_description("A C++ library for interacting with JSON.") set_description("A C++ library for interacting with JSON.")
set_urls("https://github.com/open-source-parsers/jsoncpp/archive/$(version).zip") add_urls("https://github.com/open-source-parsers/jsoncpp/archive/$(version).zip",
"https://github.com/open-source-parsers/jsoncpp.git")
add_versions("1.9.4", "6da6cdc026fe042599d9fce7b06ff2c128e8dd6b8b751fca91eb022bce310880") add_versions("1.9.4", "6da6cdc026fe042599d9fce7b06ff2c128e8dd6b8b751fca91eb022bce310880")
add_versions("1.9.5", "a074e1b38083484e8e07789fd683599d19da8bb960959c83751cd0284bdf2043")
add_deps("cmake") add_deps("cmake")
on_load(function (package)
if package:config("shared") then
package:add("defines", "JSON_DLL")
end
end)
on_install("linux", "macosx", "android", "iphoneos", "windows", "mingw", "cross", function(package) on_install("linux", "macosx", "android", "iphoneos", "windows", "mingw", "cross", function(package)
local configs = {"-DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF", "-DJSONCPP_WITH_TESTS=OFF", "-DJSONCPP_WITH_EXAMPLE=OFF", "-DBUILD_OBJECT_LIBS=OFF"} local configs = {"-DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF", "-DJSONCPP_WITH_TESTS=OFF", "-DJSONCPP_WITH_EXAMPLE=OFF", "-DBUILD_OBJECT_LIBS=OFF"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DBUILD_STATIC_LIBS=" .. (package:config("shared") and "OFF" or "ON")) table.insert(configs, "-DBUILD_STATIC_LIBS=" .. (package:config("shared") and "OFF" or "ON"))
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
if package:config("pic") ~= false then if package:config("pic") ~= false then
table.insert(configs, "-DCMAKE_POSITION_INDEPENDENT_CODE=ON") table.insert(configs, "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
end end
@ -28,18 +34,11 @@ package("jsoncpp")
static void test() { static void test() {
const std::string rawJson = R"({"Age": 20, "Name": "colin"})"; const std::string rawJson = R"({"Age": 20, "Name": "colin"})";
const auto rawJsonLength = static_cast<int>(rawJson.length()); const auto rawJsonLength = static_cast<int>(rawJson.length());
constexpr bool shouldUseOldWay = false;
JSONCPP_STRING err; JSONCPP_STRING err;
Json::Value root; Json::Value root;
if (shouldUseOldWay) { Json::CharReaderBuilder builder;
Json::Reader reader; const std::unique_ptr<Json::CharReader> reader(builder.newCharReader());
reader.parse(rawJson, root); reader->parse(rawJson.c_str(), rawJson.c_str() + rawJsonLength, &root, &err);
} else {
Json::CharReaderBuilder builder;
const std::unique_ptr<Json::CharReader> reader(builder.newCharReader());
if (!reader->parse(rawJson.c_str(), rawJson.c_str() + rawJsonLength, &root,
&err)) ;
}
const std::string name = root["Name"].asString(); const std::string name = root["Name"].asString();
const int age = root["Age"].asInt(); const int age = root["Age"].asInt();
assert(name == "colin"); assert(name == "colin");

@ -8,19 +8,22 @@ package("leptonica")
"https://github.com/DanBloomberg/leptonica.git") "https://github.com/DanBloomberg/leptonica.git")
add_versions("1.80.0", "3952b974ec057d24267aae48c54bca68ead8275604bf084a73a4b953ff79196e") add_versions("1.80.0", "3952b974ec057d24267aae48c54bca68ead8275604bf084a73a4b953ff79196e")
add_versions("1.81.1", "e9dd2100194843a20bbb980ad8b94610558d47f623861bc80ac967f2d2ecb879") add_versions("1.81.1", "e9dd2100194843a20bbb980ad8b94610558d47f623861bc80ac967f2d2ecb879")
add_versions("1.82.0", "40fa9ac1e815b91e0fa73f0737e60c9eec433a95fa123f95f2573dd3127dd669")
add_deps("cmake") add_deps("cmake")
add_deps("libwebp", {configs = {img2webp = true, webpmux = true}}) add_deps("libwebp", {configs = {img2webp = true, webpmux = true}})
add_deps("zlib", "libtiff", "libpng", "libjpeg", "giflib") add_deps("zlib", "libtiff", "libpng", "libjpeg", "giflib")
on_load("windows", function (package)
if package:config("shared") then
package:add("defines", "LIBLEPT_IMPORTS")
end
end)
on_install("windows", "linux", function (package) on_install("windows", "linux", function (package)
local configs = {"-DSW_BUILD=OFF"} local configs = {"-DSW_BUILD=OFF"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
if package:config("pic") ~= false then table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DCMAKE_POSITION_INDEPENDENT_CODE=ON") import("package.tools.cmake").install(package, configs)
end
import("package.tools.cmake").install(package, configs, {buildir = "build"})
-- will be removed in 2.5.4
os.trymv(path.join("build", "install", "cmake"), package:installdir())
end) end)
on_test(function (package) on_test(function (package)

@ -11,7 +11,6 @@ package("libarchive")
add_deps("cmake") add_deps("cmake")
add_deps("zlib", "bzip2", "lz4", "zstd") add_deps("zlib", "bzip2", "lz4", "zstd")
on_install("windows", "linux", "macosx", function (package) on_install("windows", "linux", "macosx", function (package)
io.replace("CMakeLists.txt", "-D_CRT_SECURE_NO_DEPRECATE)", "-D_CRT_SECURE_NO_DEPRECATE)\nADD_DEFINITIONS(-DWIN32_LEAN_AND_MEAN)", {plain = true})
local configs = {"-DENABLE_TEST=OFF", "-DENABLE_OPENSSL=OFF", "-DENABLE_PCREPOSIX=OFF", "-DENABLE_LibGCC=OFF", "-DENABLE_CNG=OFF", "-DENABLE_ICONV=OFF", "-DENABLE_ACL=OFF", "-DENABLE_EXPAT=OFF", "-DENABLE_LIBXML2=OFF", "-DENABLE_LIBB2=OFF"} local configs = {"-DENABLE_TEST=OFF", "-DENABLE_OPENSSL=OFF", "-DENABLE_PCREPOSIX=OFF", "-DENABLE_LibGCC=OFF", "-DENABLE_CNG=OFF", "-DENABLE_ICONV=OFF", "-DENABLE_ACL=OFF", "-DENABLE_EXPAT=OFF", "-DENABLE_LIBXML2=OFF", "-DENABLE_LIBB2=OFF"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))

@ -7,16 +7,20 @@ package("tesseract")
add_urls("https://github.com/tesseract-ocr/tesseract/archive/$(version).tar.gz", add_urls("https://github.com/tesseract-ocr/tesseract/archive/$(version).tar.gz",
"https://github.com/tesseract-ocr/tesseract.git") "https://github.com/tesseract-ocr/tesseract.git")
add_versions("4.1.1", "2a66ff0d8595bff8f04032165e6c936389b1e5727c3ce5a27b3e059d218db1cb") add_versions("4.1.1", "2a66ff0d8595bff8f04032165e6c936389b1e5727c3ce5a27b3e059d218db1cb")
add_versions("4.1.3", "83dc56b544be938983f528c777e4e1d906205b0f6dc0110afc223f2cc1cec6d3")
add_configs("training", {description = "Build training tools.", default = false, type = "boolean"}) add_configs("training", {description = "Build training tools.", default = false, type = "boolean"})
add_deps("cmake") add_deps("cmake")
add_deps("leptonica") add_deps("leptonica")
add_deps("libarchive", {optional = true}) add_deps("libarchive", {optional = true})
on_load(function (package) on_load("windows", "linux", function (package)
if package:config("training") then if package:config("training") then
package:add("deps", "icu4c") package:add("deps", "icu4c")
end end
if package:config("shared") then
package:add("defines", "TESS_IMPORTS")
end
end) end)
on_install("windows", "linux", function (package) on_install("windows", "linux", function (package)
@ -24,8 +28,10 @@ package("tesseract")
io.replace("src/training/CMakeLists.txt", "find_package(PkgConfig)", "", {plain = true}) io.replace("src/training/CMakeLists.txt", "find_package(PkgConfig)", "", {plain = true})
local configs = {"-DSW_BUILD=OFF", "-DBUILD_TESTS=OFF", "-DUSE_SYSTEM_ICU=ON"} local configs = {"-DSW_BUILD=OFF", "-DBUILD_TESTS=OFF", "-DUSE_SYSTEM_ICU=ON"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=OFF") table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DWIN32_MT_BUILD=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF")) if package:is_plat("windows") then
table.insert(configs, "-DWIN32_MT_BUILD=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
end
table.insert(configs, "-DBUILD_TRAINING_TOOLS=" .. (package:config("training") and "ON" or "OFF")) table.insert(configs, "-DBUILD_TRAINING_TOOLS=" .. (package:config("training") and "ON" or "OFF"))
if package:config("pic") ~= false then if package:config("pic") ~= false then
table.insert(configs, "-DCMAKE_POSITION_INDEPENDENT_CODE=ON") table.insert(configs, "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")

Loading…
Cancel
Save