aboutsummaryrefslogtreecommitdiffstats
path: root/wscript
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-05-27 15:48:25 +0200
committerDavid Robillard <d@drobilla.net>2018-12-31 12:15:40 -0500
commit6650e22960f4dcd7d66dc560aae0347dc3272e1d (patch)
treec5942a6ae5a510c093eefe9ca3a50c889911518e /wscript
parent85627db501282f3cb49223b816dbc226bd99ca16 (diff)
downloadserd-6650e22960f4dcd7d66dc560aae0347dc3272e1d.tar.gz
serd-6650e22960f4dcd7d66dc560aae0347dc3272e1d.tar.bz2
serd-6650e22960f4dcd7d66dc560aae0347dc3272e1d.zip
WIP: Add validation
Diffstat (limited to 'wscript')
-rw-r--r--wscript45
1 files changed, 33 insertions, 12 deletions
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)