Scons: NSIS support (installer target)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16854 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Bo Peng 2007-01-25 19:13:22 +00:00
parent 93f1f8bdac
commit c9fb2a107e
5 changed files with 34 additions and 11 deletions

View File

@ -113,3 +113,8 @@ Creating the Installer
Finally, go to development\Win32\packaging\installer Finally, go to development\Win32\packaging\installer
(in a normal Windows Explorer), right-click on lyx.nsi and click (in a normal Windows Explorer), right-click on lyx.nsi and click
"Compile NSIS Script". "Compile NSIS Script".
You can also use the installer target of scons. Namely, use a command like
$ scons -f development\scons\SConscript installer
This will create $BUILDDIR\lyx-version-timestamp-Installer.exe for a devel version,
and $BUILDDIR\lyx-version-Install.exe for a released version of lyx.

View File

@ -126,6 +126,11 @@ Installation options:
* DESTDIR: if specified, install to this directory instead of $prefix. * DESTDIR: if specified, install to this directory instead of $prefix.
* version_suffix=yes/no/something : if specified, this suffix will be * version_suffix=yes/no/something : if specified, this suffix will be
appended to the user data directory. appended to the user data directory.
* win_installer: if specified under windows, and if 'installer' target
is given, generate NSIS installer specifed as win_installer which can
be a full path name. The default is lyx-version-timestamp-Installer.exe
for a development version, and lyx-version-Installer.exe for a released
version.
Compiler choice and flags: Compiler choice and flags:
@ -147,7 +152,7 @@ You can specify one or more of the following targets:
Programs: Programs:
tex2lyx, client, lyx, all = tex2lyx + client + lyx tex2lyx, client, lyx, all = tex2lyx + client + lyx
Installation: Installation:
po, install = all + po po, install = all + po, installer (windows only, need NSIS)
Misc: Misc:
msvs_projects msvs_projects

View File

@ -24,9 +24,14 @@ SetCompressor /SOLID lzma
!system '"${NSISDIR}\makensis.exe" "${FILES_PDFVIEW}\pdfview.nsi"' !system '"${NSISDIR}\makensis.exe" "${FILES_PDFVIEW}\pdfview.nsi"'
;-------------------------------- ;--------------------------------
;LyX Installer ;LyX Installer, output file can be specified using command line option
; /DExeFile=/path/to/installer
OutFile "${SETUP_EXE}" !ifdef ExeFile
OutFile "${ExeFile}"
!else
Outfile "${SETUP_EXE}"
!endif
;-------------------------------- ;--------------------------------
;Components ;Components

View File

@ -189,6 +189,8 @@ opts.AddOptions(
comp1,comp2,...: rebuild specified targets''', None), comp1,comp2,...: rebuild specified targets''', None),
# can be set to a non-existing directory # can be set to a non-existing directory
('prefix', 'install architecture-independent files in PREFIX', default_prefix), ('prefix', 'install architecture-independent files in PREFIX', default_prefix),
# replace the default name and location of the windows installer
('win_installer', 'name or full path to the windows installer', None),
# build directory, will use $mode if not set # build directory, will use $mode if not set
('build_dir', 'Build directory', None), ('build_dir', 'Build directory', None),
# version suffix # version suffix
@ -2015,10 +2017,19 @@ if build_installer:
else: else:
print 'No nsis compiler is found. Existing...' print 'No nsis compiler is found. Existing...'
Exit(2) Exit(2)
installer = env.installer(# 'target.exe', if not env.has_key('win_installer') or env['win_installer'] is None:
'$TOP_SRCDIR/development/Win32/packaging/installer/lyx.nsi') if devel_version:
env['win_installer'] = '%s-%s-%s-Installer.exe' % (package_name, package_version, time.strftime('%Y-%m-%d'))
else:
env['win_installer'] = '%s-%s-Installer.exe' % (package_name, package_version)
# if absolute path is given, use it, otherwise, write to current directory
if not (':' in env['win_installer'] or '/' in env['win_installer'] or '\\' in env['win_installer']):
env['win_installer'] = os.path.join(env.Dir('$BUILDDIR').abspath, env['win_installer'])
env.Append(NSISDEFINES={'ExeFile':env['win_installer']})
installer = env.installer(env['win_installer'],
'$TOP_SRCDIR/development/Win32/packaging/installer/lyx.nsi')
# since I can not use a scanner, explicit dependent is required # since I can not use a scanner, explicit dependent is required
env.Depends(installer, \ env.Depends(installer, [lyx, tex2lyx] + \
['$TOP_SRCDIR/development/Win32/packaging/installer/%s' % x for x in win32_packaging_installer_files] + \ ['$TOP_SRCDIR/development/Win32/packaging/installer/%s' % x for x in win32_packaging_installer_files] + \
['$TOP_SRCDIR/development/Win32/packaging/installer/components/%s' % x for x in win32_packaging_installer_components_files] + \ ['$TOP_SRCDIR/development/Win32/packaging/installer/components/%s' % x for x in win32_packaging_installer_components_files] + \
['$TOP_SRCDIR/development/Win32/packaging/installer/dialogs/%s' % x for x in win32_packaging_installer_dialogs_files] + \ ['$TOP_SRCDIR/development/Win32/packaging/installer/dialogs/%s' % x for x in win32_packaging_installer_dialogs_files] + \
@ -2026,7 +2037,6 @@ if build_installer:
['$TOP_SRCDIR/development/Win32/packaging/installer/include/%s' % x for x in win32_packaging_installer_include_files] + \ ['$TOP_SRCDIR/development/Win32/packaging/installer/include/%s' % x for x in win32_packaging_installer_include_files] + \
['$TOP_SRCDIR/development/Win32/packaging/installer/lang/%s' % x for x in win32_packaging_installer_lang_files ] ['$TOP_SRCDIR/development/Win32/packaging/installer/lang/%s' % x for x in win32_packaging_installer_lang_files ]
) )
print "installer is", installer
frontend_env.Alias('installer', installer) frontend_env.Alias('installer', installer)

View File

@ -83,7 +83,7 @@ def env_nsis(source, target, env, for_signature):
return '"' + str + '"' return '"' + str + '"'
else: else:
return str return str
ret = env['NSIS'] + " " ret = env['NSIS'] + " /V2 "
if env.has_key('NSISFLAGS'): if env.has_key('NSISFLAGS'):
for flag in env['NSISFLAGS']: for flag in env['NSISFLAGS']:
ret += flag ret += flag
@ -92,12 +92,10 @@ def env_nsis(source, target, env, for_signature):
for d in env['NSISDEFINES']: for d in env['NSISDEFINES']:
ret += '/D'+d ret += '/D'+d
if env['NSISDEFINES'][d]: if env['NSISDEFINES'][d]:
ret += '=' + quoteIfSpaced(toString(env['NSISDEFINES'][d],env)) ret += '=' + quoteIfSpaced(env['NSISDEFINES'][d])
ret += ' ' ret += ' '
for s in source: for s in source:
ret += quoteIfSpaced(str(s)) ret += quoteIfSpaced(str(s))
print ret
Exit(0)
return ret return ret