summaryrefslogtreecommitdiff
path: root/tex/context/base/mkxl/libs-imp-lzo.lmt
blob: 1cc84a9e38858b6ac0cacb53f39794a32c0e310f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
if not modules then modules = { } end modules ['libs-imp-lzo'] = {
    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-lzo2?repo=mingw64

local libname = "lzo"
local libfile = "liblzo"

local lzolib = resolvers.libraries.validoptional(libname)

if not lzolib then return end

local lzo_compress       = lzolib.compress
local lzo_decompresssize = lzolib.decompresssize

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 lzo = {
    compress       = function (...) return okay() and lzo_compress      (...) end,
    decompresssize = function (...) return okay() and lzo_decompresssize(...) end,
}

package.loaded[libname] = lzo

return lzo