[vala/wip/meson] Meson: implemented bootstrap build
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/meson] Meson: implemented bootstrap build
- Date: Thu, 2 May 2019 22:31:51 +0000 (UTC)
commit 4f19dbc87caf4ee4077bdd56ea0bec27c107d804
Author: Daniel Espinosa <esodan gmail com>
Date: Thu May 2 14:38:08 2019 -0500
Meson: implemented bootstrap build
bootstrap can be enable by -Dbootstrap=true. Requires to have
all C sources in tree
ccode/meson.build | 30 +++++++++----------
codegen/meson.build | 32 +++++++++-----------
compiler/meson.build | 26 +++++++++++++---
gee/meson.build | 38 +++++++++++++++++++-----
libvaladoc/meson.build | 3 +-
meson.build | 10 +++++--
meson_options.txt | 4 +++
vala/meson.build | 75 +++++++++++++++++++++++++++++++++++++----------
valadoc/meson.build | 3 +-
valadoc/tests/meson.build | 3 +-
vapigen/meson.build | 49 ++++++++++++++++++++++++++-----
11 files changed, 199 insertions(+), 74 deletions(-)
---
diff --git a/ccode/meson.build b/ccode/meson.build
index 11adae37b..88477c277 100644
--- a/ccode/meson.build
+++ b/ccode/meson.build
@@ -1,4 +1,7 @@
-valaccode_sources = files(
+inc_libvalaccodeh = include_directories ('.')
+inc_libvalaccodeh_dep = declare_dependency (include_directories : inc_libvalaccodeh)
+
+valaccode_sources = [
'valaccodeassignment.vala',
'valaccodebinaryexpression.vala',
'valaccodeblock.vala',
@@ -53,20 +56,15 @@ valaccode_sources = files(
'valaccodevariabledeclarator.vala',
'valaccodewhilestatement.vala',
'valaccodewriter.vala'
-)
+]
+
+valaccode_sources_c = []
-valaccode_lib = static_library(
- 'valaccode',
- valaccode_sources,
- dependencies: [gobject_dep, valagee_dep, valacore_dep],
- install: false,
- vala_args: ['--use-header'],
- vala_header: 'valaccode.h',
- vala_vapi: 'valaccode.vapi',
-)
+foreach f : valaccode_sources
+ if get_option ('bootstrap')
+ af = f.split('.vala')
+ nf = join_paths (meson.current_source_dir (), af[0] + '.c')
+ valaccode_sources_c += nf
+ endif
+endforeach
-valaccode_dep = declare_dependency(
- link_with: [valaccode_lib],
- dependencies: [valagee_dep],
- include_directories: include_directories('.'),
-)
diff --git a/codegen/meson.build b/codegen/meson.build
index 89fdc1d48..37ac9d440 100644
--- a/codegen/meson.build
+++ b/codegen/meson.build
@@ -1,4 +1,7 @@
-valacodegen_sources = files(
+inc_libvalacodegenh = include_directories ('.')
+inc_libvalacodegenh_dep = declare_dependency (include_directories : inc_libvalacodegenh)
+
+valacodegen_sources = [
'valaccode.vala',
'valaccodearraymodule.vala',
'valaccodeassignmentmodule.vala',
@@ -28,22 +31,15 @@ valacodegen_sources = files(
'valainterfaceregisterfunction.vala',
'valastructregisterfunction.vala',
'valatyperegisterfunction.vala',
-)
+]
+
+valacodegen_sources_c = []
-valacodegen_lib = shared_library(
- 'valacodegen',
- valacodegen_sources,
- dependencies: [gobject_dep, valacore_dep, valaccode_dep],
- install_rpath: pkglibdir,
- install_dir: pkglibdir,
- install: [ true, false, false ],
- vala_args: ['--use-header'],
- vala_header: 'valacodegen.h',
- vala_vapi: 'valacodegen.vapi',
-)
+foreach f : valacodegen_sources
+ if get_option ('bootstrap')
+ af = f.split('.vala')
+ nf = join_paths (meson.current_source_dir (), af[0] + '.c')
+ valacodegen_sources_c += nf
+ endif
+endforeach
-valacodegen_dep = declare_dependency(
- link_with: [valacodegen_lib],
- dependencies: [valacore_dep, valaccode_dep],
- include_directories: include_directories('.'),
-)
diff --git a/compiler/meson.build b/compiler/meson.build
index 25e934ee8..b0a0a031f 100644
--- a/compiler/meson.build
+++ b/compiler/meson.build
@@ -1,14 +1,32 @@
-valac_sources = files(
+valac_sources = [
'valacompiler.vala',
-)
+]
+
+
+valac_sources_c = []
+
+foreach f : valac_sources
+ if get_option ('bootstrap')
+ af = f.split('.vala')
+ nf = join_paths (meson.current_source_dir (), af[0] + '.c')
+ valac_sources_c += nf
+ endif
+endforeach
valac_name = 'valac@0@'.format(vala_version_suffix)
valac_exe = executable(
valac_name,
- valac_sources,
- dependencies: [glib_dep, valacodegen_dep],
+ valac_sources_c,
+ dependencies: [
+ valacore_lib_deps,
+ inc_libvalarooth_dep,
+ inc_libvalah_dep,
+ inc_libvalacodegenh_dep,
+ inc_libvalaccodeh_dep,
+ inc_libvalageeh_dep],
install: true,
+ link_with: valacore_lib
)
vala_name = 'vala@0@'.format(vala_version_suffix)
diff --git a/gee/meson.build b/gee/meson.build
index abfdf0b02..b1cd0d293 100644
--- a/gee/meson.build
+++ b/gee/meson.build
@@ -1,4 +1,7 @@
-valagee_sources = files(
+inc_libvalageeh = include_directories ('.')
+inc_libvalageeh_dep = declare_dependency (include_directories : inc_libvalageeh)
+
+valagee_sources = [
'arraylist.vala',
'collection.vala',
'hashmap.vala',
@@ -10,18 +13,37 @@ valagee_sources = files(
'map.vala',
'set.vala',
'timsort.vala',
-)
+]
+
+
+valagee_sources_c = []
+
+foreach f : valagee_sources
+ if get_option ('bootstrap')
+ af = f.split('.vala')
+ nf = af[0] + '.c'
+ valagee_sources_c += nf
+ endif
+endforeach
+
+install_dirs = [
+ false,
+ join_paths (get_option('includedir'), 'vala@0@'.format (vala_version_suffix)),
+ false
+ ]
+if get_option ('bootstrap')
+
+install_dirs = [
+ true
+ ]
+endif
valagee_lib = static_library(
'valagee',
- valagee_sources,
+ valagee_sources_c,
dependencies: [gobject_dep],
install: [ false, true, false ],
- install_dir: [
- false,
- join_paths (get_option('includedir'), 'vala@0@'.format (vala_version_suffix)),
- false
- ],
+ install_dir: install_dirs,
vala_args: ['--use-header'],
vala_header: 'valagee.h',
vala_vapi: 'gee.vapi',
diff --git a/libvaladoc/meson.build b/libvaladoc/meson.build
index 1830ba9dd..f1714ebd3 100644
--- a/libvaladoc/meson.build
+++ b/libvaladoc/meson.build
@@ -132,7 +132,7 @@ libvaladoc_sources = files(
libvaladoc_lib = shared_library(
'valadoc@0@'.format(vala_version_suffix),
libvaladoc_sources,
- dependencies: [gmodule_dep, valacore_dep, valacodegen_dep, libgvc_dep],
+ dependencies: [gmodule_dep, valacore_dep, libgvc_dep],
version: '0.0.0',
install: true,
install_dir: [
@@ -144,6 +144,7 @@ libvaladoc_lib = shared_library(
vala_args: ['--use-header'],
vala_header: 'valadoc.h',
vala_vapi: 'valadoc@0@.vapi'.format(vala_version_suffix),
+ link_with: valacore_lib
)
libvaladoc_dep = declare_dependency(link_with: [libvaladoc_lib], dependencies: [gmodule_dep, valacore_dep,
libgvc_dep], include_directories: include_directories('.'))
diff --git a/meson.build b/meson.build
index 0f68fb5ba..d5c03bce4 100644
--- a/meson.build
+++ b/meson.build
@@ -154,21 +154,27 @@ if (vg.found())
)
endif
+inc_libvalarooth = include_directories ('.')
+inc_libvalarooth_dep = declare_dependency (include_directories : inc_libvalarooth)
+
subdir('gobject-introspection')
subdir('gee')
-subdir('vala')
subdir('ccode')
subdir('codegen')
+subdir('vala')
subdir('compiler')
subdir('vapigen')
subdir('vapi')
-if valadoc_enabled
+if valadoc_enabled and not get_option('bootstrap')
subdir('libvaladoc')
subdir('valadoc')
endif
+if not get_option('bootstrap')
subdir('doc')
+endif
+
subdir('tests')
install_data('vala.m4', install_dir: join_paths('share', 'aclocal'))
diff --git a/meson_options.txt b/meson_options.txt
index 9909755d7..ed482e15e 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -11,3 +11,7 @@ option('man-pages', type: 'boolean', value: 'false',
# Resource directories
option('girdir', type: 'string', value: '',
description : 'Directory to use GIRs from')
+
+# Enable bootstrap
+option ('bootstrap', type: 'boolean', value: 'false',
+ description: 'Build Vala using existing C files')
diff --git a/vala/meson.build b/vala/meson.build
index 4ef686c58..5ab690179 100644
--- a/vala/meson.build
+++ b/vala/meson.build
@@ -1,4 +1,7 @@
-valacore_sources = files(
+inc_libvalah = include_directories ('.')
+inc_libvalah_dep = declare_dependency (include_directories : inc_libvalah)
+
+valacore_sources = [
'valaaddressofexpression.vala',
'valaarraycopymethod.vala',
'valaarraycreationexpression.vala',
@@ -150,8 +153,23 @@ valacore_sources = files(
'valavoidtype.vala',
'valawhilestatement.vala',
'valayieldstatement.vala',
-)
+]
+
+valacore_sources_c = []
+
+foreach f : valacore_sources
+ if get_option ('bootstrap')
+ af = f.split('.vala')
+ nf = af[0] + '.c'
+ message ('Setting up: '+nf)
+ valacore_sources_c += nf
+ endif
+endforeach
+valacore_sources_c += valaccode_sources_c
+valacore_sources_c += valacodegen_sources_c
+
+if not get_option ('bootstrap')
# https://github.com/mesonbuild/meson/issues/688
valaversion_source = vcs_tag(
input: configure_file(
@@ -161,31 +179,55 @@ valaversion_source = vcs_tag(
),
output: 'valaversion.vala',
)
+else
+ valaversion_source = files('valaversion.c')
+endif
+
+install_dirs = [
+ true,
+ join_paths (get_option('includedir'), 'vala@0@'.format (vala_version_suffix)),
+ false
+ ]
+if get_option ('bootstrap')
+install_dirs = [
+ true
+ ]
+endif
+
+valacore_lib_deps = [
+ glib_dep,
+ gobject_dep,
+ gmodule_dep,
+ valagee_dep
+]
valacore_lib = shared_library(
'vala@0@'.format(vala_version_suffix),
- valacore_sources,
+ valacore_sources_c,
valaversion_source,
- dependencies: [gobject_dep, gmodule_dep, valagee_dep],
+ dependencies: [
+ valacore_lib_deps,
+ inc_libvalarooth_dep,
+ inc_libvalah_dep,
+ inc_libvalacodegenh_dep,
+ inc_libvalaccodeh_dep,
+ inc_libvalageeh_dep],
version: '0.0.0',
install: true,
vala_args: ['--use-header'],
vala_header: 'vala.h',
vala_vapi: 'vala.vapi',
- install_dir: [
- true,
- join_paths (get_option('includedir'), 'vala@0@'.format (vala_version_suffix)),
- false
- ],
+ install_dir: install_dirs,
)
-valacore_dep = declare_dependency(
+valacore_lib_dep = declare_dependency(
link_with: [valacore_lib],
- dependencies: [valagee_dep],
- include_directories: include_directories('.', '..'),
+ dependencies: [valacore_lib_deps],
+ include_directories: inc_libvalah,
)
-custom_target(
+if not get_option('bootstrap')
+libvala_vapi = custom_target(
'libvala@0@.vapi'.format(vala_version_suffix),
command: [
find_program('cat'),
@@ -194,7 +236,10 @@ custom_target(
],
depends: [valagee_lib, valacore_lib],
capture: true,
- install: true,
- install_dir: join_paths('share', 'vala', 'vapi'),
output: 'libvala@0@.vapi'.format(vala_version_suffix),
)
+else
+libvala_vapi = join_paths(meson.current_source_dir(), 'libvala'+vala_version_suffix+'.vapi')
+endif
+
+install_data(libvala_vapi, install_dir: join_paths('share', 'vala', 'vapi'))
diff --git a/valadoc/meson.build b/valadoc/meson.build
index 08e891e5b..d4413b647 100644
--- a/valadoc/meson.build
+++ b/valadoc/meson.build
@@ -11,8 +11,9 @@ valadoc_name = 'valadoc@0@'.format(vala_version_suffix)
valadoc_exe = executable(
valadoc_name,
valadoc_sources,
- dependencies: [gobject_dep, valacodegen_dep, libvaladoc_dep],
+ dependencies: [gobject_dep, valacore_dep, libvaladoc_dep],
install: true,
+ link_with: valacore_lib
)
# https://github.com/mesonbuild/meson/issues/1602
diff --git a/valadoc/tests/meson.build b/valadoc/tests/meson.build
index 039a4be5e..49e4dcc6d 100644
--- a/valadoc/tests/meson.build
+++ b/valadoc/tests/meson.build
@@ -60,8 +60,9 @@ driver_exe = executable('driver',
join_paths(meson.source_root(), 'valadoc/treebuilder.vala'),
),
c_args: '-DTOP_SRC_DIR="@0@"'.format(meson.source_root()),
- dependencies: [gobject_dep, valacodegen_dep, libvaladoc_dep],
+ dependencies: [gobject_dep, valacore_dep, libvaladoc_dep],
install: false,
+ link_with: [ libvaladoc_lib, valacore_lib]
)
test('valadoc/driver',
diff --git a/vapigen/meson.build b/vapigen/meson.build
index df3e18c5a..0c83c5336 100644
--- a/vapigen/meson.build
+++ b/vapigen/meson.build
@@ -1,33 +1,66 @@
-vapigen_sources = files(
+vapigen_sources = [
'valagidlparser.vala',
'valavapigen.vala',
-)
+]
+
+
+vapigen_sources_c = []
+
+foreach f : vapigen_sources
+ if get_option ('bootstrap')
+ af = f.split('.vala')
+ nf = join_paths (meson.current_source_dir (), af[0] + '.c')
+ vapigen_sources_c += nf
+ endif
+endforeach
vapigen_name = 'vapigen@0@'.format(vala_version_suffix)
vapigen_exe = executable(
vapigen_name,
- vapigen_sources,
- dependencies: [glib_dep, valagee_dep, valacore_dep, gidl_dep],
+ vapigen_sources_c,
+ dependencies: [valacore_lib_deps, gidl_dep,
+ inc_libvalarooth_dep,
+ inc_libvalah_dep,
+ inc_libvalacodegenh_dep,
+ inc_libvalaccodeh_dep,
+ inc_libvalageeh_dep],
install: true,
vala_args: ['--pkg', 'gidl', '--vapidir', join_paths(meson.source_root(), 'gobject-introspection')],
+ link_with: valacore_lib
)
# https://github.com/mesonbuild/meson/issues/1602
meson.add_install_script('sh', '-c', 'cd $DESTDIR@0@; ln -fs --relative @1@
vapigen'.format(join_paths(get_option('prefix'), get_option('bindir')), vapigen_name))
-vapicheck_sources = files(
+vapicheck_sources = [
'valavapicheck.vala',
-)
+]
+
+vapicheck_sources_c = []
+
+foreach f : vapicheck_sources
+ if get_option ('bootstrap')
+ af = f.split('.vala')
+ nf = join_paths (meson.current_source_dir (), af[0] + '.c')
+ vapicheck_sources_c += nf
+ endif
+endforeach
vapicheck_name = 'vapicheck@0@'.format(vala_version_suffix)
executable(
vapicheck_name,
- vapicheck_sources,
- dependencies: [glib_dep, valagee_dep, valacore_dep, gidl_dep],
+ vapicheck_sources_c,
+ dependencies: [valacore_lib_deps, gidl_dep,
+ inc_libvalarooth_dep,
+ inc_libvalah_dep,
+ inc_libvalacodegenh_dep,
+ inc_libvalaccodeh_dep,
+ inc_libvalageeh_dep],
install: true,
vala_args: ['--pkg', 'gidl', '--vapidir', join_paths(meson.source_root(), 'gobject-introspection')],
+ link_with: valacore_lib
)
# https://github.com/mesonbuild/meson/issues/1602
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]