From f6429fa1cd078d89eb9287c4bcf7fd5343525f67 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Wed, 9 May 2018 15:31:39 +0200 Subject: [PATCH] Port to Meson --- Makefile.am | 66 ----- autogen.sh | 130 --------- configure.ac | 190 ------------- docs/Makefile.am | 1 - docs/meson.build | 3 + docs/reference/matrix-glib-sdk/Makefile.am | 85 ------ docs/reference/matrix-glib-sdk/meson.build | 4 + docs/reference/meson.build | 1 + git.mk | 227 ---------------- meson.build | 70 +++++ meson_options.txt | 24 ++ src/Makefile.am | 299 --------------------- src/matrix-enumtypes.c.template | 59 ---- src/matrix-enumtypes.h.template | 42 --- src/matrix-glib.map | 6 + src/meson.build | 178 ++++++++++++ 16 files changed, 286 insertions(+), 1099 deletions(-) delete mode 100644 Makefile.am delete mode 100755 autogen.sh delete mode 100644 configure.ac delete mode 100644 docs/Makefile.am create mode 100644 docs/meson.build delete mode 100644 docs/reference/matrix-glib-sdk/Makefile.am create mode 100644 docs/reference/matrix-glib-sdk/meson.build create mode 100644 docs/reference/meson.build delete mode 100644 git.mk create mode 100644 meson.build create mode 100644 meson_options.txt delete mode 100644 src/Makefile.am delete mode 100644 src/matrix-enumtypes.c.template delete mode 100644 src/matrix-enumtypes.h.template create mode 100644 src/matrix-glib.map create mode 100644 src/meson.build diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index 5f55bde..0000000 --- a/Makefile.am +++ /dev/null @@ -1,66 +0,0 @@ -ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} - -# Set up subdirectories to traverse -SUBDIRS = src - -if ENABLE_GTK_DOC - SUBDIRS += docs/reference/matrix-glib-sdk -endif - -# Specify files to include in dist - -# in share/doc/ -matrixglibdocdir = ${prefix}/doc/matrix-glib -matrixglibdoc_DATA = \ - README \ - COPYING \ - AUTHORS \ - ChangeLog \ - INSTALL \ - NEWS - -# with make dist - -EXTRA_DIST = $(matrixglibdoc_DATA) \ - autogen.sh \ - config.rpath - -# Lists of generated files you want to be able to clean - -MAINTAINERCLEANFILES = \ - $(srcdir)/aclocal.m4 \ - $(srcdir)/compile \ - $(srcdir)/config.guess \ - $(srcdir)/config.h.in \ - $(srcdir)/config.rpath \ - $(srcdir)/config.sub \ - $(srcdir)/depcomp \ - $(srcdir)/install-sh \ - $(srcdir)/ltmain.sh \ - $(srcdir)/missing \ - $(srcdir)/mkinstalldirs \ - $(srcdir)/ChangeLog \ - `find "$(srcdir)" -type f -name Makefile.in -print` \ - $(NULL) - -DISTCLEANFILES = \ - ChangeLog - -# Automatically generate ChangeLog from git - -ChangeLog: - @echo Creating $@ - @touch ChangeLog - @if test -d "$(srcdir)/.git"; then \ - (GIT_DIR=$(top_srcdir)/.git ./missing --run git log --stat) | fmt > $@.tmp \ - && mv -f $@.tmp $@ \ - || ($(RM) $@.tmp; \ - echo Failed to generate ChangeLog, your ChangeLog may be outdated >&2; \ - (test -f $@ || echo git-log is required to generate this file >> $@)); \ - else \ - test -f $@ || \ - (echo A git checkout and git-log is required to generate ChangeLog >&2 && \ - echo A git checkout and git-log is required to generate this file >> $@); \ - fi - -.PHONY: ChangeLog diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index feb403a..0000000 --- a/autogen.sh +++ /dev/null @@ -1,130 +0,0 @@ -#! /bin/sh -# Run this to generate all the initial makefiles, etc. - -srcdir=`dirname "$0"` -test -z "$srcdir" && srcdir=. - -DIE=0 -PKG_NAME="matrix-glib" - -(test -f "$srcdir/configure.ac" \ - && test -f "$srcdir/src/matrix-client.c") || { - echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" - echo " top-level $PKG_NAME directory" - - exit 1 -} - -(gtkdocize --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`gtkdocize' installed." - echo "Download the appropriate package for your distribution," - echo "or get the source tarball at ftp://ftp.gnome.org/" - - DIE=1 -} - -(autoconf --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`autoconf' installed." - echo "Download the appropriate package for your distribution," - echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" - - DIE=1 -} - -(grep "^LT_INIT" $srcdir/configure.ac >/dev/null) && { - (libtool --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`libtool' installed." - echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/" - - DIE=1 - } -} - -(automake --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`automake' installed." - echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/" - - DIE=1 - NO_AUTOMAKE=yes -} - -# if no automake, don't bother testing for aclocal -test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: Missing \`aclocal'. The version of \`automake'" - echo "installed doesn't appear recent enough." - echo "You can get automake from ftp://ftp.gnu.org/pub/gnu/" - - DIE=1 -} - -if test "$DIE" -eq 1; then - exit 1 -fi - -if test -z "$*"; then - echo "**Warning**: I am going to run \`configure' with no arguments." - echo "If you wish to pass any to it, please specify them on the" - echo \`$0\'" command line." - echo -fi - -case $CC in -xlc ) - am_opt=--include-deps;; -esac - -coin="$srcdir/configure.ac" -dr=`dirname $coin` - -cd $dr - -m4dir=`grep '^AC_CONFIG_MACRO_DIR' configure.ac \ - | sed -n -e 's/AC_CONFIG_MACRO_DIR(\([^()]*\))/\1/p' \ - | sed -e 's/^\[\(.*\)\]$/\1/' \ - | sed -e 1q` -m4_dir=$m4dir - -if test -n "$m4dir"]; then - m4dir="-I $m4dir" -fi - -aclocalinclude="$ACLOCAL_FLAGS" - -if grep "^LT_INIT" "$coin" > /dev/null; then - if test -z "$NO_LIBTOOLIZE"; then - echo "Running libtoolize ..." - libtoolize --force --copy || exit $? - fi -fi - -echo "Running aclocal $aclocalinclude ..." -aclocal $m4dir $ACLOCAL_FLAGS $aclocalinclude || exit $? - -if grep "^GTK_DOC_CHECK" "$coin" > /dev/null; then - echo "Running gtkdocize ..." - gtkdocize || exit $? -fi - -if grep "^A[CM]_CONFIG_HEADER" "$coin" > /dev/null; then - echo "Running autoheader ..." - autoheader || exit $? -fi - -echo "Running automake --gnu $am_opt ..." -automake --add-missing --copy --gnu $am_opt -Wno-portability || exit $? - -echo "Running autoconf ..." -autoconf || exit $? - -if test x$NOCONFIGURE = x; then - echo Running "$srcdir/configure" "$@" ... - "$srcdir/configure" "$@" \ - && echo Now type \`make\' to compile. || exit 1 -else - echo Skipping configure process. -fi diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 20f39dc..0000000 --- a/configure.ac +++ /dev/null @@ -1,190 +0,0 @@ -# Process this file with autoconf to produce a configure script - -# Sections -# Version numbers -# Setup -# Dependencies -# Output - -### Version numbers - -# Release Version -m4_define([matrix_glib_major_version], [0]) -m4_define([matrix_glib_minor_version], [0]) -m4_define([matrix_glib_micro_version], [1]) -m4_define([matrix_glib_nano_version], [0]) - -# LT_VERSION -# If library source has changed since last release, increment revision -# If public symbols have been added, removed or changed since last -# release, increment current and set revision to 0 -# If public symbols have been added since last release, increment age -# If public symbols have been removed since last release, set age to 0 -m4_define([matrix_glib_lt_current], [0]) -m4_define([matrix_glib_lt_revision], [0]) -m4_define([matrix_glib_lt_age], [0]) - -# Combine numbers to various version variables (different uses) -# Display the nano_version only if it's not '0' -m4_define([matrix_glib_base_version], - matrix_glib_major_version.matrix_glib_minor_version.matrix_glib_micro_version) -m4_define([matrix_glib_full_version], - [m4_if(matrix_glib_nano_version, [0], - matrix_glib_base_version, - matrix_glib_base_version.matrix_glib_nano_version)]) - -# You should set project_released to one in order to mark this as a -# released version and to avoid date on version numbers -m4_define(matrix_glib_released, [0]) -m4_define([matrix_glib_maybe_datestamp], - m4_if(matrix_glib_released, [1], - [], - [m4_esyscmd([date +.%Y%m%d | tr -d '\n\r'])])) - -m4_define([matrix_glib_version], matrix_glib_full_version[]matrix_glib_maybe_datestamp) -m4_define([matrix_glib_major_minor_version], matrix_glib_major_version.matrix_glib_minor_version) -m4_define([matrix_glib_module_version], matrix_glib_lt_current) -m4_define([matrix_glib_api_version], [matrix_glib_major_version.0]) - -### Setup - -# Initialise autoconf with project details, version -AC_INIT([MatrixGlib], matrix_glib_version, - [gergely@polonkai.eu], [matrix-glib]) -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) - -AC_PREREQ([2.65]) -AC_COPYRIGHT([Copyright (C) 2015,2016 Gergely Polonkai]) - -# Configure various files and settings for autoconf/automake -AC_CONFIG_MACRO_DIR([m4]) -AC_CONFIG_SRCDIR([Makefile.am]) -AC_CONFIG_HEADERS([config.h]) -AC_CONFIG_SRCDIR([configure.ac]) -AM_INIT_AUTOMAKE([1.11 dist-xz no-define - no-dist-gzip tar-ustar -Wno-portability]) -AM_MAINTAINER_MODE([enable]) - -AC_PROG_CC -AM_PROG_CC_C_O -AM_PROG_AR -AC_PROG_LIBTOOL - -# Initialise libtool (handles library creation) with versions from above -LT_INIT(win32-dll) - -PKG_PROG_PKG_CONFIG([0.21]) - -AC_SUBST([CFLAGS]) -AC_SUBST([CPPFLAGS]) -AC_SUBST([LDFLAGS]) - -AC_SUBST([LT_CURRENT], matrix_glib_lt_current) -AC_SUBST([LT_REVISION], matrix_glib_lt_revision) -AC_SUBST([LT_AGE], matrix_glib_lt_age) - -AC_SUBST([MATRIX_GLIB_VERSION], matrix_glib_base_version) - -### Dependencies - -GLIB_REQUIRED=2.40.0 -VALA_REQUIRED=0.30.0 -LIBVALA_REQUIRED=0.30 -GIO_REQUIRED=2.22 -SOUP_REQUIRED=2.44.2 -JSON_REQUIRED=0.16.2 - -# Check GLib -PKG_CHECK_MODULES([GLIB], - [glib-2.0 >= $GLIB_REQUIRED - gobject-2.0 >= $GLIB_REQUIRED]) - -m4_ifdef([GTK_DOC_CHECK], [ -GTK_DOC_CHECK([1.25], [--flavour no-tmpl]) -], [ -AM_CONDITIONAL([ENABLE_GTK_DOC], false) -]) - -# Check for GIO -PKG_CHECK_MODULES([GIO], [gio-2.0 >= $GIO_REQUIRED]) - -# Check for libSoup -PKG_CHECK_MODULES([SOUP], [libsoup-2.4 >= $SOUP_REQUIRED]) - -# Check for JSON-GLib -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, - AS_HELP_STRING([--enable-debug], - [compile with debugging support]), - [debug=$enableval], [debug=no]) -AM_CONDITIONAL([DEBUG], [test $debug = yes]) - -if test x"$debug" = x"$enableval"; then - AC_DEFINE([DEBUG], [1], [Define as 1 if debugging should be enabled]) - - if test x"$cflags_set" != x"set"; then - case " $CFLAGS " in - *[[\ \ ]]-g[[\ \ ]]*) ;; - *) - CFLAGS="$CFLAGS -g" - - if test x"$USE_MAINTAINER_MODE" = x"$enableval"; then - CFLAGS="$CFLAGS -O0" - fi - - ;; - esac - fi -else - AC_DEFINE([DEBUG], [0], [Define as 1 if debugging should be enabled]) -fi - -AC_SUBST([MATRIX_GLIB_MAJOR_VERSION], matrix_glib_major_version) -AC_SUBST([MATRIX_GLIB_MINOR_VERSION], matrix_glib_minor_version) -AC_SUBST([MATRIX_GLIB_MICRO_VERSION], matrix_glib_micro_version) - -# This is used to identify a set of API compatible between versions -# - If new versions are compatible with the actual one, just leave -# this untouched -# - If new version breaks API change it in order to allow parallel -# installations with old versions. Change name of pc files to use -# a new API, too -AC_SUBST([MATRIX_GLIB_API_VERSION], matrix_glib_api_version) - -AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal]) -AC_PATH_PROG([GLIB_MKENUMS], [glib-mkenums]) - -AC_CONFIG_FILES([ - Makefile - src/Makefile - src/matrix-version.h - src/matrix-glib-0.0.pc - docs/reference/matrix-glib-sdk/Makefile -]) -AC_OUTPUT - -# Print configuration summary -echo "" -echo " Configuration summary for Matrix-$MATRIX_GLIB_VERSION" -echo " Installation prefix: $prefix" -echo " Documentation: ${enable_gtk_doc}" -echo " Debug: $debug" -echo "" diff --git a/docs/Makefile.am b/docs/Makefile.am deleted file mode 100644 index 741f850..0000000 --- a/docs/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = diff --git a/docs/meson.build b/docs/meson.build new file mode 100644 index 0000000..e1b9c00 --- /dev/null +++ b/docs/meson.build @@ -0,0 +1,3 @@ +if get_option('gtk-doc') + subdir('reference') +endif diff --git a/docs/reference/matrix-glib-sdk/Makefile.am b/docs/reference/matrix-glib-sdk/Makefile.am deleted file mode 100644 index 002d635..0000000 --- a/docs/reference/matrix-glib-sdk/Makefile.am +++ /dev/null @@ -1,85 +0,0 @@ -# This is a blank Makefile.am for using gtk-doc. -# Copy this to your project's API docs directory and modify the variables to -# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples -# of using the various options. - -# The name of the module, e.g. 'glib'. -DOC_MODULE=matrix-glib-sdk - -# Uncomment for versioned docs and specify the version of the module, e.g. '2'. -#DOC_MODULE_VERSION=2 - -# The top-level XML file. -DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml - -# Directories containing the source code. -# gtk-doc will search all .c and .h files beneath these paths -# for inline comments documenting functions and macros. -# e.g. DOC_SOURCE_DIR=$(top_srcdir)/gtk $(top_srcdir)/gdk -DOC_SOURCE_DIR=$(top_srcdir)/src - -# Extra options to pass to gtkdoc-scangobj. Normally not needed. -SCANGOBJ_OPTIONS= - -# Extra options to supply to gtkdoc-scan. -# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" -SCAN_OPTIONS= - -# Extra options to supply to gtkdoc-mkdb -# e.g. MKDB_OPTIONS=--xml-mode --output-format=xml -MKDB_OPTIONS=--xml-mode --output-format=xml - -# Extra options to supply to gtkdoc-mkhtml -MKHTML_OPTIONS= - -# Extra options to supply to gtkdoc-fixref. Normally not needed. -# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html -FIXXREF_OPTIONS= - -# Used for dependencies. The docs will be rebuilt if any of these change. -# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h -# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c -HFILE_GLOB=$(top_srcdir)/src/*.h -CFILE_GLOB=$(top_srcdir)/src/*.c - -# Extra header to include when scanning, which are not under DOC_SOURCE_DIR -# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h -EXTRA_HFILES= - -# Header files or dirs to ignore when scanning. Use base file/dir names -# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h private_code -IGNORE_HFILES=utils.h - -# Images to copy into HTML directory. -# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png -HTML_IMAGES= - -# Extra files that are included by $(DOC_MAIN_SGML_FILE). -# e.g. content_files=running.xml building.xml changes-2.0.xml -content_files= - -# Files where gtk-doc abbrevations (#GtkWidget) are expanded -# e.g. expand_content_files=running.xml -expand_content_files= - -# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library. -# Only needed if you are using gtkdoc-scangobj to dynamically query widget -# signals and properties. -# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) -# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) -GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_srcdir)/src -GTKDOC_LIBS=$(top_builddir)/src/libmatrix-glib-0.0.la - -# This includes the standard gtk-doc make rules, copied by gtkdocize. -include $(top_srcdir)/gtk-doc.make - -# Comment this out if you want 'make check' to test you doc status -# and run some sanity checks -if ENABLE_GTK_DOC -TESTS_ENVIRONMENT = \ - DOC_MODULE=$(DOC_MODULE) DOC_MAIN_SGML_FILE=$(DOC_MAIN_SGML_FILE) \ - SRCDIR=$(abs_srcdir) BUILDDIR=$(abs_builddir) -TESTS = $(GTKDOC_CHECK) -endif - --include $(top_srcdir)/git.mk diff --git a/docs/reference/matrix-glib-sdk/meson.build b/docs/reference/matrix-glib-sdk/meson.build new file mode 100644 index 0000000..fa54cbe --- /dev/null +++ b/docs/reference/matrix-glib-sdk/meson.build @@ -0,0 +1,4 @@ +gnome.gtkdoc('matrix-glib-sdk', + main_xml : 'matrix-glib-sdk-docs.xml', + src_dir : join_paths(meson.source_root(), 'src'), + install : true) diff --git a/docs/reference/meson.build b/docs/reference/meson.build new file mode 100644 index 0000000..27f9a30 --- /dev/null +++ b/docs/reference/meson.build @@ -0,0 +1 @@ +subdir('matrix-glib-sdk') diff --git a/git.mk b/git.mk deleted file mode 100644 index d5bf7b8..0000000 --- a/git.mk +++ /dev/null @@ -1,227 +0,0 @@ -# git.mk -# -# Copyright 2009, Red Hat, Inc. -# Copyright 2010,2011 Behdad Esfahbod -# Written by Behdad Esfahbod -# -# Copying and distribution of this file, with or without modification, -# is permitted in any medium without royalty provided the copyright -# notice and this notice are preserved. -# -# The latest version of this file can be downloaded from: -# https://raw.github.com/behdad/git.mk/master/git.mk -# Bugs, etc, should be reported upstream at: -# https://github.com/behdad/git.mk -# -# To use in your project, import this file in your git repo's toplevel, -# then do "make -f git.mk". This modifies all Makefile.am files in -# your project to -include git.mk. Remember to add that line to new -# Makefile.am files you create in your project, or just rerun the -# "make -f git.mk". -# -# This enables automatic .gitignore generation. If you need to ignore -# more files, add them to the GITIGNOREFILES variable in your Makefile.am. -# But think twice before doing that. If a file has to be in .gitignore, -# chances are very high that it's a generated file and should be in one -# of MOSTLYCLEANFILES, CLEANFILES, DISTCLEANFILES, or MAINTAINERCLEANFILES. -# -# The only case that you need to manually add a file to GITIGNOREFILES is -# when remove files in one of mostlyclean-local, clean-local, distclean-local, -# or maintainer-clean-local make targets. -# -# Note that for files like editor backup, etc, there are better places to -# ignore them. See "man gitignore". -# -# If "make maintainer-clean" removes the files but they are not recognized -# by this script (that is, if "git status" shows untracked files still), send -# me the output of "git status" as well as your Makefile.am and Makefile for -# the directories involved and I'll diagnose. -# -# For a list of toplevel files that should be in MAINTAINERCLEANFILES, see -# Makefile.am.sample in the git.mk git repo. -# -# Don't EXTRA_DIST this file. It is supposed to only live in git clones, -# not tarballs. It serves no useful purpose in tarballs and clutters the -# build dir. -# -# This file knows how to handle autoconf, automake, libtool, gtk-doc, -# gnome-doc-utils, yelp.m4, mallard, intltool, gsettings, dejagnu. -# -# This makefile provides the following targets: -# -# - all: "make all" will build all gitignore files. -# - gitignore: makes all gitignore files in the current dir and subdirs. -# - .gitignore: make gitignore file for the current dir. -# - gitignore-recurse: makes all gitignore files in the subdirs. -# -# KNOWN ISSUES: -# -# - Recursive configure doesn't work as $(top_srcdir)/git.mk inside the -# submodule doesn't find us. If you have configure.{in,ac} files in -# subdirs, add a proxy git.mk file in those dirs that simply does: -# "include $(top_srcdir)/../git.mk". Add more ..'s to your taste. -# And add those files to git. See vte/gnome-pty-helper/git.mk for -# example. -# - -git-all: git-mk-install - -git-mk-install: - @echo Installing git makefile - @any_failed=; \ - find "`test -z "$(top_srcdir)" && echo . || echo "$(top_srcdir)"`" -name Makefile.am | while read x; do \ - if grep 'include .*/git.mk' $$x >/dev/null; then \ - echo $$x already includes git.mk; \ - else \ - failed=; \ - echo "Updating $$x"; \ - { cat $$x; \ - echo ''; \ - echo '-include $$(top_srcdir)/git.mk'; \ - } > $$x.tmp || failed=1; \ - if test x$$failed = x; then \ - mv $$x.tmp $$x || failed=1; \ - fi; \ - if test x$$failed = x; then : else \ - echo Failed updating $$x; >&2 \ - any_failed=1; \ - fi; \ - fi; done; test -z "$$any_failed" - -.PHONY: git-all git-mk-install - - -### .gitignore generation - -$(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk - $(AM_V_GEN) \ - { \ - if test "x$(DOC_MODULE)" = x -o "x$(DOC_MAIN_SGML_FILE)" = x; then :; else \ - for x in \ - $(DOC_MODULE)-decl-list.txt \ - $(DOC_MODULE)-decl.txt \ - tmpl/$(DOC_MODULE)-unused.sgml \ - "tmpl/*.bak" \ - xml html \ - ; do echo /$$x; done; \ - fi; \ - if test "x$(DOC_MODULE)$(DOC_ID)" = x -o "x$(DOC_LINGUAS)" = x; then :; else \ - for lc in $(DOC_LINGUAS); do \ - for x in \ - $(if $(DOC_MODULE),$(DOC_MODULE).xml) \ - $(DOC_PAGES) \ - $(DOC_INCLUDES) \ - ; do echo /$$lc/$$x; done; \ - done; \ - for x in \ - $(_DOC_OMF_ALL) \ - $(_DOC_DSK_ALL) \ - $(_DOC_HTML_ALL) \ - $(_DOC_MOFILES) \ - $(DOC_H_FILE) \ - "*/.xml2po.mo" \ - "*/*.omf.out" \ - ; do echo /$$x; done; \ - fi; \ - if test "x$(HELP_ID)" = x -o "x$(HELP_LINGUAS)" = x; then :; else \ - for lc in $(HELP_LINGUAS); do \ - for x in \ - $(HELP_FILES) \ - "$$lc.stamp" \ - "$$lc.mo" \ - ; do echo /$$lc/$$x; done; \ - done; \ - fi; \ - if test "x$(gsettings_SCHEMAS)" = x; then :; else \ - for x in \ - $(gsettings_SCHEMAS:.xml=.valid) \ - $(gsettings__enum_file) \ - ; do echo /$$x; done; \ - fi; \ - if test -f $(srcdir)/po/Makefile.in.in; then \ - for x in \ - po/Makefile.in.in \ - po/Makefile.in \ - po/Makefile \ - po/POTFILES \ - po/stamp-it \ - po/.intltool-merge-cache \ - "po/*.gmo" \ - "po/*.mo" \ - po/$(GETTEXT_PACKAGE).pot \ - intltool-extract.in \ - intltool-merge.in \ - intltool-update.in \ - ; do echo /$$x; done; \ - fi; \ - if test -f $(srcdir)/configure; then \ - for x in \ - autom4te.cache \ - configure \ - config.h \ - stamp-h1 \ - libtool \ - config.lt \ - ; do echo /$$x; done; \ - fi; \ - if test "x$(DEJATOOL)" = x; then :; else \ - for x in \ - $(DEJATOOL) \ - ; do echo /$$x.sum; echo /$$x.log; done; \ - echo /site.exp; \ - fi; \ - for x in \ - .gitignore \ - $(GITIGNOREFILES) \ - $(CLEANFILES) \ - $(PROGRAMS) $(check_PROGRAMS) $(EXTRA_PROGRAMS) \ - $(LIBRARIES) $(check_LIBRARIES) $(EXTRA_LIBRARIES) \ - $(LTLIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LTLIBRARIES) \ - so_locations \ - .libs _libs \ - $(MOSTLYCLEANFILES) \ - "*.$(OBJEXT)" \ - "*.lo" \ - $(DISTCLEANFILES) \ - $(am__CONFIG_DISTCLEAN_FILES) \ - $(CONFIG_CLEAN_FILES) \ - TAGS ID GTAGS GRTAGS GSYMS GPATH tags \ - "*.tab.c" \ - $(MAINTAINERCLEANFILES) \ - $(BUILT_SOURCES) \ - $(DEPDIR) \ - Makefile \ - Makefile.in \ - "*.orig" \ - "*.rej" \ - "*.bak" \ - "*~" \ - ".*.sw[nop]" \ - ".dirstamp" \ - ; do echo /$$x; done; \ - } | \ - sed "s@^/`echo "$(srcdir)" | sed 's/\(.\)/[\1]/g'`/@/@" | \ - sed 's@/[.]/@/@g' | \ - LC_ALL=C sort | uniq > $@.tmp && \ - mv $@.tmp $@; - -all: $(srcdir)/.gitignore gitignore-recurse-maybe -gitignore: $(srcdir)/.gitignore gitignore-recurse - -gitignore-recurse-maybe: - @for subdir in $(DIST_SUBDIRS); do \ - case " $(SUBDIRS) " in \ - *" $$subdir "*) :;; \ - *) test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) .gitignore gitignore-recurse-maybe || echo "Skipping $$subdir");; \ - esac; \ - done -gitignore-recurse: - @for subdir in $(DIST_SUBDIRS); do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) .gitignore gitignore-recurse || echo "Skipping $$subdir"); \ - done - -maintainer-clean: gitignore-clean -gitignore-clean: - -rm -f $(srcdir)/.gitignore - -.PHONY: gitignore-clean gitignore gitignore-recurse gitignore-recurse-maybe diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..10207dc --- /dev/null +++ b/meson.build @@ -0,0 +1,70 @@ +project('matrix-glib', 'c', version : '0.0.1') + +sdk_version = meson.project_version() +ver_arr = sdk_version.split('.') + +matrix_glib_major_version = ver_arr[0] +matrix_glib_minor_version = ver_arr[1] +matrix_glib_micro_version = ver_arr[2] +matrix_glib_nano_version = '0' + +lt_current = ver_arr[0] +matrix_glib_lt_revision = '0' +matrix_glib_lt_age = '0' + +matrix_glib_base_version = meson.project_version() +matrix_glib_full_version = meson.project_version() + +if matrix_glib_nano_version != '0' + matrix_glib_full_version += '.' + matrix_glib_nano_version +endif + +matrix_glib_released = '0' + +if matrix_glib_released == '1' + matrix_glib_maybe_datestamp = '' +else + datestamp = run_command('date', '+.%Y%m%d') + matrix_glib_maybe_datestamp = '.' + datestamp.stdout().strip() +endif + +matrix_glib_version = matrix_glib_full_version + matrix_glib_maybe_datestamp +matrix_glib_major_minor_version = matrix_glib_major_version + '.' + matrix_glib_minor_version +matrix_glib_module_version = lt_current +matrix_glib_api_version = matrix_glib_major_version + '.0' + +gnome = import('gnome') + +glib_required = '>= 2.40.0' +vala_required = '>= 0.30.0' +libvala_required = '>= 0.30' +gio_required = '>= 2.22' +soup_required = '>= 2.44.2' +json_required = '>= 0.16.2' + +glib = dependency('glib-2.0', version : glib_required) +gobject = dependency('gobject-2.0', version : glib_required) +gio = dependency('gio-2.0', version : gio_required) +soup = dependency('libsoup-2.4', version : soup_required) +json = dependency('json-glib-1.0', version : json_required) + +conf = configuration_data() + +if get_option('debug') + conf.set('DEBUG', 1) + add_global_arguments('-g', language : 'c') + + if get_option('maintainer-mode') + add_global_arguments('-O0', language : 'c') + endif +else + conf.set('DEBUG', 0) +endif + +configure_file(output : 'config.h', + configuration : conf) + +config_inc = include_directories('.') + +subdir('src') +subdir('docs') diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..9f0faf4 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,24 @@ +option('debug', + type : 'boolean', + value : false, + description : 'compile with debugging support') + +option('maintainer-mode', + type : 'boolean', + value : false, + description : 'enable maintainer mode') + +option('gtk-doc', + type : 'boolean', + value : false, + description : 'generate API reference') + +option('introspection', + type : 'boolean', + value : true, + description : 'generate GObject Introspection data') + +option('test-clients', + type : 'boolean', + value : true, + description : 'compile the test clients') diff --git a/src/Makefile.am b/src/Makefile.am deleted file mode 100644 index fd556a0..0000000 --- a/src/Makefile.am +++ /dev/null @@ -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) diff --git a/src/matrix-enumtypes.c.template b/src/matrix-enumtypes.c.template deleted file mode 100644 index 82f02a8..0000000 --- a/src/matrix-enumtypes.c.template +++ /dev/null @@ -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 - * . - */ - -#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 ***/ diff --git a/src/matrix-enumtypes.h.template b/src/matrix-enumtypes.h.template deleted file mode 100644 index 0327afa..0000000 --- a/src/matrix-enumtypes.h.template +++ /dev/null @@ -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 - * . - */ - -#ifndef __MATRIX_ENUMTYPES_H__ -#define __MATRIX_ENUMTYPES_H__ - -#include - -/*** 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 ***/ diff --git a/src/matrix-glib.map b/src/matrix-glib.map new file mode 100644 index 0000000..a6ad787 --- /dev/null +++ b/src/matrix-glib.map @@ -0,0 +1,6 @@ +{ +global: + matrix_*; +local: + *; +} diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..a7d2298 --- /dev/null +++ b/src/meson.build @@ -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