Browse Source

detect required static libs through ldd

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@929 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.11
Jan Kneschke 16 years ago
parent
commit
2a4080a88b
  1. 10
      SConstruct
  2. 28
      src/SConscript

10
SConstruct

@ -157,7 +157,7 @@ if 1:
checkTypes(autoconf, Split('pid_t size_t off_t'))
autoconf.env.Append( LIBSQLITE3 = '', LIBXML2 = '', LIBMYSQL = '', LIBZ = '',
LIBBZ2 = '', LIBCRYPT = '', LIBMEMCACHE = '', LIBFCGI = '',
LIBBZ2 = '', LIBCRYPT = '', LIBMEMCACHE = '', LIBFCGI = '', LIBPCRE = '',
LIBLDAP = '', LIBLBER = '', LIBLUA = '', LIBLUALIB = '', LIBDL = '')
if env['with_fam']:
@ -179,7 +179,7 @@ if 1:
if env['with_ldap']:
if autoconf.CheckLibWithHeader('ldap', 'ldap.h', 'C'):
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_LDAP_H', '-DHAVE_LIBLDAP' ], LIBLDAP = [ 'ldap' ])
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_LDAP_H', '-DHAVE_LIBLDAP' ], LIBLDAP = 'ldap')
if autoconf.CheckLibWithHeader('lber', 'lber.h', 'C'):
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_LBER_H', '-DHAVE_LIBLBER' ], LIBLBER = 'lber')
@ -198,12 +198,16 @@ if 1:
if env['with_lua']:
if autoconf.CheckLibWithHeader('lua', 'lua.h', 'C'):
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_LUA_H', '-DHAVE_LIBLUA' ], LIBLUA = 'lua', LIBLUALIB = 'lualib')
ol = env['LIBS']
if autoconf.CheckLibWithHeader('fcgi', 'fastcgi.h', 'C'):
autoconf.env.Append(LIBFCGI = 'fcgi')
env['LIBS'] = ol
ol = env['LIBS']
if autoconf.CheckLibWithHeader('dl', 'dlfcn.h', 'C'):
autoconf.env.Append(LIBDL = 'dl')
env['LIBS'] = ol
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' ])

28
src/SConscript

@ -1,3 +1,7 @@
import os
import re
import types
Import('env')
common_src = Split("buffer.c log.c \
@ -96,7 +100,29 @@ staticbin = staticenv.Program('lighttpd-semi-static',
## you might have to adjust the list of libs and the order for your setup
## this is tricky, be warned
fullstaticlib = staticlib + [ 'sasl2', 'gssapi_krb5', 'ssl', 'crypto', 'crypt', 'krb5', 'k5crypto', 'krb5support', 'com_err', 'resolv' ]
fullstaticlib = []
## try to calculate the libs for fullstatic with ldd
## 1. find the lib
## 2. check the deps
## 3. add them to the libs
searchlibs = os.pathsep.join([ '/lib/', '/usr/lib/', '/usr/local/lib/' ])
lddre = re.compile(r'^\s+lib([^=-]+)(?:-[\.0-9]+)?\.so\.[0-9]+ =>', re.MULTILINE)
for libs in staticlib:
if type(libs) is types.StringType: libs = [ libs ]
for lib in libs:
fullstaticlib += [ lib ]
solibpath = env.WhereIs('lib' + lib + '.so', searchlibs)
fullstaticlib += [ lib ]
if solibpath is None:
continue
f = os.popen('ldd ' + solibpath, 'r')
for aword in lddre.findall(f.read()):
fullstaticlib += [ aword ]
f.close
fullstaticbin = staticenv.Program('lighttpd-static',
staticobj,
LIBS = fullstaticlib,

Loading…
Cancel
Save