From 1247550061530e8816b1c7334d3b4bf9fd9268b9 Mon Sep 17 00:00:00 2001 From: joostverburg Date: Sun, 29 Oct 2006 11:50:31 +0000 Subject: [PATCH] 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 --- Contrib/Math/SConscript | 20 ++++++--- Contrib/Math/Source/mathcrtmt.lib | Bin 0 -> 25562 bytes Docs/src/build.but | 12 ++++- INSTALL | 13 ++++-- SCons/Config/ms | 70 ++++++++++++++++++++++++++++-- SConstruct | 1 + 6 files changed, 101 insertions(+), 15 deletions(-) create mode 100644 Contrib/Math/Source/mathcrtmt.lib diff --git a/Contrib/Math/SConscript b/Contrib/Math/SConscript index ebb80a0a..ee7ea215 100644 --- a/Contrib/Math/SConscript +++ b/Contrib/Math/SConscript @@ -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 diff --git a/Contrib/Math/Source/mathcrtmt.lib b/Contrib/Math/Source/mathcrtmt.lib new file mode 100644 index 0000000000000000000000000000000000000000..698ec2b02686d9932cedcd60d36638e401dcd441 GIT binary patch literal 25562 zcmeHP3w%`7ng51Bh)IM2!$Uy{5EMkhOlI=J2SFGRO@I<2RD+OYW*{~%^FXEIQn9UZ zthMi2TiUu++uiEYF16UYTNEu~+f}q~86gzhZi@}J(qefmmHz+d-ZS^!$?GPxtZw(4 z-~G;a&-uP{?mgf6zVo`^?+o0!^(>7m+-X zG_Oed7Lm+HMTR{r;=M~`WTi;f3X#!BADb$2!9^nD-WIuVzsQ6qMJC=SGI_noluwIX zvQ}i;H6qh56}jvbva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OE8Q;IxJDb6x1sZTui2nK6fYJn+5 z9;Xz09ZPD;CuiJlNv$%a$m5h^Pi9FCYP|S0OX^lriabuKEQi#`ub71j(@*$GQ;IxJ zsZkE8iTSJnE%lfwMINUV`(Nt`3qLjZfF<=KQ;IxJDKu7_)IY!cPiP3btY4T?i4D;d7M%lHCRu$d;i!&mef$QQ1Te$1pOG2&3vk1j3&Urncr+ohib;_ zFFl30S3HTmD)fn#RJF-(1g2M4-RA|A^vrXl^JW^J1*>+}k<#W7>HRzMJn2m6#F6AZ zAGO}o(d<1O<=)fL?>!wA-_z0ZJsd^f)6w-k9cul5@Q8O)?_G|-kJh!ewM4>_Zk_?J z7jgUk3e(LwZQM1%9)n;XPw<}obC`q;?BC&-PH4fkR#6t>D(*vj|7!<%j+oIiU9ImJ zN1~s>qI@@Fp6*UePOK=IC*_*u+ScW*v0Tq5ChIz|-n{F`jrG$Nw4_J*9C{a6y?Gw| FUjPGQ=(qp? literal 0 HcmV?d00001 diff --git a/Docs/src/build.but b/Docs/src/build.but index b99e40cf..ae3c0dd2 100644 --- a/Docs/src/build.but +++ b/Docs/src/build.but @@ -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 diff --git a/INSTALL b/INSTALL index 881e5dcb..121ac517 100644 --- a/INSTALL +++ b/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 diff --git a/SCons/Config/ms b/SCons/Config/ms index 6d87312b..24baa3c5 100644 --- a/SCons/Config/ms +++ b/SCons/Config/ms @@ -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 @@ -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 diff --git a/SConstruct b/SConstruct index d65e3748..f0a0472c 100644 --- a/SConstruct +++ b/SConstruct @@ -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))