| diff -aurN 002/SConstruct 003/SConstruct |
| --- 002/SConstruct |
| +++ 003/SConstruct |
| @@ -299,10 +299,8 @@ |
| def GetArcSuffix(env, unicode = None): |
| if unicode is None: |
| unicode = 'UNICODE' in env['CPPDEFINES'] |
| - suff = '-unicode' |
| - if not unicode: |
| - suff = '-ansi' |
| - return GetArcCPU(env) + suff |
| + # We do not use GetArcCPU here because this is constant in the MSYS2 package |
| + return 'unicode' if unicode else 'ansi' |
| |
| ###################################################################### |
| ####### Distribution ### |
| diff -aurN 002/Source/build.cpp 003/Source/build.cpp |
| --- 002/Source/build.cpp |
| +++ 003/Source/build.cpp |
| @@ -3600,7 +3600,7 @@ |
| |
| tstring searchPath = definedlist.find(_T("NSISDIR")); |
| searchPath += PLATFORM_PATH_SEPARATOR_STR _T("Plugins") PLATFORM_PATH_SEPARATOR_STR; |
| - searchPath += get_target_suffix(); |
| + searchPath += get_target_suffix(false); |
| |
| SCRIPT_MSG(_T("Processing default plugins: \"%") NPRIs PLATFORM_PATH_SEPARATOR_STR _T("*.dll\"\n"), searchPath.c_str()); |
| if (!m_pPlugins->Initialize(searchPath.c_str(), is_target_64bit(), !!display_script)) |
| @@ -3869,14 +3869,14 @@ |
| return success ? PS_OK : PS_ERROR; |
| } |
| |
| -const TCHAR* CEXEBuild::get_target_suffix(CEXEBuild::TARGETTYPE tt, const TCHAR*defval) const |
| +const TCHAR* CEXEBuild::get_target_suffix(CEXEBuild::TARGETTYPE tt, const bool include_arch, const TCHAR*defval) const |
| { |
| switch(tt) |
| { |
| - case TARGET_X86ANSI : return _T("x86-ansi"); |
| - case TARGET_X86UNICODE: return _T("x86-unicode"); |
| - case TARGET_AMD64 : return _T("amd64-unicode"); |
| - case TARGET_ARM64 : return _T("arm64-unicode"); |
| + case TARGET_X86ANSI : return include_arch? _T("x86-ansi") : _T("ansi"); |
| + case TARGET_X86UNICODE: return include_arch? _T("x86-unicode") : _T("unicode"); |
| + case TARGET_AMD64 : return include_arch? _T("amd64-unicode") : _T("unicode"); |
| + case TARGET_ARM64 : return include_arch? _T("arm64-unicode") : _T("unicode"); |
| default: return defval; |
| } |
| } |
| @@ -3912,10 +3912,22 @@ |
| |
| CEXEBuild::TARGETTYPE CEXEBuild::get_target_type(const TCHAR*s) const |
| { |
| + tstring str = s; |
| +#if defined(__GNUC__) |
| + if (s && !_tcsstr(s, _TEXT("-"))) |
| +#if defined(__x86_64__) || defined(__LP64__) |
| + str = _TEXT("amd64-") + str; |
| +#else |
| + str = _TEXT("x86-") + str; |
| +#endif |
| +#endif |
| + |
| for(int i = CEXEBuild::TARGETFIRST; i < CEXEBuild::TARGETCOUNT; ++i) |
| { |
| CEXEBuild::TARGETTYPE tt = (CEXEBuild::TARGETTYPE) i; |
| - if (!_tcsicmp(get_target_suffix(tt, _T("")),s) && *s) return tt; |
| + if (!_tcsicmp(get_target_suffix(tt, true, _T("")),str.c_str()) && *s) return tt; |
| + if (!_tcsicmp(get_target_suffix(tt, false, _T("")),str.c_str()) && *s) return tt; |
| + |
| } |
| return TARGET_UNKNOWN; |
| } |
| @@ -3926,17 +3938,22 @@ |
| errstr += _T(": Target parameter must be one of: "), errstr += prefix; |
| for(int comma = 0, i = CEXEBuild::TARGETFIRST; i < CEXEBuild::TARGETCOUNT; ++i) |
| { |
| - const TCHAR *ts = get_target_suffix((CEXEBuild::TARGETTYPE) i, 0); |
| + // TODO: test this |
| + const TCHAR *ts = get_target_suffix((CEXEBuild::TARGETTYPE) i, true, 0); |
| + const TCHAR *ts2 = get_target_suffix((CEXEBuild::TARGETTYPE) i, false, 0); |
| if (!ts) continue; |
| if (comma++) errstr += _T(", "), errstr += prefix; |
| errstr += ts; |
| + if (!ts2) continue; |
| + errstr += _T(", /"); |
| + errstr += ts2; |
| } |
| ERROR_MSG(_T("Error: %") NPRIs _T("\n"), errstr.c_str()); |
| } |
| |
| int CEXEBuild::load_stub() |
| { |
| - return update_exehead(stub_filename+_T("-")+get_target_suffix(), &m_exehead_original_size); |
| + return update_exehead(stub_filename+_T("-")+get_target_suffix(false), &m_exehead_original_size); |
| } |
| |
| int CEXEBuild::update_exehead(const tstring& file, size_t *size/*=NULL*/) { |
| diff -aurN 002/Source/build.h 003/Source/build.h |
| --- 002/Source/build.h |
| +++ 003/Source/build.h |
| @@ -235,8 +235,8 @@ |
| TARGETTYPE m_target_type; |
| TARGETTYPE get_target_type(const TCHAR*s) const; |
| bool m_previous_x86_unicode; |
| - const TCHAR* get_target_suffix(CEXEBuild::TARGETTYPE tt, const TCHAR*defval = _T("?")) const; |
| - const TCHAR* get_target_suffix() const { return get_target_suffix(m_target_type); } |
| + const TCHAR* get_target_suffix(CEXEBuild::TARGETTYPE tt, const bool include_arch, const TCHAR*defval = _T("?")) const; |
| + const TCHAR* get_target_suffix(const bool include_arch) const { return get_target_suffix(m_target_type, include_arch); } |
| static bool is_targettype_64bit(TARGETTYPE tt) { return TARGET_AMD64 == tt || TARGET_ARM64 == tt; } |
| bool is_target_64bit() const { return is_targettype_64bit(m_target_type); } |
| void print_bad_targettype_parameter(const TCHAR*cmdname, const TCHAR*prefix = _T("")) const; |
| diff -aurN 002/Source/makenssi.cpp 003/Source/makenssi.cpp |
| --- 002/Source/makenssi.cpp |
| +++ 003/Source/makenssi.cpp |
| @@ -660,7 +660,7 @@ |
| _ftprintf(g_output,_T("\nProcessed ")); |
| if (files_processed) _ftprintf(g_output,_T("%d file%") NPRIs _T(", "),files_processed,files_processed==1?_T(""):_T("s")); |
| if (cmds_processed) _ftprintf(g_output,_T("%d command line command%") NPRIs _T(", "),cmds_processed,cmds_processed==1?_T(""):_T("s")); |
| - _ftprintf(g_output,_T("writing output (%") NPRIs _T("):\n"),build.get_target_suffix()); |
| + _ftprintf(g_output,_T("writing output (%") NPRIs _T("):\n"),build.get_target_suffix(true)); |
| fflush(g_output); |
| } |
| |
| diff -aurN 002/Source/script.cpp 003/Source/script.cpp |
| --- 002/Source/script.cpp |
| +++ 003/Source/script.cpp |
| @@ -3698,7 +3698,7 @@ |
| { |
| pluginfullpath = definedlist.find(_T("NSISDIR")); |
| pluginfullpath += tstring(PLATFORM_PATH_SEPARATOR_STR) + _T("Plugins"); |
| - pluginfullpath += tstring(PLATFORM_PATH_SEPARATOR_STR) + get_target_suffix(); |
| + pluginfullpath += tstring(PLATFORM_PATH_SEPARATOR_STR) + get_target_suffix(false); |
| pluginfullpath += tstring(PLATFORM_PATH_SEPARATOR_STR) + t; |
| } |
| t = (TCHAR*) pluginfullpath.c_str(); |