Commit af187c8e authored by Zeeshan Ali's avatar Zeeshan Ali Committed by Zeeshan Ali

Add meson build support

During the porting I found some issues in meson that have been fixed in
the git master and hence we require the upcoming release of meson: 0.47.0.
parent e1918f73
if get_option('enable-backend')
conf = configuration_data()
if get_option('enable-demo-agent')
conf.set('demo_agent', 'geoclue-demo-agent;')
else
conf.set('demo_agent', '')
endif
conf_dir = get_option('sysconfdir') + '/geoclue/'
configure_file(output: 'geoclue.conf',
input: 'geoclue.conf.in',
configuration: conf,
install_dir: conf_dir)
conf = configuration_data()
conf.set('libexecdir', get_option('libexecdir'))
conf.set('dbus_srv_user', get_option('dbus-srv-user'))
service_dir = get_option('datadir') + '/dbus-1/system-services'
configure_file(output: 'org.freedesktop.GeoClue2.service',
input: 'org.freedesktop.GeoClue2.service.in',
configuration: conf,
install_dir: service_dir)
# DBus Service policy file
dbus_service_dir = get_option('dbus-sys-dir')
if dbus_service_dir == ''
dbus_service_dir = get_option('sysconfdir') + '/dbus-1/system.d'
endif
configure_file(output: 'org.freedesktop.GeoClue2.conf',
input: 'org.freedesktop.GeoClue2.conf.in',
configuration: conf,
install_dir: dbus_service_dir)
configure_file(output: 'org.freedesktop.GeoClue2.Agent.conf',
input: 'org.freedesktop.GeoClue2.Agent.conf.in',
configuration: conf,
install_dir: dbus_service_dir)
systemd_unit_dir = get_option('systemd-system-unit-dir')
if systemd_unit_dir == ''
dep = dependency('systemd', required: false)
if dep.found()
systemd_unit_dir = dep.get_pkgconfig_variable('systemdsystemunitdir')
endif
endif
if systemd_unit_dir != ''
configure_file(output: 'geoclue.service',
input: 'geoclue.service.in',
configuration: conf,
install_dir: systemd_unit_dir)
endif
endif
desktop_dir = get_option('datadir') + '/applications'
demo_dir = get_option('libexecdir') + '/geoclue-2.0/demos'
i18n = import('i18n')
desktop_conf = configuration_data()
desktop_conf.set('libexecdir', get_option('libexecdir'))
if get_option('enable-libgeoclue')
include_dirs = [ configinc,
libgeoclue_public_api_inc,
include_directories('../libgeoclue') ]
c_args = [ '-Werror' ]
executable('where-am-i',
'where-am-i.c',
include_directories: include_dirs,
c_args: c_args,
link_with: [ libgeoclue ],
dependencies: base_deps,
install: true,
install_dir: demo_dir)
desktop_in = configure_file(output: 'geoclue-where-am-i.desktop.in',
input: 'geoclue-where-am-i.desktop.in.in',
configuration: desktop_conf)
i18n.merge_file(output: 'geoclue-where-am-i.desktop',
input: desktop_in,
type: 'desktop',
po_dir: '../po',
install: true,
install_dir: desktop_dir)
endif
if get_option('enable-demo-agent')
include_dirs = [ configinc,
libgeoclue_public_api_inc,
libgeoclue_agent_inc ]
c_args = [ '-Werror' ]
sources = [ 'gclue-service-agent.h',
'gclue-service-agent.c',
'agent.c' ]
deps = base_deps + [ dependency('libnotify') ]
executable('agent',
sources,
include_directories: include_dirs,
c_args: c_args,
link_with: [ libgeoclue_agent ],
dependencies: deps,
install: true,
install_dir: demo_dir)
desktop_in = configure_file(output: 'geoclue-demo-agent.desktop.in',
input: 'geoclue-demo-agent.desktop.in.in',
configuration: desktop_conf,
install_dir: desktop_dir)
i18n.merge_file(output: 'geoclue-demo-agent.desktop',
input: desktop_in,
type: 'desktop',
po_dir: '../po',
install: true,
install_dir: desktop_dir)
endif
conf = configuration_data()
conf.set_quoted('VERSION', gclue_version)
version_file = configure_file(output: 'version.xml',
input: 'version.xml.in',
configuration: conf)
content_files = [ '../../COPYING.LIB' ]
scan_options = [ '--ignore-headers=config.h', '--rebuild-types' ]
# Extra options to supply to gtkdoc-mkdb
mkdb_options = [ '--output-format=xml' ]
src_dir = [ 'public-api', 'libgeoclue' ]
gnome.gtkdoc('libgeoclue',
main_xml: 'libgeoclue-docs.xml',
content_files: content_files,
gobject_typesfile: 'libgeoclue.types',
dependencies: libgeoclue_dep,
scan_args: scan_options,
src_dir: src_dir,
mkdb_args: mkdb_options,
install: true)
subdir('lib')
conf = configuration_data()
conf.set_quoted('VERSION', gclue_version)
version_file = configure_file(output: 'version.xml',
input: 'version.xml.in',
configuration: conf)
content_files = [ '../COPYING',
dbus_gen_src ]
scan_options = [ '--ignore-headers=config.h',
'--rebuild-sections',
'--rebuild-types' ]
# Extra options to supply to gtkdoc-mkdb
mkdb_options = [ '--output-format=xml' ]
gnome.gtkdoc('geoclue',
main_xml: 'geoclue-docs.xml',
content_files: content_files,
scan_args: scan_options,
src_dir: 'public-api',
mkdb_args: mkdb_options,
install: true)
sources = [ 'gclue-helpers.c', 'gclue-simple.c' ]
header_dir = 'libgeoclue-' + gclue_api_version
# FIXME: meson 0.46 doesn't seem to be actually installing the headers
# generated by gnome.gdbus_codegen:
#
# https://github.com/mesonbuild/meson/pull/3487
# Client interface
sources += gnome.gdbus_codegen('gclue-client',
'../src/org.freedesktop.GeoClue2.Client.xml',
interface_prefix: 'org.freedesktop.GeoClue2.',
namespace: 'GClue',
install_header: true,
install_dir: header_dir)
# Location interface
sources += gnome.gdbus_codegen('gclue-location',
'../src/org.freedesktop.GeoClue2.Location.xml',
interface_prefix: 'org.freedesktop.GeoClue2.',
namespace: 'GClue',
install_header: true,
install_dir: header_dir)
# Manager interface
sources += gnome.gdbus_codegen('gclue-manager',
'../src/org.freedesktop.GeoClue2.Manager.xml',
interface_prefix: 'org.freedesktop.GeoClue2.',
namespace: 'GClue',
install_header: true,
install_dir: header_dir)
headers = [ 'geoclue.h', 'gclue-helpers.h', 'gclue-simple.h' ]
install_headers(headers, subdir: header_dir)
c_args = [ '-DG_LOG_DOMAIN="Geoclue"', '-Werror' ]
include_dirs = [ libgeoclue_public_api_inc, include_directories('.') ]
link_with = [ libgeoclue_public_api ]
libgeoclue = library('geoclue-2',
sources,
include_directories: include_dirs,
dependencies: base_deps,
link_with: link_with,
install: true)
gir = find_program('g-ir-scanner', required: false)
cross_build = meson.is_cross_build()
enable_gir = get_option('enable-introspection')
if gir.found() and not cross_build and enable_gir
gir_args = [ '--quiet', '--c-include=geoclue.h' ]
gnome.generate_gir(libgeoclue,
sources: headers,
namespace: 'Geoclue',
nsversion: gclue_api_version,
identifier_prefix: 'GClue',
symbol_prefix: 'gclue',
export_packages: 'libgeoclue-' + gclue_api_version,
dependencies: base_deps,
includes: [ 'GObject-2.0', 'Gio-2.0' ],
include_directories: include_dirs,
install: true,
extra_args: gir_args)
endif
description = 'A convenience library to interact with Geoclue service'
pkgconf = import('pkgconfig')
pkgconf.generate(version: gclue_version,
name: 'Geoclue Client Library',
description: description,
filebase: 'libgeoclue-' + gclue_api_version,
libraries: libgeoclue,
subdirs: [ header_dir ],
requires: ['glib-2.0', 'gio-2.0', 'gio-unix-2.0'])
libgeoclue_dep = declare_dependency(link_with: libgeoclue,
include_directories: include_dirs,
dependencies: base_deps,
sources: sources)
project('geoclue', 'c', version: '2.4.10', meson_version : '>= 0.46.1')
gclue_version = meson.project_version()
ver_arr = gclue_version.split('.')
gclue_major_version = ver_arr[0]
gclue_minor_version = ver_arr[1]
gclue_micro_version = ver_arr[2]
gclue_api_version='2.0'
conf = configuration_data()
conf.set_quoted('VERSION', gclue_version)
conf.set_quoted('PACKAGE_VERSION', gclue_version)
conf.set_quoted('PACKAGE_NAME', 'geoclue')
conf.set_quoted('GETTEXT_PACKAGE', 'geoclue')
conf.set_quoted('PACKAGE_TARNAME', 'geoclue')
conf.set_quoted('PACKAGE_STRING', 'geoclue ' + gclue_version)
conf.set_quoted('PACKAGE_URL', 'http://www.freedesktop.org/wiki/Software/GeoClue')
conf.set_quoted('PACKAGE_BUGREPORT', 'http://bugs.freedesktop.org/enter_bug.cgi?product=GeoClue')
conf.set_quoted('TEST_SRCDIR', meson.source_root() + '/data/')
datadir = get_option('prefix') + '/' + get_option('datadir')
conf.set_quoted('LOCALEDIR', datadir + '/locale')
conf.set_quoted('SYSCONFDIR', get_option('sysconfdir'))
configure_file(output: 'config.h', configuration : conf)
configinc = include_directories('.')
gnome = import('gnome')
cc = meson.get_compiler('c')
add_global_arguments([ '-Wall' ], language: 'c')
base_deps = [ dependency('glib-2.0', version: '>= 2.34.0'),
dependency('gio-2.0', version: '>= 2.34.0'),
dependency('gio-unix-2.0', version: '>= 2.34.0') ]
libm = cc.find_library('m', required: false)
if libm.found()
base_deps += [ libm ]
endif
subdir('public-api')
if get_option('enable-backend')
subdir('src')
endif
if get_option('enable-libgeoclue')
subdir('libgeoclue')
endif
subdir('data')
subdir('demo')
subdir('po')
if get_option('enable-gtk-doc')
subdir('docs')
endif
option('enable-libgeoclue',
type: 'boolean', value: true,
description: 'Enable convenience library')
option('enable-introspection',
type: 'boolean', value: true,
description: 'Enable convenience library introspection generation')
option('enable-gtk-doc',
type: 'boolean', value: true,
description: 'Whether to generate the API reference for Geocode-GLib')
option('enable-3g-source',
type: 'boolean', value: true,
description: 'Enable 3G source (requires ModemManager')
option('enable-cdma-source',
type: 'boolean', value: true,
description: 'Enable CDMA source (requires ModemManager')
option('enable-modem-gps-source',
type: 'boolean', value: true,
description: 'Enable modem GPS source (requires ModemManager')
option('enable-nmea-source',
type: 'boolean', value: true,
description: 'Enable network NMEA source (requires Avahi libraries)')
option('enable-backend',
type: 'boolean', value: true,
description: 'Enable backend (the geoclue service)')
option('enable-demo-agent',
type: 'boolean', value: true,
description: 'Build demo agent')
option('enable-debug',
type: 'boolean', value: false,
description: 'Build debug build')
option('dbus-sys-dir',
type: 'string',
description: 'where D-BUS system.d directory is')
option('systemd-system-unit-dir',
type: 'string',
description: 'Directory for systemd service files')
option('dbus-srv-user',
type: 'string', value: 'root',
description: 'The user (existing) as which the service will run')
api_name = meson.project_name() + '-' + gclue_api_version
gettext_domain = api_name
i18n = import('i18n')
i18n.gettext(gettext_domain, preset: 'glib')
headers = [ 'gclue-enums.h' ]
header_dir = 'libgeoclue-' + gclue_api_version
install_headers(headers, subdir: header_dir)
gen_sources = gnome.mkenums_simple('gclue-enum-types',
sources: headers,
header_prefix: '#include <gclue-enums.h>',
decorator : 'GCLUE_ENUMS_H',
install_header: true,
install_dir: 'include/' + header_dir)
libgeoclue_public_api_inc = include_directories('.')
libgeoclue_public_api = static_library('geoclue-public-api',
gen_sources,
dependencies: base_deps,
install: false)
sources = gnome.gdbus_codegen('geoclue-agent-interface',
'org.freedesktop.GeoClue2.Agent.xml',
interface_prefix: 'org.freedesktop.GeoClue2.',
namespace: 'GClue',
docbook: 'docs')
libgeoclue_agent_inc = include_directories('.')
libgeoclue_agent = static_library('geoclue-agent',
sources,
dependencies: base_deps,
install: false)
install_data('org.freedesktop.GeoClue2.Agent.xml',
install_dir: dbus_interface_dir)
#!/bin/python3
from xml.etree import ElementTree as et
import sys
# We need at least one input and one output file path
if len(sys.argv) < 3:
print('Usage: OUTPUT_FILE INPUT_FILE..')
sys.exit(-1)
u = et.fromstring('<node></node>')
for x in sys.argv[2:]:
d = et.parse(x)
u.extend(d.getroot())
f = open(sys.argv[1], 'w')
f.write(et.tostring(u, encoding="unicode"))
f.close()
sources = [ 'geocode-location.h',
'geocode-location.c',
'geocode-forward.h',
'geocode-forward.c',
'geocode-reverse.h',
'geocode-reverse.c',
'geocode-glib.h',
'geocode-glib.c',
'geocode-error.h',
'geocode-error.c',
'geocode-enum-types.h',
'geocode-enum-types.c',
'geocode-place.h',
'geocode-place.c',
'geocode-bounding-box.h',
'geocode-bounding-box.c',
'geocode-glib-private.h' ]
datadir = get_option('prefix') + '/' + get_option('datadir')
localedir = datadir + '/locale'
c_args = [ '-DPACKAGE_VERSION="' + gclue_version + '"',
'-DGEOCODE_LOCALEDIR="' + localedir + '"' ]
libgeocode_glib_inc = include_directories('.', '..', '../..')
libgeocode_glib = static_library('geocode-glib',
sources,
dependencies: geoclue_deps,
include_directories: libgeocode_glib_inc,
c_args: c_args,
install: false)
dbus_interface_dir = get_option('datadir') + '/dbus-1/interfaces'
subdir('agent')
geoclue_deps = base_deps + [ dependency('json-glib-1.0', version: '>= 0.14.0'),
dependency('libsoup-2.4', version: '>= 2.42.0') ]
subdir('geocode-glib')
dbus_gen_src = []
# Client interface
client_interface_xml = 'org.freedesktop.GeoClue2.Client.xml'
dbus_gen_src += gnome.gdbus_codegen(
'gclue-client-interface',
client_interface_xml,
interface_prefix: 'org.freedesktop.GeoClue2.',
namespace: 'GClueDBus',
docbook: 'docs')
# Location interface
location_interface_xml = 'org.freedesktop.GeoClue2.Location.xml'
dbus_gen_src += gnome.gdbus_codegen(
'gclue-location-interface',
location_interface_xml,
interface_prefix: 'org.freedesktop.GeoClue2.',
namespace: 'GClueDBus',
docbook: 'docs')
# Manager interface
manager_interface_xml = 'org.freedesktop.GeoClue2.Manager.xml'
dbus_gen_src += gnome.gdbus_codegen(
'gclue-manager-interface',
manager_interface_xml,
interface_prefix: 'org.freedesktop.GeoClue2.',
namespace: 'GClueDBus',
docbook: 'docs')
sources = dbus_gen_src
annotations = [[ 'fi.w1.wpa_supplicant1',
'org.gtk.GDBus.C.Name',
'WPA_Supplicant' ],
[ 'fi.w1.wpa_supplicant1.Interface',
'org.gtk.GDBus.C.Name',
'WPA_Interface' ],
[ 'fi.w1.wpa_supplicant1.BSS',
'org.gtk.GDBus.C.Name',
'WPA_BSS' ],
[ 'fi.w1.wpa_supplicant1.BSS:SSID',
'org.gtk.GDBus.C.ForceGVariant',
'whatever' ],
[ 'fi.w1.wpa_supplicant1.BSS:BSSID',
'org.gtk.GDBus.C.ForceGVariant',
'whatever' ],
[ 'fi.w1.wpa_supplicant1.Interface::BSSAdded',
'org.gtk.GDBus.C.Name',
'BSS_Added' ],
[ 'fi.w1.wpa_supplicant1.Interface::BSSRemoved',
'org.gtk.GDBus.C.Name',
'BSS_Removed' ]]
sources += gnome.gdbus_codegen('wpa_supplicant-interface',
'fi.w1.wpa_supplicant1.xml',
interface_prefix: 'fi.w1.wpa_supplicant1.',
annotations: annotations)
sources += gnome.gdbus_codegen('compass-interface',
'net.hadess.SensorProxy.xml',
interface_prefix: 'net.hadess.SensorProxy')
sources += gnome.genmarshal('gclue-marshal',
prefix: 'gclue_marshal',
sources: ['gclue-marshal.list'])
include_dirs = [ configinc, libgeoclue_agent_inc, libgeoclue_public_api_inc ]
sources += [ 'gclue-main.c',
'gclue-3g-tower.h',
'gclue-client-info.h', 'gclue-client-info.c',
'gclue-compass.h', 'gclue-compass.c',
'gclue-config.h', 'gclue-config.c',
'gclue-error.h', 'gclue-error.c',
'gclue-location-source.h', 'gclue-location-source.c',
'gclue-locator.h', 'gclue-locator.c',
'gclue-service-manager.h', 'gclue-service-manager.c',
'gclue-service-client.h', 'gclue-service-client.c',
'gclue-service-location.h', 'gclue-service-location.c',
'gclue-web-source.c', 'gclue-web-source.h',
'gclue-wifi.h', 'gclue-wifi.c',
'gclue-mozilla.h', 'gclue-mozilla.c',
'gclue-min-uint.h', 'gclue-min-uint.c',
'gclue-location.h', 'gclue-location.c' ]
if get_option('enable-3g-source') or
get_option('enable-cdma-source') or
get_option('enable-modem-gps-source')
geoclue_deps += [ dependency('mm-glib', version: '>= 1.6') ]
sources += [ 'gclue-modem.c',
'gclue-modem.h',
'gclue-modem-manager.c',
'gclue-modem-manager.h' ]
endif
if get_option('enable-3g-source')
sources += [ 'gclue-3g.c', 'gclue-3g.h' ]
endif
if get_option('enable-cdma-source')
sources += [ 'gclue-cdma.c', 'gclue-cdma.h' ]
endif
if get_option('enable-modem-gps-source')
sources += [ 'gclue-modem-gps.c', 'gclue-modem-gps.h' ]
endif
if get_option('enable-nmea-source')
geoclue_deps += [ dependency('avahi-client', version: '>= 0.6.10'),
dependency('avahi-glib', version: '>= 0.6.10') ]
sources += [ 'gclue-nmea-source.h', 'gclue-nmea-source.c' ]
endif
c_args = [ '-DG_LOG_DOMAIN="Geoclue"', '-Werror' ]
link_with = [ libgeoclue_public_api, libgeoclue_agent, libgeocode_glib ]
install_dir = get_option('libexecdir')
executable('geoclue',
sources,
link_with: link_with,
include_directories: include_dirs,
c_args: c_args,
dependencies: geoclue_deps,
install: true,
install_dir: install_dir)
dbus_interface = dbus_interface_dir + '/org.freedesktop.GeoClue2.xml'
agent_dbus_interface = dbus_interface_dir + '/org.freedesktop.GeoClue2.Agent.xml'
pkgconf = import('pkgconfig')
pkgconf.generate(version: gclue_version,
name: 'Geoclue',
description: 'The Geoinformation Service',
filebase: 'geoclue-' + gclue_api_version,
variables: [ 'apiversion=' + gclue_api_version,
'dbus_interface=' + dbus_interface,
'agent_dbus_interface=' + agent_dbus_interface ])
interface_files = [ location_interface_xml,
client_interface_xml,
manager_interface_xml ]
# Provide a single interface file too for backwards compatiblity.
# At least gnome-settings-daemon currently relies on that.
unified_interface_xml = 'org.freedesktop.GeoClue2.xml'
create_interface = find_program('create-unified-xml.py')
cmd = [create_interface, '@OUTPUT@', '@INPUT@' ]
custom_target('gclue-xml-interface',
input: interface_files,
output: unified_interface_xml,
install: true,
install_dir: dbus_interface_dir,
command: cmd)
install_data(interface_files,
install_dir: dbus_interface_dir)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment