libs-imp-lzo.lmt /size: 1042 b    last modification: 2021-10-28 13:51
1if not modules then modules = { } end modules ['libs-imp-lzo'] = {
2    version   = 1.001,
3    comment   = "companion to luat-lib.mkxl",
4    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
5    copyright = "PRAGMA ADE / ConTeXt Development Team",
6    license   = "see context related readme files"
7}
8
9-- https://packages.msys2.org/package/mingw-w64-x86_64-lzo2?repo=mingw64
10
11local libname = "lzo"
12local libfile = "liblzo"
13
14local lzolib = resolvers.libraries.validoptional(libname)
15
16if not lzolib then return end
17
18local lzo_compress       = lzolib.compress
19local lzo_decompresssize = lzolib.decompresssize
20
21local function okay()
22    if resolvers.libraries.optionalloaded(libname,libfile) then
23        okay = function() return true end
24    else
25        okay = function() return false end
26    end
27    return okay()
28end
29
30local lzo = {
31    compress       = function (...) return okay() and lzo_compress      (...) end,
32    decompresssize = function (...) return okay() and lzo_decompresssize(...) end,
33}
34
35package.loaded[libname] = lzo
36
37return lzo
38