[libnma/lr/vapigen] build: generate VAPI files
- From: Lubomir Rintel <lkundrak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libnma/lr/vapigen] build: generate VAPI files
- Date: Fri, 18 Oct 2019 18:51:03 +0000 (UTC)
commit 024eb77f434609d6e81e1e8b053dd5efabd76031
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Fri Oct 18 19:46:37 2019 +0200
build: generate VAPI files
https://gitlab.gnome.org/GNOME/network-manager-applet/issues/49
.gitignore | 1 +
.gitlab-ci.yml | 7 +++++++
Makefile.am | 22 ++++++++++++++++++++++
configure.ac | 3 +++
meson.build | 9 +++++++++
meson_options.txt | 1 +
src/libnma-gtk4.deps | 3 +++
src/libnma.deps | 3 +++
src/meson.build | 22 ++++++++++++++++++++--
9 files changed, 69 insertions(+), 2 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 149f90e6..61273f62 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@
*.la
*.swp
*.bak
+*.vapi
Makefile
Makefile.in*
configure
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9e27152c..11e7544b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -30,6 +30,7 @@
gtk3-devel
NetworkManager-libnm-devel
pkgconfig
+ /usr/bin/vapigen
/usr/bin/autopoint
gcr-devel
gobject-introspection-devel redhat-rpm-config
@@ -57,6 +58,7 @@
-Dld_gc=false
-Dgtk_doc=false
-Dintrospection=false
+ -Dvapi=false
-Dmore_asserts=no
libnma-*/ build
- ninja -v -C build
@@ -78,6 +80,7 @@
-Dld_gc=true
-Dgtk_doc=true
-Dintrospection=true
+ -Dvapi=true
-Dmore_asserts=yes
libnma-*/ build
- ninja -v -C build
@@ -100,6 +103,7 @@
--disable-mobile-broadband-provider-info
--disable-gtk-doc
--disable-introspection
+ --disable-vala
--disable-more-warnings
--without-gcr
- make -j$(nproc)
@@ -122,6 +126,7 @@
--enable-mobile-broadband-provider-info
--enable-gtk-doc
--enable-introspection
+ --enable-vala
--enable-more-warnings
--with-gcr
- make -j$(nproc)
@@ -179,6 +184,7 @@ centos7:
NetworkManager-libnm-devel
pkgconfig
/usr/bin/autopoint
+ /usr/bin/vapigen
gcr-devel
gobject-introspection-devel redhat-rpm-config
gtk-doc
@@ -196,6 +202,7 @@ centos7:
--enable-mobile-broadband-provider-info
--enable-gtk-doc
--enable-introspection
+ --enable-vala
--enable-more-warnings
--with-gcr
- make -j$(nproc)
diff --git a/Makefile.am b/Makefile.am
index 935e0c7c..e6fd8be0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,6 @@
include $(GLIB_MAKEFILE)
-include $(INTROSPECTION_MAKEFILE)
+-include $(VAPIGEN_MAKEFILE)
include $(top_srcdir)/gtk-doc.make
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
@@ -51,6 +52,12 @@ BUILT_SOURCES += $(typelib_DATA)
INTROSPECTION_GIRS =
+if ENABLE_VAPIGEN
+vapidir = $(datadir)/vala/vapi
+VAPIGEN_VAPIS =
+vapi_DATA = $(VAPIGEN_VAPIS) $(VAPIGEN_VAPIS:.vapi=.deps)
+endif
+
SUBDIRS = \
. \
po
@@ -382,6 +389,13 @@ src_NMA_1_0_gir_SCANNERFLAGS = --warn-all --identifier-prefix=NMA --symbol-prefi
INTROSPECTION_GIRS += src/NMA-1.0.gir
endif
+if ENABLE_VAPIGEN
+VAPIGEN_VAPIS += src/libnma.vapi
+src_libnma_vapi_FILES = $(builddir)/src/NMA-1.0.gir
+src_libnma_vapi_DEPS = libnm gtk+-3.0 gio-2.0
+src/libnma.vapi: $(src_libnma_vapi_FILES) $(srcdir)/src/libnma.deps
+endif
+
check_PROGRAMS_norun += src/tests/mobile-wizard
src_tests_mobile_wizard_CPPFLAGS = \
@@ -569,6 +583,13 @@ src_NMA4_1_0_gir_SCANNERFLAGS = --warn-all --identifier-prefix=NMA --symbol-pref
INTROSPECTION_GIRS += src/NMA4-1.0.gir
endif
+if ENABLE_VAPIGEN
+VAPIGEN_VAPIS += src/libnma-gtk4.vapi
+src_libnma_gtk4_vapi_FILES = $(builddir)/src/NMA4-1.0.gir
+src_libnma_gtk4_vapi_DEPS = libnm gtk4 gio-2.0
+src/libnma-gtk4.vapi: $(src_libnma_gtk4_vapi_FILES) $(srcdir)/src/libnma-gtk4.deps
+endif
+
check_PROGRAMS_norun += src/tests/mobile-wizard-gtk4
src_tests_mobile_wizard_gtk4_SOURCES = \
@@ -805,5 +826,6 @@ EXTRA_DIST += \
CLEANFILES += \
$(INTROSPECTION_GIRS) \
$(typelib_DATA) \
+ $(VAPIGEN_VAPIS) \
\
$(BUILT_SOURCES)
diff --git a/configure.ac b/configure.ac
index 6495432c..b30f4336 100644
--- a/configure.ac
+++ b/configure.ac
@@ -221,6 +221,9 @@ AM_CONDITIONAL(WITH_GCR, test "${have_gcr}" == "yes")
dnl Check for gobject introspection
GOBJECT_INTROSPECTION_CHECK([0.9.6])
+dnl Check for VAPI generator
+VAPIGEN_CHECK(0.17.1.24)
+
GLIB_CONFIG_NMA
GLIB_GSETTINGS
AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources)
diff --git a/meson.build b/meson.build
index 13e05a3b..75214c41 100644
--- a/meson.build
+++ b/meson.build
@@ -268,6 +268,15 @@ if enable_introspection
assert(gir_dep.found(), 'introspection support was requested, but the gobject-introspection library is not
available. Use -Dintrospection=false to build without it.')
endif
+# Vala bindings
+enable_vapi = get_option('vapi')
+if enable_vapi
+ assert(enable_introspection, 'vala api require GObject introspection. Use -Dvapi=false to disable it')
+ add_languages('vala')
+ #assert(meson.get_compiler('vala').version().version_compare(vala_req_version),
+ # 'vala ' + vala_req_version + ' is required to build. Use -Dvapi=false to disable it')
+endif
+
more_asserts = get_option('more_asserts')
if more_asserts == 'no'
more_asserts = 0
diff --git a/meson_options.txt b/meson_options.txt
index a722e650..cc6f30d0 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -6,3 +6,4 @@ option('mobile_broadband_provider_info', type: 'boolean', value: true, descripti
option('ld_gc', type: 'boolean', value: true, description: 'Enable garbage collection of unused symbols on
linking')
option('gtk_doc', type: 'boolean', value: true, description: 'use gtk-doc to build documentation')
option('introspection', type: 'boolean', value: true, description: 'Enable introspection for this build')
+option('vapi', type: 'boolean', value: true, description: 'build Vala bindings')
diff --git a/src/libnma-gtk4.deps b/src/libnma-gtk4.deps
new file mode 100644
index 00000000..eecdbd04
--- /dev/null
+++ b/src/libnma-gtk4.deps
@@ -0,0 +1,3 @@
+libnm
+gtk4
+gio-2.0
diff --git a/src/libnma.deps b/src/libnma.deps
new file mode 100644
index 00000000..2a3abcef
--- /dev/null
+++ b/src/libnma.deps
@@ -0,0 +1,3 @@
+libnm
+gtk+-3.0
+gio-2.0
diff --git a/src/meson.build b/src/meson.build
index 3cd98f4e..52645fa0 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -171,7 +171,7 @@ if enable_introspection
gir_dir = join_paths(nma_datadir, 'gir-' + nma_gir_version)
typelib_dir = join_paths(nma_libdir, 'girepository-' + nma_gir_version)
- gnome.generate_gir(
+ libnma_gir = gnome.generate_gir(
libnma,
sources: gir_sources + gir_headers,
nsversion: nma_gir_version,
@@ -186,7 +186,7 @@ if enable_introspection
)
if enable_libnma_gtk4
- gnome.generate_gir(
+ libnma_gtk4_gir = gnome.generate_gir(
libnma,
sources: gir_sources + gir_headers,
nsversion: nma_gir_version,
@@ -201,3 +201,21 @@ if enable_introspection
)
endif
endif
+
+if enable_vapi
+ gnome.generate_vapi(
+ 'libnma',
+ sources: libnma_gir[0],
+ packages: [ 'libnm', 'gtk+-3.0', 'gio-2.0' ],
+ install: true,
+ )
+
+ if enable_libnma_gtk4
+ gnome.generate_vapi(
+ 'libnma-gtk4',
+ sources: libnma_gtk4_gir[0],
+ packages: [ 'libnm', 'gtk4', 'gio-2.0' ],
+ install: true,
+ )
+ endif
+endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]