summaryrefslogtreecommitdiff
path: root/tex/context/base/mkxl/libs-imp-lz4.lmt
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkxl/libs-imp-lz4.lmt')
-rw-r--r--tex/context/base/mkxl/libs-imp-lz4.lmt46
1 files changed, 46 insertions, 0 deletions
diff --git a/tex/context/base/mkxl/libs-imp-lz4.lmt b/tex/context/base/mkxl/libs-imp-lz4.lmt
new file mode 100644
index 000000000..2367a640d
--- /dev/null
+++ b/tex/context/base/mkxl/libs-imp-lz4.lmt
@@ -0,0 +1,46 @@
+if not modules then modules = { } end modules ['libs-imp-lz4'] = {
+ version = 1.001,
+ comment = "companion to luat-lib.mkxl",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- https://packages.msys2.org/package/mingw-w64-x86_64-lz4?repo=mingw64
+
+-- Instead of linking in libs like this we now do them optional. After all, once
+-- we start adding more and more stuff statically we en dup with a mess.
+
+local libname = "lz4"
+local libfile = "liblz4"
+
+local lz4lib = resolvers.libraries.validoptional(libname)
+
+if not lz4lib then return end
+
+local lz4_compress = lz4lib.compress
+----- lz4_decompress = lz4lib.decompress
+local lz4_decompresssize = lz4lib.decompresssize
+local lz4_framecompress = lz4lib.framecompress
+local lz4_framedecompress = lz4lib.framedecompress
+
+local function okay()
+ if resolvers.libraries.optionalloaded(libname,libfile) then
+ okay = function() return true end
+ else
+ okay = function() return false end
+ end
+ return okay()
+end
+
+local lz4 = {
+ compress = function (...) return okay() and lz4_compress (...) end,
+ -- decompress = function (...) return okay() and lz4_decompress (...) end,
+ decompresssize = function (...) return okay() and lz4_decompresssize (...) end,
+ framecompress = function (...) return okay() and lz4_framecompress (...) end,
+ framedecompress = function (...) return okay() and lz4_framedecompress(...) end,
+}
+
+package.loaded[libname] = lz4
+
+return lz4