meson: Improve MSVC and MinGW support and fix dependencies everywhere

Disable gio tests on Windows, fix .gitignore to not ignore
config.h.meson, and add more things to it.

Rename the library file naming and versioning to match what Autotools
outputs, e.g., libglib-2.0.so.0.5000.2 on Linux, libglib-2.0-0.dll  and
glib-2.0-0.dll on Windows with MSVC.

Several more tiny fixes, more executables built and installed, install
pkg-config and m4 files, fix building of gobject tests.

Changes to gdbus-codegen to support out-of-tree builds without
environment variables set (which you can't in Meson). We now add the
build directory to the Python module search path.
This commit is contained in:
Nirbheek Chauhan 2016-12-21 04:07:24 +05:30 committed by Matthias Clasen
parent 213957970e
commit fe2a9887a8
26 changed files with 981 additions and 706 deletions

15
.gitignore vendored
View File

@ -25,7 +25,16 @@ tags
# autofoo stuff here
compile
config.*
config.cache
config.guess
config.h
config.h.in
config.h-new
config.log
config.lt
config.rpath
config.status*
config.sub
configure
depcomp
aclocal.m4
@ -47,3 +56,7 @@ README
ChangeLog
/glib-lcov.info
/glib-lcov/
# Meson
/meson-build/
/subprojects/

View File

@ -15,6 +15,9 @@
/* poll doesn't work on devices */
#mesondefine BROKEN_POLL
/* Whether we're building a DLL and hence need symbols exported for a DLL */
#mesondefine DLL_EXPORT
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
systems. This function is required for `alloca.c' support on those systems.
*/
@ -316,9 +319,18 @@
/* Have function pthread_attr_setstacksize */
#mesondefine HAVE_PTHREAD_ATTR_SETSTACKSIZE
/* Have function pthread_cond_timedwait_relative_np */
#mesondefine HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE_NP
/* Have function pthread_condattr_setclock */
#mesondefine HAVE_PTHREAD_CONDATTR_SETCLOCK
/* Have function pthread_setname_np without TID as argument */
#mesondefine HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID
/* Have function pthread_setname_np with TID as argument */
#mesondefine HAVE_PTHREAD_SETNAME_NP_WITH_TID
/* Define to 1 if the system has the type `ptrdiff_t'. */
#mesondefine HAVE_PTRDIFF_T
@ -511,9 +523,6 @@
/* Define to 1 if you have the <sys/poll.h> header file. */
#mesondefine HAVE_SYS_POLL_H
/* Define to 1 if you have the <sys/prctl.h> header file. */
#mesondefine HAVE_SYS_PRCTL_H
/* Define to 1 if you have the <sys/resource.h> header file. */
#mesondefine HAVE_SYS_RESOURCE_H

View File

@ -7,15 +7,17 @@
import sys, os, shutil, subprocess
ofilename = sys.argv[1]
template_file_dir = sys.argv[2]
template_file_path = template_file_dir + '/' + ofilename + '.template'
headers = sys.argv[3:]
perl = sys.argv[1]
glib_mkenums = sys.argv[2]
ofilename = sys.argv[3]
ofile_rel = os.path.basename(ofilename)
template_file_dir = sys.argv[4]
template_file_path = template_file_dir + '/' + ofile_rel + '.template'
headers = sys.argv[5:]
arg_array = ['--template', template_file_path ]
arg_array = ['--template', template_file_path]
# FIXME: should use $top_builddir/gobject/glib-mkenums
cmd = [shutil.which('perl'), shutil.which('glib-mkenums')]
cmd = [perl, glib_mkenums]
pc = subprocess.Popen(cmd + arg_array + headers, stdout=subprocess.PIPE)
(stdo, _) = pc.communicate()
if pc.returncode != 0:

16
gio/data-to-c.py Normal file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env python3
import sys
if len(sys.argv) < 4:
print('Usage: {0} <filename> <variable> <output>')
with open(sys.argv[1], 'rb') as f:
in_data = f.read().decode('utf-8', 'backslashreplace')
b = [r'\x{:02x}'.format(ord(c)) for c in in_data]
out_data = "const char {0}[] = \"".format(sys.argv[2])
out_data += "".join(b) + "\";"
with open(sys.argv[3], 'w') as f:
f.write(out_data)

View File

@ -50,7 +50,7 @@ class CodeGenerator:
self.ns_upper = ''
self.ns_lower = ''
self.interface_prefix = interface_prefix
self.header_guard = header_name.upper().replace('.', '_').replace('-', '_').replace('/', '_')
self.header_guard = header_name.upper().replace('.', '_').replace('-', '_').replace('/', '_').replace(':', '_')
# ----------------------------------------------------------------------------------------------------

View File

@ -19,7 +19,4 @@
#
# Author: David Zeuthen <davidz@redhat.com>
DATADIR = "@datarootdir@"
DATADIR = DATADIR.replace(
"${prefix}", "@prefix@")
VERSION = "@VERSION@"

View File

@ -24,14 +24,18 @@ import os
import sys
srcdir = os.getenv('UNINSTALLED_GLIB_SRCDIR', None)
filedir = os.path.dirname(__file__)
if srcdir is not None:
path = os.path.join(srcdir, 'gio', 'gdbus-2.0')
elif os.name == 'nt':
# Makes gdbus-codegen 'relocatable' at runtime on Windows.
path = os.path.join(os.path.dirname(__file__), '..', 'share', 'glib-2.0')
elif os.path.basename(filedir) == 'bin':
# Make the prefix containing gdbus-codegen 'relocatable' at runtime by
# adding /some/prefix/bin/../share/glib-2.0 to the python path
path = os.path.join(filedir, '..', 'share', 'glib-2.0')
else:
path = os.path.join('@datadir@', 'glib-2.0')
# Assume that the modules we need are in the current directory and add the
# parent directory to the python path.
path = os.path.join(filedir, '..')
sys.path.insert(0, os.path.abspath(path))
from codegen import codegen_main

View File

@ -0,0 +1,35 @@
gdbus_codegen_files = [
'__init__.py',
'codegen.py',
'codegen_main.py',
'codegen_docbook.py',
'dbustypes.py',
'parser.py',
'utils.py',
]
gdbus_codegen_conf = configuration_data()
gdbus_codegen_conf.set('VERSION', glib_version)
gdbus_codegen_conf.set('PYTHON', python.path())
# Install gdbus-codegen executable
# FIXME: Set permissions
gdbus_codegen = configure_file(input : 'gdbus-codegen.in',
output : 'gdbus-codegen',
install : true,
install_dir : 'bin', configuration : gdbus_codegen_conf)
configure_file(input : 'config.py.in',
output : 'config.py',
install : true,
install_dir : 'share/glib-2.0/codegen', configuration : gdbus_codegen_conf)
blank_conf = configuration_data()
foreach f : gdbus_codegen_files
# Copy these into the builddir so that gdbus-codegen can be used uninstalled
# 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',
configuration : blank_conf)
endforeach

View File

@ -9,5 +9,6 @@ inotify_sources = [
inotify_lib = static_library('inotify',
sources : inotify_sources,
include_directories : inc_dirs,
include_directories : [configinc, glibinc, gmoduleinc],
dependencies : [gioenumtypes_dep],
c_args : [ '-DHAVE_CONFIG_H', '-fPIC', '-DG_DISABLE_DEPRECATED' ] + gio_c_args)

View File

@ -7,9 +7,11 @@ kqueue_sources = [
'kqueue-utils.c',
'kqueue-exclusions.c',
'dep-list.c',
# gkqueuefilemonitor.h includes gio.h which includes this
gioenumtypes_h,
]
kqueue_lib = static_library('kqueue',
sources : kqueue_sources,
include_directories : inc_dirs,
include_directories : [configinc, glibinc, gmoduleinc],
c_args : [ '-DHAVE_CONFIG_H', '-fPIC', '-DG_DISABLE_DEPRECATED' ] + gio_c_args)

View File

@ -1,24 +1,22 @@
gio_c_args = [
'-DG_LOG_DOMAIN="GLib-GIO"',
'-DGIO_COMPILATION',
'-DGIO_MODULE_DIR="@0@/gio/modules"'.format(get_option('libdir')),
'-DGIO_MODULE_DIR="@0@"'.format(glib_giomodulesdir),
]
# FIXME: subdir('gdbus-2.0/codegen')
gnetworking_h_conf = configuration_data()
gnetworking_h_wspiapi_include = ''
gnetworking_h_nameser_compat_include = ''
if host_machine.system() == 'windows'
if host_system == 'windows'
# <wspiapi.h> in the Windows SDK and in mingw-w64 has wrappers for
# inline workarounds for getaddrinfo, getnameinfo and freeaddrinfo if
# they aren't present at run-time (on Windows 2000).
gnetworking_h_wspiapi_include = '#include <wspiapi.h>'
endif
if host_machine.system().contains('android')
if host_system.contains('android')
# Android does not have C_IN in public headers, we define it wherever necessary
if not cc.compiles('''#include <sys/types.h>
#include <arpa/nameser.h>
@ -38,7 +36,7 @@ endif
network_libs = [ ]
network_args = [ ]
if host_machine.system() != 'windows'
if host_system != 'windows'
# res_query()
res_query_test = '''#include <resolv.h>
int main (int argc, char ** argv) {
@ -50,10 +48,10 @@ if host_machine.system() != 'windows'
''' + res_query_test
if not cc.links(res_query_test_full, name : 'res_query()')
if cc.links(res_query_test_full, args : '-lresolv', name : 'res_query() in -lresolv')
network_libs += [ find_library('resolv') ]
network_libs += [ cc.find_library('resolv') ]
network_args += [ '-lresolv' ]
elif cc.links(res_query_test, args : '-lbind', name : 'res_query() in -lbind')
network_libs += [ find_library('bind') ]
network_libs += [ cc.find_library('bind') ]
network_args += [ '-lbind' ]
else
error('Could not find res_query()')
@ -68,7 +66,7 @@ if host_machine.system() != 'windows'
}'''
if not cc.links(socket_test, name : 'socket()')
if cc.links(socket_test, args : '-lsocket', name : 'socket() in -lsocket')
network_libs += [ find_library('socket') ]
network_libs += [ cc.find_library('socket') ]
network_args += [ '-lsocket' ]
else
error('Could not find socket()')
@ -93,12 +91,18 @@ if host_machine.system() != 'windows'
endif
endif
network_args_string = ''
foreach arg : network_args
network_args_string += arg + ' '
endforeach
glib_conf.set('NETWORK_LIBS', network_args_string)
gnetworking_h_conf.set('WSPIAPI_INCLUDE', gnetworking_h_wspiapi_include)
gnetworking_h_conf.set('NAMESER_COMPAT_INCLUDE', gnetworking_h_nameser_compat_include)
gnetworking_h = configure_file(input : 'gnetworking.h.in',
output : 'gnetworking.h',
install_dir : 'include/glib-2.0/gio/',
install_dir : 'include/glib-2.0/gio',
configuration : gnetworking_h_conf)
gdbus_headers = [
@ -156,16 +160,17 @@ gdbus_sources = [
'gtestdbus.c',
]
# FIXME: These are not built into the library yet
#EXTRA_DIST += gdbusdaemon.c gdbusdaemon.h dbus-daemon.xml
#gdbus-daemon-generated.h gdbus-daemon-generated.c: $(srcdir)/dbus-daemon.xml $(srcdir)/gdbus-2.0/codegen/gdbus-codegen.in
# $(AM_V_GEN) UNINSTALLED_GLIB_SRCDIR=$(top_srcdir) ',
# UNINSTALLED_GLIB_BUILDDIR=$(top_builddir) ',
# $(PYTHON) $(srcdir)/gdbus-2.0/codegen/gdbus-codegen.in ',
# --interface-prefix org. ',
# --generate-c-code gdbus-daemon-generated ',
# --c-namespace _G ',
# $(srcdir)/dbus-daemon.xml
# Generate gdbus-codegen
subdir('gdbus-2.0/codegen')
# Generate gdbus-generated.{c,h}
gdbus_daemon_generated = custom_target('gdbus-daemon-generated',
input : ['dbus-daemon.xml'],
output : ['gdbus-daemon-generated.h', 'gdbus-daemon-generated.c'],
command : [python, gdbus_codegen,
'--interface-prefix', 'org.',
'--generate-c-code', '@OUTDIR@/gdbus-daemon-generated',
'--c-namespace', '_G', '@INPUT@'])
settings_headers = [
'gsettingsbackend.h',
@ -185,7 +190,7 @@ settings_sources = [
'gsettings.c',
]
if host_machine.system() == 'windows'
if host_system == 'windows'
settings_sources += [ 'gregistrysettingsbackend.c' ]
endif
@ -267,37 +272,15 @@ local_sources = [
'thumbnail-verify.c',
]
platform_deps = [ ]
internal_deps = [ ]
appinfo_sources = [ ]
platform_deps = []
internal_deps = []
appinfo_sources = []
# inotify
if glib_conf.has('HAVE_SYS_INOTIFY_H') and have_func_inotify_init1
subdir('inotify')
internal_deps += [ inotify_lib ]
endif
# kevent
if have_func_kqueue and have_func_kevent
subdir('kqueue')
internal_deps += [ kqueue_lib ]
endif
if host_machine.system() == 'windows'
subdir('win32')
internal_deps += [ giowin32_lib ]
endif
# FIXME: FAM support
#if HAVE_FAM
# subdir('fam')
#endif
unix_sources = [ ]
if host_machine.system() != 'windows'
appinfo_sources += [ 'gdesktopappinfo.c' ]
unix_sources = []
if host_system != 'windows'
appinfo_sources += ['gdesktopappinfo.c']
subdir('xdgmime')
internal_deps += [ xdgmime_lib ]
internal_deps += [xdgmime_lib]
unix_sources = [
'gfiledescriptorbased.c',
'gunixconnection.c',
@ -349,25 +332,24 @@ endif
gdbus_daemon_sources = [
'gdbusdaemon.c',
'gdbus-daemon-generated.c',
gdbus_daemon_generated,
]
win32_actual_sources = gdbus_daemon_sources + [
'gwin32registrykey.c',
'gcontenttype-win32.c',
'gwin32mount.c',
'gwin32volumemonitor.c',
'gwin32inputstream.c',
'gwin32outputstream.c',
]
if host_machine.system() == 'windows'
appinfo_sources += [ 'gwin32appinfo.c' ]
platform_deps += [ find_library('shlwapi'),
find_library('ws2_32'),
find_library('dnsapi'),
find_library('iphlpapi') ]
# win32_sources = $(win32_actual_sources)
win32_sources = gdbus_daemon_sources
if host_system == 'windows'
appinfo_sources += ['gwin32appinfo.c']
platform_deps += [cc.find_library('shlwapi'),
cc.find_library('dnsapi'),
cc.find_library('iphlpapi'),
winsock2]
win32_sources += [
'gwin32registrykey.c',
'gcontenttype-win32.c',
'gwin32mount.c',
'gwin32volumemonitor.c',
'gwin32inputstream.c',
'gwin32outputstream.c',
]
gio_win32_include_headers = [
'gwin32inputstream.h',
@ -491,144 +473,37 @@ gio_sources = [
'gvolumemonitor.c',
'gzlibcompressor.c',
'gzlibdecompressor.c',
# FIXME 'gioenumtypes.c',
'glistmodel.c',
'gliststore.c',
]
# FIXME
gio_sources += appinfo_sources
gio_sources += unix_sources
#gio_sources += win32_sources
gio_sources += win32_sources
gio_sources += application_sources
gio_sources += settings_sources
gio_sources += gdbus_sources
gio_sources += local_sources
foo = '''
MISSING_STUFF = '''
if OS_WIN32_AND_DLL_COMPILATION
gio_win32_res = gio-win32-res.o
gio_win32_res_ldflag = -Wl,$(gio_win32_res)
endif
if OS_COCOA
# This is dumb. The ObjC source file should be properly named .m
libgio_2_0_la_CFLAGS += -xobjective-c
libgio_2_0_la_LDFLAGS += -Wl,-framework,Foundation -Wl,-framework,AppKit
endif
libgio_2_0_la_DEPENDENCIES = $(gio_win32_res) $(gio_def) $(platform_deps)
gio-win32-res.o: gio.rc
'$(WINDRES) gio.rc $@
gioincludedir=$(includedir)/glib-2.0/gio/
gioinclude_HEADERS =',
'$(gio_headers)',
'gioenumtypes.h
# these sources (also mentioned above) are generated.
BUILT_SOURCES +=',
'gconstructor_as_data.h',
'gioenumtypes.h',
'gioenumtypes.c',
'gdbus-daemon-generated.c',
'gdbus-daemon-generated.h',
'gnetworking.h',
'$(NULL)
BUILT_EXTRA_DIST +=',
'gio.rc
# This is read by gobject-introspection/misc/ and gtk-doc
gio-public-headers.txt: Makefile
'$(AM_V_GEN) echo $(gioinclude_HEADERS) $(giowin32include_HEADERS) $(giounixinclude_HEADERS) > $@.tmp && mv $@.tmp $@
all-local: gio-public-headers.txt
gioenumtypes.h: $(gio_headers) gioenumtypes.h.template
'$(AM_V_GEN) $(top_builddir)/gobject/glib-mkenums --template $(filter %.template,$^) $(filter-out %.template,$^) >',
' gioenumtypes.h.tmp && mv gioenumtypes.h.tmp gioenumtypes.h
gioenumtypes.c: $(gio_headers) gioenumtypes.c.template
'$(AM_V_GEN) $(top_builddir)/gobject/glib-mkenums --template $(filter %.template,$^) $(filter-out %.template,$^) >',
' gioenumtypes.c.tmp && mv gioenumtypes.c.tmp gioenumtypes.c
gio.def: libgio-2.0.la
'$(AM_V_GEN) dumpbin.exe -exports .libs/libgio-2.0-0.dll | awk 'BEGIN { print "EXPORTS" } / +[[:digit:]]+ +[[:xdigit:]]+ +[[:xdigit:]]+/{ print $$4 }' > gio.def.tmp && mv gio.def.tmp gio.def
gio-2.0.lib: libgio-2.0.la gio.def
'$(AM_V_GEN) lib.exe -machine:@LIB_EXE_MACHINE_FLAG@ -name:libgio-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:$(builddir)/gio.def -out:$@
bin_PROGRAMS = gio-querymodules glib-compile-schemas glib-compile-resources gsettings
glib_compile_resources_LDADD = libgio-2.0.la',
'$(top_builddir)/gobject/libgobject-2.0.la',
'$(top_builddir)/gmodule/libgmodule-2.0.la',
'$(top_builddir)/glib/libglib-2.0.la',
'$(NULL)
glib_compile_resources_SOURCES =',
'gvdb/gvdb-format.h',
'gvdb/gvdb-builder.h',
'gvdb/gvdb-builder.c',
'glib-compile-resources.c
gio_querymodules_SOURCES = gio-querymodules.c
gio_querymodules_LDADD = libgio-2.0.la',
'$(top_builddir)/gobject/libgobject-2.0.la',
'$(top_builddir)/gmodule/libgmodule-2.0.la',
'$(top_builddir)/glib/libglib-2.0.la',
'$(NULL)
gconstructor_as_data.h: $(top_srcdir)/glib/gconstructor.h data-to-c.pl
'$(AM_V_GEN) $(srcdir)/data-to-c.pl $(top_srcdir)/glib/gconstructor.h gconstructor_code > $@.tmp && mv $@.tmp $@
glib_compile_schemas_LDADD = $(top_builddir)/glib/libglib-2.0.la
glib_compile_schemas_SOURCES =',
'gconstructor_as_data.h',
'gvdb/gvdb-format.h',
'gvdb/gvdb-builder.h',
'gvdb/gvdb-builder.c',
'glib-compile-schemas.c
gsettings_LDADD = libgio-2.0.la',
'$(top_builddir)/gobject/libgobject-2.0.la',
'$(top_builddir)/gmodule/libgmodule-2.0.la',
'$(top_builddir)/glib/libglib-2.0.la',
'$(NULL)
gsettings_SOURCES = gsettings-tool.c
schemadir = $(datadir)/glib-2.0/schemas
dist_schema_DATA = gschema.dtd
itsdir = $(datadir)/gettext/its
dist_its_DATA = gschema.loc gschema.its
# ------------------------------------------------------------------------
# gdbus(1) tool
bin_PROGRAMS += gdbus
gdbus_SOURCES = gdbus-tool.c
gdbus_LDADD = libgio-2.0.la',
'$(top_builddir)/gobject/libgobject-2.0.la',
'$(top_builddir)/gmodule/libgmodule-2.0.la',
'$(top_builddir)/glib/libglib-2.0.la',
'$(NULL)
if OS_UNIX
# ------------------------------------------------------------------------
# gapplication(1) tool
bin_PROGRAMS += gapplication
gapplication_SOURCES = gapplication-tool.c
gapplication_LDADD = libgio-2.0.la',
'$(top_builddir)/gobject/libgobject-2.0.la',
'$(top_builddir)/gmodule/libgmodule-2.0.la',
'$(top_builddir)/glib/libglib-2.0.la',
'$(NULL)
endif
completiondir = $(datadir)/bash-completion/completions
completion_DATA =',
'completion/gapplication',
@ -745,58 +620,146 @@ gio_headers = [
'glistmodel.h',
'gliststore.h',
]
# FIXME: 'gnetworking.h', - generated? was in nodist_gioinclude_HEADERS
gio_headers += application_headers
gio_headers += settings_headers
gio_headers += gdbus_headers
install_headers(gio_headers, subdir : 'glib-2.0/gio/')
gio_mkenums = find_program('build_mkenum.py')
gio_build_mkenum = find_program('build_mkenum.py')
gioenumtypes_h = custom_target('gioenumtypes_h',
output : 'gioenumtypes.h',
input : gio_headers,
install : true,
install_dir : 'include/glib-2.0/gio/',
depends : [ ],
command : [ gio_mkenums, '@OUTPUT@', meson.source_root(), '@INPUT@', gnetworking_h ])
depends : [],
command : [gio_build_mkenum, perl, glib_mkenums,
'@OUTPUT@', meson.current_source_dir(),
'@INPUT@', gnetworking_h])
gioenumtypes_c = custom_target('gioenumtypes_c',
output : 'gioenumtypes.c',
input : gio_headers,
depends : [ gioenumtypes_h ],
command : [ gio_mkenums, '@OUTPUT@', meson.source_root(), '@INPUT@', gnetworking_h, ])
depends : [gioenumtypes_h],
command : [gio_build_mkenum, perl, glib_mkenums,
'@OUTPUT@', meson.current_source_dir(),
'@INPUT@', gnetworking_h])
libgio = shared_library('gio',
gioenumtypes_dep = declare_dependency(sources : [gioenumtypes_h])
# inotify
if glib_conf.has('HAVE_SYS_INOTIFY_H') and have_func_inotify_init1
subdir('inotify')
internal_deps += [ inotify_lib ]
endif
# kevent
if have_func_kqueue and have_func_kevent
subdir('kqueue')
internal_deps += [ kqueue_lib ]
endif
if host_system == 'windows'
subdir('win32')
internal_deps += [ giowin32_lib ]
endif
# FIXME: FAM support
#if HAVE_FAM
# subdir('fam')
#endif
libgio = shared_library('gio-2.0',
gioenumtypes_h, gioenumtypes_c, gnetworking_h, gio_sources,
version : glib_version,
soversion : interface_version,
version : library_version,
soversion : soversion,
install : true,
include_directories : inc_dirs,
link_with : [ libglib, libgobject, libgmodule ] + internal_deps,
include_directories : [configinc, gioinc],
link_with : internal_deps,
#libgio_2_0_la_LDFLAGS = $(GLIB_LINK_FLAGS)',
# '$(gio_win32_res_ldflag)',
# '-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)',
# '-export-dynamic $(no_undefined)
#$(ZLIB_LIBS)
#$(SELINUX_LIBS)
#$(GLIB_LIBS)
#$(XATTR_LIBS)
#$(NETWORK_LIBS)
dependencies : [ libz_dep, libdl_dep ] + platform_deps + network_libs,
c_args : gio_c_args
dependencies : [libintl, libz_dep, libdl_dep, libglib_dep, libgobject_dep,
libgmodule_dep] + platform_deps + network_libs,
c_args : gio_c_args,
# intl.lib is not compatible with SAFESEH
link_args : noseh_link_args,
)
# gresource tool
libgio_dep = declare_dependency(link_with : libgio,
dependencies : [gioenumtypes_dep],
# We sadly need to export configinc here because everyone includes <gio/*.h>
include_directories : [configinc, gioinc])
# Dependencies used by executables below
libelf = dependency('libelf', version : '>= 0.8.12', required : false)
if libelf.found()
glib_conf.set('HAVE_LIBELF', 1)
endif
executable('gresource', 'gresource-tool.c',
include_directories : inc_dirs,
c_args : [ '-DHAVE_CONFIG_H=1' ],
link_with : [ libgio, libgobject, libgmodule, libglib ],
dependencies : libelf,
)
subdir('tests')
gconstructor_as_data_h = custom_target('gconstructor_as_data.h',
input : ['data-to-c.py', meson.source_root() + '/glib/gconstructor.h'],
output : ['gconstructor_as_data.h'],
command : [python, '@INPUT0@', '@INPUT1@', 'gconstructor_code', '@OUTPUT@'])
# Several installed executables
executable('gresource', 'gresource-tool.c',
install : true,
c_args : ['-DHAVE_CONFIG_H=1'],
# intl.lib is not compatible with SAFESEH
link_args : noseh_link_args,
dependencies : [libelf, libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
executable('gio-querymodules', 'gio-querymodules.c',
install : true,
c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
# intl.lib is not compatible with SAFESEH
link_args : noseh_link_args,
dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
executable('glib-compile-schemas',
[gconstructor_as_data_h, 'gvdb/gvdb-builder.c', 'glib-compile-schemas.c'],
install : true,
c_args : ['-DHAVE_CONFIG_H=1'],
# intl.lib is not compatible with SAFESEH
link_args : noseh_link_args,
dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
executable('glib-compile-resources',
[gconstructor_as_data_h, 'gvdb/gvdb-builder.c', 'glib-compile-resources.c'],
install : true,
c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
# intl.lib is not compatible with SAFESEH
link_args : noseh_link_args,
dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
executable('gsettings', 'gsettings-tool.c',
install : true,
c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
# intl.lib is not compatible with SAFESEH
link_args : noseh_link_args,
dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
install_data(['gschema.dtd', 'gschema.loc', 'gschema.its'],
install_dir : 'share/glib-2.0/schemas')
executable('gdbus', 'gdbus-tool.c',
install : true,
c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
# intl.lib is not compatible with SAFESEH
link_args : noseh_link_args,
dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
if host_system != 'windows'
executable('gapplication', 'gapplication-tool.c',
install : true,
c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
# intl.lib is not compatible with SAFESEH
link_args : noseh_link_args,
dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
endif
if host_system != 'windows'
subdir('tests')
endif

View File

@ -88,11 +88,9 @@ foreach test_name : gio_tests
test_name = 'autoptr-gio'
endif
exe = executable(test_name, src_file,
include_directories : inc_dirs,
install : false,
c_args : test_c_args,
link_with : [ libgio, libgmodule, libglib ],
dependencies : deps,
dependencies : [libglib_dep, libgmodule_dep, libgio_dep],
)
if test_name == 'testfilemonitor'
test(test_name, exe, env : test_env, timeout : 45)
@ -129,11 +127,9 @@ uninstalled_test_extra_programs = [
foreach extra_program : uninstalled_test_extra_programs
exe = executable(extra_program, '@0@.c'.format(extra_program),
include_directories : inc_dirs,
install : false,
c_args : test_c_args,
link_with : [ libgio, libgmodule, libglib ],
dependencies : deps,
dependencies : [libglib_dep, libgmodule_dep, libgio_dep],
)
endforeach
@ -143,26 +139,20 @@ test_extra_programs = [
]
exe = executable('tls-certificate', 'tls-certificate.c', 'gtesttlsbackend.c',
include_directories : inc_dirs,
c_args : test_c_args,
link_with : [ libgio, libgmodule, libglib ],
dependencies : deps,
dependencies : [libglib_dep, libgmodule_dep, libgio_dep],
)
test('tls-certificate', exe, env : test_env)
exe = executable('socket-client', 'socket-client.c', 'gtlsconsoleinteraction.c',
include_directories : inc_dirs,
c_args : test_c_args,
link_with : [ libgio, libgmodule, libglib ],
dependencies : deps,
dependencies : [libglib_dep, libgmodule_dep, libgio_dep],
)
#exe = executable('gdbus-daemon', 'gdbus-daemon.c', '../gdbusdaemon.c',
# #meson.build_root() + '/gio/gdbus-daemon-generated.c', # FIXME
# include_directories : inc_dirs,
# c_args : test_c_args,
# link_with : [ libgio, libgmodule, libglib ],
# dependencies : deps,
# dependencies : [libglib_dep, libgmodule_dep, libgio_dep],
#)
#test('gdbus-daemon', exe, env : test_env)
@ -174,45 +164,35 @@ endif
# FIXME: consolidate all of these into the array
exe = executable('overflow-fallback', 'overflow.c',
include_directories : inc_dirs,
c_args : [ '-DHAVE_CONFIG_H=1', '-D_GLIB_TEST_OVERFLOW_FALLBACK' ],
link_with : libglib,
dependencies : deps,
dependencies : [libglib_dep],
)
test('overflow-fallback', exe, env : test_env)
exe = executable('642026-ec', '642026.c',
include_directories : inc_dirs,
c_args : [ '-DHAVE_CONFIG_H=1', '-DG_ERRORCHECK_MUTEXES' ],
link_with : libglib,
dependencies : deps,
dependencies : [libglib_dep],
)
test('642026-ec', exe, env : test_env)
exe = executable('1bit-emufutex', '1bit-mutex.c',
include_directories : inc_dirs,
c_args : [ '-DHAVE_CONFIG_H=1', '-DTEST_EMULATED_FUTEX' ],
link_with : libglib,
dependencies : deps,
dependencies : [libglib_dep],
)
test('1bit-emufutex', exe, env : test_env)
if glib_conf.has('HAVE_EVENTFD')
exe = executable('gwakeup-fallback', 'gwakeuptest.c', '../gwakeup.c',
include_directories : inc_dirs,
c_args : [ '-DHAVE_CONFIG_H=1', '-DTEST_EVENTFD_FALLBACK' ],
link_with : libglib,
dependencies : deps,
dependencies : [libglib_dep],
)
test('gwakeup-fallback', exe, env : test_env)
endif
# test-spawn-echo helper binary required by the spawn tests
executable('test-spawn-echo', 'test-spawn-echo.c',
include_directories : inc_dirs,
c_args : [ '-DHAVE_CONFIG_H=1', '-DG_LOG_DOMAIN="GLib"' ],
link_with : libglib,
dependencies : deps,
dependencies : [libglib_dep],
)
'''

View File

@ -1,13 +1,11 @@
libtestmodulea = shared_library('testmodulea', 'test-module-a.c',
install : false,
include_directories : inc_dirs,
link_with : [ libglib, libgobject, libgmodule, libgio ],
dependencies : [libglib_dep, libgobject_dep, libgmodule_dep, libgio_dep],
c_args : [ ]
)
libtestmoduleb = shared_library('testmoduleb', 'test-module-b.c',
install : false,
include_directories : inc_dirs,
link_with : [ libglib, libgobject, libgmodule, libgio ],
dependencies : [libglib_dep, libgobject_dep, libgmodule_dep, libgio_dep],
c_args : [ ]
)

View File

@ -8,6 +8,6 @@ giowin32_sources = [
]
giowin32_lib = static_library('giowin32',
sources : giowin32_sources,
include_directories : inc_dirs,
sources : [giowin32_sources, gioenumtypes_h],
include_directories : [configinc, glibinc, gioinc, gmoduleinc],
c_args : [ '-DHAVE_CONFIG_H', '-fPIC', '-DG_DISABLE_DEPRECATED' ] + gio_c_args)

View File

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

View File

@ -1,3 +1,3 @@
charset_lib = static_library('charset', 'localcharset.c',
include_directories : inc_dirs,
include_directories : configinc,
c_args : [ '-DLIBDIR="lib"', '-fPIC' ])

View File

@ -1,6 +1,12 @@
configure_file(input : 'glibconfig.h.in', output : 'glibconfig.h', configuration : glibconfig_conf)
configure_file(input : 'glibconfig.h.in', output : 'glibconfig.h',
install : true,
install_dir : 'lib/glib-2.0/include',
configuration : glibconfig_conf)
subdir('libcharset')
if not pcre.found()
subdir('pcre')
endif
glib_headers = [
'glib.h',
@ -17,7 +23,7 @@ glib_deprecated_headers = [
'deprecated/grel.h',
'deprecated/gthread.h',
]
install_headers(glib_deprecated_headers, subdir : 'glib-2.0/deprecated/')
install_headers(glib_deprecated_headers, subdir : 'glib-2.0/glib/deprecated/')
glib_sub_headers = [
'glib-autocleanups.h',
@ -96,14 +102,6 @@ glib_sub_headers = [
]
install_headers(glib_sub_headers, subdir : 'glib-2.0/glib/')
if host_machine.system() == 'windows'
thread_src = ['gthread-win32.c']
plat_src = []
else
thread_src = ['gthread-posix.c']
plat_src = ['glib-unix.c']
endif
deprecated_sources = [
'deprecated/gallocator.c',
'deprecated/gcache.c',
@ -164,7 +162,6 @@ glib_sources = [
'gstrfuncs.c',
'gstring.c',
'gstringchunk.c',
'gtester.c',
'gtestutils.c',
'gthread.c',
'gthreadpool.c',
@ -190,19 +187,69 @@ glib_sources = [
'gwakeup.c',
'gprintf.c',]
extra_src = ['gspawn.c', 'giounix.c']
if host_system == 'windows'
thread_src = ['gthread-win32.c']
plat_src = ['gwin32.c', 'gspawn-win32.c', 'giowin32.c']
platform_deps = [winsock2, cc.find_library('winmm')]
else
thread_src = ['gthread-posix.c']
plat_src = ['glib-unix.c', 'gspawn.c', 'giounix.c']
platform_deps = []
endif
#'gspawn-win32.c', # FIXME
#'gspawn-win32-helper.c', # FIXME
libglib = shared_library('glib-2.0',
sources : [deprecated_sources, glib_sources, thread_src, plat_src],
version : library_version,
soversion : soversion,
install : true,
# intl.lib is not compatible with SAFESEH
link_args : noseh_link_args,
include_directories : configinc,
link_with : charset_lib,
dependencies : [pcre, thread_dep, libintl, librt] + libiconv + platform_deps,
c_args : ['-DG_LOG_DOMAIN="GLib"', '-DGLIB_COMPILATION', '-DPCRE_STATIC']
)
libglib = shared_library('glib',
sources : [deprecated_sources, glib_sources, thread_src, plat_src, extra_src],
version : glib_version,
soversion : interface_version,
install : true,
include_directories : inc_dirs,
link_with : charset_lib,
dependencies : [ pcre, thread_dep, libiconv, librt ],
c_args : ['-DG_LOG_DOMAIN="GLib"', '-DGLIB_COMPILATION', '-DPCRE_STATIC'])
libglib_dep = declare_dependency(link_with : libglib,
# We sadly need to export configinc here because everyone includes <glib/*.h>
include_directories : [configinc, glibinc])
subdir('tests')
# On Windows, glib needs a spawn helper for g_spawn* API
if host_system == 'windows'
if host_machine.cpu_family() == 'x86'
executable('gspawn-win32-helper', 'gspawn-win32-helper.c',
install : true,
gui_app : true,
c_args : ['-DHAVE_CONFIG_H=1'],
include_directories : configinc,
dependencies : [libglib_dep])
executable('gspawn-win32-helper-console', 'gspawn-win32-helper.c',
install : true,
c_args : ['-DHAVE_CONFIG_H=1', '-DHELPER_CONSOLE'],
include_directories : configinc,
dependencies : [libglib_dep])
else
executable('gspawn-win64-helper', 'gspawn-win32-helper.c',
install : true,
gui_app : true,
c_args : ['-DHAVE_CONFIG_H=1'],
include_directories : configinc,
dependencies : [libglib_dep])
executable('gspawn-win64-helper-console', 'gspawn-win32-helper.c',
install : true,
c_args : ['-DHAVE_CONFIG_H=1', '-DHELPER_CONSOLE'],
include_directories : configinc,
dependencies : [libglib_dep])
endif
else
executable('gtester', 'gtester.c',
install : true,
c_args : ['-DHAVE_CONFIG_H=1'],
include_directories : configinc,
dependencies : [libglib_dep])
endif
# gtester doesn't work on native windows
if cc.get_id() != 'msvc'
subdir('tests')
endif

50
glib/pcre/meson.build Normal file
View File

@ -0,0 +1,50 @@
pcre_sources = [
'pcre_byte_order.c',
'pcre_chartables.c',
'pcre_compile.c',
'pcre_config.c',
'pcre_dfa_exec.c',
'pcre_exec.c',
'pcre_fullinfo.c',
'pcre_get.c',
'pcre_globals.c',
'pcre_jit_compile.c',
'pcre_newline.c',
'pcre_ord2utf8.c',
'pcre_string_utils.c',
'pcre_study.c',
'pcre_tables.c',
'pcre_valid_utf8.c',
'pcre_version.c',
'pcre_xclass.c',
'pcre.h',
'pcre_internal.h',
'ucp.h',
]
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',]
)
pcre = declare_dependency(link_with : libpcre)

View File

@ -88,57 +88,51 @@ test_env = [
'G_TEST_BUILDDIR=' + meson.current_build_dir(),
]
test_cargs = ['-DHAVE_CONFIG_H=1', '-DG_LOG_DOMAIN="GLib"']
foreach test_name : glib_tests
deps = [ libm, thread_dep ]
deps = [libm, thread_dep, libglib_dep]
if test_name == 'regex'
deps += [ pcre ]
deps += [pcre]
endif
exe = executable(test_name, '@0@.c'.format(test_name),
include_directories : inc_dirs,
c_args : [ '-DHAVE_CONFIG_H=1', '-DG_LOG_DOMAIN="GLib"' ],
link_with : libglib,
dependencies : deps,
install : false,
c_args : ['-DPCRE_STATIC'] + test_cargs,
dependencies : deps,
install : false,
)
test(test_name, exe, env : test_env)
endforeach
c_args_atomic = [ ]
c_args_atomic = []
if cc.get_id() == 'gcc'
c_args_atomic += [ '-Wstrict-aliasing=2' ]
c_args_atomic += ['-Wstrict-aliasing=2']
endif
deps = [libm, thread_dep, libglib_dep]
exe = executable('atomic', 'atomic.c',
include_directories : inc_dirs,
c_args : [ '-DHAVE_CONFIG_H=1' ] + c_args_atomic,
link_with : libglib,
c_args : test_cargs + c_args_atomic,
dependencies : deps,
)
test('atomic', exe, env : test_env)
# FIXME: consolidate all of these into the array
exe = executable('overflow-fallback', 'overflow.c',
include_directories : inc_dirs,
c_args : [ '-DHAVE_CONFIG_H=1', '-D_GLIB_TEST_OVERFLOW_FALLBACK' ],
link_with : libglib,
c_args : test_cargs + ['-D_GLIB_TEST_OVERFLOW_FALLBACK'],
dependencies : deps,
install : false,
)
test('overflow-fallback', exe, env : test_env)
exe = executable('642026-ec', '642026.c',
include_directories : inc_dirs,
c_args : [ '-DHAVE_CONFIG_H=1', '-DG_ERRORCHECK_MUTEXES' ],
link_with : libglib,
c_args : test_cargs + ['-DG_ERRORCHECK_MUTEXES'],
dependencies : deps,
install : false,
)
test('642026-ec', exe, env : test_env)
exe = executable('1bit-emufutex', '1bit-mutex.c',
include_directories : inc_dirs,
c_args : [ '-DHAVE_CONFIG_H=1', '-DTEST_EMULATED_FUTEX' ],
link_with : libglib,
c_args : test_cargs + ['-DTEST_EMULATED_FUTEX'],
dependencies : deps,
install : false,
)
@ -146,20 +140,16 @@ test('1bit-emufutex', exe, env : test_env)
if glib_conf.has('HAVE_EVENTFD')
exe = executable('gwakeup-fallback', 'gwakeuptest.c', '../gwakeup.c',
include_directories : inc_dirs,
c_args : [ '-DHAVE_CONFIG_H=1', '-DTEST_EVENTFD_FALLBACK' ],
link_with : libglib,
c_args : test_cargs + ['-DTEST_EVENTFD_FALLBACK'],
dependencies : deps,
install : false,
)
test('gwakeup-fallback', exe, env : test_env)
endif
# test-spawn-echo helper binary required by the spawn tests
# test-spawn-echo helper binary required by the spawn tests above
executable('test-spawn-echo', 'test-spawn-echo.c',
include_directories : inc_dirs,
c_args : [ '-DHAVE_CONFIG_H=1', '-DG_LOG_DOMAIN="GLib"' ],
link_with : libglib,
dependencies : deps,
install : false,
c_args : test_cargs,
dependencies : deps,
install : false,
)

View File

@ -22,21 +22,21 @@ int main (int argc, char ** argv) {
}'''
# On Windows force native WIN32 shared lib loader
if host_machine.system() == 'windows'
if host_system == 'windows'
g_module_impl = 'G_MODULE_IMPL_WIN32'
# Force native AIX library loader
# dlopen() filepath must be of the form /path/libname.a(libname.so)
elif host_machine.system() == 'aix'
elif host_system == 'aix'
g_module_impl = 'G_MODULE_IMPL_AR'
elif cc.links(dlopen_dlsym_test_code, name : 'dlopen() and dlsym() in system libraries')
g_module_impl = 'G_MODULE_IMPL_DL'
# NSLinkModule (dyld) in system libraries (Darwin)
elif cc.has_function('NSLinkModule', prefix : '#include <mach-o/dyld.h>', name : 'NSLinkModule')
elif cc.has_function('NSLinkModule')
g_module_impl = 'G_MODULE_IMPL_DYLD'
g_module_need_uscore = 1
elif cc.links(dlopen_dlsym_test_code, args : '-ldl', name : 'dlopen() and dlsym() in libdl')
g_module_impl = 'G_MODULE_IMPL_DL'
libdl_dep = find_library('dl')
libdl_dep = cc.find_library('dl')
g_module_lib_args = '-ldl'
endif
@ -45,17 +45,23 @@ if g_module_impl == 'G_MODULE_IMPL_DL'
# FIXME: check for OSF1/5.0 RTLD_GLOBAL brokenness (is this still relevant?)
# Check whether we need preceding underscores
if not meson.is_cross_build()
if cc.get_id() == 'msvc'
message('Building for MSVC: assuming that symbols are prefixed with underscore')
g_module_need_uscore = 1
elif meson.has_exe_wrapper()
# FIXME: communicate result via stdout instead of return value, so non-0 return is not printed in bold red
rres = cc.run(dlopen_dlsym_test_code,
args : g_module_lib_args,
name : 'dlsym() preceding underscores')
if rres.compiled() and rres.returncode() == 0
if host_system == 'windows' or rres.returncode() == 0
g_module_need_uscore = 1
endif
else
message('Cross-compiling: assuming that symbols aren\'t prefixed with underscore')
g_module_need_uscore = 0
endif
if cc.has_function('dlerror', prefix : '#include <dlfcn.h>', args : g_module_lib_args, name : 'dlerror')
if cc.has_function('dlerror', args : g_module_lib_args)
g_module_have_dlerror = 1
endif
endif
@ -76,15 +82,17 @@ 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',
sources : [ 'gmodule.c' ],
version : glib_version,
soversion : interface_version,
libgmodule = shared_library('gmodule-2.0',
sources : ['gmodule.c'],
version : library_version,
soversion : soversion,
install : true,
include_directories : inc_dirs,
link_with : libglib,
dependencies : libdl_dep,
c_args : ['-DG_LOG_DOMAIN="GModule"', '-DG_DISABLE_DEPRECATED' ],
include_directories : [configinc, gmoduleinc],
dependencies : [libdl_dep, libglib_dep],
c_args : ['-DG_LOG_DOMAIN="GModule"', '-DG_DISABLE_DEPRECATED'],
)
libgmodule_dep = declare_dependency(link_with : libgmodule,
include_directories : gmoduleinc)

View File

@ -0,0 +1,21 @@
#!/usr/bin/env python3
# Does the same thing as `marshal-genstrings.pl` and the 'gmarshal.strings'
# target in Makefile.am
import re
import sys
prefix = '"g_cclosure_marshal_'
suffix = '",\n'
if len(sys.argv) != 3:
print('Usage: {0} <input> <output>'.format(sys.argv[0]))
fin = open(sys.argv[1], 'r')
fout = open(sys.argv[2], 'w')
for line in fin:
if not line[0].isalpha():
continue
symbol = line[:-1].replace(':', '__').replace(',', '_')
fout.write(prefix + symbol + suffix)

View File

@ -1,10 +1,3 @@
#FIXME
#if host_machine.system() == 'windows'
# plat_src = []
#else
# plat_src = []
#endif
gobject_install_headers = [
'gobject-autocleanups.h',
'glib-types.h',
@ -52,14 +45,42 @@ gobject_c_sources = [
'gvaluetypes.c',
]
libgobject = shared_library('gobject',
sources : [ gobject_c_sources ],
version : glib_version,
soversion : interface_version,
install : true,
include_directories : inc_dirs,
link_with : libglib,
dependencies : libffi_dep,
c_args : ['-DG_LOG_DOMAIN="GLib-GObject"', '-DGOBJECT_COMPILATION' ])
libgobject = shared_library('gobject-2.0',
sources : [gobject_c_sources],
version : library_version,
soversion : soversion,
install : true,
include_directories : [configinc],
dependencies : [libffi_dep, libglib_dep],
c_args : ['-DG_LOG_DOMAIN="GLib-GObject"', '-DGOBJECT_COMPILATION'])
libgobject_dep = declare_dependency(link_with : libgobject,
include_directories : gobjectinc)
glib_mkenums_conf = configuration_data()
glib_mkenums_conf.set('GLIB_VERSION', glib_version)
glib_mkenums_conf.set('PERL_PATH', perl.path())
# FIXME: Set permissions
glib_mkenums = configure_file(input : 'glib-mkenums.in',
output : 'glib-mkenums',
install : true,
install_dir : 'bin', configuration : glib_mkenums_conf)
executable('gobject-query', 'gobject-query.c',
install : true,
c_args : ['-DHAVE_CONFIG_H=1'],
dependencies : [libglib_dep, libgobject_dep])
gmarshal_strings = custom_target('gmarshal.strings',
input : ['gmarshal-list-to-strings.py', 'gmarshal.list'],
output : ['gmarshal.strings'],
command : [python, '@INPUT0@', '@INPUT1@', '@OUTPUT@'])
glib_genmarshal = executable('glib-genmarshal',
gmarshal_strings, 'glib-genmarshal.c',
install : true,
c_args : ['-DHAVE_CONFIG_H=1'],
dependencies : [libglib_dep, libgobject_dep])
subdir('tests')

View File

@ -4,14 +4,18 @@
import sys, subprocess
assert(len(sys.argv) == 3)
if len(sys.argv) != 3:
print('Usage: {0} <listname> <outputfile>')
sys.exit(0)
_, listname, outname = sys.argv
glib_genmarshal = sys.argv[1]
listname = sys.argv[2]
outname = sys.argv[3]
if outname.endswith('.h'):
arg = '--header'
else:
arg = '--body'
output = subprocess.check_output(['glib-genmarshal', '--prefix=test', '--valist-marshallers', arg, listname])
output = subprocess.check_output([glib_genmarshal, '--prefix=test', '--valist-marshallers', arg, listname])
open(outname, 'wb').write(output)

View File

@ -23,16 +23,14 @@ test_env = [
]
foreach test_name : gobject_tests
deps = [ libm, thread_dep ]
deps = [libm, thread_dep, libglib_dep, libgobject_dep]
test_src = '@0@.c'.format(test_name)
# private is an existing or reserved target it seems
if test_name == 'private'
test_name = 'gobject-private'
endif
exe = executable(test_name, test_src,
include_directories : inc_dirs,
c_args : [ '-DHAVE_CONFIG_H=1', '-DG_LOG_DOMAIN="GLib-GObject"' ],
link_with : [ libglib, libgobject ],
c_args : ['-DHAVE_CONFIG_H=1', '-DG_LOG_DOMAIN="GLib-GObject"'],
dependencies : deps,
)
test(test_name, exe, env : test_env)
@ -40,29 +38,23 @@ endforeach
# The marshalers test requires running a binary, so we cannot build it when
# cross-compiling
if not meson.is_cross_build()
# FIXME: need to pass this as argument to the genmarshal script
# and somehow we need to specify it as build dep of the custom targets
# lib_genmarshal = meson.build_root() + '/gobject/glib-genmarshal'
if not meson.has_exe_wrapper()
genmarshal = find_program('gobject_test_marshal.py')
marshalers_h = custom_target('marshalers_h',
output : 'marshalers.h',
input : 'marshalers.list',
command : [ genmarshal, '@INPUT@', '@OUTPUT@' ],
command : [genmarshal, glib_genmarshal, '@INPUT@', '@OUTPUT@'],
)
marshalers_c = custom_target('marshalers_c',
output : 'marshalers.c',
input : 'marshalers.list',
command : [ genmarshal, '@INPUT@', '@OUTPUT@' ],
command : [genmarshal, glib_genmarshal, '@INPUT@', '@OUTPUT@'],
)
exe = executable('signals',
'signals.c', marshalers_h, marshalers_c,
include_directories : inc_dirs,
c_args : [ '-DHAVE_CONFIG_H=1', '-DG_LOG_DOMAIN="GLib-GObject"' ],
link_with : [ libglib, libgobject ],
c_args : ['-DHAVE_CONFIG_H=1', '-DG_LOG_DOMAIN="GLib-GObject"'],
dependencies : deps,
)
test('signals', exe, env : test_env)

View File

@ -1,11 +1,10 @@
# Just a skeleton lib for backwards compatibility since all the functionaliy
# has been moved into glib now
libgthread = shared_library('gthread',
libgthread = shared_library('gthread-2.0',
sources : [ 'gthread-impl.c' ],
version : glib_version,
soversion : interface_version,
version : library_version,
soversion : soversion,
install : true,
include_directories : inc_dirs,
link_with : libglib,
dependencies : [libglib_dep],
c_args : ['-DG_LOG_DOMAIN="GThread"' ],
)

File diff suppressed because it is too large Load Diff