master hovercats/oakiss / pkg / libcbor / gen.lua
 1cflags{
 2	'-Wall', '-Wpedantic',
 3	'-D HAVE_ENDIAN_H',
 4	'-I $outdir/include',
 5}
 6
 7build('sed', '$outdir/include/cbor/configuration.h', '$srcdir/src/cbor/configuration.h.in', {
 8	expr={
 9		[[-e 's,$${CBOR_VERSION_MAJOR},0,']],
10		[[-e 's,$${CBOR_VERSION_MINOR},9,']],
11		[[-e 's,$${CBOR_VERSION_PATCH},0,']],
12		[[-e 's,$${CBOR_BUFFER_GROWTH},2,']],
13		[[-e 's,$${CBOR_MAX_STACK_SIZE},2048,']],
14		[[-e 's,$${CBOR_RESTRICT_SPECIFIER},restrict,']],
15		[[-e 's,$${CBOR_INLINE_SPECIFIER},inline,']],
16		'-e /CBOR_CUSTOM_ALLOC/d',
17		'-e /CBOR_PRETTY_PRINTER/d',
18	},
19})
20
21pkg.hdrs = {
22	copy('$outdir/include', '$srcdir/src', {
23		'cbor.h',
24		'cbor/arrays.h',
25		'cbor/bytestrings.h',
26		'cbor/callbacks.h',
27		'cbor/common.h',
28		'cbor/data.h',
29		'cbor/encoding.h',
30		'cbor/floats_ctrls.h',
31		'cbor/ints.h',
32		'cbor/maps.h',
33		'cbor/serialization.h',
34		'cbor/streaming.h',
35		'cbor/strings.h',
36		'cbor/tags.h',
37	}),
38	copy('$outdir/include/cbor', '$dir', {'cbor_export.h'}),
39	'$outdir/include/cbor/configuration.h',
40}
41pkg.deps = {'$gendir/headers'}
42
43lib('libcbor.a', [[
44	src/cbor.c
45	src/cbor/(
46		streaming.c
47		internal/(
48			encoders.c
49			builder_callbacks.c
50			loaders.c
51			memory_utils.c
52			stack.c
53			unicode.c
54		)
55		encoding.c
56		serialization.c
57		arrays.c
58		common.c
59		floats_ctrls.c
60		bytestrings.c
61		callbacks.c
62		strings.c
63		maps.c
64		tags.c
65		ints.c
66	)
67]])
68
69fetch 'git'