fix bug #2497148 - allow out of tree builds on POSIX platforms

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5921 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
pabs3 2009-02-04 14:05:48 +00:00
parent a1671db5d6
commit f41ba95bab
12 changed files with 57 additions and 20 deletions

View file

@ -81,7 +81,7 @@ if build_chm:
Copy(build_dir, '${SOURCE.dir}/../style.css'), Copy(build_dir, '${SOURCE.dir}/../style.css'),
Copy(build_dir, '${SOURCE.dir}/chmlink.js'), Copy(build_dir, '${SOURCE.dir}/chmlink.js'),
Copy(build_dir, '${SOURCE.dir}/nsis.hhp'), Copy(build_dir, '${SOURCE.dir}/nsis.hhp'),
Action('cd "%s" && "%s" ${SOURCES.abspath}' % (build_dir, halibut[0].abspath)), Action('cd "%s" && "%s" ${SOURCES.abspath}' % (build_dir, halibut[0].rfile())),
hhc_action hhc_action
] ]
) )
@ -110,7 +110,7 @@ else:
html_builder = Builder( html_builder = Builder(
action = [ action = [
Copy(build_dir, '${SOURCE.dir}/../style.css'), Copy(build_dir, '${SOURCE.dir}/../style.css'),
Action('cd "%s" && "%s" ${SOURCES.abspath}' % (build_dir, halibut[0].abspath)) Action('cd "%s" && "%s" ${SOURCES.abspath}' % (build_dir, halibut[0].rfile()))
] ]
) )

View file

@ -23,10 +23,14 @@ defenv.Append(CPPDEFINES = [('NSISCALL', '$STDCALL')])
stub_env = defenv.Clone() stub_env = defenv.Clone()
stub_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
### makensis environment ### makensis environment
makensis_env = defenv.Clone() makensis_env = defenv.Clone()
makensis_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
### plugin environment ### plugin environment
plugin_env = defenv.Clone(no_import_lib = 1) plugin_env = defenv.Clone(no_import_lib = 1)
@ -39,10 +43,14 @@ util_env = defenv.Clone()
cp_util_env = util_env.Clone() cp_util_env = util_env.Clone()
cp_util_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
### test environment ### test environment
test_env = defenv.Clone() test_env = defenv.Clone()
test_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
# return # return
Return('stub_env makensis_env plugin_env util_env cp_util_env test_env') Return('stub_env makensis_env plugin_env util_env cp_util_env test_env')

View file

@ -10,7 +10,7 @@ Import('FlagsConfigure')
def cross_env(env): def cross_env(env):
if env['PLATFORM'] != 'win32': if env['PLATFORM'] != 'win32':
env.Tool('crossmingw', toolpath = ['../Tools']) env.Tool('crossmingw', toolpath = [Dir('../Tools').rdir()])
### flags ### flags
@ -66,6 +66,8 @@ if defenv['DEBUG']:
stub_env = defenv.Clone() stub_env = defenv.Clone()
cross_env(stub_env) cross_env(stub_env)
stub_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
if not defenv['DEBUG']: if not defenv['DEBUG']:
stub_env.Append(CCFLAGS = ['-Os']) # optimize for size stub_env.Append(CCFLAGS = ['-Os']) # optimize for size
stub_env.Append(CCFLAGS = ['-Wall']) # all warnings stub_env.Append(CCFLAGS = ['-Wall']) # all warnings
@ -84,6 +86,8 @@ stub_env.Append(LINKFLAGS = ['$MAP_FLAG']) # generate map file
makensis_env = defenv.Clone() makensis_env = defenv.Clone()
makensis_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
if not defenv['DEBUG']: if not defenv['DEBUG']:
makensis_env.Append(CCFLAGS = ['-O2']) # optimize makensis_env.Append(CCFLAGS = ['-O2']) # optimize
makensis_env.Append(CCFLAGS = ['-Wall']) # all warnings makensis_env.Append(CCFLAGS = ['-Wall']) # all warnings
@ -117,6 +121,8 @@ plugin_env.Append(LINKFLAGS = ['$MAP_FLAG']) # generate map file
cp_util_env = defenv.Clone() cp_util_env = defenv.Clone()
cp_util_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
if not defenv['DEBUG']: if not defenv['DEBUG']:
cp_util_env.Append(CCFLAGS = ['-O2']) # optimize cp_util_env.Append(CCFLAGS = ['-O2']) # optimize
cp_util_env.Append(CCFLAGS = ['-Wall']) # all warnings cp_util_env.Append(CCFLAGS = ['-Wall']) # all warnings
@ -151,6 +157,7 @@ conf.Finish()
### test environment ### test environment
test_env = defenv.Clone() test_env = defenv.Clone()
test_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
conf = FlagsConfigure(test_env) conf = FlagsConfigure(test_env)
conf.CheckCompileFlag('-m32') conf.CheckCompileFlag('-m32')
conf.CheckLinkFlag('-m32') conf.CheckLinkFlag('-m32')
@ -168,7 +175,7 @@ conf.Finish()
# sure the sections will be written in the correct order. # sure the sections will be written in the correct order.
# #
stub_env.Append(LINKFLAGS = '-T %s' % File('linker_script').abspath) stub_env.Append(LINKFLAGS = ['-T', File('linker_script').rfile()])
# #
# GCC requires some functions from the CRT to be present, if certain # GCC requires some functions from the CRT to be present, if certain

View file

@ -23,10 +23,14 @@ defenv.Append(CPPDEFINES = [('NSISCALL', '$STDCALL')])
stub_env = defenv.Clone() stub_env = defenv.Clone()
stub_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
### makensis environment ### makensis environment
makensis_env = defenv.Clone() makensis_env = defenv.Clone()
makensis_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
### use "$CXX -Ae" as the "$CC" compiler to build makensis ### use "$CXX -Ae" as the "$CC" compiler to build makensis
makensis_env['CC'] = makensis_env['CXX'] makensis_env['CC'] = makensis_env['CXX']
@ -111,10 +115,14 @@ util_env = defenv.Clone()
cp_util_env = util_env.Clone() cp_util_env = util_env.Clone()
cp_util_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
### test environment ### test environment
test_env = defenv.Clone() test_env = defenv.Clone()
test_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
# return # return
Return('stub_env makensis_env plugin_env util_env cp_util_env test_env') Return('stub_env makensis_env plugin_env util_env cp_util_env test_env')

View file

@ -81,6 +81,8 @@ conf.Finish()
stub_env = defenv.Clone() stub_env = defenv.Clone()
stub_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
if not defenv['DEBUG']: if not defenv['DEBUG']:
stub_env.Append(CCFLAGS = ['/O1']) # optimize for size stub_env.Append(CCFLAGS = ['/O1']) # optimize for size
stub_env.Append(CCFLAGS = ['/W3']) # level 3 warnings stub_env.Append(CCFLAGS = ['/W3']) # level 3 warnings
@ -96,6 +98,8 @@ stub_env.Append(CCFLAGS = ['/Fa${TARGET}.lst']) # listing file name
makensis_env = defenv.Clone() makensis_env = defenv.Clone()
makensis_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
if not defenv['DEBUG']: if not defenv['DEBUG']:
makensis_env.Append(CCFLAGS = ['/O2']) # optimize for speed makensis_env.Append(CCFLAGS = ['/O2']) # optimize for speed
makensis_env.Append(CCFLAGS = ['$EXCEPTION_FLAG']) # enable exceptions makensis_env.Append(CCFLAGS = ['$EXCEPTION_FLAG']) # enable exceptions
@ -130,10 +134,14 @@ util_env.Append(LINKFLAGS = ['$MAP_FLAG']) # generate map file
cp_util_env = util_env.Clone() cp_util_env = util_env.Clone()
cp_util_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
### test environment ### test environment
test_env = defenv.Clone() test_env = defenv.Clone()
test_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
### weird compiler requirements ### weird compiler requirements
def check_requirement(ctx, func, trigger): def check_requirement(ctx, func, trigger):

View file

@ -178,11 +178,22 @@ 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_CONF', '"%s"' % defenv.subst('$PREFIX_CONF'))])
defenv.Append(NSIS_CPPDEFINES = [('PREFIX_DATA', '"%s"' % defenv.subst('$PREFIX_DATA'))]) defenv.Append(NSIS_CPPDEFINES = [('PREFIX_DATA', '"%s"' % defenv.subst('$PREFIX_DATA'))])
# Need this early for the config header files to be placed in
if defenv['DEBUG']:
defenv.Replace(BUILD_PREFIX = 'build/debug')
else:
defenv.Replace(BUILD_PREFIX = 'build/release')
defenv.Replace(BUILD_CONFIG = defenv.subst('$BUILD_PREFIX/config'))
# ensure the config directory exists
defenv.Execute(Mkdir(defenv.Dir('#$BUILD_CONFIG')))
# write configuration into sconf.h and defines.h # write configuration into sconf.h and defines.h
sconf_h = open(File('#Source/exehead/sconf.h').abspath, 'w') sconf_h = open(defenv.File('#$BUILD_CONFIG/nsis-sconf.h').abspath, 'w')
sconf_h.write('// This file is automatically generated by SCons\n// DO NOT EDIT THIS FILE\n') sconf_h.write('// This file is automatically generated by SCons\n// DO NOT EDIT THIS FILE\n')
defines_h = open(File('#Source/defines.h').abspath, 'w') defines_h = open(defenv.File('#$BUILD_CONFIG/nsis-defines.h').abspath, 'w')
defines_h.write('// This file is automatically generated by SCons\n// DO NOT EDIT THIS FILE\n') defines_h.write('// This file is automatically generated by SCons\n// DO NOT EDIT THIS FILE\n')
for i in defenv['NSIS_CPPDEFINES']: for i in defenv['NSIS_CPPDEFINES']:
@ -199,7 +210,7 @@ sconf_h.close()
defines_h.close() defines_h.close()
# write version into version.h # write version into version.h
f = open(File('#Source/version.h').abspath, 'w') 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('// This file is automatically generated by SCons\n// DO NOT EDIT THIS FILE\n')
f.write('#define NSIS_VERSION "v%s"\n' % defenv['VERSION']) f.write('#define NSIS_VERSION "v%s"\n' % defenv['VERSION'])
f.close() f.close()
@ -322,13 +333,8 @@ defenv.TestScript = TestScript
####### Environments ### ####### Environments ###
###################################################################### ######################################################################
if defenv['DEBUG']:
defenv.Replace(BUILD_PREFIX = 'build/debug')
else:
defenv.Replace(BUILD_PREFIX = 'build/release')
if defenv['MSTOOLKIT']: if defenv['MSTOOLKIT']:
defenv.Tool('mstoolkit', toolpath = ['SCons/Tools']) defenv.Tool('mstoolkit', toolpath = [Dir('SCons/Tools').rdir()])
defenv.Append(CCFLAGS = Split('$APPEND_CCFLAGS')) defenv.Append(CCFLAGS = Split('$APPEND_CCFLAGS'))
defenv.Append(LINKFLAGS = Split('$APPEND_LINKFLAGS')) defenv.Append(LINKFLAGS = Split('$APPEND_LINKFLAGS'))

View file

@ -18,7 +18,7 @@
#include <stdio.h> #include <stdio.h>
#include "exehead/config.h" #include "exehead/config.h"
#include "version.h" #include <nsis-version.h>
#include "build.h" #include "build.h"
#include "util.h" #include "util.h"
@ -112,7 +112,7 @@ CEXEBuild::CEXEBuild() :
definedlist.add("NSIS_VERSION", NSIS_VERSION); definedlist.add("NSIS_VERSION", NSIS_VERSION);
// automatically generated header file containing all defines // automatically generated header file containing all defines
#include "defines.h" #include <nsis-defines.h>
// no longer optional // no longer optional
definedlist.add("NSIS_SUPPORT_STANDARD_PREDEFINES"); definedlist.add("NSIS_SUPPORT_STANDARD_PREDEFINES");

View file

@ -19,7 +19,7 @@
#ifndef APSTUDIO_INVOKED // keep msdev's resource editor from mangling the .rc file #ifndef APSTUDIO_INVOKED // keep msdev's resource editor from mangling the .rc file
#include "sconf.h" #include <nsis-sconf.h>
#ifndef NSIS_CONFIG_VISIBLE_SUPPORT #ifndef NSIS_CONFIG_VISIBLE_SUPPORT
#ifdef NSIS_CONFIG_LICENSEPAGE #ifdef NSIS_CONFIG_LICENSEPAGE

View file

@ -21,7 +21,7 @@
#include "util.h" #include "util.h"
#include "DialogTemplate.h" #include "DialogTemplate.h"
#include "exehead/resource.h" #include "exehead/resource.h"
#include "version.h" #include <nsis-version.h>
using namespace std; using namespace std;

View file

@ -27,7 +27,7 @@
#include "build.h" #include "build.h"
#include "util.h" #include "util.h"
#include "version.h" #include <nsis-version.h>
using namespace std; using namespace std;

View file

@ -16,7 +16,7 @@
#include "Platform.h" #include "Platform.h"
#include "manifest.h" #include "manifest.h"
#include "version.h" #include <nsis-version.h>
namespace manifest namespace manifest
{ {

View file

@ -25,7 +25,7 @@
#include "DialogTemplate.h" #include "DialogTemplate.h"
#include "lang.h" #include "lang.h"
#include "dirreader.h" #include "dirreader.h"
#include "version.h" #include <nsis-version.h>
#include "icon.h" #include "icon.h"
#include "exehead/api.h" #include "exehead/api.h"
#include "exehead/resource.h" #include "exehead/resource.h"