summaryrefslogtreecommitdiff
path: root/pkg/libcbor/gen.lua
blob: b2725ab330ac34c92d294f08d8bcd0690ab3eac4 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
cflags{
	'-Wall', '-Wpedantic',
	'-D HAVE_ENDIAN_H',
	'-I $outdir/include',
}

build('sed', '$outdir/include/cbor/configuration.h', '$srcdir/src/cbor/configuration.h.in', {
	expr={
		[[-e 's,$${CBOR_VERSION_MAJOR},0,']],
		[[-e 's,$${CBOR_VERSION_MINOR},5,']],
		[[-e 's,$${CBOR_VERSION_PATCH},0,']],
		[[-e 's,$${CBOR_BUFFER_GROWTH},2,']],
		[[-e 's,$${CBOR_RESTRICT_SPECIFIER},restrict,']],
		[[-e 's,$${CBOR_INLINE_SPECIFIER},inline,']],
		'-e /CBOR_CUSTOM_ALLOC/d',
		'-e /CBOR_PRETTY_PRINTER/d',
	},
})

pkg.hdrs = {
	copy('$outdir/include', '$srcdir/src', {
		'cbor.h',
		'cbor/arrays.h',
		'cbor/bytestrings.h',
		'cbor/callbacks.h',
		'cbor/common.h',
		'cbor/data.h',
		'cbor/encoding.h',
		'cbor/floats_ctrls.h',
		'cbor/ints.h',
		'cbor/maps.h',
		'cbor/serialization.h',
		'cbor/streaming.h',
		'cbor/strings.h',
		'cbor/tags.h',
	}),
	'$outdir/include/cbor/configuration.h',
}
pkg.deps = {'$gendir/headers'}

lib('libcbor.a', [[
	src/cbor.c
	src/cbor/(
		streaming.c
		internal/(
			encoders.c
			builder_callbacks.c
			loaders.c
			memory_utils.c
			stack.c
			unicode.c
		)
		encoding.c
		serialization.c
		arrays.c
		common.c
		floats_ctrls.c
		bytestrings.c
		callbacks.c
		strings.c
		maps.c
		tags.c
		ints.c
	)
]])

fetch 'git'