source: mainline/meson/part/exports/meson.build@ 32ae27bb

Last change on this file since 32ae27bb was 00e6288, checked in by Vojtech Horky <vojtech.horky@…>, 21 months 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: 3.2 KB
Line 
1#
2# Copyright (c) 2019 Jiří Zárevúcky
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions
7# are met:
8#
9# - Redistributions of source code must retain the above copyright
10# notice, this list of conditions and the following disclaimer.
11# - Redistributions in binary form must reproduce the above copyright
12# notice, this list of conditions and the following disclaimer in the
13# documentation and/or other materials provided with the distribution.
14# - The name of the author may not be used to endorse or promote products
15# derived from this software without specific prior written permission.
16#
17# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27#
28
29## Generate config.mk, config.sh
30
31# Get the directory where the compiler resides.
32
33cc_fullname = run_command(which, meson.get_compiler('c').cmd_array()[0].split(' ')[0], check: true).stdout().strip()
34cc_path = run_command(dirname, cc_fullname, check: true).stdout().strip()
35
36message(['Compiler directory is:', cc_path])
37
38export_cppflags = [
39 '-isystem', '$(HELENOS_EXPORT_ROOT)/include/libposix',
40 '-isystem', '$(HELENOS_EXPORT_ROOT)/include/libc',
41 '-idirafter', '$(HELENOS_EXPORT_ROOT)/include',
42]
43
44export_ldflags = [
45 '-nostdlib',
46 '-L$(HELENOS_EXPORT_ROOT)/lib',
47 '-Wl,--whole-archive',
48 '$(HELENOS_EXPORT_ROOT)/lib/libstartfiles.a',
49 '-Wl,--no-whole-archive',
50]
51
52export_ldlibs = [
53 '-Wl,--as-needed',
54 '-lposix',
55 '-lmath',
56 '-lc',
57 '-lgcc',
58 '-Wl,--no-as-needed',
59]
60
61cc_arch = meson.get_cross_property('cc_arch')
62
63conf_data = configuration_data({
64 'HELENOS_OVERLAY_PATH' : meson.source_root() / 'uspace/overlay',
65 'HELENOS_CROSS_PATH' : cc_path,
66 'HELENOS_ARCH' : cc_arch,
67 'HELENOS_CFLAGS' : ' '.join(arch_uspace_c_args),
68 'HELENOS_CXXFLAGS' : ' '.join(arch_uspace_c_args),
69 'HELENOS_CPPFLAGS' : ' '.join(export_cppflags),
70 'HELENOS_LDFLAGS' : ' '.join(export_ldflags),
71 'HELENOS_LDLIBS' : ' '.join(export_ldlibs),
72 'HELENOS_TARGET' : cc_arch + '-helenos',
73})
74
75config_mk = configure_file(
76 input: 'config.mk.in',
77 output: 'config.mk',
78 configuration: conf_data,
79)
80
81config_sh = custom_target('config.sh',
82 input: config_mk,
83 output: 'config.sh',
84 command: [ sed, 's:$(HELENOS_EXPORT_ROOT):${HELENOS_EXPORT_ROOT}:g', '@INPUT@' ],
85 capture: true,
86)
87
88run_target('export-dev',
89 command: [
90 sh,
91 meson.source_root() / 'meson' / 'part' / 'exports' / 'copy-export.sh',
92 ] + [
93 'config', config_mk, 'config.mk',
94 'config', config_sh, 'config.sh',
95 ] + exported_devel_files
96)
Note: See TracBrowser for help on using the repository browser.