#!/usr/bin/env python # encoding: utf-8 """ waf build script for Lighttpd 2.x License and Copyright: see COPYING file """ import Options, sys common_uselib = ['glib', 'gthread', 'gmodule'] common_ccflags = [ '-std=gnu99', '-Wall', '-g', '-Wshadow', '-W', '-pedantic' ] common_src = ''' actions.c base.c chunk.c chunk_parser.c collect.c condition.c condition_parsers.rl config_parser.rl connection.c filter_chunked.c http_headers.c http_request_parser.rl log.c module.c network.c network_write.c network_writev.c network_sendfile.c options.c plugin.c plugin_core.c profiler.c request.c response.c server.c sys-files.c sys-socket.c url_parser.rl utils.c value.c virtualrequest.c waitqueue.c worker.c ''' common_src_lua = ''' actions_lua.c condition_lua.c config_lua.c value_lua.c ''' main_src = ''' lighttpd.c ''' lighty_common_ccflags = [ '-fPIC', '-DHAVE_CONFIG_H', '-D_GNU_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE_SOURCE', '-D_LARGE_FILES', # '-fno-strict-aliasing', ] def lighty_mod(bld, target, src, uselib = [], option = ''): if option and not getattr(Options.options, option): return mod = bld.new_task_gen('cc', 'shlib') mod.target = target mod.source = src mod.uselib = ['lightymod'] + common_uselib + uselib #mod.ccflags = common_ccflags def configure(conf): opts = Options.options conf.env['CCFLAGS_lighty'] = conf.env['CCFLAGS'] + common_ccflags + lighty_common_ccflags conf.env['CCFLAGS_lightymod'] = conf.env['CCFLAGS'] + common_ccflags + [ '-DHAVE_CONFIG_H' ] if not opts.debug: conf.env['CCFLAGS'] += ['-O2'] if opts.static: conf.env['LINKFLAGS_lighty'] += ['-static'] if sys.platform != 'darwin': conf.env['LINKFLAGS_lighty'] += [ '-export-dynamic' ] conf.env['LINKFLAGS_lightymod'] += [ '-module', '-export-dynamic', '-avoid-version', '-W,l-no-undefined' ] else: # OSX aka darwin needs special treatment conf.env['shlib_PATTERN'] = 'lib%s.so' conf.env['LINKFLAGS_lighty'] += ['-flat_namespace'] conf.env['LINKFLAGS_lightymod'] += ['-flat_namespace', '-undefined dynamic_lookup'] def build(bld): env = bld.env opts = Options.options lighty = bld.new_task_gen('cc', 'program') lighty.source = main_src + common_src lighty.target = 'lighttpd' + opts.append lighty.includes = '.' lighty.uselib = common_uselib + ['ev', 'lighty'] #lighty.install_path = '${SOME_PATH}/bin' lighty_mod(bld, 'mod_fortune', 'modules/mod_fortune.c') lighty_mod(bld, 'mod_status', 'modules/mod_status.c')