mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-20 10:35:50 +00:00
Change link order for static links
This commit is contained in:
19
SConstruct
19
SConstruct
@@ -393,16 +393,15 @@ def config_base(env):
|
|||||||
env.Append(CPPPATH=[os.path.join(profile_jemalloc, 'include')])
|
env.Append(CPPPATH=[os.path.join(profile_jemalloc, 'include')])
|
||||||
env.Append(LINKFLAGS=['-Wl,-rpath,' + os.path.join(profile_jemalloc, 'lib')])
|
env.Append(LINKFLAGS=['-Wl,-rpath,' + os.path.join(profile_jemalloc, 'lib')])
|
||||||
|
|
||||||
def add_static_libs(env, libs):
|
def add_static_libs(env, static_libs, dyn_libs=None):
|
||||||
if not 'HASSTATICLIBS' in env:
|
if not 'HASSTATICLIBS' in env:
|
||||||
env['HASSTATICLIBS'] = True
|
env['HASSTATICLIBS'] = True
|
||||||
env['STATICLIBS'] = ''
|
env.Replace(LINKCOM=env['LINKCOM'] + " -Wl,-Bstatic $STATICLIBS -Wl,-Bdynamic $DYNAMICLIBS")
|
||||||
env.Replace(LINKCOM=env['LINKCOM'] + " -Wl,-Bstatic $STATICLIBS")
|
for k,l in [('STATICLIBS', static_libs or []), ('DYNAMICLIBS', dyn_libs or [])]:
|
||||||
c = env['STATICLIBS']
|
c = env.get(k, '')
|
||||||
if c == None: c = ''
|
for f in l:
|
||||||
for f in libs:
|
|
||||||
c += ' -l' + f
|
c += ' -l' + f
|
||||||
env['STATICLIBS'] = c
|
env[k] = c
|
||||||
|
|
||||||
def get_libs(lib, static):
|
def get_libs(lib, static):
|
||||||
'''Returns a tuple of lists. The first element is the static libs,
|
'''Returns a tuple of lists. The first element is the static libs,
|
||||||
@@ -453,9 +452,9 @@ def config_env(toolchain, variant, env):
|
|||||||
link_static = should_link_static()
|
link_static = should_link_static()
|
||||||
for l in ['openssl', 'protobuf']:
|
for l in ['openssl', 'protobuf']:
|
||||||
static, dynamic = get_libs(l, link_static)
|
static, dynamic = get_libs(l, link_static)
|
||||||
if static:
|
if link_static:
|
||||||
add_static_libs(env, static)
|
add_static_libs(env, static, dynamic)
|
||||||
if dynamic:
|
else:
|
||||||
env.Append(LIBS=dynamic)
|
env.Append(LIBS=dynamic)
|
||||||
env.ParseConfig('pkg-config --static --cflags ' + l)
|
env.ParseConfig('pkg-config --static --cflags ' + l)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user