summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Georg <mail@jensge.org>2021-05-26 22:56:38 +0000
committerJens Georg <mail@jensge.org>2021-05-26 22:56:38 +0000
commiteb28c34fd624302b787287efc88e256f5bf48578 (patch)
tree6bc917599f2620fe819ad149d746decdba998d72
parent3330b34e49c8063c1d11f57168bdd1571cd9fa8d (diff)
downloadgupnp-dlna-eb28c34fd624302b787287efc88e256f5bf48578.tar.gz
build: Add Meson build support
-rw-r--r--.gitignore1
-rw-r--r--.gitlab-ci.yml192
-rw-r--r--Makefile.am2
-rw-r--r--doc/Makefile.am2
-rw-r--r--doc/gupnp-dlna-gst/Makefile.am1
-rw-r--r--doc/gupnp-dlna-gst/meson.build21
-rw-r--r--doc/gupnp-dlna-metadata/Makefile.am1
-rw-r--r--doc/gupnp-dlna-metadata/meson.build9
-rw-r--r--doc/gupnp-dlna/Makefile.am1
-rw-r--r--doc/gupnp-dlna/meson.build31
-rw-r--r--doc/meson.build13
-rw-r--r--libgupnp-dlna/Makefile.am6
-rw-r--r--libgupnp-dlna/gupnp-dlna-metadata-backend.c4
-rw-r--r--libgupnp-dlna/meson.build159
-rw-r--r--libgupnp-dlna/metadata-backends/gstreamer/meson.build75
-rw-r--r--libgupnp-dlna/metadata-backends/meson.build1
-rw-r--r--libgupnp-dlna/metadata/gupnp-dlna-metadata-extractor.c2
-rw-r--r--meson.build67
-rw-r--r--meson_options.txt6
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/meson.build28
-rw-r--r--tools/Makefile.am2
-rw-r--r--tools/meson.build25
-rw-r--r--vala/Makefile.am3
-rw-r--r--vala/gupnp-dlna-gst-2.0-custom.vala2
-rw-r--r--vala/meson.build27
26 files changed, 678 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index 591b59f..5a0cdfa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -102,3 +102,4 @@ po/Makefile.in.in
po/POTFILES
stamp-*
tests/dlna-profile-parser
+build
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..39e61fd
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,192 @@
+include:
+ - remote: "https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/290b79e0e78eab67a83766f4e9691be554fc4afd/templates/ci-fairy.yml"
+ - remote: 'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/290b79e0e78eab67a83766f4e9691be554fc4afd/templates/fedora.yml'
+
+variables:
+ MESON_TEST_TIMEOUT_MULTIPLIER: 3
+
+stages:
+ - review
+ - prepare
+ - build
+ - test
+ - analysis
+ - website
+
+.check-template: &check
+ extends:
+ - .fdo.ci-fairy
+ artifacts:
+ expire_in: 1 week
+ paths:
+ - check-junit-report.xml
+ reports:
+ junit: check-junit-report.xml
+
+check-commit-log:
+ variables:
+ GIT_DEPTH: "100"
+ stage: review
+ script:
+ - if [[ x"$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" != "x" ]] ;
+ then
+ ci-fairy check-commits --junit-xml=check-junit-report.xml ;
+ else
+ echo "Not a merge request" ;
+ fi
+ <<: *check
+
+check-merge-request:
+ variables:
+ GIT_STRATEGY: none
+ stage: review
+ script:
+ - if [[ x"$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" != "x" ]] ;
+ then
+ ci-fairy check-merge-request --require-allow-collaboration --junit-xml=check-junit-report.xml ;
+ else
+ echo "Not a merge request" ;
+ fi
+ <<: *check
+
+.build-template: &build
+ stage: build
+ script:
+ - meson . build --prefix=/usr -Db_coverage=true
+ - ninja -C build
+ artifacts:
+ expire_in: 1 day
+ paths:
+ - build
+
+.gupnpdlna.fedora@common:
+ variables:
+ BASE_TAG: '2021-05-23.2'
+ FDO_UPSTREAM_REPO: GNOME/gupnp-dlna
+ FDO_DISTRIBUTION_PACKAGES: 'clang clang-analyzer gcovr git libasan libubsan python3-gobject python3-pip xmlto gobject-introspection-devel gtk-doc libxml2-devel vala ninja-build gstreamer1-devel gstreamer1-plugins-base-devel'
+ FDO_DISTRIBUTION_EXEC: |
+ dnf clean all &&
+ pip3 install meson
+
+.gupnpdlna.fedora:34@x86_64:
+ extends: .gupnpdlna.fedora@common
+ variables:
+ FDO_DISTRIBUTION_VERSION: 34
+ FDO_DISTRIBUTION_TAG: "x86_64-${BASE_TAG}"
+
+build-fedora-container@x86_64:
+ extends:
+ - .fdo.container-build@fedora
+ - .gupnpdlna.fedora:34@x86_64
+ stage: prepare
+ variables:
+ GIT_STRATEGY: none
+
+
+build-fedora@x86_64:
+ extends:
+ - .fdo.distribution-image@fedora
+ - .gupnpdlna.fedora:34@x86_64
+ needs:
+ - build-fedora-container@x86_64
+ <<: *build
+
+
+.test-template: &test
+ stage: test
+ variables:
+ G_SLICE: "always-malloc"
+ MALLOC_CHECK_: "3"
+ script:
+ - if [[ x"$GUPNP_DLNA_RUN_MEDIA_TEST" != "x" ]] ;
+ then
+ git clone --depth=1 https://gitlab.gnome.org/GNOME/gupnp-dlna-media.git tests/gupnp-dlna-media ;
+ else
+ echo "Media discoverer tests disabled." ;
+ fi
+ - cd build
+ - |
+ # Remove the many "CI_" variables from the environment. Meson dumps the
+ # whole environment for every failed test, and that gives a whole
+ # screenful of junk each time unless we strip these.
+ unset $(env|grep -o '^CI_[^=]*')
+ env LANG=C.UTF-8 LC_ALL=C.UTF-8 meson test --print-errorlogs ${MESON_TEST_EXTRA_ARGS}
+ after_script:
+ - |
+ echo "Distribution: "
+ echo
+ egrep '^NAME=|^VERSION=' /etc/os-release
+ echo
+ echo "Test suite settings:"
+ echo
+ echo "G_MESSAGES_DEBUG: ${G_MESSAGES_DEBUG}"
+ echo "MESON_TEST_EXTRA_ARGS: ${MESON_TEST_EXTRA_ARGS}"
+ echo
+ echo "These values can be set at https://gitlab.gnome.org/GNOME/gupnp-dlna/pipelines/new"
+ artifacts:
+ expire_in: 1 day
+ when: always
+ paths:
+ - build
+ reports:
+ junit: "build/meson-logs/testlog.junit.xml"
+
+test-fedora@x86_64:
+ extends:
+ - .fdo.distribution-image@fedora
+ - .gupnpdlna.fedora:34@x86_64
+ needs:
+ - build-fedora@x86_64
+ <<: *test
+
+coverage-analysis:
+ extends:
+ - .fdo.distribution-image@fedora
+ - .gupnpdlna.fedora:34@x86_64
+ stage: analysis
+ allow_failure: true
+ script:
+ - cd build
+ - mkdir -p coveragereport
+ - gcovr --html-details --print-summary --root=.. --exclude=../build --exclude=../docs/reference --exclude=../tests --exclude=../tools --exclude=../examples --output coveragereport/index.html
+ coverage: '/^lines: (\d+\.\d+\%)/'
+ artifacts:
+ when: always
+ paths:
+ - build/coveragereport
+ needs:
+ - test-fedora@x86_64
+
+static-scan:
+ extends:
+ - .fdo.distribution-image@fedora
+ - .gupnpdlna.fedora:34@x86_64
+ stage: analysis
+ needs:
+ - build-fedora-container@x86_64
+ script:
+ - meson --buildtype=debug _scan_build
+ - ninja -C _scan_build scan-build
+ artifacts:
+ paths:
+ - _scan_build/meson-logs
+ allow_failure: true
+
+pages:
+ extends:
+ - .fdo.distribution-image@fedora
+ - .gupnpdlna.fedora:34@x86_64
+ stage: website
+ script:
+ - meson doc-build -Dgtk_doc=true
+ - ninja -C doc-build gupnp-dlna-doc
+ - mkdir -p public
+ - mv doc-build/doc/html public/docs
+ artifacts:
+ paths:
+ - public
+ needs:
+ - build-fedora-container@x86_64
+ only:
+ - master
+
diff --git a/Makefile.am b/Makefile.am
index 17b6d6a..7e6e0e2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,7 @@
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
+EXTRA_DIST = meson.build meson_options.txt
+
SUBDIRS = libgupnp-dlna tools tests data doc vala
pkgconfig_DATA = gupnp-dlna-2.0.pc gupnp-dlna-metadata-2.0.pc
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 192859d..65f1d5e 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -7,4 +7,4 @@ endif
SUBDIRS += .
-EXTRA_DIST = version.xml.in
+EXTRA_DIST = version.xml.in meson.build
diff --git a/doc/gupnp-dlna-gst/Makefile.am b/doc/gupnp-dlna-gst/Makefile.am
index 809fbcc..2478e9f 100644
--- a/doc/gupnp-dlna-gst/Makefile.am
+++ b/doc/gupnp-dlna-gst/Makefile.am
@@ -88,4 +88,5 @@ include $(top_srcdir)/gtk-doc.make
# Other files to distribute
# e.g. EXTRA_DIST += version.xml.in
+EXTRA_DIST = meson.build
DISTCLEANFILES = version.xml
diff --git a/doc/gupnp-dlna-gst/meson.build b/doc/gupnp-dlna-gst/meson.build
new file mode 100644
index 0000000..b791bf7
--- /dev/null
+++ b/doc/gupnp-dlna-gst/meson.build
@@ -0,0 +1,21 @@
+gnome.gtkdoc('gupnp-dlna-gst',
+ main_xml : 'gupnp-dlna-gst-docs.sgml',
+ src_dir : ['libgupnp-dlna/metadata-backends/gstreamer'],
+ ignore_headers : [
+ 'gupnp-dlna-gst-container-information.h',
+ 'gupnp-dlna-gst-video-information.h',
+ 'gupnp-dlna-gst-metadata-extractor.h',
+ 'gupnp-dlna-gst-audio-information.h',
+ 'gupnp-dlna-gst-info-utils.h',
+ 'gupnp-dlna-gst-information.h',
+ 'gupnp-dlna-gst-image-information.h',
+ ],
+ fixxref_args : [
+ '--extra-dir', join_paths(meson.build_root(), 'doc/gupnp-dlna/html'),
+ ],
+ content_files : version_xml,
+ dependencies : [
+ libgupnp_dlna,
+ libgupnp_dlna_gst
+ ],
+ install : true)
diff --git a/doc/gupnp-dlna-metadata/Makefile.am b/doc/gupnp-dlna-metadata/Makefile.am
index 14252e0..4c2bb0c 100644
--- a/doc/gupnp-dlna-metadata/Makefile.am
+++ b/doc/gupnp-dlna-metadata/Makefile.am
@@ -86,4 +86,5 @@ include $(top_srcdir)/gtk-doc.make
# Other files to distribute
# e.g. EXTRA_DIST += version.xml.in
+EXTRA_DIST = meson.build
DISTCLEANFILES = version.xml
diff --git a/doc/gupnp-dlna-metadata/meson.build b/doc/gupnp-dlna-metadata/meson.build
new file mode 100644
index 0000000..a11217b
--- /dev/null
+++ b/doc/gupnp-dlna-metadata/meson.build
@@ -0,0 +1,9 @@
+gnome.gtkdoc('gupnp-dlna-metadata',
+ main_xml : 'gupnp-dlna-metadata-docs.sgml',
+ src_dir : [join_paths(meson.source_root(), 'libgupnp-dlna/metadata')],
+ fixxref_args : [
+ '--extra-dir', join_paths(meson.build_root(), 'doc/gupnp-dlna/html'),
+ ],
+ content_files : version_xml,
+ dependencies : libgupnp_dlna,
+ install : true)
diff --git a/doc/gupnp-dlna/Makefile.am b/doc/gupnp-dlna/Makefile.am
index 8c93762..895e4fc 100644
--- a/doc/gupnp-dlna/Makefile.am
+++ b/doc/gupnp-dlna/Makefile.am
@@ -98,4 +98,5 @@ include $(top_srcdir)/gtk-doc.make
# Other files to distribute
# e.g. EXTRA_DIST += version.xml.in
+EXTRA_DIST = meson.build
DISTCLEANFILES = version.xml
diff --git a/doc/gupnp-dlna/meson.build b/doc/gupnp-dlna/meson.build
new file mode 100644
index 0000000..887b679
--- /dev/null
+++ b/doc/gupnp-dlna/meson.build
@@ -0,0 +1,31 @@
+gnome.gtkdoc('gupnp-dlna',
+ main_xml : 'gupnp-dlna-docs.sgml',
+ src_dir : ['libgupnp-dlna'],
+ ignore_headers : [
+ 'gupnp-dlna-metadata-extractor.h',
+ 'gupnp-dlna-gst-container-information.h',
+ 'gupnp-dlna-gst-video-information.h',
+ 'gupnp-dlna-gst-utils.h',
+ 'gupnp-dlna-gst-metadata-extractor.h',
+ 'gupnp-dlna-gst-audio-information.h',
+ 'gupnp-dlna-gst-info-utils.h',
+ 'gupnp-dlna-gst-information.h',
+ 'gupnp-dlna-gst-image-information.h',
+ 'gupnp-dlna-field-value.h',
+ 'gupnp-dlna-metadata-backend.h',
+ 'gupnp-dlna-profile-guesser-impl.h',
+ 'gupnp-dlna-profile-loader.h',
+ 'gupnp-dlna-g-values-private.h',
+ 'gupnp-dlna-info-set.h',
+ 'gupnp-dlna-info-value.h',
+ 'gupnp-dlna-profile-private.h',
+ 'gupnp-dlna-restriction-private.h',
+ 'gupnp-dlna-utils.h',
+ 'gupnp-dlna-value.h',
+ 'gupnp-dlna-value-list-private.h',
+ 'gupnp-dlna-value-type.h',
+ 'gupnp-dlna-value-union.h'
+ ],
+ content_files : version_xml,
+ dependencies : libgupnp_dlna,
+ install : true)
diff --git a/doc/meson.build b/doc/meson.build
new file mode 100644
index 0000000..3804525
--- /dev/null
+++ b/doc/meson.build
@@ -0,0 +1,13 @@
+entities = configuration_data()
+entities.set('VERSION', meson.project_version())
+version_xml = configure_file(
+ input: 'version.xml.in',
+ output: 'version.xml',
+ configuration: entities
+)
+
+if get_option('gtk_doc')
+ subdir('gupnp-dlna')
+ subdir('gupnp-dlna-gst')
+ subdir('gupnp-dlna-metadata')
+endif
diff --git a/libgupnp-dlna/Makefile.am b/libgupnp-dlna/Makefile.am
index ecb9f4e..051eab3 100644
--- a/libgupnp-dlna/Makefile.am
+++ b/libgupnp-dlna/Makefile.am
@@ -253,3 +253,9 @@ typelib_DATA = $(gir_DATA:.gir=.typelib)
CLEANFILES = $(gir_DATA) $(typelib_DATA)
endif
+
+EXTRA_DIST = \
+ meson.build \
+ metadata-backends/gstreamer/meson.build \
+ metadata-backends/meson.build \
+ meson.build
diff --git a/libgupnp-dlna/gupnp-dlna-metadata-backend.c b/libgupnp-dlna/gupnp-dlna-metadata-backend.c
index e0754cd..a8cad10 100644
--- a/libgupnp-dlna/gupnp-dlna-metadata-backend.c
+++ b/libgupnp-dlna/gupnp-dlna-metadata-backend.c
@@ -19,6 +19,10 @@
* Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <gmodule.h>
#include "gupnp-dlna-metadata-backend.h"
diff --git a/libgupnp-dlna/meson.build b/libgupnp-dlna/meson.build
new file mode 100644
index 0000000..ea79d37
--- /dev/null
+++ b/libgupnp-dlna/meson.build
@@ -0,0 +1,159 @@
+headers_subdir = 'gupnp-dlna-2.0/libgupnp-dlna'
+
+loader_sources = files(
+ 'gupnp-dlna-profile-loader.c'
+)
+
+libloader = static_library(
+ 'loader',
+ loader_sources,
+ c_args : [
+ '-DG_LOG_DOMAIN="gupnp-dlna-loader"',
+ '-DDATA_DIR="@0@"'.format(shareddir)
+ ],
+ dependencies : [glib, gio, xml],
+ include_directories: include_directories('..')
+)
+
+guesser_sources = files(
+ 'gupnp-dlna-profile-guesser.c',
+ 'gupnp-dlna-profile-guesser-impl.c'
+)
+
+libguesser = static_library(
+ 'guesser',
+ guesser_sources,
+ dependencies : [glib, gio],
+ c_args : [
+ '-DG_LOG_DOMAIN="gupnp-dlna-guesser"',
+ '-DDATA_DIR="@0@"'.format(shareddir)
+ ],
+ include_directories: include_directories(
+ '..',
+ 'metadata'
+ )
+)
+
+metadata_sources = files(
+ 'gupnp-dlna-metadata-backend.c',
+ 'metadata/gupnp-dlna-metadata-extractor.c'
+)
+
+libmetadata = static_library(
+ 'metadata',
+ metadata_sources,
+ dependencies : [glib, gio],
+ c_args : [
+ '-DG_LOG_DOMAIN="gupnp-dlna-metadata"',
+ '-DDATA_DIR="@0@"'.format(shareddir)
+ ],
+ include_directories: include_directories(
+ '..',
+ 'metadata'
+ )
+)
+
+headers = files(
+ 'gupnp-dlna-profile-guesser.h',
+ 'gupnp-dlna-profile.h',
+ 'gupnp-dlna-restriction.h',
+ 'gupnp-dlna-value-list.h',
+ 'gupnp-dlna-g-values.h',
+ 'gupnp-dlna-audio-information.h',
+ 'gupnp-dlna-container-information.h',
+ 'gupnp-dlna-image-information.h',
+ 'gupnp-dlna-video-information.h',
+ 'gupnp-dlna-information.h',
+ 'gupnp-dlna-values.h',
+ 'gupnp-dlna.h'
+)
+
+install_headers(
+ headers,
+ subdir: headers_subdir
+)
+
+metadata_headers = files('metadata/gupnp-dlna-metadata-extractor.h')
+
+install_headers(
+ metadata_headers,
+ subdir: join_paths(headers_subdir, 'metadata')
+)
+
+sources = files(
+ 'gupnp-dlna-audio-information.c',
+ 'gupnp-dlna-container-information.c',
+ 'gupnp-dlna-image-information.c',
+ 'gupnp-dlna-information.c',
+ 'gupnp-dlna-video-information.c',
+ 'gupnp-dlna-field-value.c',
+ 'gupnp-dlna-profile.c',
+ 'gupnp-dlna-restriction.c',
+ 'gupnp-dlna-value-list.c',
+ 'gupnp-dlna-g-values.c',
+ 'gupnp-dlna-utils.c',
+ 'gupnp-dlna-value-type.c',
+ 'gupnp-dlna-info-value.c',
+ 'gupnp-dlna-value.c',
+ 'gupnp-dlna-info-set.c'
+)
+
+libgupnp_dlna = library(
+ 'gupnp-dlna-2.0',
+ sources,
+ version: library_version,
+ link_whole: [
+ libloader,
+ libguesser,
+ libmetadata
+ ],
+ dependencies: [glib, gio, gmodule],
+ c_args : ['-DG_LOG_DOMAIN="gupnp-dlna"'],
+ include_directories: include_directories('..'),
+ install: true
+)
+
+gupnp_dlna = declare_dependency(
+ link_with : libgupnp_dlna,
+ include_directories: [include_directories('.'), include_directories('..')],
+)
+
+pkg.generate(
+ libgupnp_dlna,
+ version: meson.project_version(),
+ subdirs : 'gupnp-dlna-2.0',
+ name: 'gupnp-dlna-2.0',
+ description: 'GObject-based DLNA specific UPnP library',
+ libraries: [glib, gobject]
+)
+
+pkg.generate(
+ version: meson.project_version(),
+ subdirs: 'gupnp-dlna-2.0/metadata',
+ name : 'gupnp-dlna-metadata-2.0',
+ description: 'Metadata extractor plugin development files for GUPnP-DLNA',
+ libraries: [glib, gobject, gupnp_dlna],
+ variables: 'plugindir=@0@'.format(metadata_backend_dir)
+)
+
+if get_option('introspection')
+ gupnp_dlna_gir_dir = meson.current_build_dir()
+ gupnp_dlna_gir = gnome.generate_gir(
+ libgupnp_dlna,
+ sources : headers +
+ metadata_headers +
+ sources +
+ guesser_sources +
+ metadata_sources +
+ loader_sources,
+ namespace : 'GUPnPDLNA',
+ header : 'libgupnp-dlna/gupnp-dlna.h',
+ nsversion : '2.0',
+ symbol_prefix : 'gupnp_dlna',
+ identifier_prefix : 'GUPnPDLNA',
+ install: true,
+ includes : ['GObject-2.0']
+ )
+endif
+
+subdir('metadata-backends')
diff --git a/libgupnp-dlna/metadata-backends/gstreamer/meson.build b/libgupnp-dlna/metadata-backends/gstreamer/meson.build
new file mode 100644
index 0000000..298b381
--- /dev/null
+++ b/libgupnp-dlna/metadata-backends/gstreamer/meson.build
@@ -0,0 +1,75 @@
+dlna_gst_headers = files('gupnp-dlna-gst-utils.h')
+
+dlna_backend_dir = meson.current_build_dir()
+
+install_headers(dlna_gst_headers, subdir : headers_subdir)
+
+dlna_gst_sources = files(
+ 'gupnp-dlna-gst-audio-information.c',
+ 'gupnp-dlna-gst-container-information.c',
+ 'gupnp-dlna-gst-image-information.c',
+ 'gupnp-dlna-gst-information.c',
+ 'gupnp-dlna-gst-info-utils.c',
+ 'gupnp-dlna-gst-utils.c',
+ 'gupnp-dlna-gst-video-information.c'
+)
+
+libgupnp_dlna_gst = library(
+ 'gupnp-dlna-gst-2.0',
+ dlna_gst_sources,
+ version: library_version,
+ dependencies : [
+ glib,
+ gio,
+ gstreamer_pbu,
+ gstreamer,
+ config_dep,
+ gupnp_dlna
+ ],
+ c_args : ['-DG_LOG_DOMAIN="gupnp-dlna-metadata"'],
+ install: true
+)
+
+shared_module(
+ 'gstreamer',
+ files(
+ 'gupnp-dlna-gst-metadata-backend.c',
+ 'gupnp-dlna-gst-metadata-extractor.c',
+ ),
+ link_with: libgupnp_dlna_gst,
+ dependencies : [
+ glib,
+ gstreamer_pbu,
+ config_dep,
+ ],
+ include_directories : include_directories(
+ '../../metadata',
+ '../..'
+ ),
+ install: true,
+ install_dir : metadata_backend_dir
+)
+
+pkg.generate(
+ libgupnp_dlna_gst,
+ version: meson.project_version(),
+ subdirs : 'gupnp-dlna-2.0',
+ name: 'gupnp-dlna-gst-2.0',
+ description : 'GStreamer specific utils using GUPnP-DLNA',
+ libraries: gupnp_dlna,
+ requires: gstreamer_pbu
+)
+
+if get_option('introspection')
+ gupnp_dlna_gst_gir = gnome.generate_gir(
+ libgupnp_dlna_gst,
+ sources : dlna_gst_headers +
+ dlna_gst_sources,
+ namespace : 'GUPnPDLNAGst',
+ nsversion : '2.0',
+ symbol_prefix : 'gupnp_dlna_gst',
+ identifier_prefix : 'GUPnPDLNAGst',
+ install: true,
+ includes : ['GObject-2.0', gupnp_dlna_gir.get(0), 'Gst-1.0', 'GstPbutils-1.0']
+ )
+endif
diff --git a/libgupnp-dlna/metadata-backends/meson.build b/libgupnp-dlna/metadata-backends/meson.build
new file mode 100644
index 0000000..fe02013
--- /dev/null
+++ b/libgupnp-dlna/metadata-backends/meson.build
@@ -0,0 +1 @@
+subdir('gstreamer')
diff --git a/libgupnp-dlna/metadata/gupnp-dlna-metadata-extractor.c b/libgupnp-dlna/metadata/gupnp-dlna-metadata-extractor.c
index 2ddc6df..766a739 100644
--- a/libgupnp-dlna/metadata/gupnp-dlna-metadata-extractor.c
+++ b/libgupnp-dlna/metadata/gupnp-dlna-metadata-extractor.c
@@ -160,7 +160,7 @@ gupnp_dlna_metadata_extractor_extract_async
*
* Discovers synchronously metadata of given @uri.
*
- * Returns: A #GUPnPDLNAInformation object if discovery succeeded,
+ * Returns: (transfer full) : A #GUPnPDLNAInformation object if discovery succeeded,
* otherwise %NULL.
*/
GUPnPDLNAInformation *
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..3819ef8
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,67 @@
+project(
+ 'gupnp-dlna',
+ 'c',
+ version: '0.11.0'
+)
+
+pkg = import('pkgconfig')
+gnome = import('gnome')
+
+shareddir = join_paths(get_option('prefix'), get_option('datadir'), 'gupnp-dlna-2.0')
+metadata_backend_dir = join_paths(get_option('prefix'), get_option('libdir'), 'gupnp-dlna')
+library_version = '3.0.0'
+
+config = configuration_data()
+config.set_quoted('GUPNP_DLNA_DEFAULT_METADATA_BACKEND', get_option('default_backend'))
+config.set_quoted('GUPNP_DLNA_DEFAULT_METADATA_BACKEND_DIR', metadata_backend_dir)
+
+configure_file(output: 'config.h', configuration: config)
+add_global_arguments('-DHAVE_CONFIG_H=1', language : 'c')
+
+glib = dependency('glib-2.0')
+gobject = dependency('gobject-2.0')
+gio = dependency('gio-2.0')
+gmodule = dependency('gmodule-2.0')
+xml = dependency('libxml-2.0')
+config_dep = declare_dependency(
+ include_directories : include_directories('.')
+)
+
+gstreamer = dependency('gstreamer-1.0', required: get_option('gstreamer_backend'), disabler : true)
+gstreamer_pbu = dependency('gstreamer-pbutils-1.0', required: get_option('gstreamer_backend'), disabler : true)
+
+# default is relative to the source dir; if test_media is absolute, join_paths() will return that instead
+media_dir = join_paths(meson.current_source_dir(), get_option('test_media'))
+dlna_profile_dir = join_paths(meson.current_source_dir(), 'data')
+
+install_data(
+ files(
+ 'data/dlna-profiles.rng',
+ 'data/aac.xml',
+ 'data/ac3.xml',
+ 'data/amr.xml',
+ 'data/avc.xml',
+ 'data/common.xml',
+ 'data/jpeg.xml',
+ 'data/lpcm.xml',
+ 'data/mp3.xml',
+ 'data/mpeg1.xml',
+ 'data/mpeg4.xml',
+ 'data/mpeg-common.xml',
+ 'data/mpeg-ps.xml',
+ 'data/mpeg-ts.xml',
+ 'data/png.xml',
+ 'data/wma.xml'
+ ),
+ install_dir : join_paths(shareddir, 'dlna-profiles')
+)
+
+subdir('libgupnp-dlna')
+subdir('tools')
+if get_option('introspection')
+ if get_option('vapi')
+ subdir('vala')
+ endif
+endif
+subdir('doc')
+subdir('tests')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..bdf45ab
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,6 @@
+option('gstreamer_backend', type : 'feature', value: 'enabled')
+option('default_backend', type: 'string', value: 'gstreamer')
+option('introspection', type: 'boolean', value: 'true')
+option('vapi', type: 'boolean', value: 'true')
+option('gtk_doc', type: 'boolean', value: 'false')
+option('test_media', type: 'string', value: 'tests/gupnp-dlna-media')
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 465614d..51fd784 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -26,3 +26,5 @@ sets_CFLAGS = \
$(WARN_CFLAGS) \
-I$(top_srcdir) \
-I$(top_srcdir)/libgupnp-dlna
+
+EXTRA_DIST = meson.build
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..f988ccd
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,28 @@
+test_file_config = configuration_data()
+test_file_config.set('abs_top_builddir', meson.project_build_root())
+discoverer_test = configure_file(
+ input: 'test-discoverer.sh.in',
+ output: 'test-discoverer.sh',
+ configuration: test_file_config
+)
+
+test(
+ 'discoverer',
+ discoverer_test,
+ env : [
+ 'MEDIA_DIR=' + media_dir,
+ 'FILE_LIST=' + join_paths(media_dir, 'media-list.txt'),
+ 'GUPNP_DLNA_PROFILE_DIR=' + dlna_profile_dir,
+ 'GUPNP_DLNA_METADATA_BACKEND_DIR=' + dlna_backend_dir
+ ]
+)
+
+test(
+ 'test-sets',
+ executable(
+ 'sets',
+ 'sets.c',
+ dependencies : [glib, gio, gobject, gupnp_dlna],
+ )
+)
+
diff --git a/tools/Makefile.am b/tools/Makefile.am
index b222d41..f4a9eb0 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -23,3 +23,5 @@ gupnp_dlna_info_2_0_SOURCES = \
gupnp_dlna_ls_profiles_2_0_LDFLAGS = $(WARN_LDFLAGS)
gupnp_dlna_ls_profiles_2_0_SOURCES = \
gupnp-dlna-ls-profiles.c
+
+EXTRA_DIST = meson.build
diff --git a/tools/meson.build b/tools/meson.build
new file mode 100644
index 0000000..1c4ecbe
--- /dev/null
+++ b/tools/meson.build
@@ -0,0 +1,25 @@
+executable(
+ 'gupnp-dlna-info-2.0',
+ files('gupnp-dlna-info.c'),
+ dependencies : [
+ glib,
+ gobject,
+ xml,
+ config_dep,
+ gupnp_dlna
+ ],
+ install: true
+)
+
+executable(
+ 'gupnp-dlna-ls-profiles-2.0',
+ files('gupnp-dlna-ls-profiles.c'),
+ dependencies : [
+ glib,
+ gobject,
+ xml,
+ config_dep,
+ gupnp_dlna
+ ],
+ install: true
+)
diff --git a/vala/Makefile.am b/vala/Makefile.am
index e090277..08a2337 100644
--- a/vala/Makefile.am
+++ b/vala/Makefile.am
@@ -24,7 +24,8 @@ EXTRA_DIST = \
GUPnPDLNA-2.0.metadata \
gupnp-dlna-2.0-custom.vala \
gupnp-dlna-2.0.vapi \
- gupnp-dlna-2.0.stamp
+ gupnp-dlna-2.0.stamp \
+ meson.build
if GSTREAMER_METADATA_BACKEND_ENABLED
gupnp-dlna-gst-2.0.vapi: gupnp-dlna-gst-2.0.stamp
diff --git a/vala/gupnp-dlna-gst-2.0-custom.vala b/vala/gupnp-dlna-gst-2.0-custom.vala
index 1ff1a6e..e69de29 100644
--- a/vala/gupnp-dlna-gst-2.0-custom.vala
+++ b/vala/gupnp-dlna-gst-2.0-custom.vala
@@ -1,2 +0,0 @@
-namespace GUPnP.DLNA.Gst {
-}
diff --git a/vala/meson.build b/vala/meson.build
new file mode 100644
index 0000000..fd30562
--- /dev/null
+++ b/vala/meson.build
@@ -0,0 +1,27 @@
+
+gupnp_dlna_vapi = gnome.generate_vapi(
+ 'gupnp-dlna-2.0',
+ sources : [
+ gupnp_dlna_gir.get(0),
+ 'gupnp-dlna-2.0-custom.vala'
+ ],
+ packages : ['glib-2.0', 'gio-2.0', 'gmodule-2.0'],
+ install : true
+)
+
+gnome.generate_vapi(
+ 'gupnp-dlna-gst-2.0',
+ sources : [
+ gupnp_dlna_gst_gir.get(0),
+ 'gupnp-dlna-gst-2.0-custom.vala'
+ ],
+ packages : [
+ 'glib-2.0',
+ 'gobject-2.0',
+ 'gstreamer-1.0',
+ 'gstreamer-pbutils-1.0',
+ gupnp_dlna_vapi
+ ],
+ gir_dirs : gupnp_dlna_gir_dir,
+ install : true
+)