Port to Meson

This commit is contained in:
2018-05-09 15:31:39 +02:00
parent 18b7aeb1e4
commit f6429fa1cd
16 changed files with 286 additions and 1099 deletions

View File

@@ -1,299 +0,0 @@
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 =
# Libraries to create
lib_LTLIBRARIES = libmatrix-glib-0.0.la
AM_CPPFLAGS += \
-include $(CONFIG_HEADER) \
-I$(top_srcdir) \
-g \
-Wall \
$(GLIB_CFLAGS) \
$(GOBJECT_CFLAGS) \
$(SOUP_CFLAGS) \
$(JSON_CFLAGS) \
$(NULL)
# Binaries to create
bin_PROGRAMS = test-api-client test-client
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 \
matrix-message-emote.h \
matrix-message-file.h \
matrix-message-image.h \
matrix-message-audio.h \
matrix-message-video.h \
matrix-message-notice.h \
matrix-event-room-base.h \
matrix-event-state-base.h \
matrix-event-tag.h \
matrix-event-presence.h \
matrix-event-room-member.h \
matrix-event-room-topic.h \
matrix-event-room-aliases.h \
matrix-event-room-avatar.h \
matrix-event-room-name.h \
matrix-event-room-message.h \
matrix-event-room-history-visibility.h \
matrix-event-room-join-rules.h \
matrix-event-room-canonical-alias.h \
matrix-event-room-create.h \
matrix-event-room-power-levels.h \
matrix-event-room-guest-access.h \
matrix-event-room-message-feedback.h \
matrix-event-room-redaction.h \
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 \
$(NULL)
INST_H_BUILT_FILES = \
matrix-version.h \
matrix-enumtypes.h \
matrix-marshalers.h \
$(NULL)
matrix_enum_headers = \
matrix-types.h \
$(NULL)
libmatrix_glib_0_0_la_SOURCES = \
$(INST_H_BUILT_FILES) \
matrix-marshalers.c \
matrix-event-types.c \
matrix-version.c \
matrix-api.c \
matrix-http-api.c \
matrix-client.c \
matrix-http-client.c \
matrix-types.c \
matrix-compacts.c \
matrix-event-base.c \
matrix-event-call-base.c \
matrix-event-call-answer.c \
matrix-event-call-hangup.c \
matrix-event-call-invite.c \
matrix-event-call-candidates.c \
matrix-message-base.c \
matrix-message-text.c \
matrix-message-location.c \
matrix-message-emote.c \
matrix-message-file.c \
matrix-message-image.c \
matrix-message-audio.c \
matrix-message-video.c \
matrix-message-notice.c \
matrix-event-tag.c \
matrix-event-presence.c \
matrix-event-room-member.c \
matrix-event-typing.c \
matrix-event-room-base.c \
matrix-event-state-base.c \
matrix-event-receipt.c \
matrix-event-room-topic.c \
matrix-event-room-aliases.c \
matrix-event-room-avatar.c \
matrix-event-room-name.c \
matrix-event-room-message.c \
matrix-event-room-history-visibility.c \
matrix-event-room-join-rules.c \
matrix-event-room-canonical-alias.c \
matrix-event-room-create.c \
matrix-event-room-power-levels.c \
matrix-event-room-message-feedback.c \
matrix-event-room-redaction.c \
matrix-event-room-guest-access.c \
matrix-event-room-third-party-invite.c \
matrix-profile.c \
matrix-room.c \
utils.c \
matrix-enumtypes.c \
$(INST_H_SRC_FILES) \
$(NULL)
libmatrix_glib_0_0_la_CFLAGS = \
$(GLIB_CFLAGS) \
$(GOBJECT_CFLAGS) \
$(SOUP_CFLAGS) \
$(JSON_CFLAGS) \
$(NULL)
libmatrix_glib_0_0_la_LIBADD = \
$(GLIB_LIBS) \
$(GOBJECT_LIBS) \
$(SOUP_LIBS) \
$(JSON_LIBS) \
$(NULL)
libmatrix_glib_0_0_la_LDFLAGS = \
-version-info "$(LT_CURRENT)":"$(LT_REVISION)":"$(LT_AGE)"
BUILT_SOURCES += \
matrix-enumtypes.c \
matrix-enumtypes.h \
matrix-marshalers.c \
matrix-marshalers.h \
$(NULL)
test_api_client_SOURCES = test-api-client.c
test_api_client_CFLAGS = $(libmatrix_glib_0_0_la_CFLAGS) $(AM_CFLAGS)
test_api_client_LDADD = \
$(libmatrix_glib_0_0_la_LIBADD) \
libmatrix-glib-$(MATRIX_GLIB_API_VERSION).la \
$(NULL)
test_client_SOURCES = test-client.c
test_client_CFLAGS = $(libmatrix_glib_0_0_la_CFLAGS) $(AM_CFLAGS)
test_client_LDADD = \
$(libmatrix_glib_0_0_la_LIBADD) \
libmatrix-glib-$(MATRIX_GLIB_API_VERSION).la \
$(NULL)
CLEANFILES += $(BUILT_SOURCES)
EXTRA_DIST += \
matrix-enumtypes.h.template \
matrix-enumtypes.c.template \
matrix-marshalers.list \
$(INST_H_SRC_FILES) \
$(NULL)
matrix-enumtypes.h: $(matrix_enum_headers) matrix-enumtypes.h.template
$(AM_V_GEN) $(GLIB_MKENUMS) --template $(filter %.template,$^) \
$(filter-out %.template,$^) > $@.tmp \
&& mv $@.tmp $@
matrix-enumtypes.c: $(matrix_enum_headers) matrix-enumtypes.h matrix-enumtypes.c.template
$(AM_V_GEN) $(GLIB_MKENUMS) --template $(filter %.template,$^) \
$(filter-out %.template,$^) > $@.tmp \
&& mv $@.tmp $@
matrix-marshalers.h: stamp-matrix-marshalers
@true
stamp-matrix-marshalers: matrix-marshalers.list
$(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=_matrix_marshal \
$(srcdir)/matrix-marshalers.list \
--header \
--valist-marshallers >> xgen-gmlh \
&& (cmp -s xgen-gmlh matrix-marshalers.h \
|| cp xgen-gmlh matrix-marshalers.h) \
&& rm -f xgen-gmlh \
&& echo timestamp > $(@F)
matrix-marshalers.c: matrix-marshalers.h
$(AM_V_GEN) (echo "#include \"matrix-marshalers.h\""; \
echo "#undef G_ENABLE_DEBUG"; \
$(GLIB_GENMARSHAL) --prefix=_matrix_marshal \
$(srcdir)/matrix-marshalers.list \
--body \
--valist-marshallers) >> xgen-gmlc \
&& cp xgen-gmlc matrix-marshalers.c \
&& rm -f xgen-gmlc
CLEANFILES += stamp-matrix-marshalers
libmatrix_glib_dlname = \
`$(SED) -nE "s/^dlname='([A-Za-z0-9.+-]+)'/\1/p" libmatrix-glib-0.0.la`¬
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
headerdir = $(includedir)/matrix-glib-$(MATRIX_GLIB_API_VERSION)
header_DATA = \
$(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=)
EXTRA_DIST += $(pkgconfig_in)

View File

@@ -1,59 +0,0 @@
/*** BEGIN file-header ***/
/*
* 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/>.
*/
#include "matrix-enumtypes.h"
/*** END file-header ***/
/*** BEGIN file-production ***/
/* enumerations from @filename@ */
/*** END file-production ***/
/*** BEGIN value-header ***/
GType
@enum_name@_get_type(void)
{
static volatile gsize g_define_type_id__volatile = 0;
if (g_once_init_enter(&g_define_type_id__volatile)) {
static const G@Type@Value values[] = {
/*** END value-header ***/
/*** BEGIN value-production ***/
{
@VALUENAME@,
"@VALUENAME@",
"@valuenick@"
},
/*** END value-production ***/
/*** BEGIN value-tail ***/
{0, NULL, NULL}
};
GType g_define_type_id = g_@type@_register_static(
g_intern_static_string("@EnumName@"),
values);
g_once_init_leave(&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
/*** END value-tail ***/

View File

@@ -1,42 +0,0 @@
/*** BEGIN file-header ***/
/*
* 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/>.
*/
#ifndef __MATRIX_ENUMTYPES_H__
#define __MATRIX_ENUMTYPES_H__
#include <glib-object.h>
/*** END file-header ***/
/*** BEGIN file-production ***/
/* enumerations from "@filename@" */
#include "@filename@"
/*** END file-production ***/
/*** BEGIN value-header ***/
GType @enum_name@_get_type(void);
#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type())
/*** END value-header ***/
/*** BEGIN file-tail ***/
#endif /* __MATRIX_ENUMTYPES_H__ */
/*** END file-tail ***/

6
src/matrix-glib.map Normal file
View File

@@ -0,0 +1,6 @@
{
global:
matrix_*;
local:
*;
}

178
src/meson.build Normal file
View File

@@ -0,0 +1,178 @@
add_global_arguments('-DG_LOG_DOMAIN="Matrix-GLib"', language : 'c')
add_global_arguments('-D__MATRIX_GLIB_SDK_COMPILATION', language : 'c')
add_global_arguments('-Wall', language : 'c')
enums = gnome.mkenums_simple('matrix-enumtypes',
install_header : true,
sources : 'matrix-types.h',
install_dir : 'matrix-glib-sdk')
marshalers = gnome.genmarshal('matrix-marshalers',
prefix : '_matrix_marshal',
sources : 'matrix-marshalers.list',
valist_marshallers : true)
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',
'matrix-event-room-base.h',
'matrix-event-state-base.h',
'matrix-event-tag.h',
'matrix-event-presence.h',
'matrix-event-room-member.h',
'matrix-event-room-topic.h',
'matrix-event-room-aliases.h',
'matrix-event-room-avatar.h',
'matrix-event-room-name.h',
'matrix-event-room-message.h',
'matrix-event-room-history-visibility.h',
'matrix-event-room-join-rules.h',
'matrix-event-room-canonical-alias.h',
'matrix-event-room-create.h',
'matrix-event-room-power-levels.h',
'matrix-event-room-guest-access.h',
'matrix-event-room-message-feedback.h',
'matrix-event-room-redaction.h',
'matrix-event-room-third-party-invite.h',
'matrix-event-typing.h',
'matrix-event-receipt.h'
]
message_h_files = [
'matrix-message-base.h',
'matrix-message-text.h',
'matrix-message-location.h',
'matrix-message-emote.h',
'matrix-message-file.h',
'matrix-message-image.h',
'matrix-message-audio.h',
'matrix-message-video.h',
'matrix-message-notice.h'
]
inst_h_src_files = [
'matrix-types.h',
'matrix-compacts.h',
'matrix-api.h',
'matrix-http-api.h',
'matrix-client.h',
'matrix-http-client.h',
'utils.h',
'matrix-profile.h',
'matrix-room.h',
event_h_files,
message_h_files,
enums[1],
marshalers[1]
]
version_conf = configuration_data()
version_conf.set('MATRIX_GLIB_MAJOR_VERSION', matrix_glib_major_version)
version_conf.set('MATRIX_GLIB_MINOR_VERSION', matrix_glib_minor_version)
version_conf.set('MATRIX_GLIB_MICRO_VERSION', matrix_glib_micro_version)
version_file = configure_file(input : 'matrix-version.h.in',
output : 'matrix-version.h',
configuration : version_conf,
install : false)
sources = [
version_file,
enums,
marshalers,
inst_h_src_files,
'matrix-event-types.c',
'matrix-version.c',
'matrix-api.c',
'matrix-http-api.c',
'matrix-client.c',
'matrix-http-client.c',
'matrix-types.c',
'matrix-compacts.c',
'matrix-event-base.c',
'matrix-event-call-base.c',
'matrix-event-call-answer.c',
'matrix-event-call-hangup.c',
'matrix-event-call-invite.c',
'matrix-event-call-candidates.c',
'matrix-message-base.c',
'matrix-message-text.c',
'matrix-message-location.c',
'matrix-message-emote.c',
'matrix-message-file.c',
'matrix-message-image.c',
'matrix-message-audio.c',
'matrix-message-video.c',
'matrix-message-notice.c',
'matrix-event-tag.c',
'matrix-event-presence.c',
'matrix-event-room-member.c',
'matrix-event-typing.c',
'matrix-event-room-base.c',
'matrix-event-state-base.c',
'matrix-event-receipt.c',
'matrix-event-room-topic.c',
'matrix-event-room-aliases.c',
'matrix-event-room-avatar.c',
'matrix-event-room-name.c',
'matrix-event-room-message.c',
'matrix-event-room-history-visibility.c',
'matrix-event-room-join-rules.c',
'matrix-event-room-canonical-alias.c',
'matrix-event-room-create.c',
'matrix-event-room-power-levels.c',
'matrix-event-room-message-feedback.c',
'matrix-event-room-redaction.c',
'matrix-event-room-guest-access.c',
'matrix-event-room-third-party-invite.c',
'matrix-profile.c',
'matrix-room.c',
'utils.c',
]
enum_dep = declare_dependency(sources : enums[1])
marshaler_dep = declare_dependency(sources : marshalers[1])
deps = [glib, gobject, soup, json, enum_dep, marshaler_dep]
mapfile = 'matrix-glib.map'
matrixglib = library(
'matrix-glib', sources,
soversion : lt_current,
version : matrix_glib_api_version,
dependencies : deps,
include_directories : config_inc,
link_depends : mapfile,
install : true)
if get_option('test-clients')
test_api_client = executable('test-api-client', 'test-api-client.c',
dependencies : [glib, json, soup],
link_with : matrixglib)
test_client = executable('test-client', 'test-client.c',
dependencies : [glib, json, enum_dep],
link_with : matrixglib)
endif
if get_option('introspection')
matrix_gir = gnome.generate_gir(matrixglib,
sources : sources,
nsversion : matrix_glib_api_version,
namespace : 'Matrix',
symbol_prefix : 'matrix_',
identifier_prefix : 'Matrix',
export_packages : 'matrix-glib',
dependencies : deps,
includes : [
'GObject-2.0',
'Gio-2.0',
'Soup-2.4',
'Json-1.0'
],
link_with : matrixglib,
install : true)
endif