Scons: refine scons installer

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16899 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Bo Peng 2007-01-28 06:47:11 +00:00
parent 4be2a69492
commit bae86e4098
2 changed files with 58 additions and 43 deletions

View File

@ -1,15 +1,25 @@
;LyX Windows Installer
;User Settings
;User Settings, all these macros can be redefined from command line,
;using options like /DFilesLyX="..\..\..\..\lyx-install"
;Location of LyX files and dependencies
!ifndef FilesLyX
!define FILES_LYX "..\..\..\..\build-msvc"
!endif
!ifndef FilesDeps
!define FILES_DEPS "..\..\..\..\lyx-windows-deps-msvc-qt4"
!endif
;Location of Windows installation
!ifndef FilesWindows
!define FILES_WINDOWS "C:\WINDOWS"
!endif
;Location of Python 2.5
!ifndef FilesPython
!define FILES_PYTHON "C:\Python25"
!endif

View File

@ -1997,50 +1997,9 @@ if build_po:
gmo_files.extend(env.Transfiles(f))
if build_installer:
#
# build windows installer using NSIS
#
# NOTE:
# There is a nsis builder on scons wiki but it does not work with
# our lyx.nsi because it does not dig through all the include directives
# and find the dependencies automatically. Also, it can not parse
# OutFile in lyx.nsi since it is defined as SETUP_EXE which is in turn
# something rely on date.
# Because of this, I am doing a simple nsis builder here.
if platform_name != 'win32':
print 'installer target is only available for windows platform'
Exit(1)
if env.has_key('NSIS') and env['NSIS'] is not None:
# create a builder to strip and install
env['BUILDERS']['installer'] = Builder(generator=utils.env_nsis)
else:
print 'No nsis compiler is found. Existing...'
Exit(2)
if not env.has_key('win_installer') or env['win_installer'] is None:
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
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/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/graphics/%s' % x for x in win32_packaging_installer_graphics_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 ]
)
frontend_env.Alias('installer', installer)
if 'install' in targets:
if 'install' in targets or 'installer' in targets:
#
# this part is a bit messy right now. Since scons will provide
# --DESTDIR option soon, at least the dest_dir handling can be
@ -2176,5 +2135,51 @@ if 'install' in targets:
Alias('install', dest_file)
if build_installer:
#
# build windows installer using NSIS
#
# NOTE:
# There is a nsis builder on scons wiki but it does not work with
# our lyx.nsi because it does not dig through all the include directives
# and find the dependencies automatically. Also, it can not parse
# OutFile in lyx.nsi since it is defined as SETUP_EXE which is in turn
# something rely on date.
# Because of this, I am doing a simple nsis builder here.
if platform_name != 'win32':
print 'installer target is only available for windows platform'
Exit(1)
if env.has_key('NSIS') and env['NSIS'] is not None:
# create a builder to strip and install
env['BUILDERS']['installer'] = Builder(generator=utils.env_nsis)
else:
print 'No nsis compiler is found. Existing...'
Exit(2)
if not env.has_key('win_installer') or env['win_installer'] is None:
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'],
'FilesLyx':env.get('DESTDIR', r'..\..\..\..\build-msvc')
})
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
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/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/graphics/%s' % x for x in win32_packaging_installer_graphics_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 ]
)
frontend_env.Alias('installer', installer)
Default('lyx')
Alias('all', ['lyx', 'client', 'tex2lyx'])