Browse Source

[waf] remove waf for now, doesn't work anymore

personal/stbuehler/wip
Stefan Bühler 9 years ago
parent
commit
ccd512ca57
  1. 35
      ragel.py
  2. 36
      src/angel/wscript
  3. 57
      src/common/wscript
  4. 95
      src/main/wscript
  5. 66
      src/modules/wscript
  6. BIN
      waf
  7. 254
      wscript

35
ragel.py

@ -1,35 +0,0 @@
#! /usr/bin/env python
# encoding: utf-8
"Ragel: '.rl' files are converted into .c files using 'ragel': {.rl -> .c -> .o}"
import TaskGen, Task, Runner
def rageltaskfun(task):
env = task.env
ragelbin = env.get_flat('RAGEL')
if ragelbin:
if task.inputs[0].srcpath(env) == '../src/main/config_parser.rl':
cmd = '%s -o %s -C -T0 %s' % (ragelbin, task.outputs[0].bldpath(env), task.inputs[0].srcpath(env))
else:
cmd = '%s -o %s -C -T1 %s' % (ragelbin, task.outputs[0].bldpath(env), task.inputs[0].srcpath(env))
else:
src = task.inputs[0].srcpath(env)
src = src[:src.rfind('.')] + '.c'
cmd = 'cp %s %s' % (src, task.outputs[0].bldpath(env))
return task.generator.bld.exec_command(cmd)
rageltask = Task.task_type_from_func('ragel', rageltaskfun, vars = ['RAGEL'], color = 'BLUE', ext_in = '.rl', ext_out = '.c', before = 'c')
@TaskGen.extension('.rl')
@TaskGen.before('apply_core')
def ragel(self, node):
out = node.change_ext('.c')
self.allnodes.append(out)
tsk = self.create_task('ragel')
tsk.set_inputs(node)
tsk.set_outputs(out)
def detect(conf):
dang = conf.find_program('ragel', var='RAGEL', mandatory=True)

36
src/angel/wscript

@ -1,36 +0,0 @@
#!/usr/bin/env python
# encoding: utf-8
"""
waf build script for Lighttpd 2.x
License and Copyright: see COPYING file
"""
import Options, sys
source = '''
angel_config_parser.rl
angel_log.c
angel_main.c
angel_plugin.c
angel_plugin_core.c
angel_proc.c
angel_server.c
angel_value.c
'''
def configure(conf):
opts = Options.options
pass
def build(bld):
libcommon = bld.new_task_gen(
features = 'cc cprogram',
source = source,
defines = ['HAVE_CONFIG_H=1'],
uselib = ['glib', 'gthread', 'gmodule', 'ev'],
uselib_local = ['common'],
includes = ['#/include/'],
target = 'lighttpd2')

57
src/common/wscript

@ -1,57 +0,0 @@
#!/usr/bin/env python
# encoding: utf-8
"""
waf build script for Lighttpd 2.x
License and Copyright: see COPYING file
"""
import Options, sys, Utils
def configure(conf):
if sys.platform.startswith('freebsd'):
conf.check(lib='kvm', uselib_store='kvm', mandatory=True)
pass
def build(bld):
source = '''
angel_connection.c
angel_data.c
buffer.c
encoding.c
events.c
fetch.c
idlist.c
ip_parsers.rl
jobqueue.c
memcached.c
mempool.c
module.c
radix.c
sys_memory.c
tasklet.c
utils.c
waitqueue.c
'''
if bld.env['WITH_PROFILER'] == 1:
if sys.platform.startswith('freebsd'):
libs += ['execinfo']
source += '''
profiler.c
'''
if sys.platform.startswith('freebsd'):
libs = ['kvm']
else:
libs = []
libcommon = bld.new_task_gen(
features = 'cc cshlib',
source = source,
defines = ['HAVE_CONFIG_H=1'],
uselib = ['glib', 'gthread', 'gmodule', 'ev'] + libs,
includes = ['#/include/'],
target = 'common')

95
src/main/wscript

@ -1,95 +0,0 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# encoding: utf-8
"""
waf build script for Lighttpd 2.x
License and Copyright: see COPYING file
"""
import Options, sys
def configure(conf):
pass
def build(bld):
libs = ['glib', 'gthread', 'gmodule', 'ev']
source = '''
actions.c
angel.c
angel_fake.c
base_lua.c
backends.c
chunk.c
chunk_parser.c
collect.c
condition.c
config_parser.rl
connection.c
environment.c
etag.c
filter.c
filter_chunked.c
filter_buffer_on_disk.c
http_headers.c
http_range_parser.rl
http_request_parser.rl
http_response_parser.rl
lighttpd_glue.c
lighttpd_worker.c
log.c
mimetype.c
network.c
network_sendfile.c
network_write.c
network_writev.c
options.c
pattern.c
plugin.c
plugin_core.c
request.c
response.c
server.c
stat_cache.c
stream.c
stream_http_response.c
stream_simple_socket.c
throttle.c
url_parser.rl
value.c
virtualrequest.c
worker.c
'''
if bld.env['USE_LUA'] == 1:
libs += ['lua']
source += '''
actions_lua.c
condition_lua.c
config_lua.c
value_lua.c
chunk_lua.c
core_lua.c
environment_lua.c
filters_lua.c
http_headers_lua.c
physical_lua.c
request_lua.c
response_lua.c
stat_lua.c
subrequest_lua.c
virtualrequest_lua.c
'''
libcommon = bld.new_task_gen(
features = 'cc cprogram',
source = source,
defines = ['HAVE_CONFIG_H=1'],
uselib = libs,
uselib_local = ['common'],
includes = ['#/include/'],
target = 'lighttpd2-worker')

66
src/modules/wscript

@ -1,66 +0,0 @@
#!/usr/bin/env python
# encoding: utf-8
"""
waf build script for Lighttpd 2.x
License and Copyright: see COPYING file
"""
import Options, sys
def lighty_mod(bld, target, src, uselib = []):
mod = bld.new_task_gen(
features = 'cc cshlib',
source = src,
defines = ['HAVE_CONFIG_H=1'],
uselib = ['glib', 'gthread', 'gmodule', 'ev', 'lighty_mod'] + uselib,
uselib_local = ['common'],
includes = ['#/include/'],
target = target)
if sys.platform == 'darwin':
mod.env['shlib_PATTERN'] = 'lib%s.so'
def configure(conf):
pass
def build(bld):
env = bld.env
lighty_mod(bld, 'mod_access', 'mod_access.c')
lighty_mod(bld, 'mod_accesslog', 'mod_accesslog.c')
lighty_mod(bld, 'mod_auth', 'mod_auth.c')
lighty_mod(bld, 'mod_balance', 'mod_balance.c')
lighty_mod(bld, 'mod_cache_disk_etag', 'mod_cache_disk_etag.c')
uselib = []
if env['HAVE_ZLIB'] == 1:
uselib += ['z']
if env['HAVE_BZIP'] == 1:
uselib += ['bz2']
if len(uselib) != 0:
lighty_mod(bld, 'mod_deflate', 'mod_deflate.c', uselib)
lighty_mod(bld, 'mod_debug', 'mod_debug.c')
lighty_mod(bld, 'mod_dirlist', 'mod_dirlist.c')
lighty_mod(bld, 'mod_expire', 'mod_expire.c')
lighty_mod(bld, 'mod_fastcgi', 'mod_fastcgi.c fastcgi_stream.c')
lighty_mod(bld, 'mod_flv', 'mod_flv.c')
lighty_mod(bld, 'mod_fortune', 'mod_fortune.c')
lighty_mod(bld, 'mod_limit', 'mod_limit.c')
if bld.env['USE_LUA'] == 1:
lighty_mod(bld, 'mod_lua', 'mod_lua.c', ['lua'])
lighty_mod(bld, 'mod_memcached', 'mod_memcached.c', ['lua'] if bld.env['USE_LUA'] == 1 else [])
if env['USE_OPENSSL'] == 1:
uselib = ['ssl','crypto']
lighty_mod(bld, 'mod_openssl', 'mod_openssl.c openssl_filter.c', uselib)
lighty_mod(bld, 'mod_progress', 'mod_progress.c')
lighty_mod(bld, 'mod_proxy', 'mod_proxy.c')
lighty_mod(bld, 'mod_redirect', 'mod_redirect.c')
lighty_mod(bld, 'mod_rewrite', 'mod_rewrite.c')
lighty_mod(bld, 'mod_scgi', 'mod_scgi.c')
lighty_mod(bld, 'mod_status', 'mod_status.c')
lighty_mod(bld, 'mod_throttle', 'mod_throttle.c')
lighty_mod(bld, 'mod_userdir', 'mod_userdir.c')
lighty_mod(bld, 'mod_vhost', 'mod_vhost.c')

BIN
waf

Binary file not shown.

254
wscript

@ -1,254 +0,0 @@
#!/usr/bin/env python
# encoding: utf-8
"""
waf build script for Lighttpd 2.x
License and Copyright: see COPYING file
"""
import Options, types, os, sys, Runner, Utils
from time import gmtime, strftime, timezone
LIGHTTPD_VERSION_MAJOR=2
LIGHTTPD_VERSION_MINOR=0
LIGHTTPD_VERSION_PATCH=0
# the following two variables are used by the target "waf dist"
VERSION='%d.%d.%d' % (LIGHTTPD_VERSION_MAJOR,LIGHTTPD_VERSION_MINOR,LIGHTTPD_VERSION_PATCH)
APPNAME='lighttpd'
# these variables are mandatory ('/' are converted automatically)
srcdir = '.'
blddir = 'build'
def set_options(opt):
opt.tool_options('compiler_cc')
opt.tool_options('ragel', tdir = '.')
# ./waf configure options
opt.add_option('--with-lua', action='store_true', help='with lua 5.1 for mod_magnet', dest = 'lua', default = False)
opt.add_option('--with-openssl', action='store_true', help='with openssl-support [default: off]', dest='openssl', default=False)
opt.add_option('--with-zlib', action='store_true', help='with deflate/gzip-support [default: off]', dest='zlib', default=False)
opt.add_option('--with-bzip', action='store_true', help='with bzip2-support [default: off]', dest='bzip', default=False)
opt.add_option('--with-profiler', action='store_true', help='with memory profiler [default: off]', dest='profiler', default=False)
opt.add_option('--with-all', action='store_true', help='Enable all features', dest = 'all', default = False)
opt.add_option('--static', action='store_true', help='build a static lighttpd with all modules added', dest = 'static', default = False)
opt.add_option('--append', action='store', help='Append string to binary names / library dir', dest = 'append', default = '')
opt.add_option('--lib-dir', action='store', help='Module directory [default: prefix + /lib/lighttpd + append]', dest = 'libdir', default = '')
opt.add_option('--debug', action='store_true', help='Do not compile with -O2', dest = 'debug', default = False)
opt.add_option('--extra-warnings', action='store_true', help='show more warnings while compiling', dest='extra_warnings', default=False)
def configure(conf):
opts = Options.options
#conf.check_message_2('The waf build system has been disabled, please use cmake for the time being.', 'RED')
#sys.exit(1)
conf.define('LIGHTTPD_VERSION_MAJOR', LIGHTTPD_VERSION_MAJOR)
conf.define('LIGHTTPD_VERSION_MINOR', LIGHTTPD_VERSION_MINOR)
conf.define('LIGHTTPD_VERSION_PATCH', LIGHTTPD_VERSION_PATCH)
conf.define('PACKAGE_NAME', APPNAME)
conf.define('PACKAGE_VERSION', VERSION)
conf.define('PACKAGE_BUILD_DATE', strftime("%b %d %Y %H:%M:%S UTC", gmtime()));
conf.define('LIBRARY_DIR', opts.libdir)
conf.check_tool('compiler_cc')
conf.check_tool('ragel', tooldir = '.')
conf.env['CCFLAGS'] = tolist(conf.env['CCFLAGS'])
conf.env['CCFLAGS'] += [
'-std=gnu99', '-Wall', '-Wshadow', '-W', '-pedantic', '-fPIC',
'-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE_SOURCE', '-D_LARGE_FILES',
'-g', '-g2'
# '-fno-strict-aliasing',
]
if sys.platform != 'darwin':
conf.env['LINKFLAGS'] += [ '-export-dynamic' ]
conf.env['LINKFLAGS_lighty_mod'] += [ '-module', '-avoid-version', '-W,l-no-undefined' ]
else:
# OSX aka darwin needs special treatment
conf.env['LINKFLAGS'] += ['-flat_namespace']
conf.env['LINKFLAGS_lighty_mod'] += ['-undefined', 'dynamic_lookup']
# check for available libraries
conf.check_cfg(package='glib-2.0', uselib_store='glib', atleast_version='2.16', args='--cflags --libs', mandatory=True)
conf.check_cfg(package='gmodule-2.0', uselib_store='gmodule', atleast_version='2.16', args='--cflags --libs', mandatory=True)
conf.check_cfg(package='gthread-2.0', uselib_store='gthread', atleast_version='2.16', args='--cflags --libs', mandatory=True)
conf.check(header_name="glib.h", uselib='glib', mandatory=True)
glib_version = conf.check_cfg(modversion='glib-2.0')
conf.check(lib='ev', uselib_store='ev', mandatory=True)
conf.check(header_name='ev.h', uselib='ev', mandatory=True)
if opts.all:
opts.lua = True
opts.openssl = True
opts.zlib = True
opts.bzip = True
if not opts.debug:
conf.env['CCFLAGS'] += ['-O2']
if opts.extra_warnings:
conf.env['CCFLAGS'] += [
'-Wmissing-declarations', '-Wdeclaration-after-statement', '-Wno-pointer-sign', '-Wcast-align', '-Winline', '-Wsign-compare',
'-Wnested-externs', '-Wpointer-arith'#, '-Werror', '-Wbad-function-cast', '-Wmissing-prototypes'
]
conf.env['LDFLAGS'] += [
'-Wmissing-prototypes', '-Wmissing-declarations',
'-Wdeclaration-after-statement', '-Wno-pointer-sign', '-Wcast-align', '-Winline', '-Wsign-compare',
'-Wnested-externs', '-Wpointer-arith', '-Wl,--as-needed'#, '-Werror', '-Wbad-function-cast'
]
if opts.lua:
# lua has different names in pkg-config on different systems, we do trial and error
# debian
if not conf.check_cfg(package='lua5.1', uselib_store='lua', args='--cflags --libs'):
# freebsd
if not conf.check_cfg(package='lua-5.1', uselib_store='lua', args='--cflags --libs'):
# osx
if not conf.check_cfg(package='lua', uselib_store='lua', args='--cflags --libs'):
# no pkg-config, try by hand
conf.env['LIB_lua'] = [ 'm' ]
conf.check(lib='lua', uselib_store='lua', mandatory=True)
conf.check(header_name='lua.h', uselib='lua', mandatory=True)
conf.check(function_name='lua_setfield', header_name='lua.h', uselib='lua', mandatory=True)
conf.define('HAVE_LUA_H', 1)
conf.define('HAVE_LIBLUA', 1)
conf.define('USE_LUA', 1)
if opts.openssl:
if not conf.check_cfg(package='openssl', uselib_store='ssl', args='--cflags --libs'):
conf.check(lib='ssl', uselib_store='ssl', mandatory=True)
conf.check(header_name='openssl/ssl.h', uselib='ssl', mandatory=True)
conf.check(lib='crypto', uselib_store='crypto', mandatory=True)
conf.check(function_name='BIO_f_base64', header_name=['openssl/bio.h','openssl/evp.h'], uselib='crypto', mandatory=True)
conf.check(function_name='SSL_new', header_name='openssl/ssl.h', uselib='ssl', mandatory=True)
conf.define('USE_OPENSSL', 1)
if opts.zlib:
conf.check(lib='z', uselib_store='z', mandatory=True)
conf.check(header_name='zlib.h', uselib='z', mandatory=True)
conf.check(function_name='deflate', header_name='zlib.h', uselib='z', mandatory=True)
conf.define('HAVE_ZLIB', 1)
if opts.bzip:
conf.check(lib='bz2', uselib_store='bz2', mandatory=True)
conf.check(header_name='bzlib.h', uselib='bz2', mandatory=True)
conf.check(function_name='BZ2_bzCompressInit', header_name='bzlib.h', uselib='bz2', mandatory=True)
conf.define('HAVE_BZIP', 1)
if opts.profiler:
conf.define('WITH_PROFILER', 1)
if not opts.static:
conf.check(lib='dl', uselib_store='dl')
# check for available headers
conf.check(header_name='sys/socket.h')
conf.check(header_name='netinet/in.h')
conf.check(header_name='arpa/inet.h')
conf.check(header_name='sys/uio.h')
conf.check(header_name='sys/mman.h')
conf.check(header_name='sys/resource.h')
conf.check(header_name='sys/sendfile.h')
conf.check(header_name='sys/un.h')
if sys.platform.startswith('freebsd'):
conf.check(lib='execinfo', uselib_store='execinfo')
conf.check(function_name='backtrace', header_name='execinfo.h', define_name='HAVE_EXECINFO_H')
else:
conf.check(header_name='execinfo.h', define_name="HAVE_EXECINFO_H")
# check for available functions
if sys.platform == 'linux2':
conf.check(function_name='sendfile', header_name='sys/sendfile.h', define_name='HAVE_SENDFILE')
conf.check(function_name='sendfile64', header_name='sys/sendfile.h', define_name='HAVE_SENDFILE64')
else:
conf.check(function_name='sendfile', header_name=['sys/types.h','sys/socket.h','sys/uio.h'], define_name='HAVE_SENDFILE')
conf.check(function_name='getrlimit', header_name='sys/resource.h', define_name='HAVE_GETRLIMIT')
conf.check(function_name='writev', header_name='sys/uio.h', define_name='HAVE_WRITEV')
conf.check(function_name='inet_aton', header_name='arpa/inet.h', define_name='HAVE_INET_ATON')
conf.check(function_name='posix_fadvise', header_name='fcntl.h', define_name='HAVE_POSIX_FADVISE')
conf.check(function_name='mmap', header_name='sys/mman.h', define_name='HAVE_MMAP')
conf.check(function_name='fpathconf', header_name='unistd.h', define_name='HAVE_FPATHCONF')
conf.check(function_name='pathconf', header_name='unistd.h', define_name='HAVE_PATHCONF')
conf.check(function_name='dirfd', header_name=['sys/types.h', 'dirent.h'], define_name='HAVE_DIRFD')
conf.check(function_name='localtime_r', header_name=['time.h'], define_name='HAVE_LOCALTIME_R')
conf.check(function_name='gmtime_r', header_name=['time.h'], define_name='HAVE_GMTIME_R')
conf.check(
fragment='''
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
int main() {struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0; return 0;}
''',
msg='Checking for ipv6 support',
define_name='HAVE_IPV6'
)
conf.check(
fragment='''
#include <sys/socket.h>
int main() {struct sockaddr_storage s; return 0;}
''',
msg='Checking for struct sockaddr_storage support',
define_name='HAVE_SOCKADDR_STORAGE'
)
conf.sub_config('src/common')
conf.sub_config('src/angel')
conf.sub_config('src/main')
conf.sub_config('src/modules')
revno = get_revno(conf)
if revno:
conf.define('LIGHTTPD_REVISION', revno)
conf.write_config_header('include/lighttpd/config.h')
Utils.pprint('WHITE', '----------------------------------------')
Utils.pprint('BLUE', 'Summary:')
print_summary(conf, 'Install lighttpd/' + VERSION + ' in', conf.env['PREFIX'])
if revno:
print_summary(conf, 'Revision', revno)
print_summary(conf, 'Using glib version', glib_version)
print_summary(conf, 'With library directory', opts.libdir)
print_summary(conf, 'Build static binary', 'yes' if opts.static else 'no', 'YELLOW' if opts.static else 'GREEN')
print_summary(conf, 'Build debug binary', 'yes' if opts.debug else 'no', 'YELLOW' if opts.debug else 'GREEN')
print_summary(conf, 'With ipv6 support', 'yes' if conf.env['HAVE_IPV6'] else 'no', 'GREEN' if conf.env['HAVE_IPV6'] else 'YELLOW')
print_summary(conf, 'With lua support', 'yes' if opts.lua else 'no', 'GREEN' if opts.lua else 'YELLOW')
print_summary(conf, 'With deflate/gzip support', 'yes' if opts.zlib else 'no', 'GREEN' if opts.zlib else 'YELLOW')
print_summary(conf, 'With bzip2 support', 'yes' if opts.bzip else 'no', 'GREEN' if opts.bzip else 'YELLOW')
print_summary(conf, 'With memory profiler', 'yes' if opts.profiler else 'no', 'GREEN' if opts.profiler else 'YELLOW')
def build(bld):
bld.add_subdirs('src/common')
bld.add_subdirs('src/angel')
bld.add_subdirs('src/main')
bld.add_subdirs('src/modules')
def print_summary(conf, msg, result, color = 'GREEN'):
conf.check_message_1(msg)
conf.check_message_2(result, color)
def tolist(x):
if type(x) is types.ListType:
return x
return [x]
def get_revno(conf):
if os.path.exists('.bzr'):
try:
revno = Utils.cmd_output('bzr version-info --custom --template="{revno}"')
if revno:
return revno.strip()
except:
pass
Loading…
Cancel
Save