From 5402048cea38210c2063a91dc5a96d85ca689924 Mon Sep 17 00:00:00 2001 From: Bo Peng Date: Wed, 7 Feb 2007 07:55:38 +0000 Subject: [PATCH] Scons windows installer integration: * INSTALL.Win32: add instructin of building windows bundle installer * development/scons/SConstruct: add bundle and bundle_dir option * development/scons/scons_utils.py: handle bundle building * development/Win32/packaging/installer/lyx.nsi: allow specify bundle .exe name from command line * development/Win32/packaging/installer/settings.user.nsh: allow specify bundle directory from command line * development/Win32/packaging/installer/components/external.nsh: get files from bundle directory * development/Win32/packaging/installer/settings.nsh update miktex version (link needs to be updated as well?) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17081 a592a061-630c-0410-9148-cb99ea01b6c8 --- INSTALL.Win32 | 7 +++++ .../installer/components/external.nsh | 2 +- development/Win32/packaging/installer/lyx.nsi | 4 +++ .../Win32/packaging/installer/settings.nsh | 8 ++--- .../packaging/installer/settings.user.nsh | 6 ++++ development/scons/SConstruct | 31 ++++++++++++++++--- development/scons/scons_utils.py | 3 ++ 7 files changed, 52 insertions(+), 9 deletions(-) diff --git a/INSTALL.Win32 b/INSTALL.Win32 index 50907b264e..ed55f7660a 100644 --- a/INSTALL.Win32 +++ b/INSTALL.Win32 @@ -128,3 +128,10 @@ Creating the Installer $ 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. + + If you also want to generate bundled installer, download + lyx-windows-bundle-deps.zip from http://www.lyx.org/~bpeng, unpack + to lyx-windows-bundle-deps under the top source directory, and run + $ scons -f development\scons\SConstruct installer bundle=1 + If you prefer to use another directory, you can use option bundle_dir like + $ scons -f development\scons\SConstruct installer bundle=1 bundle_dir=c:\bundle diff --git a/development/Win32/packaging/installer/components/external.nsh b/development/Win32/packaging/installer/components/external.nsh index 568f295ce3..db03dabab8 100644 --- a/development/Win32/packaging/installer/components/external.nsh +++ b/development/Win32/packaging/installer/components/external.nsh @@ -94,7 +94,7 @@ External Components: MiKTeX, ImageMagick, Ghostscript !macro InstallComponent COMPONENT ;Extract - File /oname=$PLUGINSDIR\${COMPONENT}Setup.exe ${INSTALL_${COMPONENT}} + File /oname=$PLUGINSDIR\${COMPONENT}Setup.exe ${FILES_BUNDLE}\${INSTALL_${COMPONENT}} !insertmacro SetupComponent ${COMPONENT} diff --git a/development/Win32/packaging/installer/lyx.nsi b/development/Win32/packaging/installer/lyx.nsi index fa1d1dd2eb..34718ceab9 100644 --- a/development/Win32/packaging/installer/lyx.nsi +++ b/development/Win32/packaging/installer/lyx.nsi @@ -28,7 +28,11 @@ SetCompressor /SOLID lzma ; /DExeFile=/path/to/installer !ifdef ExeFile +!ifdef SETUPTYPE_BUNDLE +OutFile "${BundleExeFile}" +!else OutFile "${ExeFile}" +!endif !else Outfile "${SETUP_EXE}" !endif diff --git a/development/Win32/packaging/installer/settings.nsh b/development/Win32/packaging/installer/settings.nsh index aa4a681702..ebe312bc89 100644 --- a/development/Win32/packaging/installer/settings.nsh +++ b/development/Win32/packaging/installer/settings.nsh @@ -41,8 +41,8 @@ Settings for LyX installer ;-------------------------------- ;Download size (in KB) -!define SIZE_DOWNLOAD_LATEX 43127 -!define SIZE_DOWNLOAD_IMAGEMAGICK 6830 +!define SIZE_DOWNLOAD_LATEX 47271 +!define SIZE_DOWNLOAD_IMAGEMAGICK 7096 !define SIZE_DOWNLOAD_GHOSTSCRIPT 12669 !define SIZE_DOWNLOAD_VIEWER 1459 @@ -57,8 +57,8 @@ Settings for LyX installer ;-------------------------------- ;Locations of setup files for components (for bundled setup) -!define INSTALL_LATEX "basic-miktex-2.5.2471.exe" -!define INSTALL_IMAGEMAGICK "ImageMagick-6.3.0-7-Q16-windows-dll.exe" +!define INSTALL_LATEX "basic-miktex-2.5.2580.exe" +!define INSTALL_IMAGEMAGICK "ImageMagick-6.3.2-2-Q16-windows-dll.exe" !define INSTALL_GHOSTSCRIPT "gs854w32-gpl.exe" !define INSTALL_VIEWER "gsv48w32.exe" diff --git a/development/Win32/packaging/installer/settings.user.nsh b/development/Win32/packaging/installer/settings.user.nsh index f2e85509f8..f01242e993 100644 --- a/development/Win32/packaging/installer/settings.user.nsh +++ b/development/Win32/packaging/installer/settings.user.nsh @@ -16,6 +16,12 @@ !define FILES_DEPS "..\..\..\..\lyx-windows-deps-msvc-qt4" !endif +!ifdef FilesBundle +!define FILES_BUNDLE "${FilesBundle}" +!else +!define FILES_BUNDLE "..\..\..\..\lyx-windows-bundle-deps" +!endif + ;Location of Windows installation !ifdef FilesWindows diff --git a/development/scons/SConstruct b/development/scons/SConstruct index e4efb09dd9..f1029bf9d5 100644 --- a/development/scons/SConstruct +++ b/development/scons/SConstruct @@ -193,6 +193,10 @@ opts.AddOptions( ('win_installer', 'name or full path to the windows installer', None), # the deps package used to create minimal installer (qt and other libraries) ('deps_dir', 'path to the development depedency packages with zlib, iconv, zlib and qt libraries', None), + # whether or not build bundle installer + BoolOption('bundle', 'Whether or not build bundle installer', False), + # the bundle directory, containing bundled applications + PathOption('bundle_dir', 'path to the bundle dependency package with miktex setup.exe etc', None), # build directory, will use $mode if not set ('build_dir', 'Build directory', None), # version suffix @@ -2164,25 +2168,44 @@ if build_installer: # provide default setting if not env.has_key('deps_dir') or env['deps_dir'] is None: env['deps_dir'] = os.path.join(env.Dir('$TOP_SRCDIR').abspath, 'lyx-windows-deps-msvc-qt4') - if not os.path.isdir(env['deps_dir']): + if not os.path.isdir(env.Dir('$deps_dir').abspath): print 'Development dependency package is not found.' Exit(1) else: - env['deps_dir'] = env.Dir(env['deps_dir']).abspath + env['deps_dir'] = env.Dir('$deps_dir').abspath + # build bundle? + if env.has_key('bundle_dir') and os.path.isdir(env.Dir('$bundle_dir').abspath): + env['bundle_dir'] = env.Dir('$bundle_dir').abspath + elif os.path.isdir(os.path.join(env.Dir('$TOP_SRCDIR').abspath, 'lyx-windows-bundle-deps')): + env['bundle_dir'] = os.path.join(env.Dir('$TOP_SRCDIR').abspath, 'lyx-windows-bundle-deps') + else: + env['bundle_dir'] = None # 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'], + 'BundleExeFile':env['win_installer'].replace('.exe', '-bundle.exe'), 'FilesLyx':env.Dir(dest_prefix_dir).abspath, 'FilesDeps':env['deps_dir'], + 'FilesBundle':env['bundle_dir'], }) 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, 'install') - frontend_env.Alias('installer', installer) - + env.Alias('installer', installer) + # also generate bundle? + if env.has_key('bundle') and env['bundle']: + if env['bundle_dir'] is None or not os.path.isdir(env['bundle_dir']): + print 'Bundle directory does not exist (default to %s\lyx-windows-bundle-deps.' % env.Dir('$TOP_SRCDIR').abspath + print 'Use bundle_dir option to specify' + Exit(1) + # generator of the builder will add bundle stuff depending on output name + bundle_installer = env.installer(env['win_installer'].replace('.exe', '-bundle.exe'), + '$TOP_SRCDIR/development/Win32/packaging/installer/lyx.nsi') + env.Depends(bundle_installer, 'install') + env.Alias('installer', bundle_installer) Default('lyx') Alias('all', ['lyx', 'client', 'tex2lyx']) diff --git a/development/scons/scons_utils.py b/development/scons/scons_utils.py index 9187c5cf12..bd2c7b079a 100644 --- a/development/scons/scons_utils.py +++ b/development/scons/scons_utils.py @@ -94,6 +94,9 @@ def env_nsis(source, target, env, for_signature): if env['NSISDEFINES'][d]: ret += '=' + quoteIfSpaced(env['NSISDEFINES'][d]) ret += ' ' + # bundled? + if '-bundle.exe' in str(target[0]): + ret += '/DSETUPTYPE_BUNDLE=1 ' for s in source: ret += quoteIfSpaced(str(s)) return ret