1 | if CONFIG_DEVEL_FILES
|
---|
2 | # If devel files are requested, we have to install libgcc.
|
---|
3 | # We have to explicitly use gcc for this, because clang only prints
|
---|
4 | # file name instead of whole path.
|
---|
5 | libgcc = run_command(cc_arch + '-helenos-gcc',
|
---|
6 | arch_uspace_c_args, '-print-libgcc-file-name',
|
---|
7 | check: true,
|
---|
8 | ).stdout().strip()
|
---|
9 |
|
---|
10 | install_files += [[ 'lib', libgcc, 'libgcc.a' ]]
|
---|
11 | install_deps += [ files(libgcc) ]
|
---|
12 | endif
|
---|
13 |
|
---|
14 | # Emit the install script.
|
---|
15 |
|
---|
16 | install_script_text = []
|
---|
17 |
|
---|
18 | # Copy uspace/dist.
|
---|
19 | _uspace = meson.current_source_dir() / 'uspace'
|
---|
20 | install_script_text += 'cp -r -L -T -u "@0@/dist" "${DESTDIR}"'.format(_uspace)
|
---|
21 |
|
---|
22 | # Copy uspace/overlay
|
---|
23 | install_script_text += 'if ls @0@/overlay/* >/dev/null 2>/dev/null; then'.format(_uspace)
|
---|
24 | install_script_text += 'cp -r -L @0@/overlay/* "${DESTDIR}"'.format(_uspace)
|
---|
25 | install_script_text += 'fi'
|
---|
26 |
|
---|
27 |
|
---|
28 | foreach f : install_files
|
---|
29 | _cmd = 'mkdir -p "${DESTDIR}@0@" && cp -L -T "@1@" "${DESTDIR}@0@/@2@"'
|
---|
30 | install_script_text += _cmd.format(f[0], f[1], f[2])
|
---|
31 | endforeach
|
---|
32 |
|
---|
33 | install_script_text += uspace_lib_install_script_text
|
---|
34 |
|
---|
35 | install_script = configure_file(
|
---|
36 | configuration: { 'text' : '\n'.join(install_script_text) },
|
---|
37 | input: 'install.sh.in',
|
---|
38 | output: 'install.sh',
|
---|
39 | )
|
---|
40 |
|
---|
41 | # Build up dist
|
---|
42 |
|
---|
43 | dist_dir = meson.current_build_dir()/'dist/'
|
---|
44 |
|
---|
45 | dist = custom_target('DIST',
|
---|
46 | output: 'dist.tag',
|
---|
47 | input: [ install_script, install_deps ],
|
---|
48 | command: [ sh, '@INPUT0@', '@OUTPUT@', dist_dir ],
|
---|
49 | )
|
---|
50 |
|
---|
51 | # Build initrd image
|
---|
52 |
|
---|
53 | if RDFMT == 'tmpfs'
|
---|
54 | initrd_cmd = [ 'tar', '-c', '-f', '@OUTPUT@', '-C', dist_dir, '.' ]
|
---|
55 | elif RDFMT == 'fat'
|
---|
56 | initrd_cmd = [ mkfat, '1048576', dist_dir, '@OUTPUT@' ]
|
---|
57 | elif RDFMT == 'ext4fs'
|
---|
58 | initrd_cmd = [ mkext4, '1048576', dist_dir, '@OUTPUT@' ]
|
---|
59 | else
|
---|
60 | error('Unknown RDFMT: ' + RDFMT)
|
---|
61 | endif
|
---|
62 |
|
---|
63 | initrd_img = custom_target('initrd.img',
|
---|
64 | output: 'initrd.img',
|
---|
65 | input: dist,
|
---|
66 | command: initrd_cmd,
|
---|
67 | )
|
---|
68 |
|
---|
69 | rd_init_binaries += [[ initrd_img, 'boot/initrd.img' ]]
|
---|