MSVC 2005 support. Add TEMP_MSVC2005=yes to the build command line.
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4796 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
f8713252aa
commit
1247550061
6 changed files with 101 additions and 15 deletions
|
@ -1,11 +1,19 @@
|
|||
target = 'Math'
|
||||
|
||||
files = Split("""
|
||||
Source/Math.c
|
||||
Source/MyMath.c
|
||||
Source/plugin.c
|
||||
Source/mathcrt.lib
|
||||
""")
|
||||
if ['TEMP_MSVC2005']:
|
||||
files = Split("""
|
||||
Source/Math.c
|
||||
Source/MyMath.c
|
||||
Source/plugin.c
|
||||
Source/mathcrtmt.lib
|
||||
""")
|
||||
else:
|
||||
files = Split("""
|
||||
Source/Math.c
|
||||
Source/MyMath.c
|
||||
Source/plugin.c
|
||||
Source/mathcrt.lib
|
||||
""")
|
||||
|
||||
libs = Split("""
|
||||
kernel32
|
||||
|
|
BIN
Contrib/Math/Source/mathcrtmt.lib
Normal file
BIN
Contrib/Math/Source/mathcrtmt.lib
Normal file
Binary file not shown.
|
@ -6,7 +6,7 @@ NSIS version 2.07 introduced a new build system, based on \W{http://www.scons.or
|
|||
|
||||
Source code is available in \W{http://nsis.cvs.sourceforge.net/nsis}{CVS} and as a separate package with every \W{http://sourceforge.net/project/showfiles.php?group_id=22049}{NSIS distribution}.
|
||||
|
||||
To build NSIS \W{http://www.python.org/}{Python} and \W{http://www.scons.org/}{SCons} must be installed. Currently, the supported version of SCons is version 0.96.91. Any version of Python above 1.6 is supported.
|
||||
To build NSIS \W{http://www.python.org/}{Python} and \W{http://www.scons.org/}{SCons} must be installed. Currently, the supported version of SCons is version 0.96.92. Any version of Python above 1.6 is supported.
|
||||
|
||||
To build, open a console, change the working directory to the root directory of NSIS and type \c{scons}. That's it. For example:
|
||||
|
||||
|
@ -51,7 +51,15 @@ To get a complete list of options SCons has to offer, type:
|
|||
|
||||
\H{build_windows} Building on Windows
|
||||
|
||||
If Microsoft Visual C++ is installed, SCons will automatically detect and use it. \W{http://msdn.microsoft.com/visualc/vctoolkit2003/}{Visual C++ Toolkit} and \W{http://www.microsoft.com/msdownload/platformsdk/sdkupdate/}{Platform SDK} is a free alternative. The build system doesn't automatically recognize the toolkit. It must be given a hint:
|
||||
If Microsoft Visual C++ is installed, SCons will automatically detect and use it.
|
||||
|
||||
SCons 0.96.92 does not yet support Microsoft Visual C++ 2005. Therefore a temporary workaround has been added to support this compiler. Add TEMP_MSVC2005=yes to the build command line when using MSVC 2005:
|
||||
|
||||
\c scons TEMP_MSVC2005=yes
|
||||
|
||||
If you are looking for a free compiler to compile NSIS, we recommend \W{http://msdn.microsoft.com/vstudio/express/visualc/download/}{Microsoft Visual C++ 2005 Express Edition}.
|
||||
|
||||
When using the Microsoft Visual C++ Toolkit, add MSTOOLKIT=yes to the build command line:
|
||||
|
||||
\c scons MSTOOLKIT=yes
|
||||
|
||||
|
|
13
INSTALL
13
INSTALL
|
@ -6,7 +6,7 @@ This is a trimmed version of Appendix "Building NSIS" of the documentation.
|
|||
- Requirements
|
||||
|
||||
* Python version 1.6 and above (http://www.python.org/)
|
||||
* SCons version 0.96.91 and above (http://www.scons.org/)
|
||||
* SCons version 0.96.92 and above (http://www.scons.org/)
|
||||
* C compiler
|
||||
|
||||
- Optional Tools
|
||||
|
@ -32,9 +32,14 @@ This is a trimmed version of Appendix "Building NSIS" of the documentation.
|
|||
|
||||
- Special cases
|
||||
|
||||
* If using the free Visual C++ Toolkit and Platform SDK
|
||||
(available at http://msdn.microsoft.com/visualc/vctoolkit2003/,
|
||||
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/),
|
||||
* SCons 0.96.92 does not yet support Microsoft Visual C++ 2005.
|
||||
Therefore a temporary workaround has been added to support this
|
||||
compiler. Add TEMP_MSVC2005=yes to the build command line when
|
||||
using MSVC 2005:
|
||||
|
||||
scons TEMP_MSVC2005=yes PREFIX=C:\NSIS install
|
||||
|
||||
* If using the free Microsoft Visual C++ Toolkit and Platform SDK,
|
||||
add MSTOOLKIT=yes to the build command line. For example:
|
||||
|
||||
scons MSTOOLKIT=yes PREFIX=C:\NSIS install
|
||||
|
|
|
@ -2,6 +2,17 @@ print "Using Microsoft tools configuration"
|
|||
|
||||
Import('defenv')
|
||||
|
||||
### workaround for MSVC 2005 support
|
||||
|
||||
import os
|
||||
|
||||
if defenv['TEMP_MSVC2005']:
|
||||
defenv['ENV']['PATH'] = os.environ.get('PATH')
|
||||
defenv['ENV']['HOME'] = os.environ.get('HOME')
|
||||
defenv['ENV']['LIB'] = os.environ.get('LIB')
|
||||
defenv['ENV']['INCLUDE'] = os.environ.get('INCLUDE')
|
||||
defenv.Append(CCFLAGS = '/GS-')
|
||||
|
||||
### flags
|
||||
|
||||
defenv['ENTRY_FLAG'] = lambda x: '/entry:' + x
|
||||
|
@ -71,7 +82,7 @@ stub_env.Append(CCFLAGS = '/W3') # level 3 warnings
|
|||
|
||||
stub_env.Append(LINKFLAGS = '/opt:nowin98') # 512 bytes align
|
||||
stub_env.Append(LINKFLAGS = '/entry:WinMain') # entry point
|
||||
stub_env.Append(LINKFLAGS = '/NODEFAULTLIB') # no default libraries
|
||||
stub_env.Append(LINKFLAGS = '$NODEFLIBS_FLAG') # no default libraries
|
||||
stub_env.Append(LINKFLAGS = '$MAP_FLAG') # generate map file
|
||||
|
||||
### makensis environment
|
||||
|
@ -118,6 +129,52 @@ test_env = defenv.Copy()
|
|||
|
||||
### weird compiler requirements
|
||||
|
||||
def check_requirement(ctx, func, trigger):
|
||||
ctx.Message('Checking for %s requirement... ' % func)
|
||||
|
||||
flags = ctx.env['LINKFLAGS']
|
||||
|
||||
ctx.env.Append(LINKFLAGS = '$NODEFLIBS_FLAG')
|
||||
|
||||
test = """
|
||||
int __main() {
|
||||
%s
|
||||
return 0;
|
||||
}
|
||||
""" % trigger
|
||||
|
||||
result = not ctx.TryLink(test, '.c')
|
||||
ctx.Result(result)
|
||||
|
||||
ctx.env['LINKFLAGS'] = flags
|
||||
|
||||
return result
|
||||
|
||||
def add_file_to_emitter(env, emitter_name, file):
|
||||
try:
|
||||
original_emitter = env[emitter_name]
|
||||
if type(original_emitter) == list:
|
||||
original_emitter = original_emitter[0]
|
||||
except KeyError:
|
||||
original_emitter = None
|
||||
|
||||
def emitter(target, source, env):
|
||||
if original_emitter:
|
||||
target, source = original_emitter(target, source, env)
|
||||
|
||||
if '$NODEFLIBS_FLAG' not in env['LINKFLAGS']:
|
||||
return target, source
|
||||
|
||||
return target, source + env.Object(emitter_name, file)
|
||||
|
||||
env[emitter_name] = emitter
|
||||
|
||||
def add_file(file):
|
||||
file = File(file)
|
||||
add_file_to_emitter(stub_env, 'PROGEMITTER', file)
|
||||
add_file_to_emitter(util_env, 'PROGEMITTER', file)
|
||||
add_file_to_emitter(plugin_env, 'SHLIBEMITTER', file)
|
||||
|
||||
#
|
||||
# MSVC 6 SP6 doesn't like direct shifting of 64-bit integers.
|
||||
# It generates a call to ___aullshr which requires libc, which
|
||||
|
@ -125,7 +182,7 @@ test_env = defenv.Copy()
|
|||
# a call to Int64ShrlMod32.
|
||||
#
|
||||
|
||||
conf = stub_env.Configure()
|
||||
conf = stub_env.Configure(custom_tests = { 'CheckRequirement' : check_requirement })
|
||||
|
||||
int64test = """
|
||||
#include <windows.h>
|
||||
|
@ -137,8 +194,15 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam,
|
|||
|
||||
if not conf.TryLink(int64test, '.c'):
|
||||
stub_env.Append(CPPDEFINES = ['_NSIS_NO_INT64_SHR'])
|
||||
|
||||
#
|
||||
# MSVC 2005 requires the memset CRT function to be present
|
||||
#
|
||||
|
||||
conf.Finish()
|
||||
if conf.CheckRequirement('memset', 'char c[128] = "test";'):
|
||||
add_file('memset.c')
|
||||
|
||||
conf.Finish()
|
||||
|
||||
### return
|
||||
|
||||
|
|
|
@ -130,6 +130,7 @@ opts.Add(ListOption('SKIPMISC', 'A list of plug-ins that will not be built', 'no
|
|||
opts.Add(ListOption('SKIPDOC', 'A list of doc files that will not be built/installed', 'none', doc))
|
||||
# build tools
|
||||
opts.Add(BoolOption('MSTOOLKIT', 'Use Microsoft Visual C++ Toolkit', 'no'))
|
||||
opts.Add(BoolOption('TEMP_MSVC2005', 'Enable temporary work-around for Microsoft Visual C++ 2005 support', 'no'))
|
||||
opts.Add(BoolOption('CHMDOCS', 'Build CHM documentation, requires hhc.exe', hhc))
|
||||
opts.Add(PathOption('CPPPATH', 'Path to search for include files', None))
|
||||
opts.Add(PathOption('LIBPATH', 'Path to search for libraries', None))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue