Meson: Add missing options and conform to naming guidelines

https://bugzilla.gnome.org/show_bug.cgi?id=790837
This commit is contained in:
Xavier Claessens 2017-11-28 10:44:04 -05:00
parent 8e91aaed79
commit 62c4768423
8 changed files with 162 additions and 61 deletions

View File

@ -352,9 +352,6 @@
/* Define to 1 if libselinux is available */
#mesondefine HAVE_SELINUX
/* Define to 1 if you have the <selinux/selinux.h> header file. */
#mesondefine HAVE_SELINUX_SELINUX_H
/* Define to 1 if you have the `sendmmsg' function. */
#mesondefine HAVE_SENDMMSG

View File

@ -1,4 +1,4 @@
if get_option('with-docs') != 'no'
if get_option('gtk_doc')
subdir('xml')
ignore_headers = [
@ -205,7 +205,7 @@ if get_option('with-docs') != 'no'
endif
if get_option('with-man') != 'no' and xsltproc.found()
if get_option('man')
manpages = ['gapplication', 'gio-querymodules', 'glib-compile-schemas',
'glib-compile-resources', 'gsettings', 'gresource', 'gdbus',
'gio', 'gdbus-codegen']

View File

@ -1,4 +1,4 @@
if get_option('with-docs') != 'no'
if get_option('gtk_doc')
subdir('xml')
ignore_headers = [
@ -145,7 +145,7 @@ if get_option('with-docs') != 'no'
install: true)
endif
if get_option('with-man') != 'no' and xsltproc.found()
if get_option('man')
manpages = ['glib-gettextize', 'gtester', 'gtester-report']
foreach page : manpages
custom_target(page + '-man',

View File

@ -1,4 +1,4 @@
if get_option('with-docs') != 'no'
if get_option('gtk_doc')
subdir('xml')
ignore_headers = [
@ -109,7 +109,7 @@ if get_option('with-docs') != 'no'
)
endif
if get_option('with-man') != 'no' and xsltproc.found()
if get_option('man')
manpages = ['glib-mkenums', 'glib-genmarshal', 'gobject-query']
foreach page : manpages
custom_target(page + '-man',

View File

@ -733,10 +733,9 @@ libgio = shared_library('gio-2.0',
link_with : internal_deps,
#libgio_2_0_la_LDFLAGS = $(GLIB_LINK_FLAGS)',
# '$(gio_win32_res_ldflag)',
#$(SELINUX_LIBS)
#$(XATTR_LIBS)
dependencies : [libintl, libz_dep, libdl_dep, libmount_dep, libglib_dep,
libgobject_dep, libgmodule_dep] + platform_deps + network_libs,
libgobject_dep, libgmodule_dep, selinux_dep, xattr_dep,
platform_deps, network_libs],
c_args : gio_c_args,
# intl.lib is not compatible with SAFESEH
link_args : noseh_link_args,

View File

@ -1,4 +1,4 @@
charsetalias_dir = get_option('charsetalias-dir')
charsetalias_dir = get_option('charsetalias_dir')
if charsetalias_dir == ''
charsetalias_dir = get_option('libdir')
endif

View File

@ -54,7 +54,10 @@ 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_giomodulesdir = get_option('gio_module_dir')
if glib_giomodulesdir == ''
glib_giomodulesdir = join_paths(glib_libdir, 'gio', 'modules')
endif
glib_pkgconfigreldir = join_paths(glib_libdir, 'pkgconfig')
@ -1376,10 +1379,6 @@ endif
# Tests for iconv
#
# First, we check if the C library provides iconv, then GNU libiconv, then
# a native implementation
# FIXME: add option as well
#
# USE_LIBICONV_GNU: Using GNU libiconv
# USE_LIBICONV_NATIVE: Using a native impl of iconv in a separate library
#
@ -1390,22 +1389,35 @@ endif
if host_system == 'windows'
libiconv = []
glib_conf.set('USE_LIBICONV_NATIVE', true)
# Check C library; never check MinGW C library
elif cc.has_function('iconv_open')
libiconv = []
# Check for libiconv
elif cc.has_header_symbol('iconv.h', 'libiconv_open')
glib_conf.set('USE_LIBICONV_GNU', true)
libiconv = [cc.find_library('iconv')]
# Check for a custom iconv implementation
elif cc.has_header_symbol('iconv.h', 'iconv_open')
glib_conf.set('USE_LIBICONV_NATIVE', true)
libiconv = [cc.find_library('iconv')]
else
error('No iconv() implementation found in C library or libiconv')
found_iconv = false
iconv_opt = get_option('iconv')
if iconv_opt == 'libc'
if cc.has_function('iconv_open')
libiconv = []
found_iconv = true
endif
elif iconv_opt == 'gnu'
if cc.has_header_symbol('iconv.h', 'libiconv_open')
glib_conf.set('USE_LIBICONV_GNU', true)
libiconv = [cc.find_library('iconv')]
found_iconv = true
endif
elif iconv_opt == 'native'
if cc.has_header_symbol('iconv.h', 'iconv_open')
glib_conf.set('USE_LIBICONV_NATIVE', true)
libiconv = [cc.find_library('iconv')]
found_iconv = true
endif
endif
if not found_iconv
error('No iconv() implementation found in C library or libiconv')
endif
endif
if get_option('with-pcre') == 'internal'
if get_option('internal_pcre')
pcre = []
use_system_pcre = false
else
@ -1492,15 +1504,12 @@ xgettext = find_program('xgettext', required : false)
# libmount is only used by gio, but we need to fetch the libs to generate the
# pkg-config file below
libmount_dep = []
libmount_opt = get_option('enable-libmount')
if host_system == 'linux' and libmount_opt != 'no'
if get_option('libmount')
libmount_dep = [dependency('mount', version : '>=2.28', required : false)]
if not libmount_dep[0].found()
libmount_dep = [cc.find_library('mount', required : false)]
libmount_h = cc.has_header('libmount/libmount.h')
libmount_needed = libmount_opt == 'yes' and host_system == 'linux'
if libmount_needed and (not libmount_dep[0].found() or not libmount_h)
error('Need libmount but couldn\'t find it')
libmount_dep = [cc.find_library('mount', required : true)]
if not cc.has_header('libmount/libmount.h')
error('libmount support needs libmount/libmount.h header')
endif
endif
endif
@ -1509,6 +1518,52 @@ if host_system == 'windows'
winsock2 = cc.find_library('ws2_32')
endif
selinux_dep = []
if get_option('selinux')
selinux_dep = [dependency('libselinux')]
glib_conf.set('SELINUX_LIBS', '-lselinux')
glib_conf.set('HAVE_SELINUX', 1)
endif
xattr_dep = []
if get_option('xattr')
# either glibc or libattr can provide xattr support
# for both of them, we check for getxattr being in
# the library and a valid xattr header.
# try glibc
if cc.has_function('getxattr') and cc.has_header('sys/xattr.h')
glib_conf.set('HAVE_SYS_XATTR_H', 1)
glib_conf_prefix = glib_conf_prefix + '#define @0@ 1\n'.format('HAVE_SYS_XATTR_H')
#failure. try libattr
elif cc.has_header_symbol('attr/xattr.h', 'getxattr')
glib_conf.set('HAVE_ATTR_XATTR_H', 1)
glib_conf_prefix = glib_conf_prefix + '#define @0@ 1\n'.format('HAVE_ATTR_XATTR_H')
xattr_dep = [cc.find_library('xattr')]
else
error('No getxattr implementation found in C library or libxattr')
endif
glib_conf.set('HAVE_XATTR', 1)
if cc.compiles(glib_conf_prefix + '''
#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_XATTR_H
#include <sys/xattr.h>
#elif HAVE_ATTR_XATTR_H
#include <attr/xattr.h>
#endif
int main (void) {
ssize_t len = getxattr("", "", NULL, 0, 0, XATTR_NOFOLLOW);
}''',
name : 'XATTR_NOFOLLOW')
glib_conf.set('HAVE_XATTR_NOFOLLOW', 1)
endif
endif
python = import('python3').find_python()
# Determine which user environment-dependent files that we want to install
@ -1537,17 +1592,17 @@ endif
if use_system_pcre
glib_conf.set('PCRE_LIBS', '-lpcre')
endif
if libmount_dep.length() == 1 and libmount_dep[0].found()
if libmount_dep.length() != 0
glib_conf.set('LIBMOUNT_LIBS', '-lmount')
glib_conf.set('HAVE_LIBMOUNT', 1)
endif
glib_conf.set('GIO_MODULE_DIR', '${libdir}/gio/modules')
glib_conf.set('GIO_MODULE_DIR', glib_giomodulesdir)
# FIXME: Missing:
# @G_MODULE_LIBS@ @SELINUX_LIBS@ @COCOA_LIBS@ @CARBON_LIBS@ @G_LIBS_EXTRA@
# @G_MODULE_LIBS@ @COCOA_LIBS@ @CARBON_LIBS@ @G_LIBS_EXTRA@
# @PCRE_REQUIRES@ @GLIB_EXTRA_CFLAGS@ @G_THREAD_CFLAGS@
# Tracing: dtrace
want_dtrace = get_option('enable-dtrace')
want_dtrace = get_option('dtrace')
enable_dtrace = false
# Since dtrace support is opt-in we just error out if it was requested but
@ -1574,11 +1629,11 @@ if want_dtrace
endif
# systemtap
want_systemtap = get_option('enable-systemtap')
want_systemtap = get_option('systemtap')
enable_systemtap = false
if want_systemtap and enable_dtrace
tapset_install_dir = get_option('tapset-install-dir')
tapset_install_dir = get_option('tapset_install_dir')
if tapset_install_dir == ''
tapset_install_dir = join_paths(get_option('datadir'), 'systemtap/tapset', host_machine.cpu_family())
endif
@ -1656,11 +1711,8 @@ if host_system == 'windows'
install_headers([ 'msvc_recommended_pragmas.h' ], subdir : 'glib-2.0')
endif
if get_option('with-man') != 'no'
xsltproc = find_program('xsltproc', required : false)
if not xsltproc.found() and get_option('with-man') == 'yes'
error('man pages enabled and xsltproc not found')
endif
if get_option('man')
xsltproc = find_program('xsltproc', required : true)
xsltproc_command = [
xsltproc,
'--nonet',

View File

@ -1,12 +1,65 @@
option('with-docs', type : 'combo', choices : ['auto', 'yes', 'no'], value : 'auto')
option('with-man', type : 'combo', choices : ['auto', 'yes', 'no'], value : 'auto')
option('with-pcre', type : 'combo', choices : ['system', 'internal'], value : 'system')
option('enable-libmount', type : 'combo', choices : ['auto', 'yes', 'no'], value : 'yes')
option('enable-dtrace', type : 'boolean', value : false,
description : 'include tracing support for dtrace')
option('enable-systemtap', type : 'boolean', value : false,
description : 'include tracing support for systemtap')
option('tapset-install-dir', type : 'string', value : '',
description : 'path where systemtap tapsets are installed')
option('charsetalias-dir', type : 'string', value : '',
description : 'directory for charset.alias file (libdir by default)')
option('runtime_libdir',
type : 'string',
value : '',
description : 'install runtime libraries relative to libdir')
option('iconv',
type : 'combo',
choices : ['libc', 'gnu', 'native'],
value : 'libc',
description : 'iconv implementation to use (\'libc\' = \'Part of the C stdlib\'; \'gnu\' = \'GNU\'s iconv\'; \'native\' = \'A separate iconv\')')
option('charsetalias_dir',
type : 'string',
value : '',
description : 'directory for charset.alias dir (default to \'libdir\' if unset)')
option('gio_module_dir',
type : 'string',
value : '',
description : 'load gio modules from this directory (default to \'libdir/gio/modules\' if unset)')
option('selinux',
type : 'boolean',
value : true,
description : 'build with selinux support')
option('xattr',
type : 'boolean',
value : true,
description : 'build with xattr support')
option('libmount',
type : 'boolean',
value : true,
description : 'build with libmount support')
option('internal_pcre',
type : 'boolean',
value : false,
description : 'whether to use internal PCRE')
option('man',
type : 'boolean',
value : false,
description : 'generate man pages (requires xsltproc)')
option('dtrace',
type : 'boolean',
value : false,
description : 'include tracing support for dtrace')
option('systemtap',
type : 'boolean',
value : false,
description : 'include tracing support for systemtap')
option('tapset_install_dir',
type : 'string',
value : '',
description : 'path where systemtap tapsets are installed')
option('gtk_doc',
type : 'boolean',
value : false,
description : 'use gtk-doc to build documentation')