2
0
Fork 0
lighttpd2/src/wscript

126 lines
2.9 KiB
Python

#!/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
angel.c
angel_fake.c
base.c
chunk.c
chunk_parser.c
collect.c
condition.c
condition_parsers.rl
config_parser.rl
connection.c
encoding.c
environment.c
etag.c
filter_chunked.c
http_headers.c
http_request_parser.rl
http_response_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
stat_cache.c
sys-files.c
sys-socket.c
throttle.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 + lighty_common_ccflags
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_accesslog', 'modules/mod_accesslog.c')
lighty_mod(bld, 'mod_balancer', 'modules/mod_balancer.c')
lighty_mod(bld, 'mod_cache_disk_etag', 'modules/mod_cache_disk_etag.c')
lighty_mod(bld, 'mod_debug', 'modules/mod_debug.c')
lighty_mod(bld, 'mod_dirlist', 'modules/mod_dirlist.c')
lighty_mod(bld, 'mod_fastcgi', 'modules/mod_fastcgi.c')
lighty_mod(bld, 'mod_fortune', 'modules/mod_fortune.c')
lighty_mod(bld, 'mod_status', 'modules/mod_status.c')
lighty_mod(bld, 'mod_vhost', 'modules/mod_vhost.c')