Added a NSIS script template and scons target to generate script from it.
The template is very WIP.
This commit is contained in:
parent
8f1f16cc35
commit
e27d2291b4
5 changed files with 210 additions and 36 deletions
|
@ -92,7 +92,7 @@ opts.AddOptions(
|
|||
#
|
||||
|
||||
sys.path.insert(0, "./scons")
|
||||
env = Environment(tools=["tar", "gettext", "install", "python_devel"], options = opts, toolpath = ["scons"])
|
||||
env = Environment(tools=["tar", "gettext", "install", "python_devel", "scanreplace"], options = opts, toolpath = ["scons"])
|
||||
|
||||
opts.Save('.scons-option-cache', env)
|
||||
|
||||
|
@ -579,6 +579,12 @@ data_tar_env.Append(TARFLAGS='-j', TARCOMSTR="Making data tarball...")
|
|||
env.Clean(all, 'wesnoth-data.tar.bz2')
|
||||
env.Alias('data-dist', data_tarball)
|
||||
|
||||
#
|
||||
# Windows installer
|
||||
#
|
||||
|
||||
env.WindowsInstaller([wesnoth, wesnoth_editor, Dir(installable_subs)])
|
||||
|
||||
#
|
||||
# Making Mac OS X application bundles
|
||||
#
|
||||
|
|
|
@ -11,36 +11,22 @@ for bin in binaries:
|
|||
#env.Depends(res, icon)
|
||||
except AttributeError:
|
||||
res = []
|
||||
locals()[bin + "_res"] = res
|
||||
Export(bin + "_res")
|
||||
env[bin + "_res"] = res
|
||||
|
||||
if "windows-release" in COMMAND_LINE_TARGETS:
|
||||
env.Tool("scanreplace", toolpath = ["../../scons"])
|
||||
env["packaging_dir"] = Dir(".").abspath
|
||||
iss = env.ScanReplace(join(env["windows_release_dir"], "Wesnoth.iss"), "Wesnoth.iss.in")
|
||||
Depends(iss, Value(env.Dictionary()))
|
||||
Alias("windows-release", iss)
|
||||
|
||||
docs = [ File(doc, "../..") for doc in Split("README COPYING copyright") ]
|
||||
datadirs = [ Dir(dir, "../..") for dir in Split("data fonts images sounds translations") ]
|
||||
dlls = glob("../../*.dll")
|
||||
Alias("windows-release", env.InstallFiltered(Dir(env["windows_release_dir"]), datadirs))
|
||||
Alias("windows-release", env.Install(env["windows_release_dir"], docs + dlls))
|
||||
def WindowsInstaller(env, files):
|
||||
files = Flatten(files)
|
||||
env["NSIS_INSTALL_FILES"] = ""
|
||||
env["NSIS_UNINSTALL_FILES"] = ""
|
||||
for file in files:
|
||||
if file.isdir():
|
||||
env["NSIS_INSTALL_FILES"] += 'SetOutPath "$INSTDIR\\' + file.path + '"\n '
|
||||
env["NSIS_INSTALL_FILES"] += "File /r /x .* " + file.path + "\\*.*\n "
|
||||
env["NSIS_UNINSTALL_FILES"] += "RMDir /r $INSTDIR\\" + file.name + "\n "
|
||||
else:
|
||||
env["NSIS_INSTALL_FILES"] += 'SetOutPath "$INSTDIR"\n '
|
||||
env["NSIS_INSTALL_FILES"] += "File " + file.path + "\n "
|
||||
env["NSIS_UNINSTALL_FILES"] += "Delete $INSTDIR\\" + file.name + "\n "
|
||||
env.ScanReplace("#/Wesnoth.nsi", "#/packaging/windows/Wesnoth.nsi.in")
|
||||
|
||||
release_binaries = ["wesnoth", "wesnoth_editor", "wesnothd"]
|
||||
builds = {
|
||||
"" : "",
|
||||
"_i486" : "-march=i486",
|
||||
"_p2" : "-march=pentium2",
|
||||
"_p4" : "-march=pentium4",
|
||||
"_k6" : "-march=k6",
|
||||
"_athlon" : "-march=athlon",
|
||||
}
|
||||
for build in builds.keys():
|
||||
SConscript("../../src/SConscript",
|
||||
build_dir = "../../build/release_win" + build,
|
||||
exports = {"env":env.Clone(CXXFLAGS = builds[build])}
|
||||
)
|
||||
Import(release_binaries)
|
||||
for bin in release_binaries:
|
||||
Alias("windows-release", env.InstallAs("$windows_release_dir/%s%s$PROGSUFFIX" % (bin, build), eval(bin)))
|
||||
from SCons.Script.SConscript import SConsEnvironment
|
||||
SConsEnvironment.WindowsInstaller = WindowsInstaller
|
||||
|
|
178
packaging/windows/Wesnoth.nsi.in
Normal file
178
packaging/windows/Wesnoth.nsi.in
Normal file
|
@ -0,0 +1,178 @@
|
|||
;NSIS Modern User Interface
|
||||
;Multilingual Example Script
|
||||
;Written by Joost Verburg
|
||||
|
||||
;--------------------------------
|
||||
;Include Modern UI
|
||||
|
||||
!include "MUI.nsh"
|
||||
|
||||
;--------------------------------
|
||||
;General
|
||||
|
||||
SetCompressor /SOLID lzma
|
||||
|
||||
;Name and file
|
||||
Name "Battle for Wesnoth"
|
||||
OutFile "wesnoth-1.5-win32.exe"
|
||||
|
||||
;Default installation folder
|
||||
InstallDir "$PROGRAMFILES\Battle for Wesnoth"
|
||||
|
||||
;Get installation folder from registry if available
|
||||
InstallDirRegKey HKCU "Software\Battle for Wesnoth" ""
|
||||
|
||||
;--------------------------------
|
||||
;Interface Settings
|
||||
|
||||
!define MUI_ABORTWARNING
|
||||
|
||||
;--------------------------------
|
||||
;Language Selection Dialog Settings
|
||||
|
||||
;Remember the installer language
|
||||
!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
|
||||
!define MUI_LANGDLL_REGISTRY_KEY "Software\Battle for Wesnoth"
|
||||
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
|
||||
|
||||
;--------------------------------
|
||||
;Pages
|
||||
|
||||
!insertmacro MUI_PAGE_LICENSE "COPYING"
|
||||
!insertmacro MUI_PAGE_COMPONENTS
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
|
||||
;--------------------------------
|
||||
;Languages
|
||||
|
||||
!insertmacro MUI_LANGUAGE "English" ;first language is the default language
|
||||
!insertmacro MUI_LANGUAGE "French"
|
||||
!insertmacro MUI_LANGUAGE "German"
|
||||
!insertmacro MUI_LANGUAGE "Spanish"
|
||||
!insertmacro MUI_LANGUAGE "SpanishInternational"
|
||||
!insertmacro MUI_LANGUAGE "SimpChinese"
|
||||
!insertmacro MUI_LANGUAGE "TradChinese"
|
||||
!insertmacro MUI_LANGUAGE "Japanese"
|
||||
!insertmacro MUI_LANGUAGE "Korean"
|
||||
!insertmacro MUI_LANGUAGE "Italian"
|
||||
!insertmacro MUI_LANGUAGE "Dutch"
|
||||
!insertmacro MUI_LANGUAGE "Danish"
|
||||
!insertmacro MUI_LANGUAGE "Swedish"
|
||||
!insertmacro MUI_LANGUAGE "Norwegian"
|
||||
!insertmacro MUI_LANGUAGE "NorwegianNynorsk"
|
||||
!insertmacro MUI_LANGUAGE "Finnish"
|
||||
!insertmacro MUI_LANGUAGE "Greek"
|
||||
!insertmacro MUI_LANGUAGE "Russian"
|
||||
!insertmacro MUI_LANGUAGE "Portuguese"
|
||||
!insertmacro MUI_LANGUAGE "PortugueseBR"
|
||||
!insertmacro MUI_LANGUAGE "Polish"
|
||||
!insertmacro MUI_LANGUAGE "Ukrainian"
|
||||
!insertmacro MUI_LANGUAGE "Czech"
|
||||
!insertmacro MUI_LANGUAGE "Slovak"
|
||||
!insertmacro MUI_LANGUAGE "Croatian"
|
||||
!insertmacro MUI_LANGUAGE "Bulgarian"
|
||||
!insertmacro MUI_LANGUAGE "Hungarian"
|
||||
!insertmacro MUI_LANGUAGE "Thai"
|
||||
!insertmacro MUI_LANGUAGE "Romanian"
|
||||
!insertmacro MUI_LANGUAGE "Latvian"
|
||||
!insertmacro MUI_LANGUAGE "Macedonian"
|
||||
!insertmacro MUI_LANGUAGE "Estonian"
|
||||
!insertmacro MUI_LANGUAGE "Turkish"
|
||||
!insertmacro MUI_LANGUAGE "Lithuanian"
|
||||
!insertmacro MUI_LANGUAGE "Slovenian"
|
||||
!insertmacro MUI_LANGUAGE "Serbian"
|
||||
!insertmacro MUI_LANGUAGE "SerbianLatin"
|
||||
!insertmacro MUI_LANGUAGE "Arabic"
|
||||
!insertmacro MUI_LANGUAGE "Farsi"
|
||||
!insertmacro MUI_LANGUAGE "Hebrew"
|
||||
!insertmacro MUI_LANGUAGE "Indonesian"
|
||||
!insertmacro MUI_LANGUAGE "Mongolian"
|
||||
!insertmacro MUI_LANGUAGE "Luxembourgish"
|
||||
!insertmacro MUI_LANGUAGE "Albanian"
|
||||
!insertmacro MUI_LANGUAGE "Breton"
|
||||
!insertmacro MUI_LANGUAGE "Belarusian"
|
||||
!insertmacro MUI_LANGUAGE "Icelandic"
|
||||
!insertmacro MUI_LANGUAGE "Malay"
|
||||
!insertmacro MUI_LANGUAGE "Bosnian"
|
||||
!insertmacro MUI_LANGUAGE "Kurdish"
|
||||
!insertmacro MUI_LANGUAGE "Irish"
|
||||
!insertmacro MUI_LANGUAGE "Uzbek"
|
||||
!insertmacro MUI_LANGUAGE "Galician"
|
||||
!insertmacro MUI_LANGUAGE "Afrikaans"
|
||||
!insertmacro MUI_LANGUAGE "Catalan"
|
||||
|
||||
;--------------------------------
|
||||
;Reserve Files
|
||||
|
||||
;If you are using solid compression, files that are required before
|
||||
;the actual installation should be stored first in the data block,
|
||||
;because this will make your installer start faster.
|
||||
|
||||
!insertmacro MUI_RESERVEFILE_LANGDLL
|
||||
|
||||
;--------------------------------
|
||||
;Installer Sections
|
||||
|
||||
Section "Dummy Section" SecDummy
|
||||
|
||||
SetOutPath "$INSTDIR"
|
||||
|
||||
;ADD YOUR OWN FILES HERE...
|
||||
%NSIS_INSTALL_FILES
|
||||
|
||||
;Store installation folder
|
||||
WriteRegStr HKCU "Software\Battle for Wesnoth" "" $INSTDIR
|
||||
|
||||
;Create uninstaller
|
||||
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
||||
|
||||
SectionEnd
|
||||
|
||||
;--------------------------------
|
||||
;Installer Functions
|
||||
|
||||
Function .onInit
|
||||
|
||||
!insertmacro MUI_LANGDLL_DISPLAY
|
||||
|
||||
FunctionEnd
|
||||
|
||||
;--------------------------------
|
||||
;Descriptions
|
||||
|
||||
;USE A LANGUAGE STRING IF YOU WANT YOUR DESCRIPTIONS TO BE LANGAUGE SPECIFIC
|
||||
|
||||
;Assign descriptions to sections
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} "A test section."
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||
|
||||
|
||||
;--------------------------------
|
||||
;Uninstaller Section
|
||||
|
||||
Section "Uninstall"
|
||||
|
||||
;ADD YOUR OWN FILES HERE...
|
||||
%NSIS_UNINSTALL_FILES
|
||||
|
||||
Delete "$INSTDIR\Uninstall.exe"
|
||||
|
||||
RMDir "$INSTDIR"
|
||||
|
||||
DeleteRegKey /ifempty HKCU "Software\Battle for Wesnoth"
|
||||
|
||||
SectionEnd
|
||||
|
||||
;--------------------------------
|
||||
;Uninstaller Functions
|
||||
|
||||
Function un.onInit
|
||||
|
||||
!insertmacro MUI_UNGETLANGUAGE
|
||||
|
||||
FunctionEnd
|
|
@ -4,11 +4,15 @@
|
|||
|
||||
from string import Template
|
||||
|
||||
class PercentDelimitedTemplate(Template):
|
||||
delimiter = "%"
|
||||
|
||||
def replace_action(target, source, env):
|
||||
open(str(target[0]), 'w').write(Template(open(str(source[0]), 'r').read()).safe_substitute(env))
|
||||
open(str(target[0]), 'w').write(PercentDelimitedTemplate(open(str(source[0]), 'r').read()).substitute(env))
|
||||
env.Depends(target, env.Value(env.Dictionary()))
|
||||
|
||||
def replace_string(target, source, env):
|
||||
return "building '%s' from '%s'" % (str(target[0]), str(source[0]))
|
||||
return "Generating '%s' from '%s'..." % (str(target[0]), str(source[0]))
|
||||
|
||||
def generate(env, **kw):
|
||||
action = env.Action(replace_action, replace_string)
|
||||
|
|
|
@ -286,7 +286,7 @@ SConsEnvironment.WesnothProgram = WesnothProgram
|
|||
|
||||
game_cpp = python_env.Object("game.cpp");
|
||||
|
||||
env.WesnothProgram("wesnoth", [game_cpp] + [libwesnoth_extras, libwesnoth_core, libwesnoth_sdl, libwesnoth, libcampaignd] + wesnoth_res, have_client_prereqs)
|
||||
env.WesnothProgram("wesnoth", [game_cpp] + [libwesnoth_extras, libwesnoth_core, libwesnoth_sdl, libwesnoth, libcampaignd, env["wesnoth_res"]], have_client_prereqs)
|
||||
|
||||
wesnoth_editor_sources = Split("""
|
||||
editor/editor.cpp
|
||||
|
@ -299,7 +299,7 @@ wesnoth_editor_sources = Split("""
|
|||
editor/editor_undo.cpp
|
||||
animated_editor.cpp
|
||||
""")
|
||||
env.WesnothProgram("wesnoth_editor", wesnoth_editor_sources + [libwesnoth_core, libwesnoth_sdl, libwesnoth] + wesnoth_editor_res, have_client_prereqs)
|
||||
env.WesnothProgram("wesnoth_editor", wesnoth_editor_sources + [libwesnoth_core, libwesnoth_sdl, libwesnoth, env["wesnoth_editor_res"]], have_client_prereqs)
|
||||
|
||||
campaignd_sources = Split("""
|
||||
server/input_stream.cpp
|
||||
|
|
Loading…
Add table
Reference in a new issue