From 52ac543360fef82dc79802352c5519a9a118b51d Mon Sep 17 00:00:00 2001 From: anders_k Date: Fri, 7 Dec 2018 22:06:47 +0000 Subject: [PATCH] Removed LibraryLocal utility git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7061 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/Library/LibraryLocal/LibraryLocal.cpp | 103 ------------------ Contrib/Library/LibraryLocal/SConscript | 38 ------- Docs/src/build.but | 3 - Docs/src/history.but | 2 + Examples/makensis.nsi | 1 - Include/Library.nsh | 41 ++----- SConstruct | 1 - 7 files changed, 14 insertions(+), 175 deletions(-) delete mode 100644 Contrib/Library/LibraryLocal/LibraryLocal.cpp delete mode 100644 Contrib/Library/LibraryLocal/SConscript diff --git a/Contrib/Library/LibraryLocal/LibraryLocal.cpp b/Contrib/Library/LibraryLocal/LibraryLocal.cpp deleted file mode 100644 index d7847fe1..00000000 --- a/Contrib/Library/LibraryLocal/LibraryLocal.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - - LibraryLocal - used by the Library.nsh macros - Get the version of local DLL and TLB files - Written by Joost Verburg - POSIX DLL version support by kichik -- 20070415 - Unicode support by Jim Park -- 20070727 - POSIX TLB version support by anders_k -- 20170929 - -*/ - -#include "../../../Source/Platform.h" -#include "../../../Source/tstring.h" - -#include -#include -#include - -#include "../../../Source/BinInterop.h" -#include "../../../Source/util.h" -#include "../../../Source/winchar.h" - -using namespace std; - -int g_noconfig=0; // TODO: Not used? -NSISRT_DEFINEGLOBALS(); - -enum { - EC_SUCCESS = 0, - EC_NO_VERSION_PRESENT = 1, - EC_UNSUPPORTED_FORMAT = 10, // TODO: POSIX should return this for 16-bit NE files - EC_FILE_NOT_FOUND = 15, - EC_INVALID_PARAMETER = 20, - EC_FILE_IO_ERROR = 50, - EC_UNKNOWN_ERROR = 99 -}; - -NSIS_ENTRYPOINT_TMAIN -int _tmain(int argc, TCHAR* argv[]) -{ - if (!NSISRT_Initialize()) return EC_UNKNOWN_ERROR; - - tstring appmode; - const TCHAR *filename; - int filefound = 0, exitcode = EC_INVALID_PARAMETER; - - if (argc != 4) - return EC_INVALID_PARAMETER; - - appmode = argv[1]; - filename = argv[2]; - - // Validate filename - FILE*fIn = FOPEN(filename, ("rb")); - filefound = !!fIn; - if (fIn) - fclose(fIn); - - int versionfound = 0; - DWORD low = 0, high = 0; - - if (filefound) - { - // DLL/EXE version - if (appmode.compare(_T("D")) == 0) - { - versionfound = GetDLLVersion(filename, high, low); - } - - // TLB version - if (appmode.compare(_T("T")) == 0) - { - versionfound = GetTLBVersion(filename, high, low); - } - } - - // Write the version to a NSIS header file - FILE*fHdr = FOPEN(argv[3], ("wt")); - if (!fHdr) return EC_FILE_IO_ERROR; - - fputs("!warning \"LibraryLocal is deprecated, use !getdllversion /packed\"\n", fHdr); - - // File content is always ASCII so we don't use TCHAR - if (!filefound) - { - fputs("!define LIBRARY_VERSION_FILENOTFOUND\n", fHdr); - exitcode = EC_FILE_NOT_FOUND; - } - else if (!versionfound) - { - fputs("!define LIBRARY_VERSION_NONE\n", fHdr); - exitcode = EC_NO_VERSION_PRESENT; - } - else - { - fprintf(fHdr, "!define LIBRARY_VERSION_HIGH %lu\n", static_cast(high)); - fprintf(fHdr, "!define LIBRARY_VERSION_LOW %lu\n", static_cast(low)); - exitcode = EC_SUCCESS; - } - - fclose(fHdr); - return exitcode; -} diff --git a/Contrib/Library/LibraryLocal/SConscript b/Contrib/Library/LibraryLocal/SConscript deleted file mode 100644 index cb315d60..00000000 --- a/Contrib/Library/LibraryLocal/SConscript +++ /dev/null @@ -1,38 +0,0 @@ -target = 'LibraryLocal' - -files = Split(""" - LibraryLocal.cpp -""") - -required_files = Split(""" - #Source/ResourceEditor.cpp - #Source/BinInterop.cpp - #Source/util.cpp - #Source/winchar.cpp -""") - -libs = Split(""" - oleaut32 - version -""") - -libs_posix = Split(""" - iconv -""") - -Import('BuildUtil BuildUtilEnv GetAvailableLibs') - -env = BuildUtilEnv(flags = ['$EXCEPTION_FLAG'], cross_platform = True, cli = True) - -import os.path - -for s in required_files: - fn = os.path.split(s)[-1] - bn = os.path.splitext(fn)[0] - o = env.Object(bn, s) - files.append(o) - -if env['PLATFORM'] != 'win32': - libs = GetAvailableLibs(env, libs_posix) - -BuildUtil(target, files, libs, flags = ['$EXCEPTION_FLAG'], cross_platform = True, cli = True) diff --git a/Docs/src/build.but b/Docs/src/build.but index 91044782..0545f7be 100644 --- a/Docs/src/build.but +++ b/Docs/src/build.but @@ -112,9 +112,6 @@ If no cross-compiler is available, use the following: \c scons SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all \c NSIS_CONFIG_CONST_DATA_PATH=no PREFIX=/path/to/extracted/zip \c install-compiler -\c -\c scons NSIS_CONFIG_CONST_DATA_PATH=no PREFIX=/path/to/extracted/zip -\c /path/to/extracted/zip/LibraryLocal This should only build makensis and install it to the directory where a precompiled package, such as the \R{build_nightly}{nightly build} or a \W{http://sourceforge.net/project/showfiles.php?group_id=22049}{zipped release version} (nsis-x.xx.zip), is extracted. Note that the in order for this to work, the precompiled package must be compiled using the exact same sources as makensis. In particular, \c{Source\\exehead\\config.h}, the options passed to scons and \c{Source\\exehead\\fileform.h} must be identical. Nightly builds and zipped release versions are built with the default options. diff --git a/Docs/src/history.but b/Docs/src/history.but index bb9b41d9..324f50b6 100644 --- a/Docs/src/history.but +++ b/Docs/src/history.but @@ -32,6 +32,8 @@ Released on ??? ??th, 20?? \b MakeNSIS prints -CMDHELP to stdout (\W{http://sf.net/p/nsis/bugs/1203}{bug #1203}) +\b Removed LibraryLocal utility + \S2{} Translations \b Added Hind\u012b{i} (\W{http://sf.net/p/nsis/patches/289}{patch #289}) diff --git a/Examples/makensis.nsi b/Examples/makensis.nsi index acfd9b04..858fac89 100644 --- a/Examples/makensis.nsi +++ b/Examples/makensis.nsi @@ -247,7 +247,6 @@ ${MementoSection} "NSIS Core Files (required)" SecCore RMDir $INSTDIR\Docs SetOutPath $INSTDIR\Bin - File ..\Bin\LibraryLocal.exe !if ${BITS} >= 64 File /NonFatal ..\Bin\RegTool-x86.bin File ..\Bin\RegTool-amd64.bin diff --git a/Include/Library.nsh b/Include/Library.nsh index 06f72dda..41bcea65 100644 --- a/Include/Library.nsh +++ b/Include/Library.nsh @@ -156,36 +156,19 @@ ### Get library version !macro __InstallLib_Helper_GetVersion TYPE FILE - !ifdef LIBRARY_USELIBRARYLOCALHELPER - !tempfile LIBRARY_TEMP_NSH - - !ifdef NSIS_WIN32_MAKENSIS - !execute '"${NSISDIR}\Bin\LibraryLocal.exe" "${TYPE}" "${FILE}" "${LIBRARY_TEMP_NSH}"' - !else - !execute 'LibraryLocal "${TYPE}" "${FILE}" "${LIBRARY_TEMP_NSH}"' - !endif - - !include "${LIBRARY_TEMP_NSH}" - !delfile "${LIBRARY_TEMP_NSH}" - !undef LIBRARY_TEMP_NSH - - !else - - !if "${TYPE}" == "D" - !getdllversion /NoErrors /Packed "${FILE}" LIBRARY_VERSION_ - !else if "${TYPE}" == "T" - !gettlbversion /NoErrors /Packed "${FILE}" LIBRARY_VERSION_ - !endif - - ; Emulate the old LibraryLocal defines - !ifndef LIBRARY_VERSION_HIGH - !define LIBRARY_VERSION_FILENOTFOUND - !else if "${LIBRARY_VERSION_HIGH}" == "" - !define LIBRARY_VERSION_NONE - !undef LIBRARY_VERSION_HIGH - !undef LIBRARY_VERSION_LOW - !endif + !if "${TYPE}" == "D" + !getdllversion /NoErrors /Packed "${FILE}" LIBRARY_VERSION_ + !else if "${TYPE}" == "T" + !gettlbversion /NoErrors /Packed "${FILE}" LIBRARY_VERSION_ + !endif + ; Emulate the old LibraryLocal defines + !ifndef LIBRARY_VERSION_HIGH + !define LIBRARY_VERSION_FILENOTFOUND + !else if "${LIBRARY_VERSION_HIGH}" == "" + !define LIBRARY_VERSION_NONE + !undef LIBRARY_VERSION_HIGH + !undef LIBRARY_VERSION_LOW !endif !macroend diff --git a/SConstruct b/SConstruct index 7823abd1..dffcd624 100644 --- a/SConstruct +++ b/SConstruct @@ -30,7 +30,6 @@ plugins = [ ] utils = [ - 'Library/LibraryLocal', 'Library/RegTool', 'MakeLangId', 'Makensisw',