~sircmpwn/koio

ref: 0.1.2 koio/meson.build -rw-r--r-- 1.8 KiB
138cc5edSeth Hall Fix an issue with hash collisions returning incorrect values. 2 years ago
                                                                                
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
project(
	'koio',
	'c',
	version: '0.0.1',
	license: 'MIT',
	meson_version: '>=0.43.0',
	default_options: [
		'c_std=c99',
		'warning_level=2',
		'werror=true',
	],
)

# Format of so_version is CURRENT, REVISION, AGE.
# See: https://autotools.io/libtool/version.html
# for a reference about clean library versioning.
so_version = ['0', '0', '0']

add_project_arguments('-Wno-unused-parameter', language: 'c')

koio_inc = include_directories('include')

symbols_file = 'koio.syms'
symbols_flag = '-Wl,--version-script,@0@/@1@'.format(
	meson.current_source_dir(), symbols_file)
lib_koio = library(meson.project_name(),
	[
		'lib/ko_add_alias.c',
		'lib/ko_add_file.c',
		'lib/ko_del_file.c',
		'lib/ko_fopen.c',
		'lib/hashtable.c'
	],
	version: '.'.join(so_version),
	include_directories: koio_inc,
	install: true,
	link_args: symbols_flag,
)

install_headers('include/koio.h')

pkgconfig = import('pkgconfig')
pkgconfig.generate(
	libraries: lib_koio,
	version: meson.project_version(),
	filebase: meson.project_name(),
	name: meson.project_name(),
	description: 'statically embedded filesystem',
)

koio = declare_dependency(
	link_with: lib_koio,
	include_directories: koio_inc,
)

koio_tool = executable(meson.project_name(), [
	'tool/main.c'
], install: true)

cat_gen = custom_target('cat_gen.c',
	build_by_default: true,
	input: ['cat/main.c'],
	output: 'cat_gen.c',
	command: [koio_tool, '-o', '@OUTPUT@', '@INPUT@://main.c']
)

cat = executable('cat', [
		'cat/main.c',
		cat_gen
	],
	dependencies: [koio]
)

scdoc = find_program('scdoc', required: false)

if scdoc.found()
	sh = find_program('sh')
	mandir = get_option('mandir')
	custom_target(
		'koio.1',
		input: 'koio.1.scd',
		output: 'koio.1',
		command: [
			sh, '-c', '@0@ < @INPUT@ > koio.1'.format(scdoc.path())
		],
		install: true,
		install_dir: '@0@/man@1@'.format(mandir, '1')
	)
endif