On Wed, Jul 21, 2010 at 6:43 AM, Liu <liuzhongwu2008@gmail.com> wrote:
Inno-setup是我一直以来使用的installer制作工具, 很灵活, 可以在setup 的脚本中使用pascal语言, 这样, 几乎可以做任何事情, 比如读写注册表, 读写外部文件.用inno-setup最不爽的地方, 每次制作installer时候, 不得不先修改软件的版本号, 如果你的软件分试用版和专业版, 你不得不维护2个script脚本.
幸好发现有个Inno-setup preprocessor工具, 可以极大地提升inno setup的功能, 主页为http://ispp.sourceforge.net/, 下载地址为:http://www.jrsoftware.org/isdl.php#qsp , 该工具为innosetup增加了#define, 另外, 该工具提供的命令行编译器ISCC.exe, 比原版的ISCC.exe功能更强大, 可以动态传入#define标示等. 请注意下面实例代码中, 并没有使用绝对路径, 所有的路径都是相对于script脚本所在目录的.
; Script file: InstallScriptProfTrial.iss
; This script need to use a special Inno Setup version located here : http://jrsoftware.org/isdl.php#qsp
#pragma option -v+
#pragma verboselevel 9
#define Debug
#if RELEASE=="Professional"
#define SOFTWARE_NAME "MyProg Professional Edition"
#define OUTPUT_FILE_NAME "MyProg_Prof"
#else
#define SOFTWARE_NAME "MyProg Professional Trial Edition"
#define OUTPUT_FILE_NAME "MyProg_Trial"
# endif
#define SOFTWARE_PUBLISHER_SHORT_NAME "MyProg"
#define SOFTWARE_COPYRIGHTS "2010 MyProg Technology"
#define SOFTWARE_PUBLISHER "MyProg Technology"
#define SOFTWARE_PRODUCT_PAGE "http://www.MyProg.com/"
#define SOFTWARE_DOWNLOAD_PAGE "http://www.MyProg.com/download.html"
#define SOFTWARE_SUPPORT_PAGE "mailto:MyProgSupport@gmail.com"
#define SOFTWARE_SUPPORT_MAIL "MyProgSupport@gmail.com"
#define SOFTWARE_VERSION GetFileVersion("..\dist\MyProg.exe")
[Setup]
SourceDir=..\dist
OutputDir=..\installer
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{D7DEDD5E-321A-4215-B843-90E946735F64}
AppVerName={#SOFTWARE_NAME} {#SOFTWARE_VERSION}
AppVersion={#SOFTWARE_VERSION}
VersionInfoVersion={#SOFTWARE_VERSION}
VersionInfoTextVersion={#SOFTWARE_VERSION}
VersionInfoCompany={#SOFTWARE_PUBLISHER}
VersionInfoDescription=Write some comments for this software
VersionInfoCopyright={#SOFTWARE_COPYRIGHTS}
AppName={#SOFTWARE_NAME}
AppCopyright={#SOFTWARE_COPYRIGHTS}
AppPublisher={#SOFTWARE_PUBLISHER}
AppPublisherURL={#SOFTWARE_PRODUCT_PAGE}
AppSupportURL={#SOFTWARE_SUPPORT_PAGE}
AppUpdatesURL={#SOFTWARE_DOWNLOAD_PAGE}
AppComments=Thanks using {#SOFTWARE_NAME}
AppContact={#SOFTWARE_SUPPORT_MAIL}
DefaultDirName={pf}\{#SOFTWARE_PUBLISHER_SHORT_NAME}\{#SOFTWARE_NAME}\{#SOFTWARE_VERSION}
DefaultGroupName={#SOFTWARE_NAME}\{#SOFTWARE_VERSION}
OutputBaseFilename={#OUTPUT_FILE_NAME}
LicenseFile=EULA\MyProg_EULA.rtf
;InfoBeforeFile=help\FeatureList.rtf
;InfoAfterFile=help\EditionComparison.rtf
AllowNoIcons=yes
Compression=lzma2/ultra
InternalCompressLevel=ultra
SolidCompression=yes
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "*" ; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "ComUtilities.dll"; DestDir: "{app}"; Flags: regserver
[Icons]
Name: "{group}\MyProg"; Filename: "{app}\MyProg.exe"
Name: "{group}\Visit Web Site"; Filename: "{app}\help\website.url"
Name: "{userdesktop}\MyProg"; Filename: "{app}\MyProg.exe"; Tasks: desktopicon
[Run]
Filename: "{app}\MyProg.exe"; Description: "{cm:LaunchProgram,MyProg GuiRunner}"; Flags: nowait postinstall skipifsilent
编译试用版的bat文件为MakeInstallerTrial.cmd, 代码如下
set InnoSetupCompilerPath=..\..\tools\InnoSetup5\ISCC.exe
echo -
echo =========================================
echo #6. make installer file ...
echo =========================================
echo
%InnoSetupCompilerPath% InstallScriptProfTrial.iss "/dRELEASE=Trial"
echo installer created
编译正式版的batch文件为MakeInstallerProf.cmd, 代码如下
set InnoSetupCompilerPath=..\..\tools\InnoSetup5\ISCC.exe
echo -
echo =========================================
echo #6. make installer file ...
echo =========================================
echo
%InnoSetupCompilerPath% InstallScriptProfTrial.iss "/dRELEASE=Professional"
echo installer created
No comments:
Post a Comment