Completely remove Vala as a dependency

This commit is contained in:
Gergely Polonkai 2017-12-12 15:48:45 +01:00
parent 4e964da1ae
commit db0417b5bf
7 changed files with 84 additions and 201 deletions

View File

@ -105,9 +105,6 @@ GTK_DOC_CHECK([1.25], [--flavour no-tmpl])
AM_CONDITIONAL([ENABLE_GTK_DOC], false)
])
# Check for vala
VALAC_CHECK
# Check for GIO
PKG_CHECK_MODULES([GIO], [gio-2.0 >= $GIO_REQUIRED])
@ -118,7 +115,20 @@ PKG_CHECK_MODULES([SOUP], [libsoup-2.4 >= $SOUP_REQUIRED])
PKG_CHECK_MODULES([JSON], [json-glib-1.0 >= $JSON_REQUIRED])
# Check for GObject Introspection
m4_ifdef([GOBJECT_INTROSPECTION_CHECK], [
GOBJECT_INTROSPECTION_CHECK([1.32.0])
],[
AM_CONDITIONAL([HAVE_INTROSPECTION], false)
])
m4_ifdef([VALA_PROG_VAPIGEN], [
VALAC_CHECK([0.38], [0.38])
VALA_PROG_VAPIGEN([0.38])
AM_CONDITIONAL([HAVE_VAPIGEN], true)
],[
AM_CONDITIONAL([HAVE_VAPIGEN], false)
])
debug=no
AC_ARG_ENABLE(debug,
@ -167,7 +177,6 @@ AC_CONFIG_FILES([
src/Makefile
src/matrix-version.h
src/matrix-glib-0.0.pc
src/namespace-info.vala
docs/reference/matrix-glib-sdk/Makefile
])
AC_OUTPUT

View File

@ -1,76 +0,0 @@
dnl vapigen.m4
dnl
dnl Copyright 2014 Daniel Espinosa
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Lesser General Public
dnl License as published by the Free Software Foundation; either
dnl version 2.1 of the License, or (at your option) any later version.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Lesser General Public License for more details.
dnl
dnl You should have received a copy of the GNU Lesser General Public
dnl License along with this library; if not, write to the Free Software
dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
# VALAC_CHECK([VERSION], [API_VERSION])
# --------------------------------------
# Check valac existence and version.
m4_define([_VALAC_CHECK_INTERNAL],
[
AC_REQUIRE([PKG_PROG_PKG_CONFIG])
AS_IF([ test "x$2" = "x" ], [
AM_PROG_VALAC($1)
AS_IF([ test "x$VALAC" = "xno"], [
check_prog=no
AC_MSG_ERROR([valac is not installed])
], [
check_prog=yes
VALAC_VERSION=`$VALAC --api-version`
VAPIDIR=$datadir/vala-$VALAC_VERSION/vapi
VAPIDIR_UNVERSIONED=$datadir/vala-$VALAC_VERSION/vapi
])
], [
AS_IF([ test "x$1" = "x"], [
vala_pkg="libvala-$2"
], [
vala_pkg="libvala-$2 >= $1"
])
AC_MSG_CHECKING([for $vala_pkg])
PKG_CHECK_EXISTS([ $vala_pkg ], [
vala_pkg_found=yes
VAPIGEN=`$PKG_CONFIG --variable=vapigen libvala-$2`
VAPIGEN_MAKEFILE=`$PKG_CONFIG --variable=datadir libvala-$2`/vala/Makefile.vapigen
VAPIDIR=`$PKG_CONFIG --variable=vapidir libvala-$2`
GEN_INTROSPECT=`$PKG_CONFIG --variable=gen_introspect libvala-$2`
vala_datadir=`$PKG_CONFIG --variable=datadir libvala-$2`
VAPIDIR_UNVERSIONED=$vala_datadir/vala/vapi
VALA_GEN_INTROSPECT=`$PKG_CONFIG --variable=vala_gen_introspect libvala-$2`
], [
vala_pkg_found=no
AC_MSG_ERROR([no package libvala-$2 is installed])
])
AC_MSG_RESULT([$vala_pkg_found])
])
AC_SUBST([VAPIGEN])
AC_SUBST([VAPIGEN_VAPIDIR])
AC_SUBST([VAPIDIR])
AC_SUBST([VAPIDIR_UNVERSIONED])
AC_SUBST([VAPIGEN_MAKEFILE])
AC_SUBST([GEN_INTROSPECT])
AC_SUBST([VALA_GEN_INTROSPECT])
AC_SUBST([VALAC_VERSION])
])
dnl Check VAPIGEN
# VALAC_CHECK([VERSION], [API_VERSION], [DEFAULT])
# --------------------------------------
# Check vapigen existence and version.
AC_DEFUN([VALAC_CHECK],
[
_VALAC_CHECK_INTERNAL($1,$2,$3)
]
)

View File

@ -1,24 +1,13 @@
include $(top_srcdir)/vala-globals.mk
AM_CPPFLAGS = -DG_LOG_DOMAIN=\"Matrix-GLib\" -D__MATRIX_GLIB_SDK_COMPILATION
# Empty variables for elements to be added later
CLEANFILES =
BUILT_SOURCES =
EXTRA_DIST =
AM_VALAFLAGS =
# Name of the public header file
PUBLIC_HEADER = matrix-glib.h
# Libraries to create
lib_LTLIBRARIES = libmatrix-glib-0.0.la
# Vala source files
libmatrix_glib_0_0_la_VALA_SOURCES = \
namespace-info.vala \
$(NULL)
AM_CPPFLAGS += \
-include $(CONFIG_HEADER) \
-I$(top_srcdir) \
@ -28,60 +17,21 @@ AM_CPPFLAGS += \
$(GOBJECT_CFLAGS) \
$(SOUP_CFLAGS) \
$(JSON_CFLAGS) \
$(VALA_CFLAGS) \
$(NULL)
AM_VALAFLAGS += \
--library=Matrix-$(MATRIX_GLIB_API_VERSION) \
$(VALA_PKG_LIST) \
--vapi=Matrix-$(MATRIX_GLIB_API_VERSION).vapi \
-H $(PUBLIC_HEADER) \
-C \
--use-header \
--gir=Matrix-$(MATRIX_GLIB_API_VERSION).gir \
--vapidir=$(top_srcdir)/vapi \
$(NULL)
vala-stamp: $(libmatrix_glib_0_0_la_VALA_SOURCES)
@rm -f vala-temp
@touch vala-temp
$(AM_V_GEN) $(VALAC) $(AM_VALAFLAGS) $^
@mv -f vala-temp $@
CLEANFILES += \
$(PUBLIC_HEADER) \
$(libmatrix_glib_0_0_la_VALA_SOURCES:.vala=.c) \
$(NULL)
$(libmatrix_glib_0_0_la_VALA_SOURCES:.vala=.c): vala-stamp
@if test -f $@; then :; else \
trap 'rm -rf vala-lock vala-stamp' 1 2 13 15; \
if mkdir vala-lock 2> /dev/null; then \
rm -f vala-stamp; \
$(MAKE) $(AM_MAKEFLAGS) vala-stamp; \
rmdir vala-lock; \
else \
while test -d vala-lock; do sleep 1; done; \
test -f vala-stamp; exit $$?; \
fi \
fi
# Binaries to create
bin_PROGRAMS = test-api-client test-client
INST_H_SRC_FILES = \
matrix-types.h \
matrix-compacts.h \
matrix-api.h \
matrix-http-api.h \
matrix-client.h \
matrix-http-client.h \
EVENT_H_FILES = \
matrix-event-base.h \
matrix-event-call-base.h \
matrix-event-call-answer.h \
matrix-event-call-hangup.h \
matrix-event-call-invite.h \
matrix-event-call-candidates.h \
$(NULL)
MESSAGE_H_FILES = \
matrix-message-base.h \
matrix-message-text.h \
matrix-message-location.h \
@ -112,6 +62,17 @@ INST_H_SRC_FILES = \
matrix-event-room-third-party-invite.h \
matrix-event-typing.h \
matrix-event-receipt.h \
$(NULL)
INST_H_SRC_FILES = \
matrix-types.h \
matrix-compacts.h \
matrix-api.h \
matrix-http-api.h \
matrix-client.h \
matrix-http-client.h \
$(EVENT_H_FILES) \
$(MESSAGE_H_FILES) \
utils.h \
matrix-profile.h \
matrix-room.h \
@ -130,7 +91,6 @@ matrix_enum_headers = \
libmatrix_glib_0_0_la_SOURCES = \
$(INST_H_BUILT_FILES) \
matrix-marshalers.c \
$(libmatrix_glib_0_0_la_VALA_SOURCES:.vala=.c) \
matrix-event-types.c \
matrix-version.c \
matrix-api.c \
@ -199,15 +159,6 @@ libmatrix_glib_0_0_la_LIBADD = \
libmatrix_glib_0_0_la_LDFLAGS = \
-version-info "$(LT_CURRENT)":"$(LT_REVISION)":"$(LT_AGE)"
$(PUBLIC_HEADER): vala-stamp
Matrix-0.0.vapi: libmatrix-glib-$(MATRIX_GLIB_API_VERSION).la
vapidir = $(datadir)/vala/vapi
dist_vapi_DATA = \
Matrix-$(MATRIX_GLIB_API_VERSION).vapi \
Matrix-$(MATRIX_GLIB_API_VERSION).deps \
$(NULL)
BUILT_SOURCES += \
matrix-enumtypes.c \
matrix-enumtypes.h \
@ -272,30 +223,76 @@ matrix-marshalers.c: matrix-marshalers.h
CLEANFILES += stamp-matrix-marshalers
limtatrix_glib_dlname = \
libmatrix_glib_dlname = \
`$(SED) -nE "s/^dlname='([A-Za-z0-9.+-]+)'/\1/p" libmatrix-glib-0.0.la`¬
INTROSPECTION_GIRS = Matrix-$(MATRIX_GLIB_API_VERSION).gir
INTROSPECTION_COMPILER_ARGS = --includedir=. $(libmatrix_glib_dlname)
Matrix-0.0.gir: libmatrix-glib-$(MATRIX_GLIB_API_VERSION).la
Matrix-0.0.typelib: $(INTROSPECTION_GIRS)
$(INTROSPECTION_COMPILER) $(INTROSPECTION_COMPILER_ARGS) $< -o $@
if HAVE_INTROSPECTION
include $(INTROSPECTION_MAKEFILE)
INTROSPECTION_GIRS = \
Matrix-$(MATRIX_GLIB_API_VERSION).gir \
MatrixEvent-$(MATRIX_GLIB_API_VERSION).gir \
MatrixMessage-$(MATRIX_GLIB_API_VERSION).gir \
$(NULL)
Matrix-$(MATRIX_GLIB_API_VERSION).gir: libmatrix-glib-0.0.la
Matrix_0_0_gir_FILES = $(INST_H_SRC_FILE) $(INST_H_BUILT_FILES) $(filter %.c,$(libmatrix_glib_0_0_la_SOURCES))
Matrix_0_0_gir_LIBS = libmatrix-glib-0.0.la
Matrix_0_0_gir_SCANNERFLAGS = --identifier-prefix=Matrix --symbol-prefix=matrix --warn-all
Matrix_0_0_gir_INCLUDES = GLib-2.0 GObject-2.0
Matrix_0_0_gir_CFLAGS = -D_MATRIX_GLIB_SDK_COMPILATION -I$(top_srcdir) -I$(srcdir) -I$(builddir) $(AM_CPPFLAGS)
Matrix_0_0_gir_EXPORT_PACKAGES = matrix-glib
MatrixEvent-$(MATRIX_GLIB_API_VERSION).gir: libmatrix-glib-0.0.la
MatrixEvent_0_0_gir_FILES = $(EVENT_H_FILES) $(libmatrix_glib_0_0_la_SOURCES)
MatrixEvent_0_0_gir_LIBS = libmatrix-glib-0.0.la
MatrixEvent_0_0_gir_SCANNERFLAGS = --identifier-prefix=MatrixEvent --symbol-prefix=matrix_event --warn-all
MatrixEvent_0_0_gir_INCLUDES = GLib-2.0 GObject-2.0
MatrixEvent_0_0_gir_CFLAGS = -D_MATRIX_GLIB_SDK_COMPILATION -I$(top_srcdir) -I$(srcdir) -I$(builddir) $(AM_CPPFLAGS)
MatrixEvent_0_0_gir_EXPORT_PACKAGES = matrix-event-glib
MatrixMessage-$(MATRIX_GLIB_API_VERSION).gir: libmatrix-glib-0.0.la
MatrixMessage_0_0_gir_FILES = $(filter matrix-message-%.h,$(Matrix_0_0_gir_FILES))
MatrixMessage_0_0_gir_LIBS = libmatrix-glib-0.0.la
MatrixMessage_0_0_gir_SCANNERFLAGS = --identifier-prefix=MatrixMessage --symbol-prefix=matrix_message --warn-all
MatrixMessage_0_0_gir_INCLUDES = GLib-2.0 GObject-2.0
MatrixMessage_0_0_gir_CFLAGS = -D_MATRIX_GLIB_SDK_COMPILATION -I$(top_srcdir) -I$(srcdir) -I$(builddir) $(AM_CPPFLAGS)
MatrixMessage_0_0_gir_EXPORT_PACKAGES = matrix-message-glib
girdir = $(INTROSPECTION_GIRDIR)
gir_DATA = $(INTROSPECTION_GIRS)
typelibdir = $(INTROSPECTION_TYPELIBDIR)
typelib_DATA = Matrix-$(MATRIX_GLIB_API_VERSION).typelib
CLEANFILES += $(gir_DATA) $(typelibs_DATA)
headerdir = $(includedir)/matrix-glib-$(MATRIX_GLIB_API_VERSION)
header_DATA = \
$(PUBLIC_HEADER) \
$(INST_H_SRC_FILES) \
$(INST_H_BUILT_FILES) \
$(NULL)
CLEANFILES += $(gir_DATA) $(typelibs_DATA)
if HAVE_VAPIGEN
include $(VAPIGEN_MAKEFILE)
VAPIGEN_VAPIS = Matrix-$(MATRIX_GLIB_API_VERSION).vapi
Matrix_0_0_vapi_DEPS = \
json-glib-1.0 \
gio-2.0 \
libsoup-2.4 \
$(NULL)
Matrix_0_0_vapi_GIRS = $(INTROSPECTION_GIRS)
Matrix_0_0_vapi_FILES = $(INTROSPECTION_GIRS)
vapidir = $(datadir)/vala/vapi
vapi_DATA = $(VAPIGEN_VAPIS)
endif
endif
pkgconfig_in = matrix-glib-$(MATRIX_GLIB_API_VERSION).pc.in
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = $(pkgconfig_in:.in=)

View File

@ -1,3 +0,0 @@
gio-2.0
Json-1.0
libsoup-2.4

View File

@ -16,7 +16,6 @@
* <http://www.gnu.org/licenses/>.
*/
#include "matrix-glib.h"
#include "matrix-marshalers.h"
#include "matrix-event-tag.h"
#include "matrix-event-presence.h"

View File

@ -1,26 +0,0 @@
/*
* This file is part of matrix-glib-sdk
*
* matrix-glib-sdk is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* matrix-glib-sdk is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with matrix-glib-sdk. If not, see
* <http://www.gnu.org/licenses/>.
*/
[CCode (gir_namespace = "Matrix", gir_version = "@MATRIX_GLIB_API_VERSION@")]
namespace Matrix {
[CCode (gir_namespace = "Event", gir_version = "@MATRIX_GLIB_API_VERSION@")]
namespace Event {}
[CCode (gir_namespace = "Message", gir_version = "@MATRIX_GLIB_API_VERSION@")]
namespace Message {}
}

View File

@ -1,17 +0,0 @@
VALA_PKG_LIST = \
--pkg=gio-2.0 \
--pkg=json-glib-1.0 \
--pkg=libsoup-2.4 \
--pkg=c-api \
--pkg=config \
$(NULL)
VALADOC_FLAGS = \
--driver $(VALAC_VERSION) \
--force \
--package-name=Matrix-$(MATRIX_GLIB_API_VERSION) \
--package-version=$(PACKAGE_VERSION) \
-b $(top_srcdir)/src \
$(VALA_PKG_LIST) \
--vapidir=$(top_srcdir)/vapi \
$(NULL)