diff --git a/Docs/src/compiler.but b/Docs/src/compiler.but index fd83b179..f1add194 100644 --- a/Docs/src/compiler.but +++ b/Docs/src/compiler.but @@ -203,6 +203,14 @@ Date & time of the last modification to the script file according to the current NSIS version used to build the script. +\S1{prensispackedversion} $\{NSIS_PACKEDVERSION\} + +NSIS version as a 32 bit number. + +\c !if 0x2046000 >= ${NSIS_PACKEDVERSION} +\c !error "NSIS 2.47 or higher is required to build this installer!" +\c !endif + \S1{scopepredefines} Scope Predefines Standard predefines that contain information of the current code scope. diff --git a/SConstruct b/SConstruct index 2bb262d3..66c28000 100644 --- a/SConstruct +++ b/SConstruct @@ -142,8 +142,9 @@ Examples/gfx.nsi""")) opts.Add(('VERSION', 'Version of NSIS', cvs_version)) opts.Add(('VER_MAJOR', 'Major version of NSIS (recommended for dist-installer)', None)) opts.Add(('VER_MINOR', 'Minor version of NSIS (recommended for dist-installer)', None)) -opts.Add(('VER_REVISION', 'Revision of NSIS (recommended for dist-installer)', None)) -opts.Add(('VER_BUILD', 'Build version of NSIS (recommended for dist-installer)', None)) +opts.Add(('VER_REVISION', 'Revision of NSIS', None)) +opts.Add(('VER_BUILD', 'Build version of NSIS', None)) +opts.Add(('VER_PACKED', 'Packed version of NSIS in 0xMMmmmrrb format, used for feature detection in scripts (recommended if VER_MAJOR and VER_MINOR are not set)', None)) # installation opts.Add(('PREFIX', 'Installation prefix', dirs['prefix'])) opts.Add(ListVariable('SKIPSTUBS', 'A list of stubs that will not be built', 'none', stubs)) @@ -235,6 +236,16 @@ f = open(defenv.File('#$BUILD_CONFIG/nsis-version.h').abspath, 'w') f.write('// This file is automatically generated by SCons\n// DO NOT EDIT THIS FILE\n') f.write('#include "tchar.h"\n') +if (not defenv.has_key('VER_PACKED')) and defenv.has_key('VER_MAJOR') and defenv.has_key('VER_MINOR'): + packed_r = packed_b = 0 + if defenv.has_key('VER_REVISION'): + packed_r = int(defenv['VER_REVISION']) + if defenv.has_key('VER_BUILD'): + packed_r = int(defenv['VER_BUILD']) + defenv['VER_PACKED'] = '0x%0.2i%0.3i%0.2i%0.1i' % (int(defenv['VER_MAJOR']),int(defenv['VER_MINOR']),packed_r,packed_b) +if defenv.has_key('VER_PACKED'): + f.write('#define NSIS_PACKEDVERSION _T("%s")\n' % defenv['VER_PACKED']) + if defenv.has_key('VER_MAJOR'): defenv['VERSION'] = defenv['VER_MAJOR'] if defenv.has_key('VER_MINOR'): diff --git a/Source/build.cpp b/Source/build.cpp index 5c23c1ca..6df36ae7 100644 --- a/Source/build.cpp +++ b/Source/build.cpp @@ -131,6 +131,9 @@ CEXEBuild::CEXEBuild() : ns_label.add(_T(""),0); definedlist.add(_T("NSIS_VERSION"), NSIS_VERSION); +#ifdef NSIS_PACKEDVERSION + definedlist.add(_T("NSIS_PACKEDVERSION"), NSIS_PACKEDVERSION); +#endif target_minimal_OS=0; build_unicode=false;