source: mainline/uspace/lib/c/meson.build@ 00e6288

topic/simplify-dev-export
Last change on this file since 00e6288 was 00e6288, checked in by Vojtech Horky <vojtech.horky@…>, 2 years ago

Add export-dev target to export all libraries

The new target export-dev builds all libraries and copies the created .a
archives and library headers to export-dev subdirectory.

Unlike the existing approach from tools/export.sh we do not list the
libraries manually but copy all of them automatically. This simplifies
maintenance when new library is added and it should also simplify
coastline builds as no change to HelenOS tree would be needed when the
ported software needs another library not yet mentioned in export.sh.

The approach relies as much on Meson to do the heavy-lifting as possible
and the invoked shell script merely copies the files (seems that Meson
is not able to do that by itself inside a target). The script honors
exported DESTDIR variable if set and ensures thin archives are converted
before export.

  • Property mode set to 100644
File size: 5.6 KB
Line 
1#
2# Copyright (c) 2023 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
32arch_src = []
33subdir('arch' / UARCH)
34
35c_args = [ '-fno-builtin', '-D_LIBC_SOURCE' ]
36
37root_path = '..' / '..' / '..'
38
39incdirs = [
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
47includes += include_directories(incdirs, is_system: true)
48
49allow_shared = true
50
51uspace_lib_devel_install_script_text += 'mkdir -p "${DESTDIR}include/libc"'
52foreach 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']
56endforeach
57
58src = [ arch_src ]
59
60src += files(
61 'common/adt/checksum.c',
62 'common/adt/circ_buf.c',
63 'common/adt/list.c',
64 'common/adt/hash_table.c',
65 'common/adt/odict.c',
66 'common/printf/printf_core.c',
67 'common/stdc/ctype.c',
68 'common/stdc/mem.c',
69 'common/stdc/bsearch.c',
70 'common/stdc/qsort.c',
71 'common/stdc/calloc.c',
72 'common/gsort.c',
73 'common/str.c',
74 'common/str_error.c',
75 'common/strtol.c',
76
77 'generic/libc.c',
78 'generic/adt/prodcons.c',
79 'generic/as.c',
80 'generic/ddi.c',
81 'generic/perm.c',
82 'generic/capa.c',
83 'generic/config.c',
84 'generic/context.c',
85 'generic/device/clock_dev.c',
86 'generic/device/hw_res.c',
87 'generic/device/hw_res_parsed.c',
88 'generic/device/pio_window.c',
89 'generic/dirent.c',
90 'generic/dlfcn.c',
91 'generic/elf/elf.c',
92 'generic/elf/elf_load.c',
93 'generic/elf/elf_mod.c',
94 'generic/event.c',
95 'generic/errno.c',
96 'generic/inttypes.c',
97 'generic/loc.c',
98 'generic/string.c',
99 'generic/l18n/langs.c',
100 'generic/pcb.c',
101 'generic/pio_trace.c',
102 'generic/smc.c',
103 'generic/task.c',
104 'generic/imath.c',
105 'generic/io/asprintf.c',
106 'generic/io/io.c',
107 'generic/io/printf.c',
108 'generic/io/log.c',
109 'generic/io/logctl.c',
110 'generic/io/kio.c',
111 'generic/io/klog.c',
112 'generic/io/snprintf.c',
113 'generic/io/vprintf.c',
114 'generic/io/vsnprintf.c',
115 'generic/io/table.c',
116 'generic/irq.c',
117 'generic/ieee_double.c',
118 'generic/power_of_ten.c',
119 'generic/double_to_str.c',
120 'generic/malloc.c',
121 'generic/rndgen.c',
122 'generic/stdio/scanf.c',
123 'generic/stdio/sprintf.c',
124 'generic/stdio/sscanf.c',
125 'generic/stdio/sstream.c',
126 'generic/stdio/vsprintf.c',
127 'generic/thread/fibril.c',
128 'generic/thread/fibril_synch.c',
129 'generic/thread/thread.c',
130 'generic/thread/tls.c',
131 'generic/thread/futex.c',
132 'generic/thread/mpsc.c',
133 'generic/sysinfo.c',
134 'generic/ipc.c',
135 'generic/ns.c',
136 'generic/async/client.c',
137 'generic/async/server.c',
138 'generic/async/ports.c',
139 'generic/loader.c',
140 'generic/getopt.c',
141 'generic/time.c',
142 'generic/tmpfile.c',
143 'generic/stdio.c',
144 'generic/stdlib.c',
145 'generic/udebug.c',
146 'generic/vfs/canonify.c',
147 'generic/vfs/inbox.c',
148 'generic/vfs/mtab.c',
149 'generic/vfs/vfs.c',
150 'generic/setjmp.c',
151 'generic/stack.c',
152 'generic/stacktrace.c',
153 'generic/arg_parse.c',
154 'generic/stats.c',
155 'generic/assert.c',
156 'generic/ubsan.c',
157 'generic/uuid.c',
158)
159
160if CONFIG_RTLD
161 src += files(
162 'generic/rtld/rtld.c',
163 'generic/rtld/dynamic.c',
164 'generic/rtld/module.c',
165 'generic/rtld/symbol.c',
166 )
167endif
168
169test_src = files(
170 'test/adt/circ_buf.c',
171 'test/adt/odict.c',
172 'test/capa.c',
173 'test/casting.c',
174 'test/double_to_str.c',
175 'test/fibril/timer.c',
176 'test/getopt.c',
177 'test/gsort.c',
178 'test/ieee_double.c',
179 'test/imath.c',
180 'test/inttypes.c',
181 'test/io/table.c',
182 'test/loc.c',
183 'test/main.c',
184 'test/mem.c',
185 'test/perf.c',
186 'test/perm.c',
187 'test/qsort.c',
188 'test/sprintf.c',
189 'test/stdio/scanf.c',
190 'test/stdio.c',
191 'test/stdlib.c',
192 'test/str.c',
193 'test/string.c',
194 'test/strtol.c',
195 'test/uuid.c',
196)
197
198# Startfiles.
199# This is what other systems know as crt*.o files, i.e. a set of object files
200# that are automatically built into every program binary (but not libraries).
201# We haven't yet installed the object files where the compiler can find them,
202# so we have to add them manually.
203#
204
205start_src = [ arch_start_src, files('generic/crt/crt1.c') ]
206
207libstartfiles = static_library('startfiles', start_src,
208 include_directories: includes,
209 c_args: arch_uspace_c_args + c_args,
210 pic: false,
211)
212
213if CONFIG_DEVEL_FILES
214 install_files += [[ 'lib', libstartfiles.full_path(), 'libstartfiles.a' ]]
215 install_deps += [ libstartfiles ]
216endif
Note: See TracBrowser for help on using the repository browser.