788 lines
24 KiB
Diff
788 lines
24 KiB
Diff
Description: Usage of the zlib compression library provided by the system
|
|
The changes were cherry-picked from the following upstream svn revisions
|
|
6030, 6039, 6044 and 6063. Furthermore the NSIS embedded inflate function
|
|
was made compatible with the one from zlib.
|
|
Forwarded: http://sf.net/support/tracker.php?aid=2918870
|
|
Forwarded: http://sf.net/support/tracker.php?aid=2995455
|
|
Author: Thomas Gaugler <thomas@dadie.net>
|
|
Last-Update: 2016-04-08
|
|
|
|
--- a/Source/zlib/INFBLOCK.C
|
|
+++ b/Source/zlib/INFBLOCK.C
|
|
@@ -424,7 +424,7 @@
|
|
}
|
|
break;
|
|
case LENS:
|
|
- NEEDBITS(16)
|
|
+ NEEDBITS(32)
|
|
s->sub.left = (uInt)b & 0xffff;
|
|
b = k = 0; /* dump bits */
|
|
Tracev((stderr, "inflate: stored length %u\n", s->sub.left));
|
|
--- a/INSTALL
|
|
+++ b/INSTALL
|
|
@@ -6,7 +6,8 @@
|
|
- Requirements
|
|
|
|
* Python version 1.6 and above (http://www.python.org/)
|
|
- * SCons version 0.96.93 and above (http://www.scons.org/)
|
|
+ * SCons version 1.2.0 and above (http://www.scons.org/)
|
|
+ * zlib version 1.2.3 and above (http://www.zlib.net/)
|
|
* C compiler
|
|
|
|
- Optional Tools
|
|
@@ -16,6 +17,14 @@
|
|
* wxWidgets 2.8 for NSIS Menu (http://www.wxwidgets.org)
|
|
WXWIN environment variable must be set to wxWidgets directory on Windows
|
|
|
|
+ - Preparation
|
|
+
|
|
+ * Unpack the zip archive of the downloaded zlib compiled DLL package
|
|
+ to a folder of your choice, e.g. C:\Dev\zlib-1.2.4 and set the
|
|
+ ZLIB_W32 environment variable, type:
|
|
+
|
|
+ set ZLIB_W32=C:\Dev\zlib-1.2.4
|
|
+
|
|
- Installing
|
|
|
|
* type:
|
|
--- a/Contrib/VPatch/Source/GenPat/SConscript
|
|
+++ b/Contrib/VPatch/Source/GenPat/SConscript
|
|
@@ -13,6 +13,7 @@
|
|
""")
|
|
|
|
libs = Split("""
|
|
+ z
|
|
""")
|
|
|
|
Import('BuildUtil')
|
|
--- a/Contrib/VPatch/Source/GenPat/adler32.cpp
|
|
+++ b/Contrib/VPatch/Source/GenPat/adler32.cpp
|
|
@@ -24,69 +24,14 @@
|
|
*/
|
|
|
|
#include "adler32.h"
|
|
-
|
|
-#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */
|
|
-
|
|
-#define BASE 65521UL /* largest prime smaller than 65536 */
|
|
-#define NMAX 5552
|
|
-/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
|
|
-
|
|
-#define DO1(buf,i) {s1 += buf[i]; s2 += s1;}
|
|
-#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
|
|
-#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
|
|
-#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
|
|
-#define DO16(buf) DO8(buf,0); DO8(buf,8);
|
|
-
|
|
-#ifdef NO_DIVIDE
|
|
-# define MOD(a) \
|
|
- do { \
|
|
- if (a >= (BASE << 16)) a -= (BASE << 16); \
|
|
- if (a >= (BASE << 15)) a -= (BASE << 15); \
|
|
- if (a >= (BASE << 14)) a -= (BASE << 14); \
|
|
- if (a >= (BASE << 13)) a -= (BASE << 13); \
|
|
- if (a >= (BASE << 12)) a -= (BASE << 12); \
|
|
- if (a >= (BASE << 11)) a -= (BASE << 11); \
|
|
- if (a >= (BASE << 10)) a -= (BASE << 10); \
|
|
- if (a >= (BASE << 9)) a -= (BASE << 9); \
|
|
- if (a >= (BASE << 8)) a -= (BASE << 8); \
|
|
- if (a >= (BASE << 7)) a -= (BASE << 7); \
|
|
- if (a >= (BASE << 6)) a -= (BASE << 6); \
|
|
- if (a >= (BASE << 5)) a -= (BASE << 5); \
|
|
- if (a >= (BASE << 4)) a -= (BASE << 4); \
|
|
- if (a >= (BASE << 3)) a -= (BASE << 3); \
|
|
- if (a >= (BASE << 2)) a -= (BASE << 2); \
|
|
- if (a >= (BASE << 1)) a -= (BASE << 1); \
|
|
- if (a >= BASE) a -= BASE; \
|
|
- } while (0)
|
|
-#else
|
|
-# define MOD(a) a %= BASE
|
|
-#endif
|
|
+namespace zlib {
|
|
+#include <zlib.h>
|
|
+}
|
|
|
|
namespace Checksum {
|
|
|
|
/* ========================================================================= */
|
|
uLong adler32(uLong adler, const Byte *buf, uInt len) {
|
|
- unsigned long s1 = adler & 0xffff;
|
|
- unsigned long s2 = (adler >> 16) & 0xffff;
|
|
- int k;
|
|
-
|
|
- if (buf == Z_NULL) return 1L;
|
|
-
|
|
- while (len > 0) {
|
|
- k = len < NMAX ? (int)len : NMAX;
|
|
- len -= k;
|
|
- while (k >= 16) {
|
|
- DO16(buf);
|
|
- buf += 16;
|
|
- k -= 16;
|
|
- }
|
|
- if (k != 0) do {
|
|
- s1 += *buf++;
|
|
- s2 += s1;
|
|
- } while (--k);
|
|
- MOD(s1);
|
|
- MOD(s2);
|
|
- }
|
|
- return (s2 << 16) | s1;
|
|
+ return zlib::adler32(adler, buf, len);
|
|
}
|
|
}
|
|
--- a/Contrib/zip2exe/zlib/ioapi.c
|
|
+++ b/Contrib/zip2exe/zlib/ioapi.c
|
|
@@ -10,7 +10,7 @@
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
-#include "zlib.h"
|
|
+#include <zlib.h>
|
|
#include "ioapi.h"
|
|
|
|
|
|
--- a/Contrib/zip2exe/zlib/unzip.c
|
|
+++ b/Contrib/zip2exe/zlib/unzip.c
|
|
@@ -38,7 +38,7 @@
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
-#include "zlib.h"
|
|
+#include <zlib.h>
|
|
#include "unzip.h"
|
|
|
|
#ifdef STDC
|
|
--- a/Contrib/zip2exe/zlib/unzip.h
|
|
+++ b/Contrib/zip2exe/zlib/unzip.h
|
|
@@ -50,7 +50,7 @@
|
|
#endif
|
|
|
|
#ifndef _ZLIB_H
|
|
-#include "zlib.h"
|
|
+#include <zlib.h>
|
|
#endif
|
|
|
|
#ifndef _ZLIBIOAPI_H
|
|
--- a/Contrib/zip2exe/SConscript
|
|
+++ b/Contrib/zip2exe/SConscript
|
|
@@ -2,14 +2,8 @@
|
|
|
|
files = Split("""
|
|
main.cpp
|
|
- zlib/adler32.c
|
|
- zlib/crc32.c
|
|
- zlib/inffast.c
|
|
- zlib/inflate.c
|
|
- zlib/inftrees.c
|
|
zlib/ioapi.c
|
|
zlib/unzip.c
|
|
- zlib/zutil.c
|
|
""")
|
|
|
|
resources = Split("""
|
|
@@ -26,6 +20,7 @@
|
|
comdlg32
|
|
advapi32
|
|
shell32
|
|
+ z
|
|
""")
|
|
|
|
headers = Split("""
|
|
--- /dev/null
|
|
+++ b/Contrib/SubStart/SConscript
|
|
@@ -0,0 +1,16 @@
|
|
+Import('env')
|
|
+
|
|
+target = "substart"
|
|
+
|
|
+files = Split("""
|
|
+ substart.c
|
|
+""")
|
|
+
|
|
+libs = Split("""
|
|
+""")
|
|
+
|
|
+Import('BuildUtil')
|
|
+
|
|
+substart = BuildUtil(target, files, libs)
|
|
+
|
|
+env.DistributeBin(substart, names=['makensis.exe'], alias='install-compiler') # install as makensis
|
|
--- /dev/null
|
|
+++ b/Contrib/SubStart/substart.c
|
|
@@ -0,0 +1,109 @@
|
|
+/*
|
|
+ * substart.c
|
|
+ *
|
|
+ * Copyright (c) 2010 Thomas Gaugler
|
|
+ *
|
|
+ * Licensed under the zlib/libpng license (the "License");
|
|
+ * you may not use this file except in compliance with the License.
|
|
+ *
|
|
+ * Licence details can be found in the file COPYING.
|
|
+ *
|
|
+ * This software is provided 'as-is', without any express or implied
|
|
+ * warranty.
|
|
+ */
|
|
+
|
|
+#include <windows.h>
|
|
+#include <tchar.h>
|
|
+#include <stdio.h>
|
|
+
|
|
+/* Macro to determine the string length of a constant */
|
|
+#define CONST_STRLEN(x) ((sizeof(x) / sizeof(*x)) - 1)
|
|
+
|
|
+/* Name of the sub folder containing the executable
|
|
+ invoked by this stub executable.
|
|
+ */
|
|
+static const TCHAR SUBFOLDER[] = _T("Bin");
|
|
+
|
|
+/* Redirect to an executable located in a sub folder relative to
|
|
+ this starter executable. Name of the stub executable has to
|
|
+ match with the one in the sub folder.
|
|
+ The command line parameters are passed along.
|
|
+ */
|
|
+int main( int argc, char *argv[] )
|
|
+{
|
|
+ int err = ERROR_SUCCESS;
|
|
+ TCHAR szPath[MAX_PATH];
|
|
+
|
|
+ /* Get the full path of the running executable */
|
|
+ if ( GetModuleFileName( NULL, szPath, MAX_PATH ) )
|
|
+ {
|
|
+ size_t len = _tcslen(szPath);
|
|
+ size_t offset = len + CONST_STRLEN(SUBFOLDER) + 1;
|
|
+
|
|
+ err = ERROR_BAD_PATHNAME;
|
|
+ if (offset < MAX_PATH)
|
|
+ {
|
|
+ /* Move file name part of full path by length of sub folder
|
|
+ name and thereafter fill in the sub folder name in the
|
|
+ newly created gap.
|
|
+ */
|
|
+ register TCHAR *p = szPath + len;
|
|
+ register TCHAR *q = szPath + offset;
|
|
+
|
|
+ while (p > szPath)
|
|
+ {
|
|
+ *(q--) = *(p--);
|
|
+ if (*p == '\\')
|
|
+ {
|
|
+ /* Fill in sub folder name */
|
|
+ *q = *p;
|
|
+ q = ++p;
|
|
+ p = (TCHAR *)SUBFOLDER;
|
|
+ while (*p)
|
|
+ {
|
|
+ *(q++) = *(p++);
|
|
+ }
|
|
+ err = ERROR_SUCCESS;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
+ if (err)
|
|
+ {
|
|
+ _tprintf( _T("Path too long: %s\n"), szPath );
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ STARTUPINFO si;
|
|
+ PROCESS_INFORMATION pi;
|
|
+
|
|
+ ZeroMemory( &si, sizeof(si) );
|
|
+ si.cb = sizeof(si);
|
|
+ ZeroMemory( &pi, sizeof(pi) );
|
|
+
|
|
+ /* Start a subprocess running the executable of the
|
|
+ sub folder of the cuand wait for its completion */
|
|
+ if ( CreateProcess( szPath, GetCommandLine(), NULL, NULL,
|
|
+ FALSE, 0, NULL, NULL, &si, &pi ) )
|
|
+ {
|
|
+ WaitForSingleObject( pi.hProcess, INFINITE );
|
|
+ CloseHandle( pi.hProcess );
|
|
+ CloseHandle( pi.hThread );
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ err = GetLastError();
|
|
+ _tprintf( _T("CreateProcess (%s) failed (%d).\n"), szPath, err );
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ err = GetLastError();
|
|
+ _tprintf( _T("GetModuleFileName failed (%d).\n"), err );
|
|
+ }
|
|
+
|
|
+ return err;
|
|
+}
|
|
+
|
|
--- /dev/null
|
|
+++ b/Contrib/SubStart/ReadMe.txt
|
|
@@ -0,0 +1,34 @@
|
|
+substart - Redirect to an executable located in the 'Bin' sub folder
|
|
+ relative to the starter executable.
|
|
+------------------------------------------------------------------------
|
|
+
|
|
+Copyright (C) 2010 Thomas Gaugler
|
|
+Licensed under the zlib/libpng license
|
|
+
|
|
+This tool runs the executable of the same name in the 'Bin' sub folder
|
|
+and passes along the command line options.
|
|
+
|
|
+The main purpose of the tool is that scripts expecting an executable in
|
|
+the root of the program installation folder continue to run.
|
|
+
|
|
+USAGE
|
|
+-----
|
|
+
|
|
+The original executable has to go into the 'Bin' sub folder and the
|
|
+the substart executable renamed to the original executable name needs
|
|
+to be placed at the original location.
|
|
+
|
|
+EXAMPLE
|
|
+-------
|
|
+
|
|
+Directory hierarchy:
|
|
+C:\Program Files\NSIS
|
|
+C:\Program Files\NSIS\Bin\makensis.exe
|
|
+C:\Program Files\NSIS\makensis.exe (-> substart.exe renamed to makensis.exe)
|
|
+
|
|
+C:\Program Files\NSIS\makensis.exe /VERSION
|
|
+
|
|
+
|
|
+Please be aware that the name of the substart executable has to match
|
|
+with the one in the sub folder.
|
|
+
|
|
--- a/Source/czlib.h
|
|
+++ b/Source/czlib.h
|
|
@@ -18,7 +18,7 @@
|
|
#define __CZLIB_H__
|
|
|
|
#include "compressor.h"
|
|
-#include "zlib/ZLIB.H"
|
|
+#include <zlib.h>
|
|
|
|
class CZlib : public ICompressor {
|
|
public:
|
|
@@ -27,7 +27,13 @@
|
|
int Init(int level, unsigned int dict_size) {
|
|
stream = new z_stream;
|
|
if (!stream) return Z_MEM_ERROR;
|
|
- return deflateInit(stream, level);
|
|
+
|
|
+ stream->zalloc = (alloc_func)Z_NULL;
|
|
+ stream->zfree = (free_func)Z_NULL;
|
|
+ stream->opaque = (voidpf)Z_NULL;
|
|
+
|
|
+ return deflateInit2(stream, level,
|
|
+ Z_DEFLATED, -MAX_WBITS, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY);
|
|
}
|
|
|
|
int End() {
|
|
--- a/Source/build.cpp
|
|
+++ b/Source/build.cpp
|
|
@@ -414,7 +414,7 @@
|
|
if (dir) nsis_dir = dir;
|
|
else {
|
|
#ifndef NSIS_CONFIG_CONST_DATA_PATH
|
|
- nsis_dir = get_executable_dir(makensis_path);
|
|
+ nsis_dir = get_dir_name(get_executable_dir(makensis_path));
|
|
#else
|
|
nsis_dir = PREFIX_DATA;
|
|
#endif
|
|
--- a/Source/SConscript
|
|
+++ b/Source/SConscript
|
|
@@ -46,11 +46,6 @@
|
|
7zip/Common/CRC.cpp
|
|
""")
|
|
|
|
-zlib_files = Split("""
|
|
- zlib/deflate.c
|
|
- zlib/trees.c
|
|
-""")
|
|
-
|
|
libs = Split("""
|
|
gdi32
|
|
user32
|
|
@@ -58,7 +53,7 @@
|
|
iconv
|
|
""")
|
|
|
|
-Import('env AddAvailableLibs')
|
|
+Import('env AddAvailableLibs AddZLib')
|
|
|
|
##### Use available libraries
|
|
|
|
@@ -68,6 +63,7 @@
|
|
libs += ['version']
|
|
|
|
AddAvailableLibs(env, libs)
|
|
+AddZLib(env, env['PLATFORM'], 'install-compiler')
|
|
|
|
##### Defines
|
|
|
|
@@ -87,7 +83,7 @@
|
|
|
|
##### Compile makensis
|
|
|
|
-files = makensis_files + bzip2_files + lzma_files + zlib_files
|
|
+files = makensis_files + bzip2_files + lzma_files
|
|
|
|
makensis = env.Program(target, files)
|
|
|
|
--- a/Source/makenssi.cpp
|
|
+++ b/Source/makenssi.cpp
|
|
@@ -442,7 +442,7 @@
|
|
char* env_var = getenv("NSISCONFDIR");
|
|
if(env_var == NULL)
|
|
#ifndef NSIS_CONFIG_CONST_DATA_PATH
|
|
- main_conf = get_executable_dir(argv[0]);
|
|
+ main_conf = get_dir_name(get_executable_dir(argv[0]));
|
|
#else
|
|
main_conf = PREFIX_CONF;
|
|
#endif
|
|
--- a/Source/Tests/SConscript
|
|
+++ b/Source/Tests/SConscript
|
|
@@ -56,16 +56,10 @@
|
|
required += bzip2_files
|
|
required_exehead += bzip2_exehead_files
|
|
|
|
-zlib_files = Split("""
|
|
- zlib/deflate.c
|
|
- zlib/trees.c
|
|
-""")
|
|
-
|
|
zlib_exehead_files = Split("""
|
|
zlib/INFBLOCK.C
|
|
""")
|
|
|
|
-required += zlib_files
|
|
required_exehead += zlib_exehead_files
|
|
|
|
cppunitlibs = Split("""
|
|
@@ -87,7 +81,7 @@
|
|
winver.nsi
|
|
""")
|
|
|
|
-Import('env AddAvailableLibs')
|
|
+Import('env AddAvailableLibs AddZLib')
|
|
|
|
# Test scripts
|
|
env.TestScript(scripts)
|
|
@@ -99,6 +93,7 @@
|
|
extralibs += ['version']
|
|
|
|
AddAvailableLibs(env, extralibs)
|
|
+AddZLib(env, env['PLATFORM'])
|
|
|
|
# compile using msvcrt (that's how cppunit.lib is built)
|
|
if 'msvc' in env['TOOLS'] or 'mstoolkit' in env['TOOLS']:
|
|
@@ -146,6 +141,11 @@
|
|
|
|
# build test program
|
|
tests = env.Program(target, tests + required_obj)
|
|
+ if env['PLATFORM'] == 'win32' and 'ZLIB_W32_DLL' in env:
|
|
+ import os.path
|
|
+ env.Depends(tests, env.InstallAs(
|
|
+ os.path.basename(str(env['ZLIB_W32_DLL'])),
|
|
+ env['ZLIB_W32_DLL']))
|
|
|
|
# alias running the test to 'test'
|
|
test = env.Alias('test-code', [tests], tests[0].abspath)
|
|
--- a/SCons/utils.py
|
|
+++ b/SCons/utils.py
|
|
@@ -1,6 +1,6 @@
|
|
def AddAvailableLibs(env, libs):
|
|
"""
|
|
- Scans through a list list of libraries and adds
|
|
+ Scans through a list of libraries and adds
|
|
available libraries to the environment.
|
|
"""
|
|
conf = env.Configure()
|
|
@@ -10,6 +10,32 @@
|
|
|
|
conf.Finish()
|
|
|
|
+def AddZLib(env, platform, alias='install-utils'):
|
|
+ """
|
|
+ Checks for platform specific zlib and adds the
|
|
+ appropriate compiler and linker options to the environment
|
|
+ """
|
|
+ zlib = 'z'
|
|
+ if platform == 'win32':
|
|
+ if 'ZLIB_W32' in env:
|
|
+ # Add include and library path of zlib for Win32
|
|
+ env.Append(CPPPATH = env['ZLIB_W32_INC'])
|
|
+ env.Append(LIBPATH = env['ZLIB_W32_LIB'])
|
|
+ zlib = ['zdll', 'z']
|
|
+ if 'ZLIB_W32_DLL' in env:
|
|
+ env.DistributeW32Bin(env['ZLIB_W32_DLL'], alias=alias)
|
|
+ else:
|
|
+ print 'Please specify folder of zlib for Win32 via ZLIB_W32'
|
|
+ Exit(1)
|
|
+
|
|
+ conf = env.Configure()
|
|
+ if not conf.CheckLibWithHeader(zlib, 'zlib.h', 'c'):
|
|
+ print 'zlib (%s) is missing!' % (platform)
|
|
+ Exit(1)
|
|
+
|
|
+ env = conf.Finish()
|
|
+
|
|
+
|
|
def GetAvailableLibs(env, libs):
|
|
"""
|
|
Scans through a list list of libraries and adds
|
|
@@ -87,4 +113,4 @@
|
|
"""
|
|
return env.Configure(custom_tests = { 'CheckCompileFlag' : check_compile_flag, 'CheckLinkFlag': check_link_flag })
|
|
|
|
-Export('AddAvailableLibs FlagsConfigure GetAvailableLibs')
|
|
+Export('AddAvailableLibs AddZLib FlagsConfigure GetAvailableLibs')
|
|
--- a/SConstruct
|
|
+++ b/SConstruct
|
|
@@ -1,4 +1,4 @@
|
|
-EnsureSConsVersion(0,98)
|
|
+EnsureSConsVersion(1,2)
|
|
|
|
stubs = [
|
|
'bzip2',
|
|
@@ -36,6 +36,7 @@
|
|
'Makensisw',
|
|
'NSIS Menu',
|
|
'UIs',
|
|
+ 'SubStart',
|
|
'VPatch/Source/GenPat',
|
|
'zip2exe'
|
|
]
|
|
@@ -156,6 +157,7 @@
|
|
opts.Add(('APPEND_CCFLAGS', 'Additional C/C++ compiler flags'))
|
|
opts.Add(('APPEND_LINKFLAGS', 'Additional linker flags'))
|
|
opts.Add(PathVariable('WXWIN', 'Path to wxWindows library folder (e.g. C:\\Dev\\wxWidgets-2.8.10)', os.environ.get('WXWIN')))
|
|
+opts.Add(PathVariable('ZLIB_W32', 'Path to Win32 zlib library folder (e.g. C:\\Dev\\zlib-1.2.3)', os.environ.get('ZLIB_W32')))
|
|
# build options
|
|
opts.Add(BoolVariable('DEBUG', 'Build executables with debugging information', 'no'))
|
|
opts.Add(PathVariable('CODESIGNER', 'A program used to sign executables', None))
|
|
@@ -306,6 +308,14 @@
|
|
def DistributeExamples(files, names=[], path='', alias=None):
|
|
return defenv.Distribute(files, names, 'doc', 'Examples', path, alias, 'examples')
|
|
|
|
+def FindMakeNSIS(env, path):
|
|
+ exename = 'makensis_not_found'
|
|
+ file = env.FindFile('makensis$PROGSUFFIX',
|
|
+ [os.path.join(path, '.'), os.path.join(path, 'Bin')])
|
|
+ if file:
|
|
+ exename = str(file)
|
|
+ return exename
|
|
+
|
|
def Sign(targets):
|
|
if defenv.has_key('CODESIGNER'):
|
|
for t in targets:
|
|
@@ -344,6 +354,30 @@
|
|
|
|
defenv.Default('$BUILD_PREFIX')
|
|
|
|
+if 'ZLIB_W32' in defenv:
|
|
+ defenv['ZLIB_W32_INC'] = os.path.dirname(str(
|
|
+ defenv.FindFile('zlib.h',
|
|
+ [
|
|
+ defenv['ZLIB_W32'],
|
|
+ os.path.join(defenv['ZLIB_W32'], 'include')
|
|
+ ]
|
|
+ )
|
|
+ ))
|
|
+ # Search for import library of zlib for VisualC or mingw
|
|
+ for importlib in ['zdll.lib', 'libzdll.a']:
|
|
+ defenv['ZLIB_W32_LIB'] = os.path.dirname(str(
|
|
+ defenv.FindFile(importlib,
|
|
+ [
|
|
+ defenv['ZLIB_W32'],
|
|
+ os.path.join(defenv['ZLIB_W32'], 'lib')
|
|
+ ]
|
|
+ )
|
|
+ ))
|
|
+ if defenv['ZLIB_W32_LIB']:
|
|
+ break
|
|
+ defenv['ZLIB_W32_DLL'] = defenv.FindFile('zlib1.dll',
|
|
+ [defenv['ZLIB_W32'], defenv['ZLIB_W32_LIB']])
|
|
+
|
|
tools = defenv['TOOLS']
|
|
|
|
envs = []
|
|
@@ -393,17 +427,21 @@
|
|
inst_env['NSISDIR'] = os.path.abspath(str(defenv['INSTDISTDIR']))
|
|
inst_env['NSISCONFDIR'] = os.path.abspath(str(defenv['INSTDISTDIR']))
|
|
|
|
+def build_installer(target, source, env):
|
|
+ cmdline = FindMakeNSIS(env, str(env['INSTDISTDIR'])) + ' %sDOUTFILE=%s %s' % (optchar, target[0].abspath, env['INSTVER'])
|
|
+ cmd = env.Command(None, source, cmdline + ' $SOURCE')
|
|
+ AlwaysBuild(cmd)
|
|
+ AlwaysBuild(env.AddPostAction(cmd, Delete('$INSTDISTDIR')))
|
|
+ env.Alias('dist-installer', cmd)
|
|
+
|
|
installer_target = defenv.Command('nsis-${VERSION}-setup${DISTSUFFIX}.exe',
|
|
- '$INSTDISTDIR' + os.sep + 'Examples' + os.sep + 'makensis.nsi',
|
|
- '$INSTDISTDIR' + os.sep + 'makensis$PROGSUFFIX ' +
|
|
- '%sDOUTFILE=$TARGET.abspath $INSTVER $SOURCE' % optchar,
|
|
+ os.path.join('$INSTDISTDIR', 'Examples', 'makensis.nsi'),
|
|
+ build_installer,
|
|
ENV = inst_env)
|
|
defenv.Depends(installer_target, '$INSTDISTDIR')
|
|
defenv.Sign(installer_target)
|
|
defenv.Alias('dist-installer', installer_target)
|
|
|
|
-AlwaysBuild(defenv.AddPostAction(installer_target, Delete('$INSTDISTDIR')))
|
|
-
|
|
defenv.Alias('dist', ['dist-zip', 'dist-installer'])
|
|
|
|
######################################################################
|
|
@@ -462,7 +500,10 @@
|
|
|
|
defenv.Alias('makensis', makensis)
|
|
|
|
-ins = defenv.DistributeBin(makensis,alias='install-compiler')
|
|
+if defenv['PLATFORM'] == 'win32':
|
|
+ defenv.DistributeW32Bin(makensis, alias='install-compiler')
|
|
+else:
|
|
+ defenv.DistributeBin(makensis, alias='install-compiler')
|
|
|
|
######################################################################
|
|
####### Common Functions ###
|
|
@@ -546,13 +587,21 @@
|
|
####### Utilities ###
|
|
######################################################################
|
|
|
|
+Import('AddZLib')
|
|
+
|
|
def BuildUtilEnv(defines = None, flags = None, libs = None,
|
|
entry = None, nodeflib = None,
|
|
cross_platform = False):
|
|
if not cross_platform:
|
|
env = util_env.Clone()
|
|
+ platform = 'win32'
|
|
else:
|
|
env = cp_util_env.Clone()
|
|
+ platform = env['PLATFORM']
|
|
+
|
|
+ if libs and 'z' in libs:
|
|
+ libs.remove('z')
|
|
+ AddZLib(env, platform)
|
|
|
|
AddEnvStandardFlags(env, defines, flags, libs, entry, nodeflib)
|
|
|
|
@@ -692,6 +741,8 @@
|
|
skipped_tests = env['SKIPTESTS'].split(',')
|
|
ignored_tests = env['IGNORETESTS'].split(',')
|
|
|
|
+ compiler = FindMakeNSIS(env, env.subst('$TESTDISTDIR'))
|
|
+
|
|
for root, dirs, files in walk(instdir):
|
|
for file in files:
|
|
if file[-4:] == '.nsi':
|
|
@@ -702,9 +753,9 @@
|
|
continue
|
|
|
|
if nsif in ignored_tests:
|
|
- cmd = env.Command(None, nsi, '-makensis $SOURCE')
|
|
+ cmd = env.Command(None, nsi, '-' + compiler + ' $SOURCE')
|
|
else:
|
|
- cmd = env.Command(None, nsi, 'makensis $SOURCE')
|
|
+ cmd = env.Command(None, nsi, compiler + ' $SOURCE')
|
|
AlwaysBuild(cmd)
|
|
env.Alias('test-scripts', cmd)
|
|
|
|
--- a/Docs/src/build.but
|
|
+++ b/Docs/src/build.but
|
|
@@ -6,7 +6,32 @@
|
|
|
|
Source code is available in \W{http://nsis.svn.sourceforge.net/viewvc/nsis/}{SVN} 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.93. Any version of Python above 1.6 is supported.
|
|
+To build NSIS, \W{http://www.python.org/}{Python}, \W{http://www.scons.org/}{SCons} must be installed. Currently, the supported version of SCons is version 1.2.0 and above. Any version of Python above 1.6 is supported.
|
|
+
|
|
+NSIS uses the \W{http://zlib.net}{zlib} compression library. As a
|
|
+consequence the header and library files of zlib must be installed.
|
|
+
|
|
+In case these zlib development files aren't present then they could be
|
|
+installed via a package manager (apt-get, aptitude, rpm, yum) on POSIX
|
|
+platforms. Another option is to build zlib from scratch and install it.
|
|
+
|
|
+For Windows it is recommended to download \W{http://zlib.net}{zlib} from
|
|
+\W{http://prdownloads.sourceforge.net/libpng/zlib124-dll.zip?download}{http://prdownloads.sourceforge.net/libpng/zlib124-dll.zip?download}.
|
|
+Extract the contents of this zip archive to a folder of your choice, e.g.
|
|
+\c{C:\\dev\\zlib-1.2.4} and set an environment variable named \c{ZLIB_W32}
|
|
+containingt his path.
|
|
+
|
|
+\c C:\>set ZLIB_W32=C:\dev\zlib-1.2.4
|
|
+
|
|
+Alternatively the command line option ZLIB_W32 specifying the path
|
|
+could be passed with scons instead of the environment variable.
|
|
+
|
|
+\c C:\dev\nsis>scons ZLIB_W32=C:\dev\zlib-1.2.4
|
|
+
|
|
+The header and library files are assumed to be in %ZLIB_W32%. In addition
|
|
+scons checks for zlib header files in %ZLIB_W32%\\include, the
|
|
+import library zdll.lib in %ZLIB_W32%\\lib and the dynamic link library
|
|
+zlib1.dll in %ZLIB_W32% respectively %ZLIB_W32%\\lib.
|
|
|
|
To build, open a console, change the working directory to the root directory of NSIS and type \c{scons}. That's it. For example:
|
|
|
|
@@ -69,7 +94,7 @@
|
|
|
|
To build NSIS Menu, install \W{http://www.wxwidgets.org/}{wxWidgets 2.8}, create an environment variable named \c{WXWIN} containing the path to the installation directory of wxWidgets, run \c{Contrib\\NSIS Menu\\wx\\wxbuild.bat} and build NSIS as usual.
|
|
|
|
-\\<b\\>Important notes for Microsoft Visual C++ 6.0 users:\\</b\\> The latest \W{http://www.microsoft.com/msdownload/platformsdk/sdkupdate/}{Platform SDK} must be installed before building. Because of flaws in the libraries distributed with Microsoft Visual C++ 6.0, not installing the Platform SDK will result in crashes when using the \R{copyfiles}{CopyFiles} command. See \W{http://forums.winamp.com/showthread.php?s=&threadid=131964}{this forum topic} for more information. Installing the \W{http://msdn.microsoft.com/vstudio/downloads/tools/ppack/download.aspx}{Processor Pack} is highly recommended to decrease the size of the installer overhead.
|
|
+\\<b\\>Important notes for Microsoft Visual C++ 6.0 users:\\</b\\> The latest \W{http://www.microsoft.com/msdownload/platformsdk/sdkupdate/}{Platform SDK} must be installed before building. Because of flaws in the libraries distributed with Microsoft Visual C++ 6.0, not installing the Platform SDK will result in crashes when using the \R{copyfiles}{CopyFiles} command. See \W{http://forums.winamp.com/showthread.php?s=&threadid=131964}{this forum topic} for more information. Installing the \W{http://msdn.microsoft.com/vstudio/aa718349.aspx}{Processor Pack} is highly recommended xto decrease the size of the installer overhead.
|
|
|
|
\H{build_posix} Building on POSIX
|
|
|
|
--- a/Examples/makensis.nsi
|
|
+++ b/Examples/makensis.nsi
|
|
@@ -115,13 +115,16 @@
|
|
RMDir /r $SMPROGRAMS\NSIS
|
|
|
|
SetOverwrite on
|
|
- File ..\makensis.exe
|
|
+ File /oname=makensis.exe ..\Bin\substart.exe
|
|
File ..\makensisw.exe
|
|
File ..\COPYING
|
|
File ..\NSIS.chm
|
|
!searchparse /file "..\NSIS.chm" "ITSF" VALIDATE_CHM
|
|
File ..\NSIS.exe
|
|
File /nonfatal ..\NSIS.exe.manifest
|
|
+ SetOutPath $INSTDIR\Bin
|
|
+ File ..\Bin\makensis.exe
|
|
+ File ..\Bin\zlib1.dll
|
|
|
|
IfFileExists $INSTDIR\nsisconf.nsi "" +2
|
|
Rename $INSTDIR\nsisconf.nsi $INSTDIR\nsisconf.nsh
|
|
@@ -956,7 +959,7 @@
|
|
ExecWait '$R1 _?=$INSTDIR'
|
|
|
|
IfErrors no_remove_uninstaller
|
|
- IfFileExists "$INSTDIR\makensis.exe" no_remove_uninstaller
|
|
+ IfFileExists "$INSTDIR\Bin\makensis.exe" no_remove_uninstaller
|
|
|
|
Delete $R1
|
|
RMDir $INSTDIR
|
|
@@ -997,7 +1000,7 @@
|
|
DetailPrint "Uninstalling NSI Development Shell Extensions..."
|
|
SetDetailsPrint listonly
|
|
|
|
- IfFileExists $INSTDIR\makensis.exe nsis_installed
|
|
+ IfFileExists $INSTDIR\Bin\makensis.exe nsis_installed
|
|
MessageBox MB_YESNO "It does not appear that NSIS is installed in the directory '$INSTDIR'.$\r$\nContinue anyway (not recommended)?" IDYES nsis_installed
|
|
Abort "Uninstall aborted by user"
|
|
nsis_installed:
|
|
@@ -1031,6 +1034,7 @@
|
|
Delete $INSTDIR\makensis.exe
|
|
Delete $INSTDIR\makensisw.exe
|
|
Delete $INSTDIR\NSIS.exe
|
|
+ Delete $INSTDIR\NSIS.exe.manifest
|
|
Delete $INSTDIR\license.txt
|
|
Delete $INSTDIR\COPYING
|
|
Delete $INSTDIR\uninst-nsis.exe
|