fixed bug #1474597 - Mac OS X 10.4 build failures
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4664 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
9ed073277d
commit
991295e17f
4 changed files with 49 additions and 17 deletions
|
@ -35,6 +35,25 @@ defenv['ALIGN_FLAG'] = '-Wl,--file-alignment,512'
|
|||
defenv['CPP_REQUIRES_STDLIB'] = 1
|
||||
defenv['SUBSYS_CON'] = '-Wl,--subsystem,console'
|
||||
|
||||
### helper functions
|
||||
|
||||
# on Mac OS X, programs built with g++ 4.0, stl and -s error out:
|
||||
# dyld: lazy symbol binding failed: lazy pointer not found
|
||||
# dyld: lazy pointer not found
|
||||
#
|
||||
# to avoid this, this function checks if -s works
|
||||
|
||||
def TestStrip(ctx):
|
||||
c = """
|
||||
#include <vector>
|
||||
|
||||
int main() {
|
||||
std::vector<int> v;
|
||||
return 0;
|
||||
}
|
||||
"""
|
||||
ctx.CheckLinkFlag('-s', run = 1, extension = '.cpp', code = c)
|
||||
|
||||
### debug
|
||||
|
||||
if defenv['DEBUG']:
|
||||
|
@ -66,11 +85,10 @@ if not defenv['DEBUG']:
|
|||
makensis_env.Append(CCFLAGS = '-O2') # optimize
|
||||
makensis_env.Append(CCFLAGS = '-Wall') # all warnings
|
||||
|
||||
if not defenv['DEBUG']:
|
||||
makensis_env.Append(LINKFLAGS = '-s') # strip
|
||||
|
||||
conf = FlagsConfigure(makensis_env)
|
||||
conf.CheckLinkFlag('$MAP_FLAG') # generate map file
|
||||
if not defenv['DEBUG']:
|
||||
TestStrip(conf) # strip
|
||||
conf.Finish()
|
||||
|
||||
### plugin environment
|
||||
|
@ -93,14 +111,13 @@ plugin_env.Append(LINKFLAGS = '$MAP_FLAG') # generate map file
|
|||
cp_util_env = defenv.Copy()
|
||||
|
||||
if not defenv['DEBUG']:
|
||||
cp_util_env.Append(CCFLAGS = '-O2') # optimize
|
||||
cp_util_env.Append(CCFLAGS = '-Wall') # all warnings
|
||||
|
||||
if not defenv['DEBUG']:
|
||||
cp_util_env.Append(LINKFLAGS = '-s') # strip
|
||||
cp_util_env.Append(CCFLAGS = '-O2') # optimize
|
||||
cp_util_env.Append(CCFLAGS = '-Wall') # all warnings
|
||||
|
||||
conf = FlagsConfigure(cp_util_env)
|
||||
conf.CheckLinkFlag('$MAP_FLAG') # generate map file
|
||||
if not defenv['DEBUG']:
|
||||
TestStrip(conf) # strip
|
||||
conf.Finish()
|
||||
|
||||
### util environment
|
||||
|
|
|
@ -36,19 +36,26 @@ def check_compile_flag(ctx, flag):
|
|||
"""
|
||||
Checks if a linker flag is valid.
|
||||
"""
|
||||
def check_link_flag(ctx, flag):
|
||||
def check_link_flag(ctx, flag, run = 0, extension = '.c', code = None):
|
||||
ctx.Message('Checking for linker flag %s... ' % flag)
|
||||
|
||||
old_flags = ctx.env['LINKFLAGS']
|
||||
ctx.env.Append(LINKFLAGS = flag)
|
||||
|
||||
test = """
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
"""
|
||||
if code:
|
||||
test = code
|
||||
else:
|
||||
test = """
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
"""
|
||||
|
||||
result = ctx.TryLink(test, extension)
|
||||
|
||||
if run:
|
||||
result = result and ctx.TryRun(test, extension)[0]
|
||||
|
||||
result = ctx.TryLink(test, '.c')
|
||||
ctx.Result(result)
|
||||
|
||||
if not result:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue