From 6650e22960f4dcd7d66dc560aae0347dc3272e1d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 27 May 2018 15:48:25 +0200 Subject: WIP: Add validation --- wscript | 45 +++++++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 12 deletions(-) (limited to 'wscript') diff --git a/wscript b/wscript index 72d9c5e5..6346c9da 100644 --- a/wscript +++ b/wscript @@ -67,6 +67,19 @@ def configure(conf): defines = ['_POSIX_C_SOURCE=200809L'], mandatory = False) + autowaf.check_pkg(conf, 'libpcre', uselib_store='PCRE', mandatory=False) + if conf.env.HAVE_PCRE: + if conf.check(cflags=['-pthread'], mandatory=False): + conf.env.PTHREAD_CFLAGS = ['-pthread'] + if conf.env.CC_NAME != 'clang': + conf.env.PTHREAD_LINKFLAGS = ['-pthread'] + elif conf.check(linkflags=['-lpthread'], mandatory=False): + conf.env.PTHREAD_CFLAGS = [] + conf.env.PTHREAD_LINKFLAGS = ['-lpthread'] + else: + conf.env.PTHREAD_CFLAGS = [] + conf.env.PTHREAD_LINKFLAGS = [] + dump = Options.options.dump.split(',') if 'all' in dump or 'iter' in dump: conf.define('SERD_DEBUG_ITER', 1) @@ -104,6 +117,7 @@ lib_source = ['src/base64.c', 'src/syntax.c', 'src/system.c', 'src/uri.c', + 'src/validate.c', 'src/world.c', 'src/writer.c', 'src/zix/btree.c', @@ -124,6 +138,7 @@ def build(bld): 'includes': ['.', './src'], 'cflags': ['-fvisibility=hidden'], 'lib': ['m'], + 'use': ['PCRE'], 'vnum': SERD_VERSION, 'install_path': '${LIBDIR}'} if bld.env.MSVC_COMPILER: @@ -180,18 +195,24 @@ def build(bld): # Utilities if bld.env.BUILD_UTILS: - obj = bld(features = 'c cprogram', - source = 'src/serdi.c', - target = 'serdi', - includes = ['.', './src'], - use = 'libserd', - lib = lib_args['lib'], - install_path = '${BINDIR}') - if not bld.env.BUILD_SHARED or bld.env.STATIC_PROGS: - obj.use = 'libserd_static' - if bld.env.STATIC_PROGS: - obj.env.SHLIB_MARKER = obj.env.STLIB_MARKER - obj.linkflags = ['-static'] + for i in ['serdi', 'serd_validate']: + obj = bld(features = 'c cprogram', + source = 'src/%s.c' % i, + target = i, + includes = ['.', './src'], + use = 'libserd', + lib = lib_args['lib'], + linkflags = [], + install_path = '${BINDIR}') + if not bld.env.BUILD_SHARED or bld.env.STATIC_PROGS: + obj.use = 'libserd_static' + if bld.env.STATIC_PROGS: + obj.env.SHLIB_MARKER = obj.env.STLIB_MARKER + obj.linkflags += ['-static'] + if i == 'serd_validate': + autowaf.use_lib(bld, obj, 'PCRE') + obj.cflags = bld.env.PTHREAD_CFLAGS + obj.linkflags += bld.env.PTHREAD_LINKFLAGS # Documentation autowaf.build_dox(bld, 'SERD', SERD_VERSION, top, out) -- cgit v1.2.1