meson: Minor modernizations

This commit is contained in:
Patrick Griffis 2016-12-09 14:30:22 -05:00 committed by Matthias Clasen
parent bc2bb5639b
commit d10be6102f
12 changed files with 158 additions and 144 deletions

View File

@ -17,12 +17,18 @@ gdbus_codegen_conf.set('PYTHON', python.path())
gdbus_codegen = configure_file(input : 'gdbus-codegen.in', gdbus_codegen = configure_file(input : 'gdbus-codegen.in',
output : 'gdbus-codegen', output : 'gdbus-codegen',
install : true, 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', configure_file(input : 'config.py.in',
output : 'config.py', output : 'config.py',
install : true, 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() blank_conf = configuration_data()
foreach f : gdbus_codegen_files 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 # and then install it too so that it can be used after installation
configure_file(input : f, output : f, configure_file(input : f, output : f,
install : true, install : true,
install_dir : 'share/glib-2.0/codegen', install_dir : codegen_dir,
configuration : blank_conf) configuration : blank_conf)
endforeach endforeach

View File

@ -11,4 +11,5 @@ inotify_lib = static_library('inotify',
sources : inotify_sources, sources : inotify_sources,
include_directories : [configinc, glibinc, gmoduleinc], include_directories : [configinc, glibinc, gmoduleinc],
dependencies : [gioenumtypes_dep], 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)

View File

@ -14,4 +14,5 @@ kqueue_sources = [
kqueue_lib = static_library('kqueue', kqueue_lib = static_library('kqueue',
sources : kqueue_sources, sources : kqueue_sources,
include_directories : [configinc, glibinc, gmoduleinc], 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)

View File

@ -104,7 +104,7 @@ gnetworking_h_conf.set('NAMESER_COMPAT_INCLUDE', gnetworking_h_nameser_compat_in
gnetworking_h = configure_file(input : 'gnetworking.h.in', gnetworking_h = configure_file(input : 'gnetworking.h.in',
output : 'gnetworking.h', 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) configuration : gnetworking_h_conf)
gdbus_headers = [ gdbus_headers = [
@ -626,8 +626,7 @@ gioenumtypes_h = custom_target('gioenumtypes_h',
output : 'gioenumtypes.h', output : 'gioenumtypes.h',
input : gio_headers, input : gio_headers,
install : true, install : true,
install_dir : 'include/glib-2.0/gio/', install_dir : join_paths(get_option('includedir'), 'glib-2.0/gio'),
depends : [],
command : [gio_build_mkenum, perl, glib_mkenums, command : [gio_build_mkenum, perl, glib_mkenums,
'@OUTPUT@', meson.current_source_dir(), '@OUTPUT@', meson.current_source_dir(),
'@INPUT@', gnetworking_h]) '@INPUT@', gnetworking_h])
@ -670,7 +669,7 @@ install_data([
'completion/gsettings', 'completion/gsettings',
'completion/gresource' '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', libgio = shared_library('gio-2.0',
gioenumtypes_h, gioenumtypes_c, gnetworking_h, gio_sources, gioenumtypes_h, gioenumtypes_c, gnetworking_h, gio_sources,
@ -744,10 +743,10 @@ executable('gsettings', 'gsettings-tool.c',
link_args : noseh_link_args, link_args : noseh_link_args,
dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep]) dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
install_data('gschema.dtd', 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_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', executable('gdbus', 'gdbus-tool.c',
install : true, install : true,

View File

@ -10,4 +10,5 @@ giowin32_sources = [
giowin32_lib = static_library('giowin32', giowin32_lib = static_library('giowin32',
sources : [giowin32_sources, gioenumtypes_h], sources : [giowin32_sources, gioenumtypes_h],
include_directories : [configinc, glibinc, gioinc, gmoduleinc], 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)

View File

@ -12,4 +12,5 @@ xdgmime_sources = [
xdgmime_lib = static_library('xdgmime', xdgmime_lib = static_library('xdgmime',
sources : xdgmime_sources, sources : xdgmime_sources,
include_directories : [configinc], include_directories : [configinc],
c_args : [ '-DHAVE_CONFIG_H', '-DXDG_PREFIX=_gio_xdg', '-fPIC' ]) pic : true,
c_args : [ '-DHAVE_CONFIG_H', '-DXDG_PREFIX=_gio_xdg' ])

View File

@ -1,3 +1,4 @@
charset_lib = static_library('charset', 'localcharset.c', charset_lib = static_library('charset', 'localcharset.c',
include_directories : configinc, include_directories : configinc,
c_args : [ '-DLIBDIR="lib"', '-fPIC' ]) pic : true,
c_args : [ '-DLIBDIR="@0@"'.format(get_option('libdir')) ])

View File

@ -1,6 +1,6 @@
configure_file(input : 'glibconfig.h.in', output : 'glibconfig.h', configure_file(input : 'glibconfig.h.in', output : 'glibconfig.h',
install : true, install : true,
install_dir : 'lib/glib-2.0/include', install_dir : join_paths(get_option('libdir'), 'glib-2.0/include'),
configuration : glibconfig_conf) configuration : glibconfig_conf)
subdir('libcharset') subdir('libcharset')
@ -13,7 +13,7 @@ glib_headers = [
'glib-unix.h', 'glib-unix.h',
'glib-object.h', 'glib-object.h',
] ]
install_headers(glib_headers, subdir : 'glib-2.0/') install_headers(glib_headers, subdir : 'glib-2.0')
glib_deprecated_headers = [ glib_deprecated_headers = [
'deprecated/gallocator.h', 'deprecated/gallocator.h',
@ -23,7 +23,7 @@ glib_deprecated_headers = [
'deprecated/grel.h', 'deprecated/grel.h',
'deprecated/gthread.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_sub_headers = [
'glib-autocleanups.h', 'glib-autocleanups.h',
@ -100,14 +100,15 @@ glib_sub_headers = [
'gwin32.h', 'gwin32.h',
'gprintf.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_sources = [
'deprecated/gallocator.c', 'deprecated/gallocator.c',
'deprecated/gcache.c', 'deprecated/gcache.c',
'deprecated/gcompletion.c', 'deprecated/gcompletion.c',
'deprecated/grel.c', 'deprecated/grel.c',
'deprecated/gthread-deprecated.c'] 'deprecated/gthread-deprecated.c'
]
glib_sources = [ glib_sources = [
'garray.c', 'garray.c',
@ -185,7 +186,8 @@ glib_sources = [
'gvarianttype.c', 'gvarianttype.c',
'gversion.c', 'gversion.c',
'gwakeup.c', 'gwakeup.c',
'gprintf.c',] 'gprintf.c',
]
if host_system == 'windows' if host_system == 'windows'
thread_src = ['gthread-win32.c'] thread_src = ['gthread-win32.c']
@ -250,7 +252,7 @@ else
endif endif
install_data('gtester-report', install_dir : get_option('bindir')) 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 = configuration_data()
gdb_conf.set('datadir', glib_datadir) gdb_conf.set('datadir', glib_datadir)
@ -259,7 +261,7 @@ configure_file(
output: 'libglib-2.0.so.@0@-gdb.py'.format(library_version), output: 'libglib-2.0.so.@0@-gdb.py'.format(library_version),
configuration: gdb_conf, configuration: gdb_conf,
install: true, 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 # gtester doesn't work on native windows

View File

@ -24,10 +24,10 @@ pcre_sources = [
libpcre = static_library('pcre', libpcre = static_library('pcre',
sources : [pcre_sources], sources : [pcre_sources],
install : false,
include_directories : [configinc, glibinc], include_directories : [configinc, glibinc],
dependencies : [], pic : true,
c_args : ['-DG_LOG_DOMAIN="GLib-GRegex"', c_args : [
'-DG_LOG_DOMAIN="GLib-GRegex"',
'-DHAVE_MEMMOVE', '-DHAVE_MEMMOVE',
'-DSUPPORT_UCP', '-DSUPPORT_UCP',
'-DSUPPORT_UTF', '-DSUPPORT_UTF',
@ -43,8 +43,8 @@ libpcre = static_library('pcre',
'-DPCRE_STATIC', '-DPCRE_STATIC',
'-UBSR_ANYCRLF', '-UBSR_ANYCRLF',
'-UEBCDIC', '-UEBCDIC',
'-DGLIB_COMPILATION', '-DGLIB_COMPILATION'
'-fPIC',] ]
) )
pcre = declare_dependency(link_with : libpcre) pcre = declare_dependency(link_with : libpcre)

View File

@ -82,7 +82,7 @@ gmoduleconf_h = configure_file(input : 'gmoduleconf.h.in',
output : 'gmoduleconf.h', output : 'gmoduleconf.h',
configuration : gmoduleconf_conf) 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', libgmodule = shared_library('gmodule-2.0',
sources : ['gmodule.c'], sources : ['gmodule.c'],

View File

@ -20,7 +20,7 @@ gobject_install_headers = [
'gvaluetypes.h', 'gvaluetypes.h',
'gobjectnotifyqueue.c', # sic '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_c_sources = [
# 'gobject_probes.d', # 'gobject_probes.d',
@ -83,7 +83,7 @@ glib_genmarshal = executable('glib-genmarshal',
c_args : ['-DHAVE_CONFIG_H=1'], c_args : ['-DHAVE_CONFIG_H=1'],
dependencies : [libglib_dep, libgobject_dep]) 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 = configuration_data()
gdb_conf.set('datadir', glib_datadir) gdb_conf.set('datadir', glib_datadir)
configure_file( configure_file(
@ -91,7 +91,7 @@ configure_file(
output: 'libgobject-2.0.so.@0@-gdb.py'.format(library_version), output: 'libgobject-2.0.so.@0@-gdb.py'.format(library_version),
configuration: gdb_conf, configuration: gdb_conf,
install: true, 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') subdir('tests')

View File

@ -1,9 +1,11 @@
project('glib', 'c', 'cpp', project('glib', 'c', 'cpp',
version : '2.51.0', version : '2.51.0',
meson_version : '>= 0.32.0', meson_version : '>= 0.36.0',
default_options : [ 'warning_level=1', default_options : [
'c_std=gnu89', 'warning_level=1',
'buildtype=debugoptimized' ]) 'c_std=gnu89'
]
)
cc = meson.get_compiler('c') cc = meson.get_compiler('c')
cxx = meson.get_compiler('cpp') cxx = meson.get_compiler('cpp')
@ -46,13 +48,13 @@ gmoduleinc = include_directories('gmodule')
gioinc = include_directories('gio') gioinc = include_directories('gio')
glib_prefix = get_option('prefix') glib_prefix = get_option('prefix')
glib_libdir = glib_prefix + '/' + get_option('libdir') glib_libdir = join_paths(glib_prefix, get_option('libdir'))
glib_datadir = glib_prefix + '/' + get_option('datadir') glib_datadir = join_paths(glib_prefix, get_option('datadir'))
glib_pkgdatadir = glib_datadir + '/glib-2.0' glib_pkgdatadir = join_paths(glib_datadir, 'glib-2.0')
glib_includedir = glib_prefix + '/' + get_option('includedir') glib_includedir = join_paths(glib_prefix, get_option('includedir'))
glib_giomodulesdir = glib_libdir + '/gio/modules' glib_giomodulesdir = join_paths(glib_libdir + 'gio/modules')
glib_pkgconfigreldir = get_option('libdir') + '/pkgconfig' glib_pkgconfigreldir = join_paths(get_option('libdir'), 'pkgconfig')
######################## ########################
# Configuration begins # # 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_MICRO_VERSION', micro_version)
glib_conf.set('GLIB_INTERFACE_AGE', 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('GLIB_BINARY_AGE', 100 * minor_version.to_int() + micro_version.to_int())
glib_conf.set('GETTEXT_PACKAGE', '"glib20"') glib_conf.set_quoted('GETTEXT_PACKAGE', 'glib20')
glib_conf.set('PACKAGE_BUGREPORT', '"http://bugzilla.gnome.org/enter_bug.cgi?product=glib"') glib_conf.set_quoted('PACKAGE_BUGREPORT', 'http://bugzilla.gnome.org/enter_bug.cgi?product=glib')
glib_conf.set('PACKAGE_NAME', '"glib"') glib_conf.set_quoted('PACKAGE_NAME', 'glib')
glib_conf.set('PACKAGE_STRING', '"glib @0@"'.format(meson.project_version())) glib_conf.set_quoted('PACKAGE_STRING', 'glib @0@'.format(meson.project_version()))
glib_conf.set('PACKAGE_TARNAME', '"glib"') glib_conf.set_quoted('PACKAGE_TARNAME', 'glib')
glib_conf.set('PACKAGE_URL', '""') glib_conf.set_quoted('PACKAGE_URL', '')
glib_conf.set('PACKAGE_VERSION', '"@0@"'.format(meson.project_version())) glib_conf.set_quoted('PACKAGE_VERSION', meson.project_version())
glib_conf.set('ENABLE_NLS', 1) glib_conf.set('ENABLE_NLS', 1)
glib_conf.set('HAVE_GOOD_PRINTF', 1) # FIXME glib_conf.set('HAVE_GOOD_PRINTF', 1) # FIXME
@ -118,7 +120,7 @@ if run_command('xgettext', '--help').returncode() != 0
error('GNU Gettext required currently.') error('GNU Gettext required currently.')
endif endif
glib_conf.set('HAVE_GETTEXT', 1) 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) # FIXME: what about Cygwin (G_WITH_CYGWIN)
if host_system == 'windows' if host_system == 'windows'
@ -1356,7 +1358,7 @@ configure_file(input : 'glib-gettextize.in',
# Install m4 macros that other projects use # Install m4 macros that other projects use
install_data('m4macros/glib-2.0.m4', 'm4macros/glib-gettext.m4', 'm4macros/gsettings.m4', 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', configure_file(input : 'config.h.meson',
output : 'config.h', output : 'config.h',