-
Notifications
You must be signed in to change notification settings - Fork 23
/
install.hta.in
372 lines (327 loc) · 10.6 KB
/
install.hta.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
install.hta - GUI installer for Windows systems, using Microsoft's
HTML Application technology. Tested on XP with IE7. May
work on systems as old as Win9x with IE4.
For all other platforms, use "make install".
Copyright (c) 2008 by Educational Technology Resources, Inc. and
Warren Young. Others may also hold copyrights on code in this file.
See the CREDITS file in the top folder of the distribution for details.
This file is part of MySQL++.
MySQL++ is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
MySQL++ is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public
License along with MySQL++; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Install MySQL++ Development Files</title>
<hta:application
applicationname="mysqlppInstaller"
borderstyle="raised"
innerborder="no"
scroll="no"
singleinstance="yes"
sysmenu="no"/>
<style type="text/css">
body {
background-color: buttonface;
margin: 10px;
}
body, button, input, select, td {
font-family: Trebuchet MS, Helvetica;
font-size: 10pt;
}
input.status {
background-color: buttonface;
border: none;
}
</style>
<script type="text/javascript">
function $(id) { return document.getElementById(id); }
</script>
<script type="text/javascript">
var c = '';
var fso = new ActiveXObject('Scripting.FileSystemObject');
var folderList, driveList, installTargetField, segregateManagedBox,
segregatePlatformBox, versionedFolderBox;
var managedBuild = false;
// Copies a file under a given prefix folder to another folder
// given as a subfolder under some fixed prefix folder,
// creating the whole folder path if needed, if it doesn't exist.
// Skips prefix prepending if prefix is null. Skips folder
// creation if source file doesn't exist.
function copyFile(filePrefix, file, dirPrefix, destSubDir)
{
var src = filePrefix ? fso.BuildPath(filePrefix, file) : file;
if ((!filePrefix || fso.FolderExists(filePrefix)) &&
((src.indexOf('*') != -1) || fso.FileExists(src))) {
var dst = createFolderRecursive(
dirPrefix ? fso.BuildPath(dirPrefix, destSubDir) : destSubDir);
try {
fso.CopyFile(src, dst);
}
catch (e) {
alert('Failed to copy ' + file + ' to ' + baseInstallFolder + ': ' +
e.message + '\n\nInstallation aborted!');
window.close();
}
}
}
// Creates a folder if it doesn't already exist. If creation
// attempt fails, puts up alert dialog explaining the problem and
// quits program.
function createFolder(d)
{
if (!fso.FolderExists(d)) {
try {
fso.CreateFolder(d);
}
catch (e) {
alert('Failed to create ' + d + ' folder: ' +
e.message + '\n\nInstallation aborted!');
window.close();
}
}
}
// Like createFolder(), but will create parent directories as
// needed. Returns d, normalized.
function createFolderRecursive(d)
{
var i, dir = '', dirElements = d.split('\\');
for (i = 0; i < dirElements.length; ++i) {
dir += dirElements[i] + '\\';
createFolder(dir);
}
return dir;
}
// Called when app is fully loaded, so initialize ourselves.
function init()
{
// Set initial window size
window.resizeTo(600, 390);
// Get references to main UI elements
folderList = $('folder');
driveList = $('drive');
installTargetField = $('installTarget');
segregateManagedBox = $('segregateManaged');
segregatePlatformBox = $('segregatePlatform');
versionedFolderBox = $('versionedFolder');
// Populate drop-down list of available drives
populateDriveList();
// Populate list of directories on the current drive
populateFolderList();
// Now that we have drive and folder lists, set initial value
// for installation folder from default list selections.
updateInstallFolder();
// Set up UI event handlers. We put it off to this point so
// UI is populated before first handler gets called.
driveList.onchange = function() {
populateFolderList();
updateInstallFolder();
}
folderList.onchange = segregateManagedBox.onclick =
versionedFolderBox.onclick = updateInstallFolder;
}
// Do the actual installation
function install()
{
var i, destSubDir, srcDir;
var usePlatform = segregatePlatformBox.checked;
var versions = [ '3', '5', '8' ], version;
// Install header files
copyFile('lib', '*.h', baseInstallFolder, 'include');
// Install MinGW library build, if it exists
destSubDir = 'lib' + (usePlatform ? '\\MinGW' : '');
copyFile(null, 'libmysqlpp.a', baseInstallFolder, destSubDir);
copyFile(null, 'mysqlpp.dll', baseInstallFolder, destSubDir);
// Install any and all existing VC++ library builds
for (i = 0; i < versions.length; ++i) {
version = 'vc200' + versions[i];
destSubDir = 'lib' +
(usePlatform ? '\\VC++ 200' + versions[i] : '');
if (segregateManagedBox.checked) {
destSubDir += '\\' + (isManagedBuild(version) ?
'CLR' : 'Native');
}
srcDir = version + '\\Debug';
copyFile(srcDir, 'mysqlpp_d.dll', baseInstallFolder, destSubDir);
copyFile(srcDir, 'mysqlpp_d.lib', baseInstallFolder, destSubDir);
srcDir = version + '\\Release';
copyFile(srcDir, 'mysqlpp.dll', baseInstallFolder, destSubDir);
copyFile(srcDir, 'mysqlpp.lib', baseInstallFolder, destSubDir);
}
window.close();
}
// Returns true if the MySQL++ library for the given VC++
// version was built for use with the CLR.
function isManagedBuild(version)
{
var stream = fso.OpenTextFile(
version + '\\mysql++_mysqlpp.vcproj');
if (stream) {
var mloc = stream.ReadAll().indexOf('ManagedExtensions="1"');
stream.Close();
return mloc > 0;
}
else {
return false;
}
}
// Populates a drop-down list with the set of fixed disks and
// removable drives with media in them.
function populateDriveList()
{
var defLetter = 'C';
var e, i, letter, name;
for (e = new Enumerator(fso.Drives); !e.atEnd(); e.moveNext()) {
i = e.item();
if (i.IsReady) {
letter = i.DriveLetter;
name = letter + ': - ';
if ((i.DriveType == 3) &&
i.ShareName.length) {
name += i.ShareName;
}
else if ((i.DriveType != 3) &&
i.VolumeName.length) {
name += i.VolumeName;
}
else {
name += '(no name)';
}
driveList.add(new Option(name, letter,
letter == defLetter, letter == defLetter));
}
}
}
// Populates a list box with the top-level directories on the
// currently-selected disk drive.
function populateFolderList()
{
var driveRoot =
driveList.options[driveList.selectedIndex].value + ':\\';
var e, f = fso.GetFolder(driveRoot);
if (f) {
folderList.options.length = 0;
folderList.add(new Option(driveRoot, driveRoot, true, true));
for (e = new Enumerator(f.SubFolders); !e.atEnd(); e.moveNext()) {
folderList.add(new Option(e.item() + '\\'));
}
}
else {
alert('Failed to get folder list for ' + driveRoot);
}
}
// On clicking the text label associated with "versioned install
// folder" checkbox, toggle checkbox and update UI.
function toggleVersioning()
{
if (versionedFolderBox) {
versionedFolderBox.checked = !versionedFolderBox.checked;
updateInstallFolder();
}
}
// On clicking the text label associated with a checkbox, toggle
// checkbox state and update UI.
function toggleCheckbox(boxID)
{
var box = $(boxID);
if (box) {
box.checked = !box.checked;
updateInstallFolder();
}
}
// Called any time something changes that affects how we calculate
// the installation folder name. Rebuilds it.
function updateInstallFolder()
{
baseInstallFolder =
folderList.options[folderList.selectedIndex].text +
'MySQL++' +
(versionedFolderBox.checked ? '\\@PACKAGE_VERSION@' : '');
installTargetField.value =
baseInstallFolder +
'\\{include,lib' +
(segregatePlatformBox.checked ? '\\PLATFORM' : '') +
(segregateManagedBox.checked ? '\\{CLR,Native}' : '') +
'}';
}
</script>
</head>
<body onload="init()">
<p>
Where would you like to install the MySQL++ development
files?<br/>
<table cellspacing="10" cellpadding="0" border="0" width="100%"
summary="">
<tr>
<td align="right" valign="middle">Drives:</td>
<td width="99%">
<select id="drive">
</select>
</td>
</tr>
<tr>
<td align="right" valign="top">Folders:</td>
<td width="99%">
<select id="folder" size="6">
</select>
</td>
</tr>
<tr>
<td> </td>
<td>
<input type="checkbox" id="versionedFolder"/>
<span style="cursor: default"
onclick="toggleCheckbox('versionedFolder')">Install
in versioned folder?</span>
</td>
</tr>
<tr>
<td> </td>
<td>
<input type="checkbox" id="segregateManaged"/>
<span style="cursor: default"
onclick="toggleCheckbox('segregateManaged')">Segregate
native C++ library builds from C++/CLI (CLR)
builds?</span>
</td>
</tr>
<tr>
<td> </td>
<td>
<input type="checkbox" id="segregatePlatform"/>
<span style="cursor: default"
onclick="toggleCheckbox('segregatePlatform')">Segregate
libraries by platform?</span>
</td>
</tr>
<tr>
<td align="right" valign="middle">Target:</td>
<td valign="middle" width="99%">
<input type="text" readonly="readonly" class="status"
id="installTarget" size="80"/>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<button onclick="install()"> Install Now </button>
<button onclick="window.close()"> Never Mind </button>
</td>
</tr>
</table>
<p>
</body>
</html>