summaryrefslogtreecommitdiff
path: root/lib/mlibc/sysdeps/managarm/meson.build
blob: 3b85e30ec02e4f081d682fb7d941537aac7100f3 (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145

bragi = find_program('bragi')

bragi_gen = generator(bragi, arguments: [
		'-l', 'frigg',
		'--protobuf',
		'@INPUT@',
		'@OUTPUT@'
	],
	output: '@BASENAME@.frigg_bragi.hpp')

fs_bragi = bragi_gen.process('../../subprojects/managarm/protocols/fs/fs.bragi')
posix_bragi = bragi_gen.process('../../subprojects/managarm/protocols/posix/posix.bragi')

managarm_incl = include_directories(
		'../../subprojects/managarm/protocols/posix/include',
		'../../subprojects/managarm/hel/include',
		'../../subprojects/bragi/include')

rtdl_include_dirs += managarm_incl
rtdl_sources += files(
	'generic/ensure.cpp',
	'generic/memory.cpp',
	'rtdl-generic/support.cpp',
)
rtdl_sources += [
	fs_bragi,
	posix_bragi,
]

libc_include_dirs += include_directories('../../../ports/libdrm/include')
libc_include_dirs += managarm_incl

libc_sources += files(
	'generic/drm.cpp',
	'generic/ensure.cpp',
	'generic/entry.cpp',
	'generic/file.cpp',
	'generic/fork-exec.cpp',
	'generic/ioctl.cpp',
	'generic/memory.cpp',
	'generic/mount.cpp',
	'generic/net.cpp',
	'generic/sched.cpp',
	'generic/signals.cpp',
	'generic/socket.cpp',
	'generic/time.cpp'
)
libc_sources += [
	fs_bragi,
	posix_bragi,
]

if host_machine.cpu_family() == 'aarch64'
	libc_sources += files(
		'aarch64/signals.S',
		'aarch64/thread_entry.S',
		'aarch64/thread.cpp'
	)
elif host_machine.cpu_family() == 'x86_64'
	libc_sources += files(
		'x86_64/signals.S',
		'x86_64/thread_entry.S',
		'x86_64/thread.cpp'
	)
else
	error('Unknown architecture')
endif

if not no_headers
	install_headers(
		'include/abi-bits/access.h',
		'include/abi-bits/auxv.h',
		'include/abi-bits/seek-whence.h',
		'include/abi-bits/vm-flags.h',
		'include/abi-bits/errno.h',
		'include/abi-bits/fcntl.h',
		'include/abi-bits/in.h',
		'include/abi-bits/stat.h',
		'include/abi-bits/signal.h',
		'include/abi-bits/reboot.h',
		'include/abi-bits/resource.h',
		'include/abi-bits/socket.h',
		'include/abi-bits/termios.h',
		'include/abi-bits/time.h',
		'include/abi-bits/blkcnt_t.h',
		'include/abi-bits/blksize_t.h',
		'include/abi-bits/dev_t.h',
		'include/abi-bits/gid_t.h',
		'include/abi-bits/ino_t.h',
		'include/abi-bits/mode_t.h',
		'include/abi-bits/nlink_t.h',
		'include/abi-bits/pid_t.h',
		'include/abi-bits/uid_t.h',
		'include/abi-bits/wait.h',
		'include/abi-bits/limits.h',
		'include/abi-bits/utsname.h',
		'include/abi-bits/ptrace.h',
		'include/abi-bits/poll.h',
		'include/abi-bits/epoll.h',
		'include/abi-bits/packet.h',
		'include/abi-bits/inotify.h',
		'include/abi-bits/clockid_t.h',
		'include/abi-bits/shm.h',
		'include/abi-bits/mqueue.h',
		'include/abi-bits/suseconds_t.h',
		'include/abi-bits/fsfilcnt_t.h',
		'include/abi-bits/fsblkcnt_t.h',
		'include/abi-bits/socklen_t.h',
		'include/abi-bits/statfs.h',
		'include/abi-bits/statvfs.h',
		'include/abi-bits/ioctls.h',
		'include/abi-bits/xattr.h',
		'include/abi-bits/msg.h',
		'include/abi-bits/vt.h',
		subdir: 'abi-bits',
		follow_symlinks: true
	)
endif

if not headers_only
	crtstuff = ['crt0']
	if host_machine.cpu_family() in ['x86_64', 'aarch64']
		crtstuff += [
			'Scrt1',
			'crti',
			'crtn'
		]
	endif
	foreach crtthing : crtstuff
		crtf = crtthing + '.S'
		crt_src = files(host_machine.cpu_family() / 'crt-src' / crtf)
		crt = custom_target(
			crtthing,
			build_by_default: true,
			command: c_compiler.cmd_array() + ['-c', '-o', '@OUTPUT@', '@INPUT@'],
			input: crt_src,
			output: crtthing + '.o',
			install: true,
			install_dir: get_option('libdir')
		)
	endforeach

endif