From 4f4d9efac46c7b64f4854889bdf82e51423d62d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 19 Jan 2015 13:36:09 +0100 Subject: [PATCH 1/3] Configure: use g-ir-scanner to generate MConnCrypt vapi Use a private library instead of rebuilding the same sources multiple times --- Makefile.am | 32 +++++++++++++++++--------------- configure.ac | 10 ++++++++-- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/Makefile.am b/Makefile.am index 007cbee..8e98fe7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -46,32 +46,34 @@ mconnect_SOURCES = src/main.vala \ src/mconn-crypt.h mconnect_LDADD = $(MCONNECT_LIBS) - mconnect_CFLAGS = $(MCONNECT_CFLAGS) -Isrc -test_mconn_crypt_SOURCES = test/mconn-crypt-test.c \ - src/mconn-crypt.c \ - src/mconn-crypt.h +noinst_LTLIBRARIES = libmconn-crypt.la +libmconn_crypt_la_SOURCES = src/mconn-crypt.c \ + src/mconn-crypt.h +libmconn_crypt_la_CFLAGS = $(MCONNECT_CFLAGS) +libmconn_crypt_la_LIBADD = $(MCONNECT_LIBS) -test_mconn_crypt_LDADD = $(MCONNECT_LIBS) +test_mconn_crypt_SOURCES = test/mconn-crypt-test.c +test_mconn_crypt_LDADD = $(MCONNECT_LIBS) libmconn-crypt.la test_mconn_crypt_CFLAGS = $(MCONNECT_CFLAGS) -Isrc -test_mconn_crypt_vala_SOURCES = test/mconn-crypt-vala-test.vala \ - src/mconn-crypt.c \ - src/mconn-crypt.h -test_mconn_crypt_vala_LDADD = $(MCONNECT_LIBS) +test_mconn_crypt_vala_SOURCES = test/mconn-crypt-vala-test.vala +test_mconn_crypt_vala_LDADD = $(MCONNECT_LIBS) libmconn-crypt.la test_mconn_crypt_vala_CFLAGS = $(MCONNECT_CFLAGS) -Isrc -I. VALAFLAGS = $(MCONNECT_VALAFLAGS) --vapidir=. --pkg=mconn-crypt -mconn-crypt.gi: src/mconn-crypt.h +mconn-crypt.gir: libmconn-crypt.la rm -f $@ - $(GEN_INTROSPECT) -n MConn \ - $< $(filter -I%,$(MCONNECT_CFLAGS)) > $@ + $(G_IR_SCANNER) src/mconn-crypt.[ch] $(MCONNECT_CFLAGS) \ + --include=GObject-2.0 \ + --namespace=MConn --library $< \ + --output=$@ -mconn-crypt.vapi: mconn-crypt.gi +mconn-crypt.vapi: mconn-crypt.gir rm -f $@ - vapigen --library mconn-crypt $< + $(VALA_API_GEN) --library mconn-crypt $< # configure will expand bindir to ${exec_prefix}/bin, we want the # whole thing, that's why mconnect.desktop is generated here and not @@ -87,7 +89,7 @@ git-source-dist: git archive --prefix=mconnect-$${gitsha}/ $(REV) | \ gzip -c > mconnect-$${gitsha}.tar.gz -BUILT_SOURCES = mconn-crypt.vapi mconn-crypt.gi mconnect.desktop +BUILT_SOURCES = mconn-crypt.vapi mconn-crypt.gir mconnect.desktop CLEANFILES = $(BUILT_SOURCES) diff --git a/configure.ac b/configure.ac index 3a2bc01..8bb9bc7 100644 --- a/configure.ac +++ b/configure.ac @@ -20,6 +20,7 @@ AC_INIT([mconnect], [0.1.0], [maciek.borzecki@gmail.com]) AC_CONFIG_SRCDIR([src/main.vala]) AC_CONFIG_AUX_DIR([.]) AC_PROG_MAKE_SET +AM_PROG_LIBTOOL AM_INIT_AUTOMAKE([tar-pax foreign subdir-objects]) AM_SILENT_RULES([yes]) @@ -41,18 +42,23 @@ AC_SUBST(MCONNECT_VALAFLAGS, ["--pkg=json-glib-1.0 --pkg=gee-0.8 --pkg=libnotify # AC_SUBST(MCONNECT_VALAFLAGS, [--pkg=json-glib-1.0 --pkg=gee-0.8]) PKG_CHECK_MODULES(MCONNECT, [glib-2.0, gobject-2.0, + gobject-introspection-1.0 gio-2.0, gio-unix-2.0, json-glib-1.0, gee-0.8, libcrypto - libvala-0.26 libnotify ]) AC_SUBST(MCONNECT_CFLAGS) AC_SUBST(MCONNECT_LIBS) -AC_SUBST(GEN_INTROSPECT,$($PKG_CONFIG --variable=gen_introspect libvala-0.26)) +AC_SUBST(G_IR_SCANNER,$($PKG_CONFIG gobject-introspection-1.0 --variable=g_ir_scanner)) + +AC_PATH_PROG([VALA_API_GEN], [vapigen]) +if test -z "$VALA_API_GEN"; then + AC_MSG_ERROR([vapigen is needed]) +fi # Files to generate AC_CONFIG_FILES([Makefile]) From 2cd456ccb48307652893483a54cc84bbf7d39142 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 19 Jan 2015 13:36:51 +0100 Subject: [PATCH 2/3] MConnCrypt: fix docstring return type on decrypt --- src/mconn-crypt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mconn-crypt.h b/src/mconn-crypt.h index fcb92f2..17486c3 100644 --- a/src/mconn-crypt.h +++ b/src/mconn-crypt.h @@ -84,7 +84,7 @@ MConnCrypt *m_conn_crypt_ref(MConnCrypt *crypt); * @data: (type GBytes): data * @error: return location for a GError or NULL * - * Returns: (transfer full): a new #GBytes with decoded data + * Returns: (transfer full): a new #GByteArray with decoded data */ GByteArray * m_conn_crypt_decrypt(MConnCrypt *crypt, GBytes *data, GError **error); From e6e9f8417964342989fda9bb36feefc4ba2670f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 19 Jan 2015 13:43:04 +0100 Subject: [PATCH 3/3] README: update dependencies --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 01f4d01..9683646 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,8 @@ with usable results. Build dependencies (using package names as found in Fedora): - vala -- vala-devel - glib2-devel +- gobject-introspection-devel - libgee-devel - json-glib - openssl-devel