mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-26 06:45:37 +03:00
Merge pull request #18 from alliedmodders/static-libstdcxx
Link amxxpc with static libstdc++ on Linux.
This commit is contained in:
commit
d83ec1810a
@ -1,5 +1,7 @@
|
|||||||
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python :
|
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python :
|
||||||
import os
|
import os
|
||||||
|
import subprocess
|
||||||
|
import locale
|
||||||
|
|
||||||
class AMXXConfig(object):
|
class AMXXConfig(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -13,6 +15,7 @@ class AMXXConfig(object):
|
|||||||
self.mysql_path = None
|
self.mysql_path = None
|
||||||
self.generated_headers = None
|
self.generated_headers = None
|
||||||
self.csx_app = None
|
self.csx_app = None
|
||||||
|
self.stdcxx_path = None
|
||||||
|
|
||||||
def detectProductVersion(self):
|
def detectProductVersion(self):
|
||||||
builder.AddConfigureFile('product.version')
|
builder.AddConfigureFile('product.version')
|
||||||
@ -93,6 +96,19 @@ class AMXXConfig(object):
|
|||||||
if not self.mysql_path:
|
if not self.mysql_path:
|
||||||
raise Exception('Could not find MySQL! Try passing --mysql to configure.py.')
|
raise Exception('Could not find MySQL! Try passing --mysql to configure.py.')
|
||||||
|
|
||||||
|
# Returns list of lines of output from the compiler
|
||||||
|
@staticmethod
|
||||||
|
def invokeCompiler(args):
|
||||||
|
if builder.compiler:
|
||||||
|
p = subprocess.Popen(builder.compiler.argv + args, stdout=subprocess.PIPE)
|
||||||
|
output = p.communicate()[0]
|
||||||
|
if hasattr(output,'encoding') and output.encoding is not None:
|
||||||
|
encoding = output.encoding
|
||||||
|
else:
|
||||||
|
encoding = locale.getpreferredencoding()
|
||||||
|
return output.decode(encoding, 'replace').split('\n')
|
||||||
|
return None
|
||||||
|
|
||||||
def configure(self):
|
def configure(self):
|
||||||
builder.AddConfigureFile('pushbuild.txt')
|
builder.AddConfigureFile('pushbuild.txt')
|
||||||
|
|
||||||
@ -199,6 +215,8 @@ class AMXXConfig(object):
|
|||||||
cfg.postlink += ['-static-libgcc']
|
cfg.postlink += ['-static-libgcc']
|
||||||
elif cxx.name == 'clang':
|
elif cxx.name == 'clang':
|
||||||
cfg.postlink += ['-lgcc_eh']
|
cfg.postlink += ['-lgcc_eh']
|
||||||
|
if cxx.behavior == 'gcc':
|
||||||
|
self.stdcxx_path = self.invokeCompiler(['-m32', '-print-file-name=' + 'libstdc++.a'])[0]
|
||||||
elif builder.target_platform == 'mac':
|
elif builder.target_platform == 'mac':
|
||||||
cfg.defines += ['OSX', '_OSX', 'POSIX']
|
cfg.defines += ['OSX', '_OSX', 'POSIX']
|
||||||
cfg.cflags += ['-mmacosx-version-min=10.5']
|
cfg.cflags += ['-mmacosx-version-min=10.5']
|
||||||
|
@ -14,6 +14,7 @@ if builder.target_platform == 'linux':
|
|||||||
binary.compiler.postlink += [
|
binary.compiler.postlink += [
|
||||||
'-ldl',
|
'-ldl',
|
||||||
binary.Dep('libz.a'),
|
binary.Dep('libz.a'),
|
||||||
|
binary.Dep(AMXX.stdcxx_path),
|
||||||
]
|
]
|
||||||
elif builder.target_platform == 'mac':
|
elif builder.target_platform == 'mac':
|
||||||
binary.compiler.postlink += [binary.Dep('libz-darwin.a')]
|
binary.compiler.postlink += [binary.Dep('libz-darwin.a')]
|
||||||
|
Loading…
Reference in New Issue
Block a user