[phodav] build-sys: add meson build
- From: Marc-André Lureau <malureau src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [phodav] build-sys: add meson build
- Date: Mon, 25 Feb 2019 17:08:05 +0000 (UTC)
commit 30f2eeae7ba49e45ac819ae5fc999ed45d93aa3c
Author: Marc-André Lureau <marcandre lureau redhat com>
Date: Mon Feb 25 17:15:50 2019 +0100
build-sys: add meson build
It is mainly missing MSIs build to drop autofoo.
Signed-off-by: Marc-André Lureau <marcandre lureau redhat com>
Makefile.am | 6 +--
doc/meson.build | 41 ++++++++++++++
doc/reference/gtkdocentities.ent.in | 5 ++
doc/reference/meson.build | 40 ++++++++++++++
libphodav.syms => libphodav/libphodav.syms | 0
libphodav/meson.build | 60 +++++++++++++++++++++
meson.build | 85 ++++++++++++++++++++++++++++++
meson_options.txt | 11 ++++
po/meson.build | 3 ++
spice/meson.build | 14 +++++
10 files changed, 262 insertions(+), 3 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index b71c52d..99b88ee 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -68,12 +68,12 @@ libphodav_2_0_la_LIBADD = \
libphodav_2_0_la_LDFLAGS = \
-version-info 0:0:0 \
- -Wl,--version-script=${srcdir}/libphodav.syms \
+ -Wl,--version-script=${srcdir}/libphodav/libphodav.syms \
-no-undefined \
$(NULL)
-libphodav_2_0_la_DEPENDENCIES = libphodav.syms
-EXTRA_DIST += libphodav.syms
+libphodav_2_0_la_DEPENDENCIES = libphodav/libphodav.syms
+EXTRA_DIST += libphodav/libphodav.syms
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libphodav-2.0.pc
diff --git a/doc/meson.build b/doc/meson.build
new file mode 100644
index 0000000..5fc473b
--- /dev/null
+++ b/doc/meson.build
@@ -0,0 +1,41 @@
+if build_machine.system() == 'windows'
+ message('Disabling gtk-doc while building on Windows')
+else
+ if find_program('gtkdoc-scan', required : get_option('gtk_doc')).found()
+ subdir('reference')
+ else
+ message('Not building documentation as gtk-doc was not found')
+ endif
+endif
+
+asciidoc = find_program('asciidoc', required : false)
+xmlto = find_program('xmlto', required : false)
+
+if asciidoc.found() and xmlto.found()
+ xml = custom_target(
+ 'chezdav XML',
+ input : [ 'chezdav.txt' ],
+ output : [ 'chezdav.xml' ],
+ command : [
+ asciidoc,
+ '-o',
+ '@OUTPUT@',
+ '--backend=docbook',
+ '--doctype=manpage',
+ '@INPUT@',
+ ],
+ )
+ man = custom_target(
+ 'chezdav MAN',
+ input : xml,
+ output : [ 'chezdav.1' ],
+ command : [
+ xmlto,
+ 'man',
+ '-o', meson.current_build_dir(),
+ '@INPUT@',
+ ],
+ install : true,
+ install_dir : '@0@/man1'.format(mandir),
+ )
+endif
diff --git a/doc/reference/gtkdocentities.ent.in b/doc/reference/gtkdocentities.ent.in
new file mode 100644
index 0000000..173d9e3
--- /dev/null
+++ b/doc/reference/gtkdocentities.ent.in
@@ -0,0 +1,5 @@
+<!ENTITY package "@PACKAGE@">
+<!ENTITY package_bugreport "@PACKAGE_BUGREPORT@">
+<!ENTITY package_name "@PACKAGE_NAME@">
+<!ENTITY package_string "@PACKAGE_STRING@">
+<!ENTITY package_version "@PACKAGE_VERSION@">
diff --git a/doc/reference/meson.build b/doc/reference/meson.build
new file mode 100644
index 0000000..65ed877
--- /dev/null
+++ b/doc/reference/meson.build
@@ -0,0 +1,40 @@
+ent_conf = configuration_data()
+ent_conf.set('PACKAGE', proj_name)
+ent_conf.set('PACKAGE_BUGREPORT', proj_bugurl)
+ent_conf.set('PACKAGE_NAME', 'PhoDAV')
+ent_conf.set('PACKAGE_STRING', proj_name)
+ent_conf.set('PACKAGE_VERSION', meson.project_version())
+configure_file(input: 'gtkdocentities.ent.in', output: 'gtkdocentities.ent', configuration: ent_conf)
+
+glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix')
+glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
+docpath = join_paths(datadir, 'gtk-doc', 'html')
+
+private_headers = [
+ 'config.h',
+ 'guuid.h',
+ 'phodav-lock.h',
+ 'phodav-multistatus.h',
+ 'phodav-path.h',
+ 'phodav-priv.h',
+ 'phodav-utils.h',
+]
+
+gnome.gtkdoc(
+ 'phodav-2.0',
+ main_sgml : 'phodav-2.0-docs.sgml',
+ dependencies : declare_dependency(link_with : [libphodav]),
+ src_dir : join_paths(meson.source_root(), 'libphodav'),
+ gobject_typesfile: 'libphodav.types',
+ scan_args: [
+ '--rebuild-types',
+ '--ignore-headers=' + ' '.join(private_headers),
+ ],
+ fixxref_args: [
+ '--html-dir=@0@'.format(docpath),
+ '--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
+ '--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
+ '--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
+ ],
+ install : true,
+)
diff --git a/libphodav.syms b/libphodav/libphodav.syms
similarity index 100%
rename from libphodav.syms
rename to libphodav/libphodav.syms
diff --git a/libphodav/meson.build b/libphodav/meson.build
new file mode 100644
index 0000000..148d50c
--- /dev/null
+++ b/libphodav/meson.build
@@ -0,0 +1,60 @@
+headers = [
+ 'phodav.h',
+ 'phodav-server.h',
+]
+
+install_headers(headers, subdir : 'libphodav-2.0/libphodav')
+
+sources = [
+ 'phodav-if.c',
+ 'phodav-lock.c',
+ 'phodav-method-delete.c',
+ 'phodav-method-get.c',
+ 'phodav-method-lock.c',
+ 'phodav-method-mkcol.c',
+ 'phodav-method-movecopy.c',
+ 'phodav-method-propfind.c',
+ 'phodav-method-proppatch.c',
+ 'phodav-method-put.c',
+ 'phodav-method-unlock.c',
+ 'phodav-multistatus.c',
+ 'phodav-path.c',
+ 'phodav-server.c',
+ 'phodav-utils.c',
+]
+
+if not dependency('glib-2.0', version : '>= 2.51.2', required: false).found()
+ sources += 'guuid.c'
+endif
+
+mapfile = 'libphodav.syms'
+vflag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), mapfile)
+
+libphodav = library(
+ 'phodav-2.0',
+ sources,
+ c_args : [ '-DG_LOG_DOMAIN="phodav"' ],
+ include_directories : incdir,
+ version: '0.0.0',
+ link_args : [ '-Wl,--no-undefined', vflag ],
+ link_depends : mapfile,
+ dependencies : deps,
+ install : true,
+)
+
+pkgconfig = import('pkgconfig')
+pkgconfig.generate(
+ libphodav,
+ description : 'A WebDAV library based on libsoup',
+ subdirs : 'libphodav-2.0',
+ requires : 'libsoup-2.4'
+)
+
+executable(
+ 'chezdav',
+ [ 'chezdav.c' ],
+ include_directories : incdir,
+ dependencies : avahi_deps + deps,
+ link_with : [ libphodav ],
+ install : true,
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..8416ff4
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,85 @@
+project('phodav', 'c',
+ version : run_command('build-aux/git-version-gen',
'@0@/.tarball-version'.format(meson.source_root()), check : true).stdout().strip(),
+ license : 'LGPLv2.1',
+ meson_version : '>= 0.49')
+
+meson.add_dist_script('sh', '-c', 'echo
@0@>"$MESON_DIST_ROOT/.tarball-version"'.format(meson.project_version()))
+
+proj_version = meson.project_version()
+proj_name = meson.project_name()
+proj_bugurl = 'https://gitlab.gnome.org/GNOME/phodav/issues/new'
+
+gnome = import('gnome')
+prefix = get_option('prefix')
+datadir = join_paths(prefix, get_option('datadir'))
+mandir = join_paths(prefix, get_option('mandir'))
+localedir = join_paths(datadir, 'locale')
+incdir = include_directories('.')
+
+compiler = meson.get_compiler('c')
+conf = configuration_data()
+
+deps = []
+if host_machine.system() == 'windows'
+ deps += dependency('gio-windows-2.0')
+else
+ deps += dependency('gio-unix-2.0')
+endif
+
+deps += dependency('libsoup-2.4', version : '>= 2.48.0')
+deps += dependency('libxml-2.0')
+
+d1 = dependency('avahi-gobject', required : get_option('avahi'))
+d2 = dependency('avahi-client', required : get_option('avahi'))
+avahi_deps = []
+if d1.found() and d2.found()
+ avahi_deps += [ d1, d2 ]
+ conf.set('WITH_AVAHI', 1)
+endif
+
+systemd = dependency('systemd', required : get_option('systemd'))
+if systemd.found()
+ install_data(
+ 'data/spice-webdavd.service',
+ install_dir : systemd.get_pkgconfig_variable('systemdsystemunitdir')
+ )
+endif
+
+udev = dependency('udev', required : get_option('systemd'))
+if udev.found()
+ install_data(
+ 'data/70-spice-webdavd.rules',
+ install_dir : '@0@/@1@'.format(udev.get_pkgconfig_variable('udevdir'), 'rules.d'),
+ )
+endif
+
+if compiler.has_header('attr/xattr.h')
+ conf.set('HAVE_ATTR_XATTR_H', 1)
+endif
+
+subdir('po')
+subdir('libphodav')
+subdir('spice')
+subdir('doc')
+
+#
+# write config.h
+#
+config = {
+ 'VERSION' : proj_version,
+ 'PACKAGE_NAME' : proj_name,
+ 'PACKAGE_VERSION' : proj_version,
+ 'GETTEXT_PACKAGE' : proj_name,
+ 'LOCALEDIR' : localedir,
+ 'PACKAGE_STRING' : '@0@ @1@'.format(proj_name, proj_version),
+ 'PACKAGE_BUGREPORT' : proj_bugurl
+}
+foreach key, value : config
+ conf.set_quoted(key, value)
+endforeach
+
+configure_file(
+ output : 'config.h',
+ install : false,
+ configuration : conf
+)
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..cab96b2
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,11 @@
+option('gtk_doc',
+ type : 'feature',
+ description : 'Generate API documentation with gtk-doc')
+
+option('avahi',
+ type : 'feature',
+ description : 'Build with avahi/mdns')
+
+option('systemd',
+ type : 'feature',
+ description : 'Install systemd units/configuration')
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..fb3c395
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,3 @@
+i18n = import('i18n')
+i18n.gettext(meson.project_name(),
+ preset : 'glib')
diff --git a/spice/meson.build b/spice/meson.build
new file mode 100644
index 0000000..c3f87cf
--- /dev/null
+++ b/spice/meson.build
@@ -0,0 +1,14 @@
+win32_deps = []
+if host_machine.system() == 'windows'
+ win32_deps += compiler.find_library('netapi32')
+ win32_deps += compiler.find_library('mpr')
+endif
+
+executable(
+ 'spice-webdavd',
+ [ 'spice-webdavd.c' ],
+ include_directories : incdir,
+ dependencies : win32_deps + avahi_deps + deps,
+ link_with : [ libphodav ],
+ install : true,
+)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]