[5fd05862] | 1 | # TODO: Use vcs_tag() to generate version string
|
---|
| 2 | # TODO: jobfile
|
---|
| 3 | # TODO: lto
|
---|
| 4 | # TODO: CONFIG_BUILD_SHARED_LIBS
|
---|
| 5 | # TODO: fix clang build
|
---|
| 6 |
|
---|
| 7 | project(
|
---|
| 8 | 'HelenOS',
|
---|
| 9 | [ 'c', 'cpp' ],
|
---|
| 10 | default_options : ['buildtype=plain', 'c_std=gnu11', 'cpp_std=c++17', 'warning_level=3', 'werror=false', 'b_staticpic=false', 'default_library=shared', 'prefix=/' ],
|
---|
[1ef3213] | 11 | meson_version: '>=0.50.1',
|
---|
[5fd05862] | 12 | )
|
---|
| 13 |
|
---|
| 14 | cc = meson.get_compiler('c')
|
---|
| 15 | basename = find_program('basename')
|
---|
| 16 | dirname = find_program('dirname')
|
---|
| 17 | find = find_program('find')
|
---|
| 18 | grep = find_program('grep')
|
---|
| 19 | mkarray = find_program('tools/mkarray_for_meson.sh')
|
---|
| 20 | objdump = find_program('objdump')
|
---|
[98975a8] | 21 | objcopy = find_program('objcopy')
|
---|
[5fd05862] | 22 | sed = find_program('sed')
|
---|
| 23 | unzip = find_program('unzip')
|
---|
| 24 | which = find_program('which')
|
---|
[28fcaee] | 25 | sh = [ find_program('sh'), '-x', '-u', '-e' ]
|
---|
[fd6c8b1] | 26 | mkext4 = find_program('tools/mkext4.py')
|
---|
| 27 | mkfat = find_program('tools/mkfat.py')
|
---|
[5b586b9] | 28 | mkuimage = find_program('tools/mkuimage.py')
|
---|
[28fcaee] | 29 | cp = find_program('cp')
|
---|
| 30 |
|
---|
| 31 | genisoimage = find_program('genisoimage', required: false)
|
---|
| 32 |
|
---|
| 33 | if not genisoimage.found()
|
---|
| 34 | genisoimage = find_program('mkisofs', required: false)
|
---|
| 35 | endif
|
---|
| 36 |
|
---|
| 37 | if not genisoimage.found()
|
---|
| 38 | xorriso = find_program('xorriso', required: false)
|
---|
| 39 |
|
---|
| 40 | if xorriso.found()
|
---|
| 41 | genisoimage = [ xorriso, '-as', 'genisoimage' ]
|
---|
| 42 | else
|
---|
| 43 | error('Need genisoimage, mkisofs or xorriso.')
|
---|
| 44 | endif
|
---|
| 45 | endif
|
---|
| 46 |
|
---|
[5fd05862] | 47 |
|
---|
| 48 | autocheck = generator(find_program('tools/autocheck.awk'),
|
---|
| 49 | arguments: [ '@INPUT@' ],
|
---|
| 50 | output: '@PLAINNAME@.check.c',
|
---|
| 51 | capture: true,
|
---|
| 52 | )
|
---|
| 53 |
|
---|
[3706d93] | 54 | # TODO: bug in Meson
|
---|
| 55 | #gzip = generator(find_program('gzip'),
|
---|
| 56 | # arguments: [ '--no-name', '-9', '--stdout', '@INPUT@' ],
|
---|
| 57 | # output: '@PLAINNAME@.gz',
|
---|
| 58 | # capture: true,
|
---|
| 59 | #)
|
---|
| 60 |
|
---|
| 61 | gzip = [ find_program('gzip'), '--no-name', '-9', '--stdout', '@INPUT@' ]
|
---|
[a73a1453] | 62 |
|
---|
[1ef3213] | 63 | # Tar's arguments make sure that the archive is reproducible.
|
---|
| 64 | tar = [
|
---|
| 65 | find_program('tar'),
|
---|
| 66 | '-c',
|
---|
| 67 | '-f', '@OUTPUT@',
|
---|
| 68 | '--mtime=1970-01-01 00:00:00Z',
|
---|
| 69 | '--group=0',
|
---|
| 70 | '--owner=0',
|
---|
| 71 | '--numeric-owner',
|
---|
| 72 | '--mode=go=rX,u+rw,a-s',
|
---|
| 73 | '--no-acls',
|
---|
| 74 | '--no-selinux',
|
---|
| 75 | '--no-xattrs',
|
---|
| 76 | '--format=ustar',
|
---|
| 77 | '--transform', 's:@OUTDIR@/::',
|
---|
| 78 | '@INPUT@',
|
---|
| 79 | ]
|
---|
[5fd05862] | 80 |
|
---|
| 81 | if get_option('default_library') == 'both'
|
---|
| 82 | error('You must use either shared or static for default_library.')
|
---|
| 83 | endif
|
---|
| 84 |
|
---|
| 85 | debug_options = false
|
---|
| 86 |
|
---|
| 87 | # Output compiler flags for use by third-party builds.
|
---|
| 88 | # NOTE: See $srcroot/meson/cross/$arch for architecture-specific compiler flags.
|
---|
| 89 |
|
---|
| 90 | if debug_options
|
---|
| 91 | message('Cross c_args:')
|
---|
| 92 | message(meson.get_cross_property('c_args'))
|
---|
| 93 | message('Cross cpp_args:')
|
---|
| 94 | message(meson.get_cross_property('cpp_args'))
|
---|
| 95 | message('Cross c_link_args:')
|
---|
| 96 | message(meson.get_cross_property('c_link_args'))
|
---|
| 97 | message('Cross cpp_link_args:')
|
---|
| 98 | message(meson.get_cross_property('cpp_link_args'))
|
---|
| 99 | endif
|
---|
| 100 |
|
---|
| 101 | # Read some variables from Makefile.common
|
---|
| 102 | config_variables = [
|
---|
| 103 | # Uspace and kernel
|
---|
| 104 | 'CONFIG_BAREBONE',
|
---|
| 105 | 'CONFIG_BUILD_SHARED_LIBS',
|
---|
| 106 | 'CONFIG_DEBUG',
|
---|
| 107 | 'CONFIG_DEVEL_FILES',
|
---|
| 108 | 'CONFIG_FPU',
|
---|
| 109 | 'CONFIG_LINE_DEBUG',
|
---|
| 110 | 'CONFIG_PCUT_SELF_TESTS',
|
---|
| 111 | 'CONFIG_PCUT_TESTS',
|
---|
| 112 | 'CONFIG_RTLD',
|
---|
| 113 | 'CONFIG_STRIP_BINARIES',
|
---|
| 114 | 'CONFIG_UBSAN',
|
---|
| 115 | 'CONFIG_USE_SHARED_LIBS',
|
---|
[bc48242] | 116 | 'CROSS_TARGET',
|
---|
[5fd05862] | 117 | 'OPTIMIZATION',
|
---|
| 118 | 'PROCESSOR',
|
---|
[41408d94] | 119 | 'QUADFLOAT',
|
---|
[5fd05862] | 120 | 'RDFMT',
|
---|
| 121 |
|
---|
| 122 | # Kernel only
|
---|
| 123 | 'CONFIG_ACPI',
|
---|
| 124 | 'CONFIG_AM335X_TIMERS',
|
---|
| 125 | 'CONFIG_ASID',
|
---|
| 126 | 'CONFIG_ASID_FIFO',
|
---|
| 127 | 'CONFIG_AT_KBD',
|
---|
| 128 | 'CONFIG_BCM2835_MAILBOX',
|
---|
| 129 | 'CONFIG_DSRLNIN',
|
---|
| 130 | 'CONFIG_DSRLNOUT',
|
---|
| 131 | 'CONFIG_EGA',
|
---|
| 132 | 'CONFIG_FB',
|
---|
| 133 | 'CONFIG_GICV2',
|
---|
| 134 | 'CONFIG_I8042',
|
---|
| 135 | 'CONFIG_I8259',
|
---|
| 136 | 'CONFIG_IOMAP_BITMAP',
|
---|
| 137 | 'CONFIG_IOMAP_DUMMY',
|
---|
| 138 | 'CONFIG_KCONSOLE',
|
---|
| 139 | 'CONFIG_MAC_KBD',
|
---|
| 140 | 'CONFIG_MULTIBOOT',
|
---|
| 141 | 'CONFIG_NS16550',
|
---|
| 142 | 'CONFIG_OFW_PCI',
|
---|
| 143 | 'CONFIG_OFW_TREE',
|
---|
| 144 | 'CONFIG_OMAP_UART',
|
---|
| 145 | 'CONFIG_PAGE_HT',
|
---|
| 146 | 'CONFIG_PAGE_PT',
|
---|
| 147 | 'CONFIG_PC_KBD',
|
---|
| 148 | 'CONFIG_PL011_UART',
|
---|
| 149 | 'CONFIG_PL050',
|
---|
| 150 | 'CONFIG_S3C24XX_IRQC',
|
---|
| 151 | 'CONFIG_S3C24XX_UART',
|
---|
| 152 | 'CONFIG_SMP',
|
---|
| 153 | 'CONFIG_SOFTINT',
|
---|
| 154 | 'CONFIG_SRLN',
|
---|
| 155 | 'CONFIG_SUN_KBD',
|
---|
| 156 | 'CONFIG_SYMTAB',
|
---|
| 157 | 'CONFIG_TEST',
|
---|
| 158 | 'CONFIG_TRACE',
|
---|
[41408d94] | 159 | 'CONFIG_TSB',
|
---|
[5fd05862] | 160 | 'CONFIG_UDEBUG',
|
---|
| 161 | 'CONFIG_VIA_CUDA',
|
---|
| 162 | 'MACHINE',
|
---|
| 163 | 'MEMORY_MODEL',
|
---|
[5f176da] | 164 |
|
---|
| 165 | 'UARCH',
|
---|
| 166 | 'KARCH',
|
---|
[28fcaee] | 167 | 'BARCH',
|
---|
| 168 | 'GRUB_ARCH',
|
---|
[5b586b9] | 169 | 'UIMAGE_OS',
|
---|
[3706d93] | 170 | 'CONFIG_COMPRESSED_INIT',
|
---|
[5fd05862] | 171 | ]
|
---|
| 172 |
|
---|
| 173 | foreach varname : config_variables
|
---|
| 174 | result = run_command(grep, '^' + varname + '\\b', meson.source_root() / 'Makefile.config')
|
---|
| 175 | if result.returncode() != 0
|
---|
| 176 | # TODO: Output negative/inapplicable variables too in config, so that we can check for typos here.
|
---|
| 177 | #warning('Missing configuration variable ' + varname + ' in Makefile.config')
|
---|
| 178 | set_variable(varname, false)
|
---|
| 179 | continue
|
---|
| 180 | endif
|
---|
| 181 |
|
---|
| 182 | value = result.stdout().split('\n')[0].strip().split('=')[1].strip()
|
---|
| 183 | if value == 'y'
|
---|
| 184 | value = true
|
---|
| 185 | elif value == 'n'
|
---|
| 186 | value = false
|
---|
| 187 | endif
|
---|
| 188 |
|
---|
| 189 | set_variable(varname, value)
|
---|
| 190 | if debug_options
|
---|
| 191 | message([ varname, value ])
|
---|
| 192 | endif
|
---|
| 193 | endforeach
|
---|
| 194 |
|
---|
| 195 | # Also read version information.
|
---|
| 196 | version_variables = [
|
---|
| 197 | 'COPYRIGHT',
|
---|
| 198 | 'NAME',
|
---|
| 199 | 'PATCHLEVEL',
|
---|
| 200 | 'SUBLEVEL',
|
---|
| 201 | 'VERSION',
|
---|
| 202 | ]
|
---|
| 203 |
|
---|
| 204 | foreach varname : version_variables
|
---|
| 205 | line = run_command(grep, '^' + varname + '\\b', meson.source_root() / 'version', check: true).stdout().strip()
|
---|
| 206 | value = line.split('=')[1].strip()
|
---|
| 207 | set_variable('HELENOS_' + varname, value)
|
---|
| 208 | if debug_options
|
---|
| 209 | message([ 'HELENOS_' + varname, value ])
|
---|
| 210 | endif
|
---|
| 211 | endforeach
|
---|
| 212 |
|
---|
| 213 | HELENOS_RELEASE = HELENOS_VERSION + '.' + HELENOS_PATCHLEVEL + '.' + HELENOS_SUBLEVEL
|
---|
| 214 |
|
---|
| 215 | add_project_arguments(
|
---|
| 216 | # TODO: Remove from project arguments and only use where needed.
|
---|
| 217 | '-imacros', join_paths(meson.source_root(), 'config.h'),
|
---|
| 218 | language : [ 'c' ],
|
---|
| 219 | )
|
---|
| 220 |
|
---|
| 221 | add_project_link_arguments(
|
---|
| 222 | cc.get_supported_link_arguments([
|
---|
| 223 | '-Wl,--gc-sections',
|
---|
| 224 | '-Wl,--warn-common',
|
---|
| 225 | ]),
|
---|
| 226 | '-Wl,--fatal-warnings',
|
---|
| 227 | language : [ 'c', 'cpp' ],
|
---|
| 228 | )
|
---|
| 229 |
|
---|
| 230 | # TODO: enable more warnings
|
---|
| 231 | # FIXME: -fno-builtin-strftime works around seemingly spurious format warning.
|
---|
| 232 | # We should investigate what's going on there.
|
---|
| 233 |
|
---|
| 234 | extra_common_flags = [
|
---|
| 235 | '-O' + OPTIMIZATION,
|
---|
| 236 | '-fexec-charset=UTF-8',
|
---|
| 237 | '-finput-charset=UTF-8',
|
---|
| 238 |
|
---|
| 239 | '-D_HELENOS_SOURCE',
|
---|
| 240 | '-Wa,--fatal-warnings',
|
---|
| 241 |
|
---|
| 242 | '-Wall',
|
---|
| 243 | '-Wextra',
|
---|
| 244 |
|
---|
| 245 | '-Werror-implicit-function-declaration',
|
---|
| 246 |
|
---|
| 247 | '-Wwrite-strings',
|
---|
| 248 | '-Wsystem-headers',
|
---|
| 249 | '-Wunknown-pragmas',
|
---|
| 250 |
|
---|
| 251 | '-Wno-unused-parameter',
|
---|
| 252 |
|
---|
| 253 | '-pipe',
|
---|
| 254 | '-ffunction-sections',
|
---|
| 255 |
|
---|
| 256 | '-fno-common',
|
---|
| 257 |
|
---|
| 258 | '-fdebug-prefix-map=' + meson.source_root() + '=.',
|
---|
| 259 | ]
|
---|
| 260 |
|
---|
[5f176da] | 261 | if UARCH != 'ia64'
|
---|
[5fd05862] | 262 | extra_common_flags += [ '-fvar-tracking-assignments' ]
|
---|
| 263 | endif
|
---|
| 264 |
|
---|
| 265 | if CONFIG_DEBUG
|
---|
| 266 | extra_common_flags += [ '-Werror' ]
|
---|
| 267 | endif
|
---|
| 268 |
|
---|
| 269 | if CONFIG_LINE_DEBUG
|
---|
| 270 | extra_common_flags += [ '-gdwarf-4', '-g3' ]
|
---|
| 271 | endif
|
---|
| 272 |
|
---|
| 273 | extra_cflags = extra_common_flags + [
|
---|
| 274 | '-Wmissing-prototypes',
|
---|
| 275 |
|
---|
| 276 | '-Wno-missing-braces',
|
---|
| 277 | '-Wno-missing-field-initializers',
|
---|
| 278 | '-Wno-unused-command-line-argument',
|
---|
| 279 | '-Wno-unused-parameter',
|
---|
| 280 | '-Wno-typedef-redefinition',
|
---|
| 281 | '-Wno-clobbered',
|
---|
| 282 | '-Wno-nonnull-compare',
|
---|
| 283 |
|
---|
| 284 | '-fno-builtin-strftime',
|
---|
| 285 | ]
|
---|
| 286 |
|
---|
| 287 | if CONFIG_UBSAN
|
---|
| 288 | extra_cflags += '-fsanitize=undefined'
|
---|
| 289 | endif
|
---|
| 290 |
|
---|
| 291 | extra_cppflags = extra_common_flags + [
|
---|
| 292 | '-fno-exceptions',
|
---|
| 293 | '-frtti',
|
---|
| 294 | ]
|
---|
| 295 |
|
---|
| 296 | w_flags = {
|
---|
| 297 | 'c': extra_cflags,
|
---|
| 298 | 'cpp': extra_cppflags,
|
---|
| 299 | }
|
---|
| 300 |
|
---|
| 301 | # Process flags. Only sets those that compiler supports.
|
---|
| 302 | foreach lang : [ 'c', 'cpp' ]
|
---|
| 303 | extra_cflags = meson.get_compiler(lang).get_supported_arguments(w_flags.get(lang))
|
---|
| 304 | add_project_arguments(extra_cflags, language : [ lang ])
|
---|
| 305 | add_project_link_arguments(extra_cflags, language : [ lang ])
|
---|
| 306 | endforeach
|
---|
| 307 |
|
---|
[63660a3] | 308 | # Init binaries.
|
---|
| 309 | rd_init = [
|
---|
[28fcaee] | 310 | # IMPORTANT: The order of entries is important for bootloader!
|
---|
| 311 | 'srv/ns',
|
---|
[63660a3] | 312 | 'srv/loader',
|
---|
[28fcaee] | 313 | 'app/init',
|
---|
[63660a3] | 314 | 'srv/locsrv',
|
---|
[28fcaee] | 315 | 'srv/bd/rd',
|
---|
[63660a3] | 316 | 'srv/vfs',
|
---|
[28fcaee] | 317 | 'srv/logger',
|
---|
| 318 | 'srv/fs/' + RDFMT,
|
---|
[63660a3] | 319 | ]
|
---|
| 320 |
|
---|
[28fcaee] | 321 | # References to the actual binary files. Filled in by uspace.
|
---|
| 322 | rd_init_binaries = []
|
---|
| 323 |
|
---|
[63660a3] | 324 | # Binaries allowed on the initrd image when CONFIG_BAREBONE is enabled.
|
---|
[d197d25a] | 325 | rd_essential = [
|
---|
[63660a3] | 326 | 'app/bdsh',
|
---|
| 327 | 'app/getterm',
|
---|
| 328 | 'app/kio',
|
---|
| 329 |
|
---|
| 330 | 'srv/devman',
|
---|
| 331 | 'srv/fs/locfs',
|
---|
[7b1ae09] | 332 | 'srv/hid/console',
|
---|
[63660a3] | 333 | 'srv/hid/input',
|
---|
| 334 | 'srv/hid/output',
|
---|
| 335 | 'srv/klog',
|
---|
| 336 |
|
---|
| 337 | 'drv/root/root',
|
---|
| 338 | 'drv/root/virt',
|
---|
| 339 | 'drv/fb/kfb',
|
---|
| 340 | ]
|
---|
| 341 |
|
---|
| 342 | if CONFIG_FB
|
---|
| 343 | rd_essential += [
|
---|
| 344 | 'app/vlaunch',
|
---|
| 345 | 'app/vterm',
|
---|
[7b1ae09] | 346 |
|
---|
| 347 | 'srv/hid/compositor',
|
---|
[63660a3] | 348 | ]
|
---|
| 349 | endif
|
---|
| 350 |
|
---|
| 351 |
|
---|
| 352 | ## The at-sign
|
---|
| 353 | #
|
---|
| 354 | # The `atsign` variable holds the ASCII character representing the at-sign
|
---|
| 355 | # ('@') used in various $(AS) constructs (e.g. @progbits). On architectures that
|
---|
| 356 | # don't use '@' for starting a comment, `atsign` is merely '@'. However, on
|
---|
| 357 | # those that do use it for starting a comment (e.g. arm32), `atsign` must be
|
---|
| 358 | # defined as the percentile-sign ('%') in the architecture-dependent files.
|
---|
| 359 | #
|
---|
| 360 | atsign = '@'
|
---|
| 361 |
|
---|
| 362 | ## Some architectures need a particular string at the beginning of assembly files.
|
---|
| 363 | kernel_as_prolog = ''
|
---|
| 364 | uspace_as_prolog = ''
|
---|
| 365 |
|
---|
[5f176da] | 366 | subdir('meson' / 'arch' / UARCH)
|
---|
[63660a3] | 367 |
|
---|
[740e952] | 368 | install_files = []
|
---|
| 369 | install_deps = []
|
---|
| 370 |
|
---|
[2fff3c4] | 371 | subdir('kernel')
|
---|
[5fd05862] | 372 | subdir('uspace')
|
---|
| 373 |
|
---|
| 374 |
|
---|
| 375 | ## Generate config.mk
|
---|
| 376 |
|
---|
| 377 | # Get the directory where the compiler resides.
|
---|
| 378 |
|
---|
| 379 | cc_fullname = run_command(which, meson.get_compiler('c').cmd_array()[0].split(' ')[0], check: true).stdout().strip()
|
---|
| 380 | cc_path = run_command(dirname, cc_fullname, check: true).stdout().strip()
|
---|
| 381 |
|
---|
| 382 | message(['Compiler directory is:', cc_path])
|
---|
| 383 |
|
---|
| 384 | export_cppflags = [
|
---|
| 385 | '-isystem', '$(HELENOS_EXPORT_ROOT)/include/posix',
|
---|
| 386 | '-isystem', '$(HELENOS_EXPORT_ROOT)/include/libc',
|
---|
| 387 | '-idirafter', '$(HELENOS_EXPORT_ROOT)/include',
|
---|
| 388 | ]
|
---|
| 389 |
|
---|
| 390 | export_ldflags = [
|
---|
| 391 | '-nostdlib',
|
---|
| 392 | '-L$(HELENOS_EXPORT_ROOT)/lib',
|
---|
| 393 | '-Wl,--whole-archive',
|
---|
| 394 | '$(HELENOS_EXPORT_ROOT)/lib/libstartfiles.a',
|
---|
| 395 | '-Wl,--no-whole-archive',
|
---|
| 396 | ]
|
---|
| 397 |
|
---|
| 398 | export_ldlibs = [
|
---|
| 399 | '-Wl,--as-needed',
|
---|
| 400 | '-lposix',
|
---|
| 401 | '-lmath',
|
---|
| 402 | '-lc',
|
---|
| 403 | '-lgcc',
|
---|
| 404 | '-Wl,--no-as-needed',
|
---|
| 405 | ]
|
---|
| 406 |
|
---|
| 407 | cc_arch = meson.get_cross_property('cc_arch')
|
---|
| 408 |
|
---|
| 409 | conf_data = configuration_data({
|
---|
| 410 | 'HELENOS_CROSS_PATH' : cc_path,
|
---|
| 411 | 'HELENOS_ARCH' : cc_arch,
|
---|
[63660a3] | 412 | 'HELENOS_CFLAGS' : ' '.join(arch_uspace_c_args),
|
---|
| 413 | 'HELENOS_CXXFLAGS' : ' '.join(arch_uspace_c_args),
|
---|
[5fd05862] | 414 | 'HELENOS_CPPFLAGS' : ' '.join(export_cppflags),
|
---|
| 415 | 'HELENOS_LDFLAGS' : ' '.join(export_ldflags),
|
---|
| 416 | 'HELENOS_LDLIBS' : ' '.join(export_ldlibs),
|
---|
| 417 | 'HELENOS_TARGET' : cc_arch + '-helenos',
|
---|
| 418 | })
|
---|
| 419 |
|
---|
| 420 | config_mk = configure_file(
|
---|
| 421 | input: 'config.mk.in',
|
---|
| 422 | output: 'config.mk',
|
---|
| 423 | configuration: conf_data,
|
---|
| 424 | )
|
---|
| 425 |
|
---|
[123cd6d] | 426 | config_sh = custom_target('config.sh',
|
---|
[5fd05862] | 427 | input: config_mk,
|
---|
| 428 | output: 'config.sh',
|
---|
| 429 | command: [ sed, 's:$(HELENOS_EXPORT_ROOT):${HELENOS_EXPORT_ROOT}:g', '@INPUT@' ],
|
---|
| 430 | capture: true,
|
---|
| 431 | )
|
---|
| 432 |
|
---|
[b2695b9] | 433 | install_files += [[ 'config', meson.current_build_dir() / 'config.mk', 'config.mk' ]]
|
---|
[123cd6d] | 434 | install_deps += [ config_mk ]
|
---|
[b2695b9] | 435 | install_files += [[ 'config', meson.current_build_dir() / 'config.sh', 'config.sh' ]]
|
---|
[123cd6d] | 436 | install_deps += [ config_sh ]
|
---|
[b2695b9] | 437 |
|
---|
| 438 | # TODO: remove
|
---|
| 439 | install_files += [[ 'config', meson.current_source_dir() / 'Makefile.common', 'Makefile.common' ]]
|
---|
[123cd6d] | 440 | install_deps += files('Makefile.common')
|
---|
[b2695b9] | 441 | install_files += [[ 'config', meson.current_source_dir() / 'Makefile.config', 'Makefile.config' ]]
|
---|
[123cd6d] | 442 | install_deps += files('Makefile.config')
|
---|
[740e952] | 443 |
|
---|
[123cd6d] | 444 | if CONFIG_DEVEL_FILES
|
---|
| 445 | # Also install libgcc
|
---|
| 446 | libgcc = run_command(
|
---|
| 447 | cc.cmd_array(), arch_uspace_c_args, '-print-libgcc-file-name',
|
---|
| 448 | check: true,
|
---|
| 449 | ).stdout().strip()
|
---|
| 450 |
|
---|
| 451 | install_files += [[ 'lib', libgcc, 'libgcc.a' ]]
|
---|
| 452 | install_deps += [ files(libgcc) ]
|
---|
| 453 | endif
|
---|
[740e952] | 454 |
|
---|
[123cd6d] | 455 |
|
---|
| 456 | # Emit the install script.
|
---|
[740e952] | 457 |
|
---|
| 458 | install_script_text = []
|
---|
| 459 |
|
---|
[123cd6d] | 460 | # Copy uspace/dist.
|
---|
| 461 | _uspace = meson.current_source_dir() / 'uspace'
|
---|
| 462 | install_script_text += 'cp -r -L -T -u "@0@/dist" "${DESTDIR}"'.format(_uspace)
|
---|
| 463 |
|
---|
[2d75831] | 464 | # Copy uspace/overlay
|
---|
| 465 | install_script_text += 'if ls @0@/overlay/* >/dev/null 2>/dev/null; then'.format(_uspace)
|
---|
| 466 | install_script_text += 'cp -r -L @0@/overlay/* "${DESTDIR}"'.format(_uspace)
|
---|
| 467 | install_script_text += 'fi'
|
---|
| 468 |
|
---|
| 469 |
|
---|
[740e952] | 470 | foreach f : install_files
|
---|
[b2695b9] | 471 | _cmd = 'mkdir -p "${DESTDIR}@0@" && cp -L -T "@1@" "${DESTDIR}@0@/@2@"'
|
---|
[740e952] | 472 | install_script_text += _cmd.format(f[0], f[1], f[2])
|
---|
| 473 | endforeach
|
---|
| 474 |
|
---|
| 475 | install_script_text += uspace_lib_install_script_text
|
---|
| 476 |
|
---|
[b2695b9] | 477 | install_script = configure_file(
|
---|
[740e952] | 478 | configuration: { 'text' : '\n'.join(install_script_text) },
|
---|
| 479 | input: 'install.sh.in',
|
---|
| 480 | output: 'install.sh',
|
---|
| 481 | )
|
---|
| 482 |
|
---|
[123cd6d] | 483 | # Build up dist
|
---|
[b2695b9] | 484 |
|
---|
[fd6c8b1] | 485 | dist_dir = meson.current_build_dir()/'dist/'
|
---|
| 486 |
|
---|
[123cd6d] | 487 | dist = custom_target('DIST',
|
---|
| 488 | output: 'dist.tag',
|
---|
[b2695b9] | 489 | input: [ install_script, install_deps ],
|
---|
[28fcaee] | 490 | command: [ sh, '@INPUT0@', '@OUTPUT@', dist_dir ],
|
---|
[b2695b9] | 491 | )
|
---|
| 492 |
|
---|
[fd6c8b1] | 493 | # Build initrd image
|
---|
| 494 |
|
---|
| 495 | if RDFMT == 'tmpfs'
|
---|
| 496 | initrd_cmd = [ 'tar', '-c', '-f', '@OUTPUT@', '-C', dist_dir, '.' ]
|
---|
| 497 | elif RDFMT == 'fat'
|
---|
| 498 | initrd_cmd = [ mkfat, '1048576', dist_dir, '@OUTPUT@' ]
|
---|
| 499 | elif RDFMT == 'ext4fs'
|
---|
| 500 | initrd_cmd = [ mkext4, '1048576', dist_dir, '@OUTPUT@' ]
|
---|
| 501 | else
|
---|
| 502 | error('Unknown RDFMT: ' + RDFMT)
|
---|
| 503 | endif
|
---|
[123cd6d] | 504 |
|
---|
[fd6c8b1] | 505 | initrd_img = custom_target('initrd.img',
|
---|
| 506 | output: 'initrd.img',
|
---|
| 507 | input: dist,
|
---|
| 508 | command: initrd_cmd,
|
---|
| 509 | )
|
---|
[123cd6d] | 510 |
|
---|
[28fcaee] | 511 | rd_init_binaries += [[ initrd_img, 'boot/initrd.img' ]]
|
---|
| 512 |
|
---|
| 513 | subdir('boot')
|
---|
| 514 |
|
---|
| 515 | custom_target(POST_OUTPUT,
|
---|
| 516 | output: POST_OUTPUT,
|
---|
| 517 | input: POST_INPUT,
|
---|
| 518 | command: [ cp, '@INPUT@', '@OUTPUT@' ],
|
---|
| 519 | build_by_default: true,
|
---|
| 520 | )
|
---|