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
This commit is contained in:
parent
8f330bbbdf
commit
7cc150c464
73 changed files with 936 additions and 713 deletions
|
@ -4,7 +4,7 @@ Import('defenv')
|
|||
|
||||
### flags
|
||||
|
||||
defenv['ENTRY_FLAG'] = lambda x: ''
|
||||
defenv['ENTRY_FLAG'] = lambda x,u: ''
|
||||
defenv['MAP_FLAG'] = ''
|
||||
defenv['EXCEPTION_FLAG'] = ''
|
||||
defenv['NODEFLIBS_FLAG'] = ''
|
||||
|
@ -12,6 +12,7 @@ defenv['C_FLAG'] = ''
|
|||
defenv['CPP_FLAG'] = ''
|
||||
defenv['CPP_REQUIRES_STDLIB'] = 0
|
||||
defenv['SUBSYS_CON'] = ''
|
||||
defenv['SUBSYS_WIN'] = ''
|
||||
defenv['MSVCRT_FLAG'] = ''
|
||||
defenv['STDCALL'] = ''
|
||||
|
||||
|
@ -19,15 +20,23 @@ defenv['STDCALL'] = ''
|
|||
|
||||
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 = defenv.Clone()
|
||||
makensis_env = tdefenv.Clone()
|
||||
|
||||
makensis_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
|
||||
|
||||
|
@ -35,13 +44,16 @@ makensis_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
|
|||
|
||||
plugin_env = defenv.Clone(no_import_lib = 1)
|
||||
|
||||
plugin_uenv = plugin_env.Clone()
|
||||
plugin_uenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])
|
||||
|
||||
### util environment
|
||||
|
||||
util_env = defenv.Clone()
|
||||
util_env = tdefenv.Clone()
|
||||
|
||||
### cross-platform util environment
|
||||
|
||||
cp_util_env = util_env.Clone()
|
||||
cp_util_env = tdefenv.Clone()
|
||||
|
||||
cp_util_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
|
||||
|
||||
|
@ -53,4 +65,4 @@ test_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
|
|||
|
||||
# return
|
||||
|
||||
Return('stub_env makensis_env plugin_env util_env cp_util_env test_env stub_env plugin_env')
|
||||
Return('stub_env makensis_env plugin_env util_env cp_util_env test_env stub_uenv plugin_uenv')
|
||||
|
|
|
@ -14,9 +14,9 @@ def cross_env(env):
|
|||
|
||||
### flags
|
||||
|
||||
def entry(x):
|
||||
if x == 'WinMain':
|
||||
x = '_WinMain@16'
|
||||
def entry(x,u):
|
||||
if x == 'NSISWinMainNOCRT':
|
||||
x = '_' + x
|
||||
elif x == 'DllMain':
|
||||
x = '_DllMain@12'
|
||||
return '-Wl,-e%s' % x
|
||||
|
@ -30,6 +30,7 @@ defenv['CPP_FLAG'] = '-xc++'
|
|||
defenv['ALIGN_FLAG'] = '-Wl,--file-alignment,512'
|
||||
defenv['CPP_REQUIRES_STDLIB'] = 1
|
||||
defenv['SUBSYS_CON'] = '-Wl,--subsystem,console'
|
||||
defenv['SUBSYS_WIN'] = '-Wl,--subsystem,windows'
|
||||
defenv['MSVCRT_FLAG'] = ''
|
||||
defenv['STDCALL'] = '"__attribute__((__stdcall__))"'
|
||||
|
||||
|
@ -66,6 +67,11 @@ def TestStrip(ctx):
|
|||
if defenv['DEBUG']:
|
||||
defenv.Append(CCFLAGS = '-g')
|
||||
|
||||
### unicode
|
||||
tdefenv = defenv.Clone()
|
||||
if tdefenv['UNICODE']:
|
||||
tdefenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])
|
||||
|
||||
### stub environment
|
||||
|
||||
stub_env = defenv.Clone()
|
||||
|
@ -84,12 +90,14 @@ if not defenv['DEBUG'] and defenv['STRIP'] and defenv['STRIP_W32']:
|
|||
stub_env.Append(LINKFLAGS = ['-mwindows']) # build windows executables
|
||||
stub_env.Append(LINKFLAGS = ['$NODEFLIBS_FLAG']) # no standard libraries
|
||||
stub_env.Append(LINKFLAGS = ['$ALIGN_FLAG']) # 512 bytes align
|
||||
stub_env.Append(LINKFLAGS = ['-Wl,-e,_WinMain@16']) # entry point
|
||||
stub_env.Append(LINKFLAGS = ['$MAP_FLAG']) # generate map file
|
||||
|
||||
stub_uenv = stub_env.Clone()
|
||||
stub_uenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])
|
||||
|
||||
### makensis environment
|
||||
|
||||
makensis_env = defenv.Clone()
|
||||
makensis_env = tdefenv.Clone()
|
||||
|
||||
makensis_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
|
||||
|
||||
|
@ -122,12 +130,18 @@ plugin_env.Append(LINKFLAGS = ['$ALIGN_FLAG']) # 512 bytes align
|
|||
plugin_env.Append(LINKFLAGS = ['$MAP_FLAG']) # generate map file
|
||||
plugin_env.Append(LINKFLAGS = ['-static-libgcc']) # remove libgcc*.dll dependency
|
||||
|
||||
plugin_uenv = plugin_env.Clone()
|
||||
plugin_uenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])
|
||||
|
||||
### cross-platform util environment
|
||||
|
||||
cp_util_env = defenv.Clone()
|
||||
cp_util_env = tdefenv.Clone()
|
||||
|
||||
cp_util_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
|
||||
|
||||
if cp_util_env['PLATFORM'] == 'win32':
|
||||
cp_util_env.Append(LINKFLAGS = ['$ALIGN_FLAG'])
|
||||
|
||||
if not defenv['DEBUG']:
|
||||
cp_util_env.Append(CCFLAGS = ['-O2']) # optimize
|
||||
cp_util_env.Append(CCFLAGS = ['-Wall']) # all warnings
|
||||
|
@ -145,6 +159,7 @@ cross_env(util_env)
|
|||
util_env.Append(LINKFLAGS = ['-mwindows']) # build windows executables
|
||||
util_env.Append(LINKFLAGS = ['$ALIGN_FLAG']) # 512 bytes align
|
||||
|
||||
|
||||
conf = FlagsConfigure(util_env)
|
||||
if not defenv['DEBUG'] and defenv['STRIP'] and defenv['STRIP_W32']:
|
||||
util_env.Append(LINKFLAGS = ['-s']) # strip
|
||||
|
@ -177,6 +192,8 @@ conf.Finish()
|
|||
#
|
||||
|
||||
stub_env.Append(LINKFLAGS = ['-T', File('linker_script').rfile()])
|
||||
stub_uenv.Append(LINKFLAGS = ['-T', File('linker_script').rfile()])
|
||||
|
||||
|
||||
#
|
||||
# GCC requires some functions from the CRT to be present, if certain
|
||||
|
@ -314,4 +331,4 @@ if makensis_env['PLATFORM'] == 'hpux':
|
|||
|
||||
### return
|
||||
|
||||
Return('stub_env makensis_env plugin_env util_env cp_util_env test_env stub_env plugin_env')
|
||||
Return('stub_env makensis_env plugin_env util_env cp_util_env test_env stub_uenv plugin_uenv')
|
||||
|
|
|
@ -4,7 +4,7 @@ Import('defenv')
|
|||
|
||||
### flags
|
||||
|
||||
defenv['ENTRY_FLAG'] = lambda x: ''
|
||||
defenv['ENTRY_FLAG'] = lambda x,u: ''
|
||||
defenv['MAP_FLAG'] = ''
|
||||
defenv['EXCEPTION_FLAG'] = ''
|
||||
defenv['NODEFLIBS_FLAG'] = ''
|
||||
|
@ -12,6 +12,7 @@ defenv['C_FLAG'] = ''
|
|||
defenv['CPP_FLAG'] = ''
|
||||
defenv['CPP_REQUIRES_STDLIB'] = 0
|
||||
defenv['SUBSYS_CON'] = ''
|
||||
defenv['SUBSYS_WIN'] = ''
|
||||
defenv['MSVCRT_FLAG'] = ''
|
||||
defenv['STDCALL'] = ''
|
||||
|
||||
|
@ -19,15 +20,22 @@ defenv['STDCALL'] = ''
|
|||
|
||||
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 = defenv.Clone()
|
||||
makensis_env = tdefenv.Clone()
|
||||
|
||||
makensis_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
|
||||
|
||||
|
@ -107,13 +115,16 @@ makensis_conf.Finish()
|
|||
|
||||
plugin_env = defenv.Clone(no_import_lib = 1)
|
||||
|
||||
plugin_uenv = plugin_env.Clone()
|
||||
plugin_uenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])
|
||||
|
||||
### util environment
|
||||
|
||||
util_env = defenv.Clone()
|
||||
util_env = tdefenv.Clone()
|
||||
|
||||
### cross-platform util environment
|
||||
|
||||
cp_util_env = util_env.Clone()
|
||||
cp_util_env = tdefenv.Clone()
|
||||
|
||||
cp_util_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
|
||||
|
||||
|
@ -125,4 +136,4 @@ test_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
|
|||
|
||||
# return
|
||||
|
||||
Return('stub_env makensis_env plugin_env util_env cp_util_env test_env stub_env plugin_env')
|
||||
Return('stub_env makensis_env plugin_env util_env cp_util_env test_env stub_uenv plugin_uenv')
|
||||
|
|
|
@ -10,13 +10,19 @@ if SCons.__version__ == '1.3.0':
|
|||
# force inclusion of Platform SDK, sometimes ignored by SCons 1.3.0 due to environment contamination
|
||||
defenv.Tool('mssdk')
|
||||
|
||||
defenv['ENTRY_FLAG'] = lambda x: '/entry:' + x
|
||||
def entry(x,u):
|
||||
if x == 'WinMain' and u:
|
||||
x = 'w' + x
|
||||
return '/entry:' + x
|
||||
|
||||
defenv['ENTRY_FLAG'] = entry
|
||||
defenv['MAP_FLAG'] = '/map'
|
||||
defenv['NODEFLIBS_FLAG'] = '/NODEFAULTLIB'
|
||||
defenv['C_FLAG'] = '/TC'
|
||||
defenv['CPP_FLAG'] = '/TP'
|
||||
defenv['CPP_REQUIRES_STDLIB'] = 0
|
||||
defenv['SUBSYS_CON'] = '/subsystem:console'
|
||||
defenv['SUBSYS_WIN'] = '/subsystem:windows'
|
||||
defenv['MSVCRT_FLAG'] = '/MD'
|
||||
defenv['STDCALL'] = '__stdcall'
|
||||
|
||||
|
@ -112,9 +118,7 @@ stub_env.Append(LINKFLAGS = ['$NODEFLIBS_FLAG']) # no default libraries
|
|||
stub_env.Append(LINKFLAGS = ['$MAP_FLAG']) # generate map file
|
||||
|
||||
stub_uenv = stub_env.Clone()
|
||||
stub_uenv.Append(LINKFLAGS = ['/entry:wWinMain']) # Unicode entry point
|
||||
stub_uenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])
|
||||
stub_env.Append(LINKFLAGS = ['/entry:WinMain']) # ANSI entry point
|
||||
|
||||
### makensis environment
|
||||
|
||||
|
@ -228,28 +232,19 @@ def add_file(file):
|
|||
|
||||
conf = stub_env.Configure()
|
||||
|
||||
if defenv['UNICODE']:
|
||||
int64test = """
|
||||
#include <windows.h>
|
||||
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPTSTR lpszCmdParam, int nCmdShow) {
|
||||
ULARGE_INTEGER *i = 0;
|
||||
return (int)(i->QuadPart >> 10);
|
||||
}
|
||||
"""
|
||||
else:
|
||||
int64test = """
|
||||
#include <windows.h>
|
||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam, int nCmdShow) {
|
||||
ULARGE_INTEGER *i = 0;
|
||||
return (int)(i->QuadPart >> 10);
|
||||
}
|
||||
"""
|
||||
int64test = """
|
||||
#include <windows.h>
|
||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam, int nCmdShow) {
|
||||
ULARGE_INTEGER *i = 0;
|
||||
return (int)(i->QuadPart >> 10);
|
||||
}
|
||||
"""
|
||||
|
||||
if not conf.TryLink(int64test, '.c'):
|
||||
stub_env.Append(CPPDEFINES = ['_NSIS_NO_INT64_SHR'])
|
||||
stub_uenv.Append(CPPDEFINES = ['_NSIS_NO_INT64_SHR'])
|
||||
|
||||
conf.Finish()
|
||||
conf.Finish()
|
||||
|
||||
#
|
||||
# MSVC 2005 requires the memset CRT function to be present
|
||||
|
@ -260,7 +255,7 @@ conf = defenv.Configure(custom_tests = { 'CheckRequirement' : check_requirement
|
|||
if conf.CheckRequirement('memset', 'char c[128] = "test";'):
|
||||
add_file('memset.c')
|
||||
|
||||
conf.Finish()
|
||||
conf.Finish()
|
||||
|
||||
### return
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue