Include CPU architecture in the RegTool filename so Library.nsh always picks the correct version

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6859 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2017-05-14 16:16:30 +00:00
parent d80b364e1d
commit ce7078517f
7 changed files with 25 additions and 32 deletions

View file

@ -49,7 +49,7 @@ template<class T> BOOL CreateProcess(const T*p1,const T*p2,LPSECURITY_ATTRIBUTES
static bool IsWinNT()
{
#ifdef _WIN64
#if defined(_WIN64) || (defined(_M_ARM) || defined(__arm__))
return true;
#else
LPCWSTR str = L"count"; // Using this string because it's already used in other parts of the code

View file

@ -12,6 +12,8 @@ libs = Split("""
ole32
""")
Import('BuildUtil')
Import('BuildUtil env GetArcCPU')
BuildUtil(target, files, libs, entry = 'NSISWinMainNOCRT', nodeflib = True, file_name = 'RegTool.bin')
filename = 'RegTool-' + GetArcCPU(env) + '.bin'
BuildUtil(target, files, libs, entry = 'NSISWinMainNOCRT', nodeflib = True, file_name = filename)

View file

@ -121,21 +121,15 @@
;------------------------
;Setup RegTool
!ifdef NSIS_MAKENSIS64
!if "${NSIS_PTR_SIZE}" < 8
!error "Incompatible RegTool bitness, compile with 32-bit NSIS!" ; 64-bit RegTool on 32-bit Windows
!endif
!else
!if "${NSIS_PTR_SIZE}" > 4
!warning "Incompatible RegTool bitness!" ; 32-bit RegTool will probably fail to register 64-bit library
!endif
!if ! /FileExists "${NSISDIR}\Bin\RegTool-${NSIS_CPU}.bin"
!error "Missing RegTool for ${NSIS_CPU}!"
!endif
ReadRegStr $R3 HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" "${REGTOOL_KEY}"
StrCpy $R3 $R3 -4 1
IfFileExists $R3 +3
File /oname=$R2\${REGTOOL_KEY}.$__INSTALLLLIB_SESSIONGUID.exe "${NSISDIR}\Bin\RegTool.bin"
File /oname=$R2\${REGTOOL_KEY}.$__INSTALLLLIB_SESSIONGUID.exe "${NSISDIR}\Bin\RegTool-${NSIS_CPU}.bin"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" \
"${REGTOOL_KEY}" '"$R2\${REGTOOL_KEY}.$__INSTALLLLIB_SESSIONGUID.exe" /S'

View file

@ -67,21 +67,15 @@ Example:
;------------------------
;Setup RegTool
!ifdef NSIS_MAKENSIS64
!if "${NSIS_PTR_SIZE}" < 8
!error "Incompatible RegTool bitness, compile with 32-bit NSIS!" ; 64-bit RegTool on 32-bit Windows
!endif
!else
!if "${NSIS_PTR_SIZE}" > 4
!warning "Incompatible RegTool bitness!" ; 32-bit RegTool will probably fail to register 64-bit library
!endif
!if ! /FileExists "${NSISDIR}\Bin\RegTool-${NSIS_CPU}.bin"
!error "Missing RegTool for ${NSIS_CPU}!"
!endif
ReadRegStr $R3 HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" "NSIS.Library.RegTool.v3"
StrCpy $R3 $R3 -4 1
IfFileExists $R3 +3
File /oname=$R2\NSIS.Library.RegTool.v3.$HWNDPARENT.exe "${NSISDIR}\Bin\RegTool.bin"
File /oname=$R2\NSIS.Library.RegTool.v3.$HWNDPARENT.exe "${NSISDIR}\Bin\RegTool-${NSIS_CPU}.bin"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" \
"NSIS.Library.RegTool.v3" '"$R2\NSIS.Library.RegTool.v3.$HWNDPARENT.exe" /S'

View file

@ -207,13 +207,13 @@ if defenv['DEBUG']:
defenv.Append(CPPDEFINES = ['DEBUG'])
# add prefixes defines
if 'NSIS_CONFIG_CONST_DATA_PATH' in defenv['NSIS_CPPDEFINES']:
defenv.Append(NSIS_CPPDEFINES = [('PREFIX_CONF', '"%s"' % defenv.subst('$PREFIX_CONF'))])
defenv.Append(NSIS_CPPDEFINES = [('PREFIX_DATA', '"%s"' % defenv.subst('$PREFIX_DATA'))])
defenv.Append(NSIS_CPPDEFINES = [('PREFIX_DOC', '"%s"' % defenv.subst('$PREFIX_DOC'))])
# Need this early for the config header files to be placed in
if defenv['UNICODE']:
if 'NSIS_CONFIG_CONST_DATA_PATH' in defenv['NSIS_CPPDEFINES']:
defenv.Append(NSIS_CPPDEFINES = [('PREFIX_CONF', '"%s"' % defenv.subst('$PREFIX_CONF'))])
defenv.Append(NSIS_CPPDEFINES = [('PREFIX_DATA', '"%s"' % defenv.subst('$PREFIX_DATA'))])
defenv.Append(NSIS_CPPDEFINES = [('PREFIX_DOC', '"%s"' % defenv.subst('$PREFIX_DOC'))])
# Need this early for the config header files to be placed in
if defenv['UNICODE']:
if defenv['DEBUG']:
defenv.Replace(BUILD_PREFIX = 'build/udebug')
else:
@ -791,7 +791,7 @@ for util in utils:
path = 'Contrib/' + util
build_dir = '$BUILD_PREFIX/' + util
exports = {'BuildUtil' : BuildUtil, 'BuildUtilEnv' : BuildUtilEnv, 'env' : util_env}
exports = {'BuildUtil' : BuildUtil, 'BuildUtilEnv' : BuildUtilEnv, 'env' : util_env, 'GetArcCPU' : GetArcCPU}
defenv.SConscript(dirs = path, variant_dir = build_dir, duplicate = False, exports = exports)

View file

@ -134,7 +134,7 @@ CEXEBuild::CEXEBuild(signed char pponly) :
m_target_type=TARGET_X86ANSI;
#ifdef _WIN32
if (sizeof(void*) > 4) m_target_type = TARGET_AMD64; // BUGBUG: There is no instruction to select it so we force
if (sizeof(void*) > 4) m_target_type = TARGET_AMD64; // BUGBUG: scons 'TARGET_ARCH' should specify the default
#endif
build_unicode=TARGET_X86ANSI != m_target_type;
build_lockedunicodetarget=false;
@ -3844,7 +3844,7 @@ bool CEXEBuild::IsIntOrUserVar(const LineParser &line, int token) const
}
int succ;
line.gettoken_int(token, &succ);
return !!succ;
return succ != false;
}
int CEXEBuild::set_target_architecture_data()
@ -3863,6 +3863,9 @@ int CEXEBuild::set_target_architecture_data()
}
definedlist.set(_T("NSIS_PTR_SIZE"), is_target_64bit() ? _T("8") : _T("4"));
tstring cpu = get_string_prefix(get_target_suffix(m_target_type), _T("-"));
definedlist.set(_T("NSIS_CPU"), cpu.c_str()); // Used by Library.nsh to pick the correct RegTool
definedlist.del(_T("NSIS_IX86"));
definedlist.del(_T("NSIS_AMD64"));
if (TARGET_AMD64 == m_target_type)

View file

@ -34,7 +34,7 @@
extern double my_wtof(const wchar_t *str);
extern size_t my_strncpy(TCHAR*Dest, const TCHAR*Src, size_t cchMax);
static bool strtrycpy(TCHAR*Dest, const TCHAR*Src, size_t cchCap) { size_t c = my_strncpy(Dest, Src, cchCap); return c < cchCap && !Src[c]; }
template<class T> bool strtrycpy(T*Dest, const T*Src, size_t cchCap) { size_t c = my_strncpy(Dest, Src, cchCap); return c < cchCap && !Src[c]; }
size_t my_strftime(TCHAR *s, size_t max, const TCHAR *fmt, const struct tm *tm);
// Adds the bitmap in filename using resource editor re as id id.