diff options
author | David Robillard <d@drobilla.net> | 2012-08-08 16:55:31 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-08-08 16:55:31 +0000 |
commit | b61fead43d08c3677a091cfed2a68820fa84faf8 (patch) | |
tree | 58917bf2d6153d61da3dcd9b72d3e472c8836d34 /wscript | |
parent | 1e0773fa078e49bc9509d83e4c33aaf96466ebc0 (diff) | |
download | serd-b61fead43d08c3677a091cfed2a68820fa84faf8.tar.gz serd-b61fead43d08c3677a091cfed2a68820fa84faf8.tar.bz2 serd-b61fead43d08c3677a091cfed2a68820fa84faf8.zip |
Add --no-shared configure option for doing static-only builds.
Add --static-progs configure option for building static binaries.
git-svn-id: http://svn.drobilla.net/serd/trunk@367 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'wscript')
-rw-r--r-- | wscript | 63 |
1 files changed, 40 insertions, 23 deletions
@@ -37,6 +37,10 @@ def options(opt): help="Include runtime stack sanity checks") opt.add_option('--static', action='store_true', default=False, dest='static', help="Build static library") + opt.add_option('--no-shared', action='store_true', default=False, dest='no_shared', + help="Do not build shared library") + opt.add_option('--static-progs', action='store_true', default=False, dest='static_progs', + help="Build programs as static binaries") opt.add_option('--largefile', action='store_true', default=False, dest='largefile', help="Build with large file support on 32-bit systems") @@ -50,9 +54,15 @@ def configure(conf): else: conf.env.append_unique('CFLAGS', '-std=c99') - conf.env['BUILD_TESTS'] = Options.options.build_tests - conf.env['BUILD_UTILS'] = not Options.options.no_utils - conf.env['BUILD_STATIC'] = Options.options.static + conf.env['BUILD_TESTS'] = Options.options.build_tests + conf.env['BUILD_UTILS'] = not Options.options.no_utils + conf.env['BUILD_SHARED'] = not Options.options.no_shared + conf.env['STATIC_PROGS'] = Options.options.static_progs + conf.env['BUILD_STATIC'] = (Options.options.static or + Options.options.static_progs) + + if not conf.env.BUILD_SHARED and not conf.env.BUILD_STATIC: + conf.fatal('Neither a shared nor a static build requested') if Options.options.stack_check: autowaf.define(conf, 'SERD_STACK_CHECK', SERD_VERSION) @@ -124,8 +134,8 @@ def build(bld): autowaf.build_pc(bld, 'SERD', SERD_VERSION, SERD_MAJOR_VERSION, [], {'SERD_MAJOR_VERSION' : SERD_MAJOR_VERSION}) - libflags = [ '-fvisibility=hidden' ] - libs = [ 'm' ] + libflags = ['-fvisibility=hidden'] + libs = ['m'] defines = [] if bld.env['MSVC_COMPILER']: libflags = [] @@ -133,17 +143,18 @@ def build(bld): defines = ['snprintf=_snprintf'] # Shared Library - obj = bld(features = 'c cshlib', - export_includes = ['.'], - source = lib_source, - includes = ['.', './src'], - lib = libs, - name = 'libserd', - target = 'serd-%s' % SERD_MAJOR_VERSION, - vnum = SERD_LIB_VERSION, - install_path = '${LIBDIR}', - defines = defines + ['SERD_SHARED', 'SERD_INTERNAL'], - cflags = libflags) + if bld.env['BUILD_SHARED']: + obj = bld(features = 'c cshlib', + export_includes = ['.'], + source = lib_source, + includes = ['.', './src'], + lib = libs, + name = 'libserd', + target = 'serd-%s' % SERD_MAJOR_VERSION, + vnum = SERD_LIB_VERSION, + install_path = '${LIBDIR}', + defines = defines + ['SERD_SHARED', 'SERD_INTERNAL'], + cflags = libflags) # Static library if bld.env['BUILD_STATIC']: @@ -165,7 +176,7 @@ def build(bld): test_libs += ['gcov'] test_cflags += ['-fprofile-arcs', '-ftest-coverage'] - # Static library (for unit test code coverage) + # Profiled static library for test coverage obj = bld(features = 'c cstlib', source = lib_source, includes = ['.', './src'], @@ -200,12 +211,18 @@ def build(bld): # Utilities if bld.env['BUILD_UTILS']: - bld(features = 'c cprogram', - source = 'src/serdi.c', - includes = ['.', './src'], - use = 'libserd', - target = 'serdi', - install_path = '${BINDIR}') + prog = bld(features = 'c cprogram', + source = 'src/serdi.c', + target = 'serdi', + includes = ['.', './src'], + use = 'libserd', + lib = ['m'], + install_path = '${BINDIR}') + if not bld.env['BUILD_SHARED'] or bld.env['STATIC_PROGS']: + prog.use = 'libserd_static' + if bld.env['STATIC_PROGS']: + prog.env.SHLIB_MARKER = prog.env.STLIB_MARKER + prog.linkflags = ['-static'] # Documentation autowaf.build_dox(bld, 'SERD', SERD_VERSION, top, out) |