1 | #
|
---|
2 | # Copyright (c) 2025 Jiri Svoboda
|
---|
3 | # Copyright (c) 2005 Martin Decky
|
---|
4 | # Copyright (c) 2007 Jakub Jermar
|
---|
5 | # All rights reserved.
|
---|
6 | #
|
---|
7 | # Redistribution and use in source and binary forms, with or without
|
---|
8 | # modification, are permitted provided that the following conditions
|
---|
9 | # are met:
|
---|
10 | #
|
---|
11 | # - Redistributions of source code must retain the above copyright
|
---|
12 | # notice, this list of conditions and the following disclaimer.
|
---|
13 | # - Redistributions in binary form must reproduce the above copyright
|
---|
14 | # notice, this list of conditions and the following disclaimer in the
|
---|
15 | # documentation and/or other materials provided with the distribution.
|
---|
16 | # - The name of the author may not be used to endorse or promote products
|
---|
17 | # derived from this software without specific prior written permission.
|
---|
18 | #
|
---|
19 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
20 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
21 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
22 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
23 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
24 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
25 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
26 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
27 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
28 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
29 | #
|
---|
30 |
|
---|
31 | # libarch
|
---|
32 | arch_src = []
|
---|
33 | subdir('arch' / UARCH)
|
---|
34 |
|
---|
35 | c_args = [ '-fno-builtin', '-D_LIBC_SOURCE' ]
|
---|
36 |
|
---|
37 | root_path = '..' / '..' / '..'
|
---|
38 |
|
---|
39 | incdirs = [
|
---|
40 | 'include',
|
---|
41 | 'arch' / UARCH / 'include',
|
---|
42 | root_path / 'abi' / 'arch' / UARCH / 'include',
|
---|
43 | root_path / 'abi' / 'include',
|
---|
44 | root_path / 'common' / 'include',
|
---|
45 | ]
|
---|
46 |
|
---|
47 | includes += include_directories(incdirs, is_system: true)
|
---|
48 |
|
---|
49 | allow_shared = true
|
---|
50 |
|
---|
51 | uspace_lib_devel_install_script_text += 'mkdir -p "${DESTDIR}include/libc"'
|
---|
52 | foreach idir : incdirs
|
---|
53 | _sdir = meson.current_source_dir() / idir
|
---|
54 | uspace_lib_devel_install_script_text += 'cp -R -L -T "@0@" "${DESTDIR}include/libc"'.format(_sdir)
|
---|
55 | exported_devel_files += ['include', _sdir, 'libc']
|
---|
56 | endforeach
|
---|
57 |
|
---|
58 | src = [ arch_src ]
|
---|
59 |
|
---|
60 | src += files(
|
---|
61 | 'common/adt/bitmap.c',
|
---|
62 | 'common/adt/checksum.c',
|
---|
63 | 'common/adt/circ_buf.c',
|
---|
64 | 'common/adt/hash_table.c',
|
---|
65 | 'common/adt/list.c',
|
---|
66 | 'common/adt/odict.c',
|
---|
67 | 'common/gsort.c',
|
---|
68 | 'common/printf/printf_core.c',
|
---|
69 | 'common/stdc/bsearch.c',
|
---|
70 | 'common/stdc/calloc.c',
|
---|
71 | 'common/stdc/ctype.c',
|
---|
72 | 'common/stdc/mem.c',
|
---|
73 | 'common/stdc/qsort.c',
|
---|
74 | 'common/stdc/snprintf.c',
|
---|
75 | 'common/stdc/uchar.c',
|
---|
76 | 'common/stdc/vsnprintf.c',
|
---|
77 | 'common/stdc/wchar.c',
|
---|
78 | 'common/str.c',
|
---|
79 | 'common/str_error.c',
|
---|
80 | 'common/strtol.c',
|
---|
81 |
|
---|
82 | 'generic/adt/prodcons.c',
|
---|
83 | 'generic/arg_parse.c',
|
---|
84 | 'generic/as.c',
|
---|
85 | 'generic/assert.c',
|
---|
86 | 'generic/async/client.c',
|
---|
87 | 'generic/async/ports.c',
|
---|
88 | 'generic/async/server.c',
|
---|
89 | 'generic/capa.c',
|
---|
90 | 'generic/config.c',
|
---|
91 | 'generic/context.c',
|
---|
92 | 'generic/dbgcon.c',
|
---|
93 | 'generic/ddi.c',
|
---|
94 | 'generic/device/clock_dev.c',
|
---|
95 | 'generic/device/hw_res.c',
|
---|
96 | 'generic/device/hw_res_parsed.c',
|
---|
97 | 'generic/device/pio_window.c',
|
---|
98 | 'generic/dirent.c',
|
---|
99 | 'generic/dlfcn.c',
|
---|
100 | 'generic/double_to_str.c',
|
---|
101 | 'generic/elf/elf.c',
|
---|
102 | 'generic/elf/elf_load.c',
|
---|
103 | 'generic/elf/elf_mod.c',
|
---|
104 | 'generic/errno.c',
|
---|
105 | 'generic/event.c',
|
---|
106 | 'generic/getopt.c',
|
---|
107 | 'generic/ieee_double.c',
|
---|
108 | 'generic/imath.c',
|
---|
109 | 'generic/inttypes.c',
|
---|
110 | 'generic/io/asprintf.c',
|
---|
111 | 'generic/io/io.c',
|
---|
112 | 'generic/io/kio.c',
|
---|
113 | 'generic/io/klog.c',
|
---|
114 | 'generic/io/log.c',
|
---|
115 | 'generic/io/logctl.c',
|
---|
116 | 'generic/io/printf.c',
|
---|
117 | 'generic/io/table.c',
|
---|
118 | 'generic/io/vprintf.c',
|
---|
119 | 'generic/ipc.c',
|
---|
120 | 'generic/irq.c',
|
---|
121 | 'generic/l18n/langs.c',
|
---|
122 | 'generic/libc.c',
|
---|
123 | 'generic/loader.c',
|
---|
124 | 'generic/loc.c',
|
---|
125 | 'generic/malloc.c',
|
---|
126 | 'generic/ns.c',
|
---|
127 | 'generic/pcb.c',
|
---|
128 | 'generic/perm.c',
|
---|
129 | 'generic/pio_trace.c',
|
---|
130 | 'generic/power_of_ten.c',
|
---|
131 | 'generic/rndgen.c',
|
---|
132 | 'generic/setjmp.c',
|
---|
133 | 'generic/shutdown.c',
|
---|
134 | 'generic/smc.c',
|
---|
135 | 'generic/stack.c',
|
---|
136 | 'generic/stacktrace.c',
|
---|
137 | 'generic/stats.c',
|
---|
138 | 'generic/stdio.c',
|
---|
139 | 'generic/stdio/scanf.c',
|
---|
140 | 'generic/stdio/sprintf.c',
|
---|
141 | 'generic/stdio/sscanf.c',
|
---|
142 | 'generic/stdio/sstream.c',
|
---|
143 | 'generic/stdio/vsprintf.c',
|
---|
144 | 'generic/stdlib.c',
|
---|
145 | 'generic/string.c',
|
---|
146 | 'generic/sysinfo.c',
|
---|
147 | 'generic/task.c',
|
---|
148 | 'generic/thread/fibril.c',
|
---|
149 | 'generic/thread/fibril_synch.c',
|
---|
150 | 'generic/thread/futex.c',
|
---|
151 | 'generic/thread/mpsc.c',
|
---|
152 | 'generic/thread/thread.c',
|
---|
153 | 'generic/thread/tls.c',
|
---|
154 | 'generic/time.c',
|
---|
155 | 'generic/tmpfile.c',
|
---|
156 | 'generic/ubsan.c',
|
---|
157 | 'generic/udebug.c',
|
---|
158 | 'generic/uuid.c',
|
---|
159 | 'generic/vfs/canonify.c',
|
---|
160 | 'generic/vfs/inbox.c',
|
---|
161 | 'generic/vfs/mtab.c',
|
---|
162 | 'generic/vfs/vfs.c',
|
---|
163 | )
|
---|
164 |
|
---|
165 | if CONFIG_RTLD
|
---|
166 | src += files(
|
---|
167 | 'generic/rtld/dynamic.c',
|
---|
168 | 'generic/rtld/module.c',
|
---|
169 | 'generic/rtld/rtld.c',
|
---|
170 | 'generic/rtld/symbol.c',
|
---|
171 | )
|
---|
172 | endif
|
---|
173 |
|
---|
174 | test_src = files(
|
---|
175 | 'test/adt/circ_buf.c',
|
---|
176 | 'test/adt/odict.c',
|
---|
177 | 'test/capa.c',
|
---|
178 | 'test/casting.c',
|
---|
179 | 'test/double_to_str.c',
|
---|
180 | 'test/fibril/timer.c',
|
---|
181 | 'test/getopt.c',
|
---|
182 | 'test/gsort.c',
|
---|
183 | 'test/ieee_double.c',
|
---|
184 | 'test/imath.c',
|
---|
185 | 'test/inttypes.c',
|
---|
186 | 'test/io/table.c',
|
---|
187 | 'test/loc.c',
|
---|
188 | 'test/main.c',
|
---|
189 | 'test/mem.c',
|
---|
190 | 'test/perf.c',
|
---|
191 | 'test/perm.c',
|
---|
192 | 'test/qsort.c',
|
---|
193 | 'test/sprintf.c',
|
---|
194 | 'test/stdio.c',
|
---|
195 | 'test/stdio/scanf.c',
|
---|
196 | 'test/stdlib.c',
|
---|
197 | 'test/str.c',
|
---|
198 | 'test/string.c',
|
---|
199 | 'test/strtol.c',
|
---|
200 | 'test/uchar.c',
|
---|
201 | 'test/uuid.c',
|
---|
202 | )
|
---|
203 |
|
---|
204 | # Startfiles.
|
---|
205 | # This is what other systems know as crt*.o files, i.e. a set of object files
|
---|
206 | # that are automatically built into every program binary (but not libraries).
|
---|
207 | # We haven't yet installed the object files where the compiler can find them,
|
---|
208 | # so we have to add them manually.
|
---|
209 | #
|
---|
210 |
|
---|
211 | start_src = [ arch_start_src, files('generic/crt/crt1.c') ]
|
---|
212 |
|
---|
213 | libstartfiles = static_library('startfiles', start_src,
|
---|
214 | include_directories: includes,
|
---|
215 | c_args: arch_uspace_c_args + c_args,
|
---|
216 | pic: false,
|
---|
217 | )
|
---|
218 | exported_devel_files += ['staticlib', libstartfiles, 'libstartfiles.a']
|
---|
219 |
|
---|
220 | if CONFIG_DEVEL_FILES
|
---|
221 | install_files += [[ 'lib', libstartfiles.full_path(), 'libstartfiles.a' ]]
|
---|
222 | install_deps += [ libstartfiles ]
|
---|
223 | endif
|
---|