[glib/meson-for-merge] meson: Minor modernizations



commit d10be6102f28e63f5d85c9d8500af28dff2b7ca7
Author: Patrick Griffis <tingping tingping se>
Date:   Fri Dec 9 14:30:22 2016 -0500

    meson: Minor modernizations

 gio/gdbus-2.0/codegen/meson.build |   12 ++-
 gio/inotify/meson.build           |    3 +-
 gio/kqueue/meson.build            |    3 +-
 gio/meson.build                   |   11 +--
 gio/win32/meson.build             |    3 +-
 gio/xdgmime/meson.build           |    3 +-
 glib/libcharset/meson.build       |    3 +-
 glib/meson.build                  |  176 +++++++++++++++++++------------------
 glib/pcre/meson.build             |   40 ++++----
 gmodule/meson.build               |    2 +-
 gobject/meson.build               |    6 +-
 meson.build                       |   40 +++++----
 12 files changed, 158 insertions(+), 144 deletions(-)
---
diff --git a/gio/gdbus-2.0/codegen/meson.build b/gio/gdbus-2.0/codegen/meson.build
index b062cfb..0e9ffbd 100644
--- a/gio/gdbus-2.0/codegen/meson.build
+++ b/gio/gdbus-2.0/codegen/meson.build
@@ -17,12 +17,18 @@ gdbus_codegen_conf.set('PYTHON', python.path())
 gdbus_codegen = configure_file(input : 'gdbus-codegen.in',
   output : 'gdbus-codegen',
   install : true,
-  install_dir : 'bin', configuration : gdbus_codegen_conf)
+  install_dir : get_option('bindir'),
+  configuration : gdbus_codegen_conf
+)
+
+codegen_dir = join_paths(get_option('datadir'), 'glib-2.0/codegen')
 
 configure_file(input : 'config.py.in',
   output : 'config.py',
   install : true,
-  install_dir : 'share/glib-2.0/codegen', configuration : gdbus_codegen_conf)
+  install_dir : codegen_dir,
+  configuration : gdbus_codegen_conf
+)
 
 blank_conf = configuration_data()
 foreach f : gdbus_codegen_files
@@ -30,6 +36,6 @@ foreach f : gdbus_codegen_files
   # and then install it too so that it can be used after installation
   configure_file(input : f, output : f,
     install : true,
-    install_dir : 'share/glib-2.0/codegen',
+    install_dir : codegen_dir,
     configuration : blank_conf)
 endforeach
diff --git a/gio/inotify/meson.build b/gio/inotify/meson.build
index 3f00d94..fc3ac71 100644
--- a/gio/inotify/meson.build
+++ b/gio/inotify/meson.build
@@ -11,4 +11,5 @@ inotify_lib = static_library('inotify',
   sources : inotify_sources,
   include_directories : [configinc, glibinc, gmoduleinc],
   dependencies : [gioenumtypes_dep],
-  c_args : [ '-DHAVE_CONFIG_H', '-fPIC', '-DG_DISABLE_DEPRECATED' ] + gio_c_args)
+  pic : true,
+  c_args : [ '-DHAVE_CONFIG_H', '-DG_DISABLE_DEPRECATED' ] + gio_c_args)
diff --git a/gio/kqueue/meson.build b/gio/kqueue/meson.build
index 326915c..8f5b97a 100644
--- a/gio/kqueue/meson.build
+++ b/gio/kqueue/meson.build
@@ -14,4 +14,5 @@ kqueue_sources = [
 kqueue_lib = static_library('kqueue',
   sources : kqueue_sources,
   include_directories : [configinc, glibinc, gmoduleinc],
-  c_args : [ '-DHAVE_CONFIG_H', '-fPIC', '-DG_DISABLE_DEPRECATED' ] + gio_c_args)
+  pic : true,
+  c_args : [ '-DHAVE_CONFIG_H', '-DG_DISABLE_DEPRECATED' ] + gio_c_args)
diff --git a/gio/meson.build b/gio/meson.build
index 576b8fd..7d15451 100644
--- a/gio/meson.build
+++ b/gio/meson.build
@@ -104,7 +104,7 @@ gnetworking_h_conf.set('NAMESER_COMPAT_INCLUDE', gnetworking_h_nameser_compat_in
 
 gnetworking_h = configure_file(input : 'gnetworking.h.in',
                                output : 'gnetworking.h',
-                               install_dir : 'include/glib-2.0/gio',
+                               install_dir : join_paths(get_option('includedir'), 'glib-2.0/gio'),
                                configuration : gnetworking_h_conf)
 
 gdbus_headers = [
@@ -626,8 +626,7 @@ gioenumtypes_h = custom_target('gioenumtypes_h',
   output : 'gioenumtypes.h',
   input : gio_headers,
   install : true,
-  install_dir : 'include/glib-2.0/gio/',
-  depends : [],
+  install_dir : join_paths(get_option('includedir'), 'glib-2.0/gio'),
   command : [gio_build_mkenum, perl, glib_mkenums,
              '@OUTPUT@', meson.current_source_dir(),
              '@INPUT@', gnetworking_h])
@@ -670,7 +669,7 @@ install_data([
   'completion/gsettings',
   'completion/gresource'
 ],
-install_dir: get_option('datadir') + '/bash-completion/completions')
+install_dir: join_paths(get_option('datadir'), 'bash-completion/completions'))
 
 libgio = shared_library('gio-2.0',
   gioenumtypes_h, gioenumtypes_c, gnetworking_h, gio_sources,
@@ -744,10 +743,10 @@ executable('gsettings', 'gsettings-tool.c',
   link_args : noseh_link_args,
   dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
 install_data('gschema.dtd',
-  install_dir : get_option('datadir') + '/glib-2.0/schemas')
+  install_dir : join_paths(get_option('datadir'), 'glib-2.0/schemas'))
 
 install_data(['gschema.loc', 'gschema.its'],
-  install_dir : get_option('datadir') + '/gettext/its')
+  install_dir : join_paths(get_option('datadir'), 'gettext/its'))
 
 executable('gdbus', 'gdbus-tool.c',
   install : true,
diff --git a/gio/win32/meson.build b/gio/win32/meson.build
index 72b521c..8d3b165 100644
--- a/gio/win32/meson.build
+++ b/gio/win32/meson.build
@@ -10,4 +10,5 @@ giowin32_sources = [
 giowin32_lib = static_library('giowin32',
   sources : [giowin32_sources, gioenumtypes_h],
   include_directories : [configinc, glibinc, gioinc, gmoduleinc],
-  c_args : [ '-DHAVE_CONFIG_H', '-fPIC', '-DG_DISABLE_DEPRECATED' ] + gio_c_args)
+  pic : true,
+  c_args : [ '-DHAVE_CONFIG_H', '-DG_DISABLE_DEPRECATED' ] + gio_c_args)
diff --git a/gio/xdgmime/meson.build b/gio/xdgmime/meson.build
index 5e1fb4a..d32d83e 100644
--- a/gio/xdgmime/meson.build
+++ b/gio/xdgmime/meson.build
@@ -12,4 +12,5 @@ xdgmime_sources = [
 xdgmime_lib = static_library('xdgmime',
   sources : xdgmime_sources,
   include_directories : [configinc],
-  c_args : [ '-DHAVE_CONFIG_H', '-DXDG_PREFIX=_gio_xdg', '-fPIC' ])
+  pic : true,
+  c_args : [ '-DHAVE_CONFIG_H', '-DXDG_PREFIX=_gio_xdg' ])
diff --git a/glib/libcharset/meson.build b/glib/libcharset/meson.build
index 9f267ef..a53f639 100644
--- a/glib/libcharset/meson.build
+++ b/glib/libcharset/meson.build
@@ -1,3 +1,4 @@
 charset_lib = static_library('charset', 'localcharset.c',
   include_directories : configinc,
-  c_args : [ '-DLIBDIR="lib"', '-fPIC' ])
+  pic : true,
+  c_args : [ '-DLIBDIR="@0@"'.format(get_option('libdir')) ])
diff --git a/glib/meson.build b/glib/meson.build
index d61c6e1..9477a6f 100644
--- a/glib/meson.build
+++ b/glib/meson.build
@@ -1,6 +1,6 @@
 configure_file(input : 'glibconfig.h.in', output : 'glibconfig.h',
   install : true,
-  install_dir : 'lib/glib-2.0/include',
+  install_dir : join_paths(get_option('libdir'), 'glib-2.0/include'),
   configuration : glibconfig_conf)
 
 subdir('libcharset')
@@ -13,7 +13,7 @@ glib_headers = [
   'glib-unix.h',
   'glib-object.h',
 ]
-install_headers(glib_headers, subdir : 'glib-2.0/')
+install_headers(glib_headers, subdir : 'glib-2.0')
 
 glib_deprecated_headers = [
   'deprecated/gallocator.h',
@@ -23,7 +23,7 @@ glib_deprecated_headers = [
   'deprecated/grel.h',
   'deprecated/gthread.h',
 ]
-install_headers(glib_deprecated_headers, subdir : 'glib-2.0/glib/deprecated/')
+install_headers(glib_deprecated_headers, subdir : 'glib-2.0/glib/deprecated')
 
 glib_sub_headers = [
   'glib-autocleanups.h',
@@ -100,92 +100,94 @@ glib_sub_headers = [
   'gwin32.h',
   'gprintf.h',
 ]
-install_headers(glib_sub_headers, subdir : 'glib-2.0/glib/')
+install_headers(glib_sub_headers, subdir : 'glib-2.0/glib')
 
 deprecated_sources = [
-'deprecated/gallocator.c',
-'deprecated/gcache.c',
-'deprecated/gcompletion.c',
-'deprecated/grel.c',
-'deprecated/gthread-deprecated.c']
+  'deprecated/gallocator.c',
+  'deprecated/gcache.c',
+  'deprecated/gcompletion.c',
+  'deprecated/grel.c',
+  'deprecated/gthread-deprecated.c'
+]
 
 glib_sources = [
-'garray.c',
-'gasyncqueue.c',
-'gatomic.c',
-'gbacktrace.c',
-'gbase64.c',
-'gbitlock.c',
-'gbookmarkfile.c',
-'gbytes.c',
-'gcharset.c',
-'gchecksum.c',
-'gconvert.c',
-'gdataset.c',
-'gdate.c',
-'gdatetime.c',
-'gdir.c',
-'genviron.c',
-'gerror.c',
-'gfileutils.c',
-'ggettext.c',
-'ghash.c',
-'ghmac.c',
-'ghook.c',
-'ghostutils.c',
-'giochannel.c',
-'gkeyfile.c',
-'glib-init.c',
-'glib-private.c',
-'glist.c',
-'gmain.c',
-'gmappedfile.c',
-'gmarkup.c',
-'gmem.c',
-'gmessages.c',
-'gnode.c',
-'goption.c',
-'gpattern.c',
-'gpoll.c',
-'gprimes.c',
-'gqsort.c',
-'gquark.c',
-'gqueue.c',
-'grand.c',
-'gregex.c',
-'gscanner.c',
-'gsequence.c',
-'gshell.c',
-'gslice.c',
-'gslist.c',
-'gstdio.c',
-'gstrfuncs.c',
-'gstring.c',
-'gstringchunk.c',
-'gtestutils.c',
-'gthread.c',
-'gthreadpool.c',
-'gtimer.c',
-'gtimezone.c',
-'gtranslit.c',
-'gtrashstack.c',
-'gtree.c',
-'guniprop.c',
-'gutf8.c',
-'gunibreak.c',
-'gunicollate.c',
-'gunidecomp.c',
-'gurifuncs.c',
-'gutils.c',
-'gvariant.c',
-'gvariant-core.c',
-'gvariant-parser.c',
-'gvariant-serialiser.c',
-'gvarianttypeinfo.c',
-'gvarianttype.c',
-'gversion.c',
-'gwakeup.c',
-'gprintf.c',]
+  'garray.c',
+  'gasyncqueue.c',
+  'gatomic.c',
+  'gbacktrace.c',
+  'gbase64.c',
+  'gbitlock.c',
+  'gbookmarkfile.c',
+  'gbytes.c',
+  'gcharset.c',
+  'gchecksum.c',
+  'gconvert.c',
+  'gdataset.c',
+  'gdate.c',
+  'gdatetime.c',
+  'gdir.c',
+  'genviron.c',
+  'gerror.c',
+  'gfileutils.c',
+  'ggettext.c',
+  'ghash.c',
+  'ghmac.c',
+  'ghook.c',
+  'ghostutils.c',
+  'giochannel.c',
+  'gkeyfile.c',
+  'glib-init.c',
+  'glib-private.c',
+  'glist.c',
+  'gmain.c',
+  'gmappedfile.c',
+  'gmarkup.c',
+  'gmem.c',
+  'gmessages.c',
+  'gnode.c',
+  'goption.c',
+  'gpattern.c',
+  'gpoll.c',
+  'gprimes.c',
+  'gqsort.c',
+  'gquark.c',
+  'gqueue.c',
+  'grand.c',
+  'gregex.c',
+  'gscanner.c',
+  'gsequence.c',
+  'gshell.c',
+  'gslice.c',
+  'gslist.c',
+  'gstdio.c',
+  'gstrfuncs.c',
+  'gstring.c',
+  'gstringchunk.c',
+  'gtestutils.c',
+  'gthread.c',
+  'gthreadpool.c',
+  'gtimer.c',
+  'gtimezone.c',
+  'gtranslit.c',
+  'gtrashstack.c',
+  'gtree.c',
+  'guniprop.c',
+  'gutf8.c',
+  'gunibreak.c',
+  'gunicollate.c',
+  'gunidecomp.c',
+  'gurifuncs.c',
+  'gutils.c',
+  'gvariant.c',
+  'gvariant-core.c',
+  'gvariant-parser.c',
+  'gvariant-serialiser.c',
+  'gvarianttypeinfo.c',
+  'gvarianttype.c',
+  'gversion.c',
+  'gwakeup.c',
+  'gprintf.c',
+]
 
 if host_system == 'windows'
   thread_src = ['gthread-win32.c']
@@ -250,7 +252,7 @@ else
 endif
 
 install_data('gtester-report', install_dir : get_option('bindir'))
-install_data('glib.py', install_dir : glib_pkgdatadir + '/gdb')
+install_data('glib.py', install_dir : join_paths(glib_pkgdatadir, 'gdb'))
 
 gdb_conf = configuration_data()
 gdb_conf.set('datadir', glib_datadir)
@@ -259,7 +261,7 @@ configure_file(
   output: 'libglib-2.0.so.@0 -gdb py'.format(library_version),
   configuration: gdb_conf,
   install: true,
-  install_dir: get_option('datadir') + '/gdb/auto-load/' + glib_libdir
+  install_dir: join_paths(get_option('datadir'), 'gdb/auto-load' + glib_libdir)
 )
 
 # gtester doesn't work on native windows
diff --git a/glib/pcre/meson.build b/glib/pcre/meson.build
index 3c6c8f0..56aecc8 100644
--- a/glib/pcre/meson.build
+++ b/glib/pcre/meson.build
@@ -24,27 +24,27 @@ pcre_sources = [
 
 libpcre = static_library('pcre',
   sources : [pcre_sources],
-  install : false,
   include_directories : [configinc, glibinc],
-  dependencies : [],
-  c_args : ['-DG_LOG_DOMAIN="GLib-GRegex"',
-            '-DHAVE_MEMMOVE',
-            '-DSUPPORT_UCP',
-            '-DSUPPORT_UTF',
-            '-DSUPPORT_UTF8',
-            '-DNEWLINE=-1',
-            '-DMATCH_LIMIT=10000000',
-            '-DMATCH_LIMIT_RECURSION=8192',
-            '-DMAX_NAME_SIZE=32',
-            '-DMAX_NAME_COUNT=10000',
-            '-DMAX_DUPLENGTH=30000',
-            '-DLINK_SIZE=2',
-            '-DPOSIX_MALLOC_THRESHOLD=10',
-            '-DPCRE_STATIC',
-            '-UBSR_ANYCRLF',
-            '-UEBCDIC',
-            '-DGLIB_COMPILATION',
-           '-fPIC',]
+  pic : true,
+  c_args : [
+    '-DG_LOG_DOMAIN="GLib-GRegex"',
+    '-DHAVE_MEMMOVE',
+    '-DSUPPORT_UCP',
+    '-DSUPPORT_UTF',
+    '-DSUPPORT_UTF8',
+    '-DNEWLINE=-1',
+    '-DMATCH_LIMIT=10000000',
+    '-DMATCH_LIMIT_RECURSION=8192',
+    '-DMAX_NAME_SIZE=32',
+    '-DMAX_NAME_COUNT=10000',
+    '-DMAX_DUPLENGTH=30000',
+    '-DLINK_SIZE=2',
+    '-DPOSIX_MALLOC_THRESHOLD=10',
+    '-DPCRE_STATIC',
+    '-UBSR_ANYCRLF',
+    '-UEBCDIC',
+    '-DGLIB_COMPILATION'
+  ]
 )
 
 pcre = declare_dependency(link_with : libpcre)
diff --git a/gmodule/meson.build b/gmodule/meson.build
index 3319740..188b178 100644
--- a/gmodule/meson.build
+++ b/gmodule/meson.build
@@ -82,7 +82,7 @@ gmoduleconf_h = configure_file(input : 'gmoduleconf.h.in',
                                output : 'gmoduleconf.h',
                                configuration : gmoduleconf_conf)
 
-install_headers(['gmodule.h'], subdir : 'glib-2.0/')
+install_headers(['gmodule.h'], subdir : 'glib-2.0')
 
 libgmodule = shared_library('gmodule-2.0',
   sources : ['gmodule.c'],
diff --git a/gobject/meson.build b/gobject/meson.build
index 717b6b4..99505d2 100644
--- a/gobject/meson.build
+++ b/gobject/meson.build
@@ -20,7 +20,7 @@ gobject_install_headers = [
   'gvaluetypes.h',
   'gobjectnotifyqueue.c', # sic
 ]
-install_headers(gobject_install_headers, subdir : 'glib-2.0/gobject/')
+install_headers(gobject_install_headers, subdir : 'glib-2.0/gobject')
 
 gobject_c_sources = [
 #  'gobject_probes.d',
@@ -83,7 +83,7 @@ glib_genmarshal = executable('glib-genmarshal',
   c_args : ['-DHAVE_CONFIG_H=1'],
   dependencies : [libglib_dep, libgobject_dep])
 
-install_data('gobject.py', install_dir : glib_pkgdatadir + '/gdb')
+install_data('gobject.py', install_dir : join_paths(glib_pkgdatadir + 'gdb'))
 gdb_conf = configuration_data()
 gdb_conf.set('datadir', glib_datadir)
 configure_file(
@@ -91,7 +91,7 @@ configure_file(
   output: 'libgobject-2.0.so.@0 -gdb py'.format(library_version),
   configuration: gdb_conf,
   install: true,
-  install_dir: get_option('datadir') + '/gdb/auto-load/' + glib_libdir
+  install_dir: join_paths(get_option('datadir'), 'gdb/auto-load/' + glib_libdir)
 )
 
 subdir('tests')
diff --git a/meson.build b/meson.build
index 0cd9927..033d7c1 100644
--- a/meson.build
+++ b/meson.build
@@ -1,9 +1,11 @@
 project('glib', 'c', 'cpp',
   version : '2.51.0',
-  meson_version : '>= 0.32.0',
-  default_options : [ 'warning_level=1',
-                      'c_std=gnu89',
-                      'buildtype=debugoptimized' ])
+  meson_version : '>= 0.36.0',
+  default_options : [
+    'warning_level=1',
+    'c_std=gnu89'
+  ]
+)
 
 cc = meson.get_compiler('c')
 cxx = meson.get_compiler('cpp')
@@ -46,13 +48,13 @@ gmoduleinc = include_directories('gmodule')
 gioinc = include_directories('gio')
 
 glib_prefix = get_option('prefix')
-glib_libdir = glib_prefix + '/' + get_option('libdir')
-glib_datadir = glib_prefix + '/' + get_option('datadir')
-glib_pkgdatadir = glib_datadir + '/glib-2.0'
-glib_includedir = glib_prefix + '/' + get_option('includedir')
-glib_giomodulesdir = glib_libdir + '/gio/modules'
+glib_libdir = join_paths(glib_prefix, get_option('libdir'))
+glib_datadir = join_paths(glib_prefix, get_option('datadir'))
+glib_pkgdatadir = join_paths(glib_datadir, 'glib-2.0')
+glib_includedir = join_paths(glib_prefix, get_option('includedir'))
+glib_giomodulesdir = join_paths(glib_libdir + 'gio/modules')
 
-glib_pkgconfigreldir = get_option('libdir') + '/pkgconfig'
+glib_pkgconfigreldir = join_paths(get_option('libdir'), 'pkgconfig')
 
 ########################
 # Configuration begins #
@@ -70,13 +72,13 @@ glib_conf.set('GLIB_MINOR_VERSION', minor_version)
 glib_conf.set('GLIB_MICRO_VERSION', micro_version)
 glib_conf.set('GLIB_INTERFACE_AGE', micro_version)
 glib_conf.set('GLIB_BINARY_AGE', 100 * minor_version.to_int() + micro_version.to_int())
-glib_conf.set('GETTEXT_PACKAGE', '"glib20"')
-glib_conf.set('PACKAGE_BUGREPORT', '"http://bugzilla.gnome.org/enter_bug.cgi?product=glib";')
-glib_conf.set('PACKAGE_NAME', '"glib"')
-glib_conf.set('PACKAGE_STRING', '"glib @0@"'.format(meson.project_version()))
-glib_conf.set('PACKAGE_TARNAME', '"glib"')
-glib_conf.set('PACKAGE_URL', '""')
-glib_conf.set('PACKAGE_VERSION', '"@0@"'.format(meson.project_version()))
+glib_conf.set_quoted('GETTEXT_PACKAGE', 'glib20')
+glib_conf.set_quoted('PACKAGE_BUGREPORT', 'http://bugzilla.gnome.org/enter_bug.cgi?product=glib')
+glib_conf.set_quoted('PACKAGE_NAME', 'glib')
+glib_conf.set_quoted('PACKAGE_STRING', 'glib @0@'.format(meson.project_version()))
+glib_conf.set_quoted('PACKAGE_TARNAME', 'glib')
+glib_conf.set_quoted('PACKAGE_URL', '')
+glib_conf.set_quoted('PACKAGE_VERSION', meson.project_version())
 glib_conf.set('ENABLE_NLS', 1)
 glib_conf.set('HAVE_GOOD_PRINTF', 1) # FIXME
 
@@ -118,7 +120,7 @@ if run_command('xgettext', '--help').returncode() != 0
   error('GNU Gettext required currently.')
 endif
 glib_conf.set('HAVE_GETTEXT', 1)
-glib_conf.set('GLIB_LOCALE_DIR', '"@0@/share/locale"'.format(get_option('prefix')))
+glib_conf.set_quoted('GLIB_LOCALE_DIR', join_paths(glib_datadir, 'locale'))
 
 # FIXME: what about Cygwin (G_WITH_CYGWIN)
 if host_system == 'windows'
@@ -1356,7 +1358,7 @@ configure_file(input : 'glib-gettextize.in',
 
 # Install m4 macros that other projects use
 install_data('m4macros/glib-2.0.m4', 'm4macros/glib-gettext.m4', 'm4macros/gsettings.m4',
-  install_dir : 'share/aclocal')
+  install_dir : join_paths(get_option('datadir'), 'aclocal'))
 
 configure_file(input : 'config.h.meson',
   output : 'config.h',


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]