Annotation of embedaddon/lighttpd/src/SConscript, revision 1.1.1.1

1.1       misho       1: import os
                      2: import re
                      3: import types
                      4: 
                      5: Import('env')
                      6: 
                      7: common_src = Split("buffer.c log.c \
                      8:       keyvalue.c chunk.c  \
                      9:       http_chunk.c stream.c fdevent.c \
                     10:       stat_cache.c plugin.c joblist.c etag.c array.c \
                     11:       data_string.c data_count.c data_array.c \
                     12:       data_integer.c md5.c data_fastcgi.c \
                     13:       fdevent_select.c fdevent_libev.c \
                     14:       fdevent_poll.c fdevent_linux_sysepoll.c \
                     15:       fdevent_solaris_devpoll.c fdevent_solaris_port.c \
                     16:       fdevent_freebsd_kqueue.c \
                     17:       data_config.c bitset.c \
                     18:       inet_ntop_cache.c crc32.c \
                     19:       connections-glue.c \
                     20:       configfile-glue.c \
                     21:       http-header-glue.c \
                     22:       splaytree.c network_writev.c \
                     23:       network_write.c network_linux_sendfile.c \
                     24:       network_freebsd_sendfile.c  \
                     25:       network_solaris_sendfilev.c network_openssl.c \
                     26:       status_counter.c \
                     27: ")
                     28: 
                     29: src = Split("server.c response.c connections.c network.c \
                     30:       configfile.c configparser.c request.c proc_open.c")
                     31: 
                     32: lemon = env.Program('lemon', 'lemon.c')
                     33: 
                     34: configparser = env.Command(['configparser.c', 'configparser.h'], 'configparser.y', '(cd build; ../' + lemon[0].path + ' -q ../$SOURCE ../src/lempar.c; cd ..)')
                     35: env.Depends(configparser, lemon)
                     36: 
                     37: 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 ..)')
                     38: env.Depends(mod_ssi_exprparser, lemon)
                     39: 
                     40: ## the modules and how they are built
                     41: modules = {
                     42:        'mod_access' : { 'src' : [ 'mod_access.c' ] },
                     43:        'mod_alias' : { 'src' : [ 'mod_alias.c' ] },
                     44:        'mod_cgi' : { 'src' : [ 'mod_cgi.c' ] },
                     45:        'mod_fastcgi' : { 'src' : [ 'mod_fastcgi.c' ] },
                     46:        'mod_scgi' : { 'src' : [ 'mod_scgi.c' ] },
                     47:        'mod_extforward' : { 'src' : [ 'mod_extforward.c' ] },
                     48:        'mod_staticfile' : { 'src' : [ 'mod_staticfile.c' ] },
                     49:        'mod_dirlisting' : { 'src' : [ 'mod_dirlisting.c' ], 'lib' : [ env['LIBPCRE'] ] },
                     50:        'mod_indexfile' : { 'src' : [ 'mod_indexfile.c' ] },
                     51:        'mod_setenv' : { 'src' : [ 'mod_setenv.c' ] },
                     52:        'mod_rrdtool' : { 'src' : [ 'mod_rrdtool.c' ] },
                     53:        'mod_usertrack' : { 'src' : [ 'mod_usertrack.c' ] },
                     54:        'mod_proxy' : { 'src' : [ 'mod_proxy.c' ] },
                     55:        'mod_userdir' : { 'src' : [ 'mod_userdir.c' ] },
                     56:        'mod_secdownload' : { 'src' : [ 'mod_secure_download.c' ] },
                     57:        'mod_accesslog' : { 'src' : [ 'mod_accesslog.c' ] },
                     58:        'mod_simple_vhost' : { 'src' : [ 'mod_simple_vhost.c' ] },
                     59:        'mod_evhost' : { 'src' : [ 'mod_evhost.c' ] },
                     60:        'mod_expire' : { 'src' : [ 'mod_expire.c' ] },
                     61:        'mod_status' : { 'src' : [ 'mod_status.c' ] },
                     62:        'mod_compress' : { 'src' : [ 'mod_compress.c' ], 'lib' : [ env['LIBZ'], env['LIBBZ2'] ] },
                     63:        'mod_redirect' : { 'src' : [ 'mod_redirect.c' ], 'lib' : [ env['LIBPCRE'] ] },
                     64:        'mod_rewrite' : { 'src' : [ 'mod_rewrite.c' ], 'lib' : [ env['LIBPCRE'] ] },
                     65:        'mod_auth' : {
                     66:                'src' : [ 'mod_auth.c', 'http_auth.c' ],
                     67:                'lib' : [ env['LIBCRYPT'], env['LIBLDAP'], env['LIBLBER'] ] },
                     68:        'mod_webdav' : { 'src' : [ 'mod_webdav.c' ], 'lib' : [ env['LIBXML2'], env['LIBSQLITE3'], env['LIBUUID'] ] },
                     69:        'mod_mysql_vhost' : { 'src' : [ 'mod_mysql_vhost.c' ], 'lib' : [ env['LIBMYSQL'] ] },
                     70:        'mod_trigger_b4_dl' : { 'src' : [ 'mod_trigger_b4_dl.c' ], 'lib' : [ env['LIBPCRE'] ] },
                     71:        'mod_cml' : {
                     72:                'src' : [ 'mod_cml_lua.c', 'mod_cml.c', 'mod_cml_funcs.c' ],
                     73:                'lib' : [ env['LIBPCRE'], env['LIBMEMCACHE'], env['LIBLUA'], env['LIBLUALIB'] ] },
                     74: #      'mod_uploadprogress' : { 'src' : [ 'mod_uploadprogress.c' ] },
                     75:        'mod_evasive' : { 'src' : [ 'mod_evasive.c' ] },
                     76:        'mod_ssi' : { 'src' : [ 'mod_ssi_exprparser.c', 'mod_ssi_expr.c', 'mod_ssi.c' ], 'lib' : [ env['LIBPCRE'] ] },
                     77:        'mod_flv_streaming' : { 'src' : [ 'mod_flv_streaming.c' ] },
                     78:        'mod_magnet' : { 'src' : [ 'mod_magnet.c', 'mod_magnet_cache.c' ], 'lib' : [ env['LIBLUA'] ] },
                     79: }
                     80: 
                     81: staticenv = env.Copy(CPPFLAGS=[ env['CPPFLAGS'], '-DLIGHTTPD_STATIC', '-DOPENSSL_NO_KRB5'])
                     82: 
                     83: ## all the core-sources + the modules
                     84: staticsrc = src + common_src
                     85: 
                     86: staticlib = env['LIBS']
                     87: staticinit = ''
                     88: for module in modules.keys():
                     89:        staticsrc += modules[module]['src']
                     90:        staticinit += "PLUGIN_INIT(%s)\n"%module
                     91:        if modules[module].has_key('lib'):
                     92:                staticlib += modules[module]['lib']
                     93: 
                     94: open('plugin-static.h', 'w+').write(staticinit)
                     95: 
                     96: ## turn all src-files into objects
                     97: staticobj = []
                     98: for cfile in staticsrc:
                     99:        staticobj += [ staticenv.Object('static-' + cfile.replace('.c', ''), cfile) ]
                    100: 
                    101: staticbin = staticenv.Program('lighttpd-semi-static',
                    102:        staticobj,
                    103:        LIBS = staticlib
                    104:        )
                    105: 
                    106: ## you might have to adjust the list of libs and the order for your setup
                    107: ## this is tricky, be warned
                    108: fullstaticlib = []
                    109: 
                    110: ## try to calculate the libs for fullstatic with ldd
                    111: ## 1. find the lib
                    112: ## 2. check the deps
                    113: ## 3. add them to the libs
                    114: searchlibs = os.pathsep.join([ '/lib/', '/usr/lib/', '/usr/local/lib/' ])
                    115: lddre = re.compile(r'^\s+lib([^=-]+)(?:-[\.0-9]+)?\.so\.[0-9]+ =>', re.MULTILINE)
                    116: for libs in staticlib:
                    117:        if type(libs) is types.StringType: libs = [ libs ]
                    118:        for lib in libs:
                    119:                fullstaticlib += [ lib ]
                    120:                solibpath = env.WhereIs('lib' + lib + '.so', searchlibs)
                    121:                fullstaticlib += [ lib ]
                    122:                if solibpath is None:
                    123:                        continue
                    124: 
                    125:                f = os.popen('ldd ' + solibpath, 'r')
                    126:                for aword in lddre.findall(f.read()):
                    127:                        fullstaticlib += [ aword ]
                    128:                f.close
                    129: 
                    130: 
                    131: fullstaticbin = staticenv.Program('lighttpd-static',
                    132:        staticobj,
                    133:        LIBS = fullstaticlib,
                    134:        LINKFLAGS= ['-static']
                    135:        )
                    136: 
                    137: Alias('static', staticbin)
                    138: Alias('fullstatic', fullstaticbin)
                    139: 
                    140: implib = 'lighttpd.exe.a'
                    141: bin_targets = ['lighttpd']
                    142: bin_linkflags = [ env['LINKFLAGS'] ]
                    143: if env['COMMON_LIB'] == 'lib':
                    144:        common_lib = env.SharedLibrary('liblighttpd', common_src, LINKFLAGS = [ env['LINKFLAGS'], '-Wl,--export-dynamic' ])
                    145: else:
                    146:        src += common_src
                    147:        common_lib = []
                    148:        if env['COMMON_LIB'] == 'bin':
                    149:                bin_linkflags += [ '-Wl,--export-all-symbols', '-Wl,--out-implib=build/' + implib ]
                    150:                bin_targets += [ implib ]
                    151:        else:
                    152:                bin_linkflags += [ '-Wl,--export-dynamic' ]
                    153: 
                    154: instbin = env.Program(bin_targets, src, LINKFLAGS = bin_linkflags, LIBS= [ env['LIBS'], common_lib, env['LIBDL'] ])
                    155: env.Depends(instbin, configparser)
                    156: 
                    157: if env['COMMON_LIB'] == 'bin':
                    158:        common_lib = instbin[1]
                    159: 
                    160: env['SHLIBPREFIX'] = ''
                    161: instlib = []
                    162: for module in modules.keys():
                    163:        libs = [ common_lib ]
                    164:        if modules[module].has_key('lib'):
                    165:                libs +=  modules[module]['lib']
                    166:        instlib += env.SharedLibrary(module, modules[module]['src'], LIBS= [ libs ])
                    167: 
                    168: inst = []
                    169: 
                    170: if env['build_dynamic']:
                    171:        Default(instbin[0], instlib)
                    172:        inst += env.Install('${sbindir}', instbin[0])
                    173:        inst += env.Install('${libdir}', instlib)
                    174:        if env['COMMON_LIB'] == 'lib':
                    175:                Default(common_lib)
                    176:                inst += env.Install('${bindir}', common_lib)
                    177: 
                    178: if env['build_static']:
                    179:        Default(staticbin)
                    180:        inst += env.Install('${sbindir}', staticbin)
                    181: 
                    182: if env['build_fullstatic']:
                    183:        Default(fullstaticbin)
                    184:        inst += env.Install('${sbindir}', fullstaticbin)
                    185: 
                    186: env.Alias('dynamic', instbin)
                    187: # default all to be installed
                    188: env.Alias('install', inst)
                    189: 
                    190: pkgdir = '.'
                    191: tarname = env['package'] + '-' + env['version']
                    192: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>