##// END OF EJS Templates
inno: replace add_path.exe with a Pascal script...
Gregory Szorc -
r42013:0f49b56d default
parent child Browse files
Show More
@@ -0,0 +1,219 b''
1 // ----------------------------------------------------------------------------
2 //
3 // Inno Setup Ver: 5.4.2
4 // Script Version: 1.4.2
5 // Author: Jared Breland <jbreland@legroom.net>
6 // Homepage: http://www.legroom.net/software
7 // License: GNU Lesser General Public License (LGPL), version 3
8 // http://www.gnu.org/licenses/lgpl.html
9 //
10 // Script Function:
11 // Allow modification of environmental path directly from Inno Setup installers
12 //
13 // Instructions:
14 // Copy modpath.iss to the same directory as your setup script
15 //
16 // Add this statement to your [Setup] section
17 // ChangesEnvironment=true
18 //
19 // Add this statement to your [Tasks] section
20 // You can change the Description or Flags
21 // You can change the Name, but it must match the ModPathName setting below
22 // Name: modifypath; Description: &Add application directory to your environmental path; Flags: unchecked
23 //
24 // Add the following to the end of your [Code] section
25 // ModPathName defines the name of the task defined above
26 // ModPathType defines whether the 'user' or 'system' path will be modified;
27 // this will default to user if anything other than system is set
28 // setArrayLength must specify the total number of dirs to be added
29 // Result[0] contains first directory, Result[1] contains second, etc.
30 // const
31 // ModPathName = 'modifypath';
32 // ModPathType = 'user';
33 //
34 // function ModPathDir(): TArrayOfString;
35 // begin
36 // setArrayLength(Result, 1);
37 // Result[0] := ExpandConstant('{app}');
38 // end;
39 // #include "modpath.iss"
40 // ----------------------------------------------------------------------------
41
42 procedure ModPath();
43 var
44 oldpath: String;
45 newpath: String;
46 updatepath: Boolean;
47 pathArr: TArrayOfString;
48 aExecFile: String;
49 aExecArr: TArrayOfString;
50 i, d: Integer;
51 pathdir: TArrayOfString;
52 regroot: Integer;
53 regpath: String;
54
55 begin
56 // Get constants from main script and adjust behavior accordingly
57 // ModPathType MUST be 'system' or 'user'; force 'user' if invalid
58 if ModPathType = 'system' then begin
59 regroot := HKEY_LOCAL_MACHINE;
60 regpath := 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment';
61 end else begin
62 regroot := HKEY_CURRENT_USER;
63 regpath := 'Environment';
64 end;
65
66 // Get array of new directories and act on each individually
67 pathdir := ModPathDir();
68 for d := 0 to GetArrayLength(pathdir)-1 do begin
69 updatepath := true;
70
71 // Modify WinNT path
72 if UsingWinNT() = true then begin
73
74 // Get current path, split into an array
75 RegQueryStringValue(regroot, regpath, 'Path', oldpath);
76 oldpath := oldpath + ';';
77 i := 0;
78
79 while (Pos(';', oldpath) > 0) do begin
80 SetArrayLength(pathArr, i+1);
81 pathArr[i] := Copy(oldpath, 0, Pos(';', oldpath)-1);
82 oldpath := Copy(oldpath, Pos(';', oldpath)+1, Length(oldpath));
83 i := i + 1;
84
85 // Check if current directory matches app dir
86 if pathdir[d] = pathArr[i-1] then begin
87 // if uninstalling, remove dir from path
88 if IsUninstaller() = true then begin
89 continue;
90 // if installing, flag that dir already exists in path
91 end else begin
92 updatepath := false;
93 end;
94 end;
95
96 // Add current directory to new path
97 if i = 1 then begin
98 newpath := pathArr[i-1];
99 end else begin
100 newpath := newpath + ';' + pathArr[i-1];
101 end;
102 end;
103
104 // Append app dir to path if not already included
105 if (IsUninstaller() = false) AND (updatepath = true) then
106 newpath := newpath + ';' + pathdir[d];
107
108 // Write new path
109 RegWriteStringValue(regroot, regpath, 'Path', newpath);
110
111 // Modify Win9x path
112 end else begin
113
114 // Convert to shortened dirname
115 pathdir[d] := GetShortName(pathdir[d]);
116
117 // If autoexec.bat exists, check if app dir already exists in path
118 aExecFile := 'C:\AUTOEXEC.BAT';
119 if FileExists(aExecFile) then begin
120 LoadStringsFromFile(aExecFile, aExecArr);
121 for i := 0 to GetArrayLength(aExecArr)-1 do begin
122 if IsUninstaller() = false then begin
123 // If app dir already exists while installing, skip add
124 if (Pos(pathdir[d], aExecArr[i]) > 0) then
125 updatepath := false;
126 break;
127 end else begin
128 // If app dir exists and = what we originally set, then delete at uninstall
129 if aExecArr[i] = 'SET PATH=%PATH%;' + pathdir[d] then
130 aExecArr[i] := '';
131 end;
132 end;
133 end;
134
135 // If app dir not found, or autoexec.bat didn't exist, then (create and) append to current path
136 if (IsUninstaller() = false) AND (updatepath = true) then begin
137 SaveStringToFile(aExecFile, #13#10 + 'SET PATH=%PATH%;' + pathdir[d], True);
138
139 // If uninstalling, write the full autoexec out
140 end else begin
141 SaveStringsToFile(aExecFile, aExecArr, False);
142 end;
143 end;
144 end;
145 end;
146
147 // Split a string into an array using passed delimeter
148 procedure MPExplode(var Dest: TArrayOfString; Text: String; Separator: String);
149 var
150 i: Integer;
151 begin
152 i := 0;
153 repeat
154 SetArrayLength(Dest, i+1);
155 if Pos(Separator,Text) > 0 then begin
156 Dest[i] := Copy(Text, 1, Pos(Separator, Text)-1);
157 Text := Copy(Text, Pos(Separator,Text) + Length(Separator), Length(Text));
158 i := i + 1;
159 end else begin
160 Dest[i] := Text;
161 Text := '';
162 end;
163 until Length(Text)=0;
164 end;
165
166
167 procedure CurStepChanged(CurStep: TSetupStep);
168 var
169 taskname: String;
170 begin
171 taskname := ModPathName;
172 if CurStep = ssPostInstall then
173 if IsTaskSelected(taskname) then
174 ModPath();
175 end;
176
177 procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
178 var
179 aSelectedTasks: TArrayOfString;
180 i: Integer;
181 taskname: String;
182 regpath: String;
183 regstring: String;
184 appid: String;
185 begin
186 // only run during actual uninstall
187 if CurUninstallStep = usUninstall then begin
188 // get list of selected tasks saved in registry at install time
189 appid := '{#emit SetupSetting("AppId")}';
190 if appid = '' then appid := '{#emit SetupSetting("AppName")}';
191 regpath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\'+appid+'_is1');
192 RegQueryStringValue(HKLM, regpath, 'Inno Setup: Selected Tasks', regstring);
193 if regstring = '' then RegQueryStringValue(HKCU, regpath, 'Inno Setup: Selected Tasks', regstring);
194
195 // check each task; if matches modpath taskname, trigger patch removal
196 if regstring <> '' then begin
197 taskname := ModPathName;
198 MPExplode(aSelectedTasks, regstring, ',');
199 if GetArrayLength(aSelectedTasks) > 0 then begin
200 for i := 0 to GetArrayLength(aSelectedTasks)-1 do begin
201 if comparetext(aSelectedTasks[i], taskname) = 0 then
202 ModPath();
203 end;
204 end;
205 end;
206 end;
207 end;
208
209 function NeedRestart(): Boolean;
210 var
211 taskname: String;
212 begin
213 taskname := ModPathName;
214 if IsTaskSelected(taskname) and not UsingWinNT() then begin
215 Result := True;
216 end else begin
217 Result := False;
218 end;
219 end;
@@ -1,120 +1,128 b''
1 ; Script generated by the Inno Setup Script Wizard.
1 ; Script generated by the Inno Setup Script Wizard.
2 ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
2 ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
3
3
4 #ifndef VERSION
4 #ifndef VERSION
5 #define FileHandle
5 #define FileHandle
6 #define FileLine
6 #define FileLine
7 #define VERSION = "unknown"
7 #define VERSION = "unknown"
8 #if FileHandle = FileOpen(SourcePath + "\..\..\..\mercurial\__version__.py")
8 #if FileHandle = FileOpen(SourcePath + "\..\..\..\mercurial\__version__.py")
9 #expr FileLine = FileRead(FileHandle)
9 #expr FileLine = FileRead(FileHandle)
10 #expr FileLine = FileRead(FileHandle)
10 #expr FileLine = FileRead(FileHandle)
11 #define VERSION = Copy(FileLine, Pos('"', FileLine)+1, Len(FileLine)-Pos('"', FileLine)-1)
11 #define VERSION = Copy(FileLine, Pos('"', FileLine)+1, Len(FileLine)-Pos('"', FileLine)-1)
12 #endif
12 #endif
13 #if FileHandle
13 #if FileHandle
14 #expr FileClose(FileHandle)
14 #expr FileClose(FileHandle)
15 #endif
15 #endif
16 #pragma message "Detected Version: " + VERSION
16 #pragma message "Detected Version: " + VERSION
17 #endif
17 #endif
18
18
19 #ifndef ARCH
19 #ifndef ARCH
20 #define ARCH = "x86"
20 #define ARCH = "x86"
21 #endif
21 #endif
22
22
23 [Setup]
23 [Setup]
24 AppCopyright=Copyright 2005-2019 Matt Mackall and others
24 AppCopyright=Copyright 2005-2019 Matt Mackall and others
25 AppName=Mercurial
25 AppName=Mercurial
26 AppVersion={#VERSION}
26 AppVersion={#VERSION}
27 #if ARCH == "x64"
27 #if ARCH == "x64"
28 AppVerName=Mercurial {#VERSION} (64-bit)
28 AppVerName=Mercurial {#VERSION} (64-bit)
29 OutputBaseFilename=Mercurial-{#VERSION}-x64
29 OutputBaseFilename=Mercurial-{#VERSION}-x64
30 ArchitecturesAllowed=x64
30 ArchitecturesAllowed=x64
31 ArchitecturesInstallIn64BitMode=x64
31 ArchitecturesInstallIn64BitMode=x64
32 #else
32 #else
33 AppVerName=Mercurial {#VERSION}
33 AppVerName=Mercurial {#VERSION}
34 OutputBaseFilename=Mercurial-{#VERSION}
34 OutputBaseFilename=Mercurial-{#VERSION}
35 #endif
35 #endif
36 InfoAfterFile=contrib/win32/postinstall.txt
36 InfoAfterFile=contrib/win32/postinstall.txt
37 LicenseFile=COPYING
37 LicenseFile=COPYING
38 ShowLanguageDialog=yes
38 ShowLanguageDialog=yes
39 AppPublisher=Matt Mackall and others
39 AppPublisher=Matt Mackall and others
40 AppPublisherURL=https://mercurial-scm.org/
40 AppPublisherURL=https://mercurial-scm.org/
41 AppSupportURL=https://mercurial-scm.org/
41 AppSupportURL=https://mercurial-scm.org/
42 AppUpdatesURL=https://mercurial-scm.org/
42 AppUpdatesURL=https://mercurial-scm.org/
43 AppID={{4B95A5F1-EF59-4B08-BED8-C891C46121B3}
43 AppID={{4B95A5F1-EF59-4B08-BED8-C891C46121B3}
44 AppContact=mercurial@mercurial-scm.org
44 AppContact=mercurial@mercurial-scm.org
45 DefaultDirName={pf}\Mercurial
45 DefaultDirName={pf}\Mercurial
46 SourceDir=..\..\..
46 SourceDir=..\..\..
47 VersionInfoDescription=Mercurial distributed SCM (version {#VERSION})
47 VersionInfoDescription=Mercurial distributed SCM (version {#VERSION})
48 VersionInfoCopyright=Copyright 2005-2019 Matt Mackall and others
48 VersionInfoCopyright=Copyright 2005-2019 Matt Mackall and others
49 VersionInfoCompany=Matt Mackall and others
49 VersionInfoCompany=Matt Mackall and others
50 InternalCompressLevel=max
50 InternalCompressLevel=max
51 SolidCompression=true
51 SolidCompression=true
52 SetupIconFile=contrib\win32\mercurial.ico
52 SetupIconFile=contrib\win32\mercurial.ico
53 AllowNoIcons=true
53 AllowNoIcons=true
54 DefaultGroupName=Mercurial
54 DefaultGroupName=Mercurial
55 PrivilegesRequired=none
55 PrivilegesRequired=none
56 ChangesEnvironment=true
56
57
57 [Files]
58 [Files]
58 Source: contrib\mercurial.el; DestDir: {app}/Contrib
59 Source: contrib\mercurial.el; DestDir: {app}/Contrib
59 Source: contrib\vim\*.*; DestDir: {app}/Contrib/Vim
60 Source: contrib\vim\*.*; DestDir: {app}/Contrib/Vim
60 Source: contrib\zsh_completion; DestDir: {app}/Contrib
61 Source: contrib\zsh_completion; DestDir: {app}/Contrib
61 Source: contrib\bash_completion; DestDir: {app}/Contrib
62 Source: contrib\bash_completion; DestDir: {app}/Contrib
62 Source: contrib\tcsh_completion; DestDir: {app}/Contrib
63 Source: contrib\tcsh_completion; DestDir: {app}/Contrib
63 Source: contrib\tcsh_completion_build.sh; DestDir: {app}/Contrib
64 Source: contrib\tcsh_completion_build.sh; DestDir: {app}/Contrib
64 Source: contrib\hgk; DestDir: {app}/Contrib; DestName: hgk.tcl
65 Source: contrib\hgk; DestDir: {app}/Contrib; DestName: hgk.tcl
65 Source: contrib\xml.rnc; DestDir: {app}/Contrib
66 Source: contrib\xml.rnc; DestDir: {app}/Contrib
66 Source: contrib\mercurial.el; DestDir: {app}/Contrib
67 Source: contrib\mercurial.el; DestDir: {app}/Contrib
67 Source: contrib\mq.el; DestDir: {app}/Contrib
68 Source: contrib\mq.el; DestDir: {app}/Contrib
68 Source: contrib\hgweb.fcgi; DestDir: {app}/Contrib
69 Source: contrib\hgweb.fcgi; DestDir: {app}/Contrib
69 Source: contrib\hgweb.wsgi; DestDir: {app}/Contrib
70 Source: contrib\hgweb.wsgi; DestDir: {app}/Contrib
70 Source: contrib\win32\ReadMe.html; DestDir: {app}; Flags: isreadme
71 Source: contrib\win32\ReadMe.html; DestDir: {app}; Flags: isreadme
71 Source: contrib\win32\postinstall.txt; DestDir: {app}; DestName: ReleaseNotes.txt
72 Source: contrib\win32\postinstall.txt; DestDir: {app}; DestName: ReleaseNotes.txt
72 Source: dist\hg.exe; DestDir: {app}; AfterInstall: Touch('{app}\hg.exe.local')
73 Source: dist\hg.exe; DestDir: {app}; AfterInstall: Touch('{app}\hg.exe.local')
73 #if ARCH == "x64"
74 #if ARCH == "x64"
74 Source: dist\lib\*.dll; Destdir: {app}\lib
75 Source: dist\lib\*.dll; Destdir: {app}\lib
75 Source: dist\lib\*.pyd; Destdir: {app}\lib
76 Source: dist\lib\*.pyd; Destdir: {app}\lib
76 #else
77 #else
77 Source: dist\w9xpopen.exe; DestDir: {app}
78 Source: dist\w9xpopen.exe; DestDir: {app}
78 #endif
79 #endif
79 Source: dist\python*.dll; Destdir: {app}; Flags: skipifsourcedoesntexist
80 Source: dist\python*.dll; Destdir: {app}; Flags: skipifsourcedoesntexist
80 Source: dist\msvc*.dll; DestDir: {app}; Flags: skipifsourcedoesntexist
81 Source: dist\msvc*.dll; DestDir: {app}; Flags: skipifsourcedoesntexist
81 Source: dist\Microsoft.VC*.CRT.manifest; DestDir: {app}; Flags: skipifsourcedoesntexist
82 Source: dist\Microsoft.VC*.CRT.manifest; DestDir: {app}; Flags: skipifsourcedoesntexist
82 Source: dist\lib\library.zip; DestDir: {app}\lib
83 Source: dist\lib\library.zip; DestDir: {app}\lib
83 Source: dist\add_path.exe; DestDir: {app}
84 Source: doc\*.html; DestDir: {app}\Docs
84 Source: doc\*.html; DestDir: {app}\Docs
85 Source: doc\style.css; DestDir: {app}\Docs
85 Source: doc\style.css; DestDir: {app}\Docs
86 Source: mercurial\help\*.txt; DestDir: {app}\help
86 Source: mercurial\help\*.txt; DestDir: {app}\help
87 Source: mercurial\help\internals\*.txt; DestDir: {app}\help\internals
87 Source: mercurial\help\internals\*.txt; DestDir: {app}\help\internals
88 Source: mercurial\default.d\*.rc; DestDir: {app}\default.d
88 Source: mercurial\default.d\*.rc; DestDir: {app}\default.d
89 Source: mercurial\locale\*.*; DestDir: {app}\locale; Flags: recursesubdirs createallsubdirs skipifsourcedoesntexist
89 Source: mercurial\locale\*.*; DestDir: {app}\locale; Flags: recursesubdirs createallsubdirs skipifsourcedoesntexist
90 Source: mercurial\templates\*.*; DestDir: {app}\Templates; Flags: recursesubdirs createallsubdirs
90 Source: mercurial\templates\*.*; DestDir: {app}\Templates; Flags: recursesubdirs createallsubdirs
91 Source: CONTRIBUTORS; DestDir: {app}; DestName: Contributors.txt
91 Source: CONTRIBUTORS; DestDir: {app}; DestName: Contributors.txt
92 Source: COPYING; DestDir: {app}; DestName: Copying.txt
92 Source: COPYING; DestDir: {app}; DestName: Copying.txt
93
93
94 [INI]
94 [INI]
95 Filename: {app}\Mercurial.url; Section: InternetShortcut; Key: URL; String: https://mercurial-scm.org/
95 Filename: {app}\Mercurial.url; Section: InternetShortcut; Key: URL; String: https://mercurial-scm.org/
96 Filename: {app}\default.d\editor.rc; Section: ui; Key: editor; String: notepad
96 Filename: {app}\default.d\editor.rc; Section: ui; Key: editor; String: notepad
97
97
98 [UninstallDelete]
98 [UninstallDelete]
99 Type: files; Name: {app}\Mercurial.url
99 Type: files; Name: {app}\Mercurial.url
100 Type: filesandordirs; Name: {app}\default.d
100 Type: filesandordirs; Name: {app}\default.d
101 Type: files; Name: "{app}\hg.exe.local"
101 Type: files; Name: "{app}\hg.exe.local"
102
102
103 [Icons]
103 [Icons]
104 Name: {group}\Uninstall Mercurial; Filename: {uninstallexe}
104 Name: {group}\Uninstall Mercurial; Filename: {uninstallexe}
105 Name: {group}\Mercurial Command Reference; Filename: {app}\Docs\hg.1.html
105 Name: {group}\Mercurial Command Reference; Filename: {app}\Docs\hg.1.html
106 Name: {group}\Mercurial Configuration Files; Filename: {app}\Docs\hgrc.5.html
106 Name: {group}\Mercurial Configuration Files; Filename: {app}\Docs\hgrc.5.html
107 Name: {group}\Mercurial Ignore Files; Filename: {app}\Docs\hgignore.5.html
107 Name: {group}\Mercurial Ignore Files; Filename: {app}\Docs\hgignore.5.html
108 Name: {group}\Mercurial Web Site; Filename: {app}\Mercurial.url
108 Name: {group}\Mercurial Web Site; Filename: {app}\Mercurial.url
109
109
110 [Run]
110 [Tasks]
111 Filename: "{app}\add_path.exe"; Parameters: "{app}"; Flags: postinstall; Description: "Add the installation path to the search path"
111 Name: modifypath; Description: Add the installation path to the search path; Flags: unchecked
112
113 [UninstallRun]
114 Filename: "{app}\add_path.exe"; Parameters: "/del {app}"
115
112
116 [Code]
113 [Code]
117 procedure Touch(fn: String);
114 procedure Touch(fn: String);
118 begin
115 begin
119 SaveStringToFile(ExpandConstant(fn), '', False);
116 SaveStringToFile(ExpandConstant(fn), '', False);
120 end;
117 end;
118
119 const
120 ModPathName = 'modifypath';
121 ModPathType = 'user';
122
123 function ModPathDir(): TArrayOfString;
124 begin
125 setArrayLength(Result, 1)
126 Result[0] := ExpandConstant('{app}');
127 end;
128 #include "modpath.iss"
@@ -1,131 +1,128 b''
1 The standalone Windows installer for Mercurial is built in a somewhat
1 The standalone Windows installer for Mercurial is built in a somewhat
2 jury-rigged fashion.
2 jury-rigged fashion.
3
3
4 It has the following prerequisites. Ensure to take the packages
4 It has the following prerequisites. Ensure to take the packages
5 matching the mercurial version you want to build (32-bit or 64-bit).
5 matching the mercurial version you want to build (32-bit or 64-bit).
6
6
7 Python 2.6 for Windows
7 Python 2.6 for Windows
8 http://www.python.org/download/releases/
8 http://www.python.org/download/releases/
9
9
10 A compiler:
10 A compiler:
11 either MinGW
11 either MinGW
12 http://www.mingw.org/
12 http://www.mingw.org/
13 or Microsoft Visual C++ 2008 SP1 Express Edition
13 or Microsoft Visual C++ 2008 SP1 Express Edition
14 http://www.microsoft.com/express/Downloads/Download-2008.aspx
14 http://www.microsoft.com/express/Downloads/Download-2008.aspx
15
15
16 Python for Windows Extensions
16 Python for Windows Extensions
17 http://sourceforge.net/projects/pywin32/
17 http://sourceforge.net/projects/pywin32/
18
18
19 mfc71.dll (just download, don't install; not needed for Python 2.6)
19 mfc71.dll (just download, don't install; not needed for Python 2.6)
20 http://starship.python.net/crew/mhammond/win32/
20 http://starship.python.net/crew/mhammond/win32/
21
21
22 Visual C++ 2008 redistributable package (needed for >= Python 2.6 or if you compile with MSVC)
22 Visual C++ 2008 redistributable package (needed for >= Python 2.6 or if you compile with MSVC)
23 for 32-bit:
23 for 32-bit:
24 http://www.microsoft.com/downloads/details.aspx?FamilyID=9b2da534-3e03-4391-8a4d-074b9f2bc1bf
24 http://www.microsoft.com/downloads/details.aspx?FamilyID=9b2da534-3e03-4391-8a4d-074b9f2bc1bf
25 for 64-bit:
25 for 64-bit:
26 http://www.microsoft.com/downloads/details.aspx?familyid=bd2a6171-e2d6-4230-b809-9a8d7548c1b6
26 http://www.microsoft.com/downloads/details.aspx?familyid=bd2a6171-e2d6-4230-b809-9a8d7548c1b6
27
27
28 The py2exe distutils extension
28 The py2exe distutils extension
29 http://sourceforge.net/projects/py2exe/
29 http://sourceforge.net/projects/py2exe/
30
30
31 GnuWin32 gettext utility (if you want to build translations)
31 GnuWin32 gettext utility (if you want to build translations)
32 http://gnuwin32.sourceforge.net/packages/gettext.htm
32 http://gnuwin32.sourceforge.net/packages/gettext.htm
33
33
34 Inno Setup
34 Inno Setup
35 http://www.jrsoftware.org/isdl.php#qsp
35 http://www.jrsoftware.org/isdl.php#qsp
36
36
37 Get and install ispack-5.3.10.exe or later (includes Inno Setup Processor),
37 Get and install ispack-5.3.10.exe or later (includes Inno Setup Processor),
38 which is necessary to package Mercurial.
38 which is necessary to package Mercurial.
39
39
40 ISTool - optional
40 ISTool - optional
41 http://www.istool.org/default.aspx/
41 http://www.istool.org/default.aspx/
42
42
43 add_path (you need only add_path.exe in the zip file)
44 http://www.barisione.org/apps.html#add_path
45
46 Docutils
43 Docutils
47 http://docutils.sourceforge.net/
44 http://docutils.sourceforge.net/
48
45
49 CA Certs file
46 CA Certs file
50 http://curl.haxx.se/ca/cacert.pem
47 http://curl.haxx.se/ca/cacert.pem
51
48
52 And, of course, Mercurial itself.
49 And, of course, Mercurial itself.
53
50
54 Once you have all this installed and built, clone a copy of the
51 Once you have all this installed and built, clone a copy of the
55 Mercurial repository you want to package, and name the repo
52 Mercurial repository you want to package, and name the repo
56 C:\hg\hg-release.
53 C:\hg\hg-release.
57
54
58 In a shell, build a standalone copy of the hg.exe program.
55 In a shell, build a standalone copy of the hg.exe program.
59
56
60 Building instructions for MinGW:
57 Building instructions for MinGW:
61 python setup.py build -c mingw32
58 python setup.py build -c mingw32
62 python setup.py py2exe -b 2
59 python setup.py py2exe -b 2
63 Note: the previously suggested combined command of "python setup.py build -c
60 Note: the previously suggested combined command of "python setup.py build -c
64 mingw32 py2exe -b 2" doesn't work correctly anymore as it doesn't include the
61 mingw32 py2exe -b 2" doesn't work correctly anymore as it doesn't include the
65 extensions in the mercurial subdirectory.
62 extensions in the mercurial subdirectory.
66 If you want to create a file named setup.cfg with the contents:
63 If you want to create a file named setup.cfg with the contents:
67 [build]
64 [build]
68 compiler=mingw32
65 compiler=mingw32
69 you can skip the first build step.
66 you can skip the first build step.
70
67
71 Building instructions with MSVC 2008 Express Edition:
68 Building instructions with MSVC 2008 Express Edition:
72 for 32-bit:
69 for 32-bit:
73 "C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86
70 "C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86
74 python setup.py py2exe -b 2
71 python setup.py py2exe -b 2
75 for 64-bit:
72 for 64-bit:
76 "C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86_amd64
73 "C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86_amd64
77 python setup.py py2exe -b 3
74 python setup.py py2exe -b 3
78
75
79 Copy add_path.exe and cacert.pem files into the dist directory that just got created.
76 Copy cacert.pem files into the dist directory that just got created.
80
77
81 If you are using Python 2.6 or later, or if you are using MSVC 2008 to compile
78 If you are using Python 2.6 or later, or if you are using MSVC 2008 to compile
82 mercurial, you must include the C runtime libraries in the installer. To do so,
79 mercurial, you must include the C runtime libraries in the installer. To do so,
83 install the Visual C++ 2008 redistributable package. Then in your windows\winsxs
80 install the Visual C++ 2008 redistributable package. Then in your windows\winsxs
84 folder, locate the folder containing the dlls version 9.0.21022.8.
81 folder, locate the folder containing the dlls version 9.0.21022.8.
85 For x86, it should be named like x86_Microsoft.VC90.CRT_(...)_9.0.21022.8(...).
82 For x86, it should be named like x86_Microsoft.VC90.CRT_(...)_9.0.21022.8(...).
86 For x64, it should be named like amd64_Microsoft.VC90.CRT_(...)_9.0.21022.8(...).
83 For x64, it should be named like amd64_Microsoft.VC90.CRT_(...)_9.0.21022.8(...).
87 Copy the files named msvcm90.dll, msvcp90.dll and msvcr90.dll into the dist
84 Copy the files named msvcm90.dll, msvcp90.dll and msvcr90.dll into the dist
88 directory.
85 directory.
89 Then in the windows\winsxs\manifests folder, locate the corresponding manifest
86 Then in the windows\winsxs\manifests folder, locate the corresponding manifest
90 file (x86_Microsoft.VC90.CRT_(...)_9.0.21022.8(...).manifest for x86,
87 file (x86_Microsoft.VC90.CRT_(...)_9.0.21022.8(...).manifest for x86,
91 amd64_Microsoft.VC90.CRT_(...)_9.0.21022.8(...).manifest for x64), copy it in the
88 amd64_Microsoft.VC90.CRT_(...)_9.0.21022.8(...).manifest for x64), copy it in the
92 dist directory and rename it to Microsoft.VC90.CRT.manifest.
89 dist directory and rename it to Microsoft.VC90.CRT.manifest.
93
90
94 Before building the installer, you have to build Mercurial HTML documentation
91 Before building the installer, you have to build Mercurial HTML documentation
95 (or fix mercurial.iss to not reference the doc directory):
92 (or fix mercurial.iss to not reference the doc directory):
96
93
97 cd doc
94 cd doc
98 mingw32-make html
95 mingw32-make html
99 cd ..
96 cd ..
100
97
101 If you use ISTool, you open the
98 If you use ISTool, you open the
102 C:\hg\hg-release\contrib\packaging\inno\mercurial.iss
99 C:\hg\hg-release\contrib\packaging\inno-installer\mercurial.iss
103 file and type Ctrl-F9 to compile the installer file.
100 file and type Ctrl-F9 to compile the installer file.
104
101
105 Otherwise you run the Inno Setup compiler. Assuming it's in the path
102 Otherwise you run the Inno Setup compiler. Assuming it's in the path
106 you should execute:
103 you should execute:
107
104
108 iscc contrib\packaging\inno\mercurial.iss /dVERSION=foo
105 iscc contrib\packaging\inno-installer\mercurial.iss /dVERSION=foo
109
106
110 Where 'foo' is the version number you would like to see in the
107 Where 'foo' is the version number you would like to see in the
111 'Add/Remove Applications' tool. The installer will be placed into
108 'Add/Remove Applications' tool. The installer will be placed into
112 a directory named Output/ at the root of your repository.
109 a directory named Output/ at the root of your repository.
113 If the /dVERSION=foo parameter is not given in the command line, the
110 If the /dVERSION=foo parameter is not given in the command line, the
114 installer will retrieve the version information from the __version__.py file.
111 installer will retrieve the version information from the __version__.py file.
115
112
116 If you want to build an installer for a 64-bit mercurial, add /dARCH=x64 to
113 If you want to build an installer for a 64-bit mercurial, add /dARCH=x64 to
117 your command line:
114 your command line:
118 iscc contrib\packaging\inno\mercurial.iss /dARCH=x64
115 iscc contrib\packaging\inno-installer\mercurial.iss /dARCH=x64
119
116
120 To automate the steps above you may want to create a batchfile based on the
117 To automate the steps above you may want to create a batchfile based on the
121 following (MinGW build chain):
118 following (MinGW build chain):
122
119
123 echo [build] > setup.cfg
120 echo [build] > setup.cfg
124 echo compiler=mingw32 >> setup.cfg
121 echo compiler=mingw32 >> setup.cfg
125 python setup.py py2exe -b 2
122 python setup.py py2exe -b 2
126 cd doc
123 cd doc
127 mingw32-make html
124 mingw32-make html
128 cd ..
125 cd ..
129 iscc contrib\packaging\inno\mercurial.iss /dVERSION=snapshot
126 iscc contrib\packaging\inno-installer\mercurial.iss /dVERSION=snapshot
130
127
131 and run it from the root of the hg repository (c:\hg\hg-release).
128 and run it from the root of the hg repository (c:\hg\hg-release).
General Comments 0
You need to be logged in to leave comments. Login now