scons fixes, and built/test on cygwin
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@771 152afb58-edef-0310-8abb-c4023f1b3aa9
This commit is contained in:
parent
56e8df101c
commit
809199f98f
73
SConstruct
73
SConstruct
|
@ -1,9 +1,11 @@
|
|||
import os
|
||||
import sys
|
||||
import re
|
||||
import string
|
||||
from stat import *
|
||||
|
||||
package = 'lighttpd'
|
||||
version = '1.4.4'
|
||||
|
||||
version = '1.4.5'
|
||||
|
||||
def checkCHeaders(autoconf, hdrs):
|
||||
p = re.compile('[^A-Z0-9]')
|
||||
|
@ -23,6 +25,31 @@ def checkTypes(autoconf, types):
|
|||
if autoconf.CheckType(type, '#include <sys/types.h>'):
|
||||
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_' + p.sub('_', type.upper()) ])
|
||||
|
||||
def checkProgram(env, withname, progname):
|
||||
withname = 'with_' + withname
|
||||
binpath = None
|
||||
|
||||
if env[withname] != 1:
|
||||
binpath = env[withname]
|
||||
else:
|
||||
prog = env.Detect(progname)
|
||||
if prog:
|
||||
binpath = env.WhereIs(prog)
|
||||
|
||||
if binpath:
|
||||
mode = os.stat(binpath)[ST_MODE]
|
||||
if S_ISDIR(mode):
|
||||
print >> sys.stderr, "* error: path `%s' is a directory" % (binpath)
|
||||
env.Exit(-1)
|
||||
if not S_ISREG(mode):
|
||||
print >> sys.stderr, "* error: path `%s' is not a file or not exists" % (binpath)
|
||||
env.Exit(-1)
|
||||
|
||||
if not binpath:
|
||||
print >> sys.stderr, "* error: can't find program `%s'" % (progname)
|
||||
env.Exit(-1)
|
||||
|
||||
return binpath
|
||||
|
||||
BuildDir('build', 'src', duplicate = 0)
|
||||
|
||||
|
@ -44,8 +71,9 @@ opts.AddOptions(
|
|||
env = Environment(
|
||||
env = os.environ,
|
||||
options = opts,
|
||||
CCFLAGS = Split('-Wall -O2 -g -pedantic -Wunused -Wshadow -Isrc/'),
|
||||
LIBS = [ 'dl' ]
|
||||
CCFLAGS = Split('-Wall -O2 -g -pedantic -Wunused -Wshadow'),
|
||||
CPPPATH = Split('#/build'),
|
||||
# LIBS = [ 'dl' ]
|
||||
)
|
||||
|
||||
env['package'] = package
|
||||
|
@ -68,7 +96,7 @@ if 1:
|
|||
|
||||
checkTypes(autoconf, Split('pid_t size_t off_t'))
|
||||
|
||||
autoconf.env.Append( LIBSQLITE3 = '', LIBXML2 = '', LIBMYSQL = '')
|
||||
autoconf.env.Append( LIBSQLITE3 = '', LIBXML2 = '', LIBMYSQL = '', LIBZ = '', LIBBZ2 = '', LIBCRYPT = '', LIBMEMCACHE = '', LIBFCGI = '')
|
||||
|
||||
if env['with_fam']:
|
||||
if autoconf.CheckLibWithHeader('fam', 'fam.h', 'C'):
|
||||
|
@ -97,6 +125,9 @@ if 1:
|
|||
if autoconf.CheckLibWithHeader('sqlite3', 'sqlite3.h', 'C'):
|
||||
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_SQLITE3_H', '-DHAVE_LIBSQLITE3' ], LIBSQLITE3 = 'sqlite3')
|
||||
|
||||
if autoconf.CheckLibWithHeader('fcgi', 'fastcgi.h', 'C'):
|
||||
autoconf.env.Append(LIBFCGI = 'fcgi')
|
||||
|
||||
if autoconf.CheckType('socklen_t', '#include <unistd.h>\n#include <sys/socket.h>\n#include <sys/types.h>'):
|
||||
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_SOCKLEN_T' ])
|
||||
|
||||
|
@ -107,32 +138,36 @@ if 1:
|
|||
env = autoconf.Finish()
|
||||
|
||||
if env['with_pcre']:
|
||||
if env['with_pcre'] != 1:
|
||||
pcre_config = env['with_pcre']
|
||||
elif env.Detect('pcre-config'):
|
||||
pcre_config = env.WhereIs('pcre-config')
|
||||
pcre_config = checkProgram(env, 'pcre', 'pcre-config')
|
||||
env.ParseConfig(pcre_config + ' --cflags --libs')
|
||||
env.Append(CPPFLAGS = [ '-DHAVE_PCRE_H', '-DHAVE_LIBPCRE' ], LIBPCRE = 'pcre')
|
||||
|
||||
if env['with_xml']:
|
||||
if env['with_xml'] != 1:
|
||||
xml2_config = env['with_xml']
|
||||
elif env.Detect('xml2-config'):
|
||||
xml2_config = env.WhereIs('xml2-config')
|
||||
xml2_config = checkProgram(env, 'xml', 'xml2-config')
|
||||
env.ParseConfig(xml2_config + ' --cflags --libs')
|
||||
env.Append(CPPFLAGS = [ '-DHAVE_LIBXML_H', '-DHAVE_LIBXML2' ], LIBXML2 = 'xml2')
|
||||
|
||||
if env['with_mysql']:
|
||||
if env['with_mysql'] != 1:
|
||||
mysql_config = env['with_mysql']
|
||||
else:
|
||||
mysql_config = env.WhereIs('mysql_config')
|
||||
|
||||
mysql_config = checkProgram(env, 'mysql', 'mysql_config')
|
||||
env.ParseConfig(mysql_config + ' --cflags --libs')
|
||||
env.Append(CPPFLAGS = [ '-DHAVE_MYSQL' ], LIBMYSQL = 'mysqlclient')
|
||||
|
||||
if re.compile("cygwin|mingw").search(env['PLATFORM']):
|
||||
env.Append(COMMON_LIB = 'bin')
|
||||
elif re.compile("darwin|aix").search(env['PLATFORM']):
|
||||
env.Append(COMMON_LIB = 'lib')
|
||||
else:
|
||||
env.Append(COMMON_LIB = False)
|
||||
|
||||
# how to make mod_compress.dll works for tests?
|
||||
if re.compile("cygwin").search(env['PLATFORM']):
|
||||
# env.Append(LINKFLAGS = "-Wl,--image-base=0x20000000")
|
||||
env.Append(LINKFLAGS = "-Wl,--enable-auto-image-base")
|
||||
|
||||
versions = string.split(version, '.')
|
||||
version_id = int(versions[0]) << 16 | int(versions[1]) << 8 | int(versions[2])
|
||||
env.Append(CPPFLAGS = [
|
||||
'-DLIGHTTPD_VERSION_ID=' + str(1 << 16 | 4 << 8 | 4),
|
||||
'-DLIGHTTPD_VERSION_ID=' + str(version_id),
|
||||
'-DPACKAGE_NAME=\\"' + package + '\\"',
|
||||
'-DPACKAGE_VERSION=\\"' + version + '\\"',
|
||||
'-DLIBRARY_DIR="\\"${libdir}\\""',
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Import('env')
|
||||
|
||||
src = Split("buffer.c log.c \
|
||||
common_src = Split("buffer.c log.c \
|
||||
keyvalue.c chunk.c \
|
||||
http_chunk.c stream.c fdevent.c \
|
||||
stat_cache.c plugin.c joblist.c etag.c array.c \
|
||||
|
@ -14,54 +14,80 @@ src = Split("buffer.c log.c \
|
|||
connections-glue.c \
|
||||
configfile-glue.c \
|
||||
http-header-glue.c \
|
||||
splaytree.c server.c response.c connections.c network.c \
|
||||
splaytree.c network_writev.c")
|
||||
|
||||
src = Split("server.c response.c connections.c network.c \
|
||||
network_write.c network_linux_sendfile.c \
|
||||
network_freebsd_sendfile.c network_writev.c \
|
||||
network_freebsd_sendfile.c \
|
||||
network_solaris_sendfilev.c network_openssl.c \
|
||||
configfile.c configparser.c request.c proc_open.c")
|
||||
|
||||
lemon = env.Program('lemon', 'lemon.c')
|
||||
|
||||
configparser = env.Command('configparser.c', 'configparser.y', '(cd build; ../' + lemon[0].path + ' -q ../$SOURCE ../src/lempar.c; cd ..)')
|
||||
configparser = env.Command(['configparser.c', 'configparser.h'], 'configparser.y', '(cd build; ../' + lemon[0].path + ' -q ../$SOURCE ../src/lempar.c; cd ..)')
|
||||
env.Depends(configparser, lemon)
|
||||
|
||||
instbin = env.Program('lighttpd', src, LINKFLAGS = [ '-Wl,--export-dynamic' ])
|
||||
mod_ssi_exprparser = env.Command(['mod_ssi_exprparser.c', 'mod_ssi_exprparser.h'], 'mod_ssi_exprparser.y', '(cd build; ../' + lemon[0].path + ' -q ../$SOURCE ../src/lempar.c; cd ..)')
|
||||
env.Depends(mod_ssi_exprparser, lemon)
|
||||
|
||||
implib = 'lighttpd.exe.a'
|
||||
bin_targets = ['lighttpd']
|
||||
bin_linkflags = [ env['LINKFLAGS'] ]
|
||||
if env['COMMON_LIB'] == 'lib':
|
||||
common_lib = env.SharedLibrary('liblighttpd', common_src, LINKFLAGS = [ env['LINKFLAGS'], '-Wl,--export-dynamic' ])
|
||||
else:
|
||||
src += common_src
|
||||
common_lib = []
|
||||
if env['COMMON_LIB'] == 'bin':
|
||||
bin_linkflags += [ '-Wl,--export-all-symbols', '-Wl,--out-implib=build/' + implib ]
|
||||
bin_targets += [ implib ]
|
||||
else:
|
||||
bin_linkflags += [ '-Wl,--export-dynamic' ]
|
||||
|
||||
instbin = env.Program(bin_targets, src, LINKFLAGS = bin_linkflags, LIBS= [ env['LIBS'], common_lib ])
|
||||
env.Depends(instbin, configparser)
|
||||
|
||||
if env['COMMON_LIB'] == 'bin':
|
||||
common_lib = instbin[1]
|
||||
|
||||
env['SHLIBPREFIX'] = ''
|
||||
instlib = []
|
||||
instlib += env.SharedLibrary('mod_access', [ 'mod_access.c' ], LIBS='')
|
||||
instlib += env.SharedLibrary('mod_alias', [ 'mod_alias.c' ], LIBS='')
|
||||
instlib += env.SharedLibrary('mod_cgi', [ 'mod_cgi.c' ], LIBS='')
|
||||
instlib += env.SharedLibrary('mod_fastcgi', [ 'mod_fastcgi.c' ], LIBS='')
|
||||
instlib += env.SharedLibrary('mod_scgi', [ 'mod_scgi.c' ], LIBS='')
|
||||
instlib += env.SharedLibrary('mod_staticfile', [ 'mod_staticfile.c' ], LIBS='')
|
||||
instlib += env.SharedLibrary('mod_dirlisting', [ 'mod_dirlisting.c' ], LIBS= [ env['LIBPCRE'] ])
|
||||
instlib += env.SharedLibrary('mod_indexfile', [ 'mod_indexfile.c' ], LIBS='')
|
||||
instlib += env.SharedLibrary('mod_setenv', [ 'mod_setenv.c' ], LIBS='')
|
||||
instlib += env.SharedLibrary('mod_rrdtool', [ 'mod_rrdtool.c' ], LIBS='')
|
||||
instlib += env.SharedLibrary('mod_usertrack', [ 'mod_usertrack.c' ], LIBS='')
|
||||
instlib += env.SharedLibrary('mod_proxy', [ 'mod_proxy.c' ], LIBS='')
|
||||
instlib += env.SharedLibrary('mod_userdir', [ 'mod_userdir.c' ], LIBS='')
|
||||
instlib += env.SharedLibrary('mod_ssi', [ 'mod_ssi.c' ], LIBS='')
|
||||
instlib += env.SharedLibrary('mod_secdownload', [ 'mod_secure_download.c' ], LIBS='')
|
||||
instlib += env.SharedLibrary('mod_access', [ 'mod_access.c' ], LIBS='')
|
||||
instlib += env.SharedLibrary('mod_accesslog', [ 'mod_accesslog.c' ], LIBS='')
|
||||
instlib += env.SharedLibrary('mod_simple_vhost', [ 'mod_simple_vhost.c' ], LIBS='')
|
||||
instlib += env.SharedLibrary('mod_evhost', [ 'mod_evhost.c' ], LIBS='')
|
||||
instlib += env.SharedLibrary('mod_expire', [ 'mod_expire.c' ], LIBS='')
|
||||
instlib += env.SharedLibrary('mod_status', [ 'mod_status.c' ], LIBS='')
|
||||
instlib += env.SharedLibrary('mod_compress', [ 'mod_compress.c' ], LIBS= [ env['LIBZ'], env['LIBBZ2'] ] )
|
||||
instlib += env.SharedLibrary('mod_redirect', [ 'mod_redirect.c' ], LIBS = [ env['LIBPCRE'] ] )
|
||||
instlib += env.SharedLibrary('mod_rewrite', [ 'mod_rewrite.c' ], LIBS= [ env['LIBPCRE'] ])
|
||||
instlib += env.SharedLibrary('mod_auth', [ Split('mod_auth.c http_auth_digest.c http_auth.c') ], LIBS= [ env['LIBCRYPT'] ])
|
||||
instlib += env.SharedLibrary('mod_webdav', [ 'mod_webdav.c' ], LIBS= [ env['LIBXML2'], env['LIBSQLITE3'] ])
|
||||
instlib += env.SharedLibrary('mod_mysql_vhost', [ 'mod_mysql_vhost.c' ], LIBS= [ env['LIBMYSQL'] ])
|
||||
instlib += env.SharedLibrary('mod_trigger_b4_dl', [ 'mod_trigger_b4_dl.c' ], LIBS= [ env['LIBPCRE'] ])
|
||||
instlib += env.SharedLibrary('mod_cml', [ 'mod_cml.c' ], LIBS= [ env['LIBPCRE'] ])
|
||||
instlib += env.SharedLibrary('mod_uploadprogress', [ 'mod_uploadprogress.c' ], LIBS='')
|
||||
instlib += env.SharedLibrary('mod_access', [ 'mod_access.c' ], LIBS= [ common_lib ])
|
||||
instlib += env.SharedLibrary('mod_alias', [ 'mod_alias.c' ], LIBS= [ common_lib ])
|
||||
instlib += env.SharedLibrary('mod_cgi', [ 'mod_cgi.c' ], LIBS= [ common_lib ])
|
||||
instlib += env.SharedLibrary('mod_fastcgi', [ 'mod_fastcgi.c' ], LIBS= [ common_lib ])
|
||||
instlib += env.SharedLibrary('mod_scgi', [ 'mod_scgi.c' ], LIBS= [ common_lib ])
|
||||
instlib += env.SharedLibrary('mod_staticfile', [ 'mod_staticfile.c' ], LIBS= [ common_lib ])
|
||||
instlib += env.SharedLibrary('mod_dirlisting', [ 'mod_dirlisting.c' ], LIBS= [ common_lib, env['LIBPCRE'] ])
|
||||
instlib += env.SharedLibrary('mod_indexfile', [ 'mod_indexfile.c' ], LIBS= [ common_lib ])
|
||||
instlib += env.SharedLibrary('mod_setenv', [ 'mod_setenv.c' ], LIBS= [ common_lib ])
|
||||
instlib += env.SharedLibrary('mod_rrdtool', [ 'mod_rrdtool.c' ], LIBS= [ common_lib ])
|
||||
instlib += env.SharedLibrary('mod_usertrack', [ 'mod_usertrack.c' ], LIBS= [ common_lib ])
|
||||
instlib += env.SharedLibrary('mod_proxy', [ 'mod_proxy.c' ], LIBS= [ common_lib ])
|
||||
instlib += env.SharedLibrary('mod_userdir', [ 'mod_userdir.c' ], LIBS= [ common_lib ])
|
||||
mod_ssi = env.SharedLibrary('mod_ssi', [ 'mod_ssi_exprparser.c', 'mod_ssi_expr.c', 'mod_ssi.c' ], LIBS= [ common_lib, env['LIBPCRE'] ])
|
||||
env.Depends(mod_ssi, mod_ssi_exprparser)
|
||||
instlib += mod_ssi
|
||||
instlib += env.SharedLibrary('mod_secdownload', [ 'mod_secure_download.c' ], LIBS= [ common_lib ])
|
||||
instlib += env.SharedLibrary('mod_accesslog', [ 'mod_accesslog.c' ], LIBS= [ common_lib ])
|
||||
instlib += env.SharedLibrary('mod_simple_vhost', [ 'mod_simple_vhost.c' ], LIBS= [ common_lib ])
|
||||
instlib += env.SharedLibrary('mod_evhost', [ 'mod_evhost.c' ], LIBS= [ common_lib ])
|
||||
instlib += env.SharedLibrary('mod_expire', [ 'mod_expire.c' ], LIBS= [ common_lib ])
|
||||
instlib += env.SharedLibrary('mod_status', [ 'mod_status.c' ], LIBS= [ common_lib ])
|
||||
instlib += env.SharedLibrary('mod_compress', [ 'mod_compress.c' ], LIBS= [ common_lib, env['LIBZ'], env['LIBBZ2'] ] )
|
||||
instlib += env.SharedLibrary('mod_redirect', [ 'mod_redirect.c' ], LIBS = [ common_lib, env['LIBPCRE'] ] )
|
||||
instlib += env.SharedLibrary('mod_rewrite', [ 'mod_rewrite.c' ], LIBS= [ common_lib, env['LIBPCRE'] ])
|
||||
instlib += env.SharedLibrary('mod_auth', [ Split('mod_auth.c http_auth_digest.c http_auth.c') ], LIBS= [ common_lib, env['LIBCRYPT'] ])
|
||||
instlib += env.SharedLibrary('mod_webdav', [ 'mod_webdav.c' ], LIBS= [ common_lib, env['LIBXML2'], env['LIBSQLITE3'] ])
|
||||
instlib += env.SharedLibrary('mod_mysql_vhost', [ 'mod_mysql_vhost.c' ], LIBS= [ common_lib, env['LIBMYSQL'] ])
|
||||
instlib += env.SharedLibrary('mod_trigger_b4_dl', [ 'mod_trigger_b4_dl.c' ], LIBS= [ common_lib, env['LIBPCRE'] ])
|
||||
instlib += env.SharedLibrary('mod_cml', [ 'mod_cml_lua.c', 'mod_cml.c' ], LIBS= [ common_lib, env['LIBPCRE'] ])
|
||||
instlib += env.SharedLibrary('mod_uploadprogress', [ 'mod_uploadprogress.c' ], LIBS= [ common_lib ])
|
||||
|
||||
inst = []
|
||||
inst += env.Install('${bindir}', instbin)
|
||||
if env['COMMON_LIB'] == 'lib':
|
||||
inst += env.Install('${bindir}', common_lib)
|
||||
inst += env.Install('${libdir}', instlib)
|
||||
|
||||
env.Alias('install', inst)
|
||||
|
|
|
@ -36,4 +36,10 @@ t = env.Command('foo1', 'prepare.sh', '(cd ./tests/; ./prepare.sh; cd ..)')
|
|||
t += env.Command('foo2', 'run-tests.pl', '( cd ./tests/; SHELL=/bin/sh ./run-tests.pl; cd ..)')
|
||||
t += env.Command('foo3', 'cleanup.sh', '(cd ./tests/; ./cleanup.sh; cd ..)')
|
||||
|
||||
if env['LIBFCGI']:
|
||||
fcgis = []
|
||||
fcgis += env.Program("fcgi-auth", "fcgi-auth.c", LIBS=env['LIBFCGI'])
|
||||
fcgis += env.Program("fcgi-responder", "fcgi-responder.c", LIBS=env['LIBFCGI'])
|
||||
env.Depends(t, fcgis)
|
||||
|
||||
env.Alias('check', t )
|
||||
|
|
|
@ -48,6 +48,8 @@ EOF
|
|||
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
|
||||
ok($tf->handle_http($t) == 0, 'Basic-Auth: Valid Auth-token - htpasswd (des)');
|
||||
|
||||
SKIP: {
|
||||
skip "no md5 for crypt under cygwin", 1 if $^O == 'cygwin';
|
||||
$t->{REQUEST} = ( <<EOF
|
||||
GET /server-config HTTP/1.0
|
||||
Host: auth-htpasswd.example.org
|
||||
|
@ -56,6 +58,7 @@ EOF
|
|||
);
|
||||
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
|
||||
ok($tf->handle_http($t) == 0, 'Basic-Auth: Valid Auth-token - htpasswd (md5)');
|
||||
}
|
||||
|
||||
$t->{REQUEST} = ( <<EOF
|
||||
GET /server-config HTTP/1.0
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#! /usr/bin/env perl
|
||||
#! /usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
|
||||
|
|
|
@ -4,5 +4,6 @@
|
|||
|
||||
export srcdir=$1
|
||||
export top_builddir=$2
|
||||
export SHELL
|
||||
|
||||
$3
|
||||
|
|
Loading…
Reference in New Issue