[gcab/wip/hughsie/meson: 2/3] Port to the Meson buildsystem
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcab/wip/hughsie/meson: 2/3] Port to the Meson buildsystem
- Date: Thu, 16 Nov 2017 21:05:21 +0000 (UTC)
commit 281d95aa7f10aaa51f394e1f6c152baa486b3fd6
Author: Richard Hughes <richard hughsie com>
Date: Thu Nov 16 21:00:38 2017 +0000
Port to the Meson buildsystem
docs/meson.build | 1 +
docs/reference/meson.build | 15 +++++++
libgcab/meson.build | 97 ++++++++++++++++++++++++++++++++++++++++++++
meson.build | 92 +++++++++++++++++++++++++++++++++++++++++
meson_options.txt | 3 +
po/meson.build | 6 +++
6 files changed, 214 insertions(+), 0 deletions(-)
---
diff --git a/docs/meson.build b/docs/meson.build
new file mode 100644
index 0000000..ead14c4
--- /dev/null
+++ b/docs/meson.build
@@ -0,0 +1 @@
+subdir('reference')
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
new file mode 100644
index 0000000..4099e21
--- /dev/null
+++ b/docs/reference/meson.build
@@ -0,0 +1,15 @@
+gcab_docs = configure_file(
+ input : 'gcab-docs.sgml.in',
+ output : 'gcab-docs.sgml',
+ configuration : conf,
+)
+
+gnome.gtkdoc(
+ 'gcab',
+ src_dir : [
+ join_paths(meson.source_root(), 'libgcab'),
+ join_paths(meson.build_root(), 'libgcab'),
+ ],
+ main_sgml : 'gcab-docs.sgml',
+ install : true
+)
diff --git a/libgcab/meson.build b/libgcab/meson.build
new file mode 100644
index 0000000..4d962dd
--- /dev/null
+++ b/libgcab/meson.build
@@ -0,0 +1,97 @@
+cargs = [
+ '-DG_LOG_DOMAIN="gcab"',
+]
+
+#libgcab_version_h = configure_file(
+# input : 'libgcab-1.0.pc.in',
+# output : 'libgcab-1.0.pc',
+# configuration : conf,
+# install : true,
+# install_dir : pkgconfig,
+#)
+
+enum_headers = ['gcab-folder.h', 'gcab-file.h']
+enums = gnome.mkenums(
+ 'gcab-enums',
+ sources : enum_headers,
+ c_template : 'gcab-enums.c.etemplate',
+ h_template : 'gcab-enums.h.etemplate',
+ install_header : true,
+ install_dir : 'libgcab-1.0/libgcab',
+ symbol_prefix : 'gcab',
+ identifier_prefix : 'GCab',
+)
+
+install_headers([
+ 'gcab-cabinet.h',
+ 'gcab-file.h',
+ 'gcab-folder.h',
+ ],
+ subdir : 'libgcab-1.0/libgcab',
+)
+
+mapfile = '../libgcab.syms'
+vflag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), mapfile)
+libgcab = shared_library(
+ 'gcab-1.0',
+ enums,
+ sources : [
+ 'gcab-cabinet.c',
+ 'gcab-folder.c',
+ 'gcab-file.c',
+ 'cabinet.c',
+ 'decomp.c',
+ 'glib-compat.c',
+ ],
+ soversion : lt_current,
+ version : lt_version,
+ dependencies : [
+ gio,
+ libz,
+ ],
+ c_args : cargs,
+ include_directories : [
+ include_directories('.'),
+ include_directories('..'),
+ ],
+ link_args : vflag,
+ link_depends : mapfile,
+ install : true
+)
+
+pkgg = import('pkgconfig')
+pkgg.generate(
+ libraries : libgcab,
+ requires : [ 'gio-2.0' ],
+ subdirs : 'libgcab-1.0',
+ version : meson.project_version(),
+ name : 'libgcab',
+ filebase : 'libgcab-1.0',
+ description : 'Cabinet file library',
+)
+
+if get_option('enable-introspection')
+ gir = gnome.generate_gir(libgcab,
+ sources : [
+ 'gcab-cabinet.c',
+ 'gcab-cabinet.h',
+ 'gcab-folder.c',
+ 'gcab-folder.h',
+ 'gcab-file.c',
+ 'gcab-file.h',
+ ],
+ nsversion : '1.0',
+ namespace : 'GCab',
+ symbol_prefix : 'gcab',
+ identifier_prefix : 'GCab',
+ export_packages : 'libgcab',
+ dependencies : [
+ gio,
+ ],
+ includes : [
+ 'Gio-2.0',
+ 'GObject-2.0',
+ ],
+ install : true
+ )
+endif
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..faa52eb
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,92 @@
+project('gcab', 'c',
+ version : '0.8',
+ license : 'LGPL-2.1+',
+ meson_version : '>=0.37.0',
+ default_options : ['warning_level=2', 'c_std=c99'],
+)
+
+# libtool versioning
+lt_current = '0'
+lt_revision = '0'
+lt_age = '0'
+lt_version = '@0@.@1@.@2@'.format(lt_current, lt_age, lt_revision)
+
+# get suported warning flags
+test_args = [
+ '-Wsystem-headers',
+ '-Wundef',
+ '-Wunused-parameter',
+ '-Wunused-local-typedefs',
+ '-Wunsafe-loop-optimizations',
+ '-Wno-sign-compare',
+ '-Wno-unused-parameter',
+]
+cc = meson.get_compiler('c')
+foreach arg: test_args
+ if cc.has_argument(arg)
+ add_project_arguments(arg, language : 'c')
+ endif
+endforeach
+
+# enable full RELRO where possible
+# FIXME: until https://github.com/mesonbuild/meson/issues/1140 is fixed
+global_link_args = []
+test_link_args = [
+ '-Wl,-z,relro',
+ '-Wl,-z,now',
+]
+foreach arg: test_link_args
+ if cc.has_argument(arg)
+ global_link_args += arg
+ endif
+endforeach
+add_global_link_arguments(
+ global_link_args,
+ language: 'c'
+)
+
+gio = dependency('gio-2.0', version : '>= 2.32.0')
+libz = dependency('zlib')
+
+gnome = import('gnome')
+i18n = import('i18n')
+
+conf = configuration_data()
+conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
+conf.set_quoted('PACKAGE_NAME', meson.project_name())
+conf.set_quoted('PACKAGE_STRING', meson.project_name())
+conf.set_quoted('VERSION', meson.project_version())
+conf.set_quoted('LOCALEDIR', get_option('localedir'))
+conf.set_quoted('PACKAGE_BUGREPORT', 'FIXME')
+configure_file(
+ output : 'config.h',
+ configuration : conf
+)
+
+install_headers(
+ 'libgcab.h',
+ subdir : 'libgcab-1.0',
+)
+
+subdir('libgcab')
+subdir('docs')
+subdir('po')
+
+executable(
+ 'gcab',
+ sources : [
+ 'gcab.c',
+ ],
+ include_directories : [
+ include_directories('libgcab'),
+ ],
+ dependencies : [
+ gio,
+ ],
+ link_with : [
+ libgcab,
+ ],
+ c_args : cargs,
+ install : true,
+ install_dir : get_option('bindir')
+)
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..114cc64
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,3 @@
+option('enable-doc', type : 'boolean', value : true, description : 'enable developer documentation')
+option('enable-introspection', type : 'boolean', value : true, description : 'generate GObject Introspection
data')
+option('enable-tests', type : 'boolean', value : true, description : 'enable tests')
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..6b9a7bc
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,6 @@
+i18n.gettext(meson.project_name(),
+ preset : 'glib',
+ args: [
+ '--default-domain=' + meson.project_name(),
+ ]
+)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]