blob: 785e0bb2efc856eca4edcc744c962059d957be5e (
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
38
39
40
41
42
43
44
45
46
|
import os, strutils
import nimterop/[build, cimport]
const
baseDir = getProjectCacheDir("nimterop" / "tests" / "liblzma")
static:
cDebug()
when defined(envTest):
setDefines(@["lzmaStd"])
elif defined(envTestStatic):
setDefines(@["lzmaStd", "lzmaStatic"])
getHeader(
"lzma.h",
giturl = "https://github.com/xz-mirror/xz",
dlurl = "https://tukaani.org/xz/xz-$1.tar.gz",
outdir = baseDir,
conFlags = "--disable-xz --disable-xzdec --disable-lzmadec --disable-lzmainfo"
)
cPlugin:
import strutils
proc onSymbol*(sym: var Symbol) {.exportc, dynlib.} =
sym.name = sym.name.strip(chars = {'_'})
cOverride:
type
lzma_internal = object
lzma_index = object
lzma_index_hash = object
lzma_options_lzma = object
lzma_stream_flags = object
lzma_block = object
lzma_index_iter = object
when not lzmaStatic:
cImport(lzmaPath, recurse = true, dynlib = "lzmaLPath")
else:
cImport(lzmaPath, recurse = true)
echo "liblzma version = " & $lzma_version_string()
|