summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeeshan Ali <zeenix@gmail.com>2016-10-31 12:28:29 +0100
committerZeeshan Ali <zeenix@gmail.com>2017-07-18 16:41:52 +0200
commit2095bdcfdd90802552818a6dd97a639391056f2b (patch)
treef0f2ef8fe0cd4c2ee1619681526d332ee04c7c4b
parent9cfd3f7616b52d87db2e85e7feece6d1a847f0d6 (diff)
downloadgeocode-glib-2095bdcfdd90802552818a6dd97a639391056f2b.tar.gz
Add meson build support
While this patch adds support to build geocode-glib with meson build system, it doesn't remove the autotools support. https://bugzilla.gnome.org/show_bug.cgi?id=785033
-rw-r--r--docs/geocode-glib-docs.xml1
-rw-r--r--docs/gtkdocentities.ent.in9
-rw-r--r--docs/meson.build44
-rw-r--r--geocode-glib/geocode-enum-types.c.in40
-rw-r--r--geocode-glib/geocode-enum-types.h.in24
-rw-r--r--geocode-glib/geocode-glib.c2
-rw-r--r--geocode-glib/meson.build90
-rw-r--r--geocode-glib/tests/meson.build41
-rw-r--r--icons/maki/poi-airport.svg (renamed from icons/maki/scalable_places_poi-airport.svg)0
-rw-r--r--icons/maki/poi-bar.svg (renamed from icons/maki/scalable_places_poi-bar.svg)0
-rw-r--r--icons/maki/poi-building.svg (renamed from icons/maki/scalable_places_poi-building.svg)0
-rw-r--r--icons/maki/poi-bus-stop.svg (renamed from icons/maki/scalable_places_poi-bus-stop.svg)0
-rw-r--r--icons/maki/poi-car.svg (renamed from icons/maki/scalable_places_poi-car.svg)0
-rw-r--r--icons/maki/poi-light-rail-station.svg (renamed from icons/maki/scalable_places_poi-light-rail-station.svg)0
-rw-r--r--icons/maki/poi-marker.svg (renamed from icons/maki/scalable_places_poi-marker.svg)0
-rw-r--r--icons/maki/poi-place-of-worship.svg (renamed from icons/maki/scalable_places_poi-place-of-worship.svg)0
-rw-r--r--icons/maki/poi-railway-station.svg (renamed from icons/maki/scalable_places_poi-railway-station.svg)0
-rw-r--r--icons/maki/poi-restaurant.svg (renamed from icons/maki/scalable_places_poi-restaurant.svg)0
-rw-r--r--icons/maki/poi-school.svg (renamed from icons/maki/scalable_places_poi-school.svg)0
-rw-r--r--icons/maki/poi-town.svg (renamed from icons/maki/scalable_places_poi-town.svg)0
-rw-r--r--icons/meson.build23
-rw-r--r--meson.build47
-rw-r--r--meson_options.txt9
-rw-r--r--po/meson.build5
24 files changed, 334 insertions, 1 deletions
diff --git a/docs/geocode-glib-docs.xml b/docs/geocode-glib-docs.xml
index f829ea8..f110f90 100644
--- a/docs/geocode-glib-docs.xml
+++ b/docs/geocode-glib-docs.xml
@@ -3,7 +3,6 @@
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
[
<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
- <!ENTITY version SYSTEM "version.xml">
]>
<book id="index">
<bookinfo>
diff --git a/docs/gtkdocentities.ent.in b/docs/gtkdocentities.ent.in
new file mode 100644
index 0000000..b4e6c43
--- /dev/null
+++ b/docs/gtkdocentities.ent.in
@@ -0,0 +1,9 @@
+<!ENTITY package "@PACKAGE@">
+<!ENTITY package_bugreport "@PACKAGE_BUGREPORT@">
+<!ENTITY package_name "@PACKAGE_NAME@">
+<!ENTITY package_string "@PACKAGE_STRING@">
+<!ENTITY package_tarname "@PACKAGE_TARNAME@">
+<!ENTITY package_url "@PACKAGE_URL@">
+<!ENTITY package_version "@PACKAGE_VERSION@">
+<!ENTITY version "@PACKAGE_VERSION@">
+<!ENTITY package_api_version "@PACKAGE_API_VERSION@">
diff --git a/docs/meson.build b/docs/meson.build
new file mode 100644
index 0000000..0f56871
--- /dev/null
+++ b/docs/meson.build
@@ -0,0 +1,44 @@
+ent_conf = configuration_data()
+ent_conf.set('PACKAGE', 'Geocode-Glib')
+ent_conf.set('PACKAGE_BUGREPORT', 'https://bugzilla.gnome.org/enter_bug.cgi?product=geocode-glib')
+ent_conf.set('PACKAGE_NAME', 'Geocode-Glib')
+ent_conf.set('PACKAGE_STRING', meson.project_name())
+ent_conf.set('PACKAGE_TARNAME', '@0@-@1@'.format(meson.project_name(), meson.project_version()))
+ent_conf.set('PACKAGE_URL', 'http://wiki.gnome.org/Project/GeocodeGlib')
+ent_conf.set('PACKAGE_VERSION', meson.project_version())
+ent_conf.set('PACKAGE_API_VERSION', gclib_api_version)
+configure_file(input: 'gtkdocentities.ent.in', output: 'gtkdocentities.ent', configuration: ent_conf)
+
+private_headers = [
+ 'config.h',
+
+ 'geocode-glib-private.h',
+ 'geocode-enum-types.h',
+ 'geocode-nominatim-test.h',
+]
+
+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')
+
+gnome.gtkdoc('geocode-glib',
+ main_xml: 'geocode-glib-docs.xml',
+ src_dir: [
+ join_paths(meson.source_root(), 'geocode-glib'),
+ join_paths(meson.build_root(), 'geocode-glib'),
+ ],
+ dependencies: geocode_glib_dep,
+ gobject_typesfile: 'geocode-glib.types',
+ scan_args: [
+ '--rebuild-types',
+ '--ignore-decorators=GEOCODE_EXTERN',
+ '--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/geocode-glib/geocode-enum-types.c.in b/geocode-glib/geocode-enum-types.c.in
new file mode 100644
index 0000000..50b09f7
--- /dev/null
+++ b/geocode-glib/geocode-enum-types.c.in
@@ -0,0 +1,40 @@
+/*** BEGIN file-header ***/
+
+#include "config.h"
+
+#include <geocode-glib/geocode-glib.h>
+#include <geocode-glib/geocode-enum-types.h>
+
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType
+@enum_name@_get_type (void)
+{
+ static GType etype = 0;
+ if (G_UNLIKELY(etype == 0)) {
+ static const G@Type@Value values[] = {
+/*** END value-header ***/
+
+/*** BEGIN value-production ***/
+ { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
+/*** END value-production ***/
+
+/*** BEGIN value-tail ***/
+ { 0, NULL, NULL }
+ };
+ etype = g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
+ }
+
+ return etype;
+}
+
+/*** END value-tail ***/
+
+/*** BEGIN file-tail ***/
+
+/*** END file-tail ***/
diff --git a/geocode-glib/geocode-enum-types.h.in b/geocode-glib/geocode-enum-types.h.in
new file mode 100644
index 0000000..ce603f6
--- /dev/null
+++ b/geocode-glib/geocode-enum-types.h.in
@@ -0,0 +1,24 @@
+/*** BEGIN file-header ***/
+#ifndef __GEOCODE_ENUM_TYPES_H__
+#define __GEOCODE_ENUM_TYPES_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@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 ***/
+G_END_DECLS
+
+#endif /* __GEOCODE_ENUM_TYPES_H__ */
+/*** END file-tail ***/
diff --git a/geocode-glib/geocode-glib.c b/geocode-glib/geocode-glib.c
index fdd9ceb..86ead74 100644
--- a/geocode-glib/geocode-glib.c
+++ b/geocode-glib/geocode-glib.c
@@ -20,6 +20,8 @@
*/
+#include "config.h"
+
#include <string.h>
#include <errno.h>
#include <locale.h>
diff --git a/geocode-glib/meson.build b/geocode-glib/meson.build
new file mode 100644
index 0000000..116129c
--- /dev/null
+++ b/geocode-glib/meson.build
@@ -0,0 +1,90 @@
+header_subdir = 'geocode-glib-' + gclib_api_version + '/geocode-glib'
+header_dir = get_option('includedir') + '/' + header_subdir
+
+headers = [ 'geocode-glib.h',
+ 'geocode-location.h',
+ 'geocode-forward.h',
+ 'geocode-reverse.h',
+ 'geocode-error.h',
+ 'geocode-place.h',
+ 'geocode-bounding-box.h',
+ 'geocode-backend.h',
+ 'geocode-mock-backend.h',
+ 'geocode-nominatim.h' ]
+
+generated_sources = gnome.mkenums('geocode-enum-types',
+ h_template: 'geocode-enum-types.h.in',
+ c_template: 'geocode-enum-types.c.in',
+ sources: headers,
+ install_header: true,
+ install_dir: header_dir)
+
+
+public_sources = [ 'geocode-location.c',
+ 'geocode-forward.c',
+ 'geocode-reverse.c',
+ 'geocode-glib.c',
+ 'geocode-error.c',
+ 'geocode-place.c',
+ 'geocode-bounding-box.c',
+ 'geocode-backend.c',
+ 'geocode-mock-backend.c',
+ 'geocode-nominatim.c' ] + generated_sources
+
+sources = public_sources + [ 'geocode-glib-private.h' ]
+
+deps = [ dependency('gio-2.0', version: '>= 2.34'),
+ dependency('json-glib-1.0', version: '>= 0.99.2'),
+ dependency('libsoup-2.4', version: '>= 2.42') ]
+libm = cc.find_library('m', required: false)
+if libm.found()
+ deps += [ libm ]
+endif
+
+include = include_directories('..')
+exports_file = join_paths(meson.current_source_dir(), 'geocode-glib.symbols')
+link_args = '-export-symbols ' + exports_file
+
+libgcglib = shared_library('geocode-glib',
+ sources,
+ dependencies: deps,
+ include_directories: include,
+ link_args: link_args,
+ install: true)
+
+install_headers(headers, subdir: header_subdir)
+
+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=geocode-glib/geocode-glib.h'
+ ]
+
+ gnome.generate_gir(libgcglib,
+ sources: public_sources + headers,
+ namespace: 'GeocodeGlib',
+ nsversion: gclib_api_version,
+ identifier_prefix: 'Geocode',
+ symbol_prefix: 'geocode',
+ export_packages: 'geocode-glib-1.0',
+ dependencies: deps,
+ includes: [ 'GObject-2.0',
+ 'Gio-2.0',
+ 'Json-1.0',
+ 'Soup-2.4' ],
+ install: true,
+ extra_args: gir_args)
+endif
+
+geocode_glib_dep = declare_dependency(link_with: libgcglib,
+ include_directories: include,
+ dependencies: deps,
+ sources: generated_sources)
+
+if get_option('enable-installed-tests')
+ subdir('tests')
+endif
diff --git a/geocode-glib/tests/meson.build b/geocode-glib/tests/meson.build
new file mode 100644
index 0000000..61df92c
--- /dev/null
+++ b/geocode-glib/tests/meson.build
@@ -0,0 +1,41 @@
+install_dir = get_option('libexecdir') + '/installed-tests/geocode-glib'
+
+e = executable('geo-uri',
+ 'geo-uri.c',
+ dependencies: geocode_glib_dep,
+ install: true,
+ install_dir: install_dir)
+test('Geo URI', e)
+
+e = executable('geocode-glib',
+ 'geocode-nominatim-test.h',
+ 'geocode-nominatim-test.c',
+ 'geocode-glib.c',
+ dependencies: geocode_glib_dep,
+ install: true,
+ install_dir: install_dir)
+env = ['G_TEST_SRCDIR=' + meson.current_source_dir()]
+test('API test', e, env: env)
+
+e = executable('mock-backend',
+ 'mock-backend.c',
+ dependencies: geocode_glib_dep,
+ install: true,
+ install_dir: install_dir)
+test('Test mock backend', e)
+
+install_data('locale_format.json',
+ 'locale_name.json',
+ 'nominatim-area.json',
+ 'nominatim-no-results.json',
+ 'nominatim-rio.json',
+ 'osm_type0.json',
+ 'osm_type1.json',
+ 'osm_type2.json',
+ 'pub.json',
+ 'rev.json',
+ 'rev_fail.json',
+ 'search.json',
+ 'search_lat_long.json',
+ 'xep.json',
+ install_dir: install_dir)
diff --git a/icons/maki/scalable_places_poi-airport.svg b/icons/maki/poi-airport.svg
index 3ca18b6..3ca18b6 100644
--- a/icons/maki/scalable_places_poi-airport.svg
+++ b/icons/maki/poi-airport.svg
diff --git a/icons/maki/scalable_places_poi-bar.svg b/icons/maki/poi-bar.svg
index fd2e941..fd2e941 100644
--- a/icons/maki/scalable_places_poi-bar.svg
+++ b/icons/maki/poi-bar.svg
diff --git a/icons/maki/scalable_places_poi-building.svg b/icons/maki/poi-building.svg
index 77214d4..77214d4 100644
--- a/icons/maki/scalable_places_poi-building.svg
+++ b/icons/maki/poi-building.svg
diff --git a/icons/maki/scalable_places_poi-bus-stop.svg b/icons/maki/poi-bus-stop.svg
index 117bc30..117bc30 100644
--- a/icons/maki/scalable_places_poi-bus-stop.svg
+++ b/icons/maki/poi-bus-stop.svg
diff --git a/icons/maki/scalable_places_poi-car.svg b/icons/maki/poi-car.svg
index aeaf247..aeaf247 100644
--- a/icons/maki/scalable_places_poi-car.svg
+++ b/icons/maki/poi-car.svg
diff --git a/icons/maki/scalable_places_poi-light-rail-station.svg b/icons/maki/poi-light-rail-station.svg
index b9f899f..b9f899f 100644
--- a/icons/maki/scalable_places_poi-light-rail-station.svg
+++ b/icons/maki/poi-light-rail-station.svg
diff --git a/icons/maki/scalable_places_poi-marker.svg b/icons/maki/poi-marker.svg
index 1a9d183..1a9d183 100644
--- a/icons/maki/scalable_places_poi-marker.svg
+++ b/icons/maki/poi-marker.svg
diff --git a/icons/maki/scalable_places_poi-place-of-worship.svg b/icons/maki/poi-place-of-worship.svg
index 4e94f81..4e94f81 100644
--- a/icons/maki/scalable_places_poi-place-of-worship.svg
+++ b/icons/maki/poi-place-of-worship.svg
diff --git a/icons/maki/scalable_places_poi-railway-station.svg b/icons/maki/poi-railway-station.svg
index b4a7ff2..b4a7ff2 100644
--- a/icons/maki/scalable_places_poi-railway-station.svg
+++ b/icons/maki/poi-railway-station.svg
diff --git a/icons/maki/scalable_places_poi-restaurant.svg b/icons/maki/poi-restaurant.svg
index ea572f3..ea572f3 100644
--- a/icons/maki/scalable_places_poi-restaurant.svg
+++ b/icons/maki/poi-restaurant.svg
diff --git a/icons/maki/scalable_places_poi-school.svg b/icons/maki/poi-school.svg
index 2445ffe..2445ffe 100644
--- a/icons/maki/scalable_places_poi-school.svg
+++ b/icons/maki/poi-school.svg
diff --git a/icons/maki/scalable_places_poi-town.svg b/icons/maki/poi-town.svg
index acc92ae..acc92ae 100644
--- a/icons/maki/scalable_places_poi-town.svg
+++ b/icons/maki/poi-town.svg
diff --git a/icons/meson.build b/icons/meson.build
new file mode 100644
index 0000000..370428a
--- /dev/null
+++ b/icons/meson.build
@@ -0,0 +1,23 @@
+public_icons = [ 'poi-airport.svg',
+ 'poi-building.svg',
+ 'poi-bus-stop.svg',
+ 'poi-car.svg',
+ 'poi-marker.svg',
+ 'poi-railway-station.svg',
+ 'poi-town.svg',
+ 'poi-school.svg',
+ 'poi-place-of-worship.svg',
+ 'poi-restaurant.svg',
+ 'poi-bar.svg',
+ 'poi-light-rail-station.svg' ]
+
+foreach icon : public_icons
+ file = join_paths('maki' , icon)
+ install_dir = join_paths(get_option('datadir'),
+ 'icons',
+ 'gnome',
+ 'scalable',
+ 'places')
+
+ install_data(file, install_dir: install_dir)
+endforeach
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..9fc6385
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,47 @@
+project('geocode-glib', 'c', version: '3.23.90')
+
+gclib_version = meson.project_version() # set in project() below
+ver_arr = gclib_version.split('.')
+
+gclib_major_version = ver_arr[0]
+gclib_minor_version = ver_arr[1]
+gclib_micro_version = ver_arr[2]
+
+gclib_api_version='1.0'
+
+conf = configuration_data()
+conf.set_quoted('VERSION', gclib_version)
+conf.set_quoted('PACKAGE_VERSION', gclib_version)
+conf.set_quoted('PACKAGE_NAME', 'geocode-glib')
+conf.set_quoted('GETTEXT_PACKAGE', 'geocode-glib')
+conf.set_quoted('PACKAGE_TARNAME', 'geocode-glib')
+conf.set_quoted('PACKAGE_STRING', 'geocode-glib ' + gclib_version)
+conf.set_quoted('PACKAGE_URL', 'https://developer.gnome.org/geocode-glib')
+conf.set_quoted('PACKAGE_BUGREPORT', 'https://bugzilla.gnome.org/enter_bug.cgi?product=geocode-glib')
+conf.set_quoted('TEST_SRCDIR', meson.source_root() + '/data/')
+datadir = get_option('prefix') + '/' + get_option('datadir')
+conf.set_quoted('GEOCODE_LOCALEDIR', datadir + '/locale')
+
+configure_file(output: 'config.h', configuration : conf)
+
+gnome = import('gnome')
+
+add_global_arguments('-Wall', language: 'c')
+cc = meson.get_compiler('c')
+if cc.get_id() == 'gcc'
+ add_global_arguments('-Wchar-subscripts',
+ '-Wmissing-declarations',
+ '-Wmissing-prototypes',
+ '-Wnested-externs',
+ '-Wpointer-arith',
+ '-Wcast-align',
+ '-Wsign-compare',
+ '-Wredundant-decls',
+ '-fno-strict-aliasing',
+ language: 'c')
+endif
+
+subdir('geocode-glib')
+subdir('po')
+subdir('icons')
+subdir('docs')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..0cb674a
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,9 @@
+option('enable-installed-tests',
+ type: 'boolean', value: true,
+ description: 'Build & install test programs')
+option('enable-introspection',
+ type: 'boolean', value: true,
+ description: 'Whether to enable the introspection generation')
+option('enable-gtk-doc',
+ type: 'boolean', value: true,
+ description: 'Whether to generate the API reference for Geocode-GLib')
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..9519a81
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,5 @@
+api_name = meson.project_name() + '-' + gclib_api_version
+gettext_domain = api_name
+
+i18n = import('i18n')
+i18n.gettext(gettext_domain, preset: 'glib')