NSIS/SCons/Config/hpc++
anders_k 7cc150c464 MakeNSIS can now generate Unicode or Ansi installers based on a script attribute. SCons generates both Ansi and Unicode stubs and plugins.
The official plugins are now stored in architecture specific subdirectories under NSIS\Plugins. !AddPluginDir also gained a new (optional) architecture flag because MakeNSIS now stores separate plugin information for each target architecture. Storing plugins in the root of the Plugins directory is no longer supported.

MinGW does not implement the unicode CRT startup functions so the entry point functions and linker parameters had to be changed. The unicode tools use the ansi entry point and a small helper function that calls into the real code: _tmain has full argc+argv emulation while wWinMain does not pass the command line parameters. The stubs do not use any CRT functions and have no CRT or unicode helper code, they call our entry point directly.



git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6269 212acab6-be3b-0410-9dea-997c60f758d6
2012-10-13 01:47:50 +00:00

139 lines
3.1 KiB
Text

print "Using hpc++ tools configuration"
Import('defenv')
### flags
defenv['ENTRY_FLAG'] = lambda x,u: ''
defenv['MAP_FLAG'] = ''
defenv['EXCEPTION_FLAG'] = ''
defenv['NODEFLIBS_FLAG'] = ''
defenv['C_FLAG'] = ''
defenv['CPP_FLAG'] = ''
defenv['CPP_REQUIRES_STDLIB'] = 0
defenv['SUBSYS_CON'] = ''
defenv['SUBSYS_WIN'] = ''
defenv['MSVCRT_FLAG'] = ''
defenv['STDCALL'] = ''
### defines
defenv.Append(CPPDEFINES = [('NSISCALL', '$STDCALL')])
### unicode
tdefenv = defenv.Clone()
if tdefenv['UNICODE']:
tdefenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])
### stub environment
stub_env = defenv.Clone()
stub_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
stub_uenv = stub_env.Clone()
stub_uenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])
### makensis environment
makensis_env = tdefenv.Clone()
makensis_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
### use "$CXX -Ae" as the "$CC" compiler to build makensis
makensis_env['CC'] = makensis_env['CXX']
makensis_env.Append(CFLAGS = ['-Ae'])
### required to build makensis
makensis_env.Append(LINKFLAGS = ['-AA'])
makensis_env.Append(LINKFLAGS = ['+DD32'])
makensis_env.Append(LINKFLAGS = ['-mt'])
makensis_env.Append(CXXFLAGS = ['-AA'])
makensis_env.Append(CCFLAGS = ['+DD32'])
makensis_env.Append(CCFLAGS = ['-mt'])
### debug for makensis
if makensis_env['DEBUG']:
makensis_env.Append(CCFLAGS = ['-g'])
makensis_env.Append(LINKFLAGS = ['-g'])
### strip for makensis
if not makensis_env['DEBUG'] and makensis_env['STRIP']:
makensis_env.Append(LINKFLAGS = ['-s'])
#
# aCC defines _BIG_ENDIAN, but we use __BIG_ENDIAN__ so check and define as
# needed (is there any HPUX that is NOT big endian?).
#
def check_big_endian(ctx):
ctx.Message('Checking for if this is a big endian host... ')
test = """
#define LITTLE_ENDIAN 0
#define BIG_ENDIAN 1
#define UNKNOWN 2
int main()
{
union {
short s;
char c[sizeof(short)];
} u;
u.s = 0x0102;
if (sizeof(short) == 2) {
if (u.c[0] == 1 && u.c[1] == 2)
return (BIG_ENDIAN);
else if (u.c[0] == 2 && u.c[1] == 1)
return (LITTLE_ENDIAN);
else
return(UNKNOWN);
} else {
return (sizeof(short));
}
}
"""
result = not ctx.TryRun(test, '.c')[0]
ctx.Result(result)
return result
makensis_conf = makensis_env.Configure(custom_tests = { 'CheckBigEndian' : check_big_endian })
if makensis_conf.CheckBigEndian():
makensis_env.Append(CPPDEFINES = ['__BIG_ENDIAN__'])
if makensis_env['PLATFORM'] == 'hpux':
makensis_env.Append(CPPDEFINES = ['NSIS_HPUX_ALLOW_UNALIGNED_DATA_ACCESS'])
makensis_conf.CheckLib("unalign")
makensis_conf.CheckLib("hppa")
makensis_conf.Finish()
### plugin environment
plugin_env = defenv.Clone(no_import_lib = 1)
plugin_uenv = plugin_env.Clone()
plugin_uenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])
### util environment
util_env = tdefenv.Clone()
### cross-platform util environment
cp_util_env = tdefenv.Clone()
cp_util_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
### test environment
test_env = defenv.Clone()
test_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
# return
Return('stub_env makensis_env plugin_env util_env cp_util_env test_env stub_uenv plugin_uenv')