-
Notifications
You must be signed in to change notification settings - Fork 70
/
README.MSVC
351 lines (225 loc) · 12 KB
/
README.MSVC
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
******************************************************************
******************************************************************
NOTE! This file is OUT OF DATE
and should probably be deleted!
FOR MORE UP-TO-DATE INFORMATION, PLEASE REFER TO
http://www.softdevlabs.com/hercules-msvc-build.html
OR
http://www.cbttape.org/~fish/hercules-msvc-build.html
******************************************************************
******************************************************************
----------------------------------------------------------------
HOW TO BUILD HERCULES FOR WINDOWS WITH MICROSOFT VISUAL C
----------------------------------------------------------------
This file gives some hints on how you can build Hercules for
the Microsoft Windows environment using the Visual C/C++
compiler, without the need for Cygwin or Mingw.
-----------------------------------------------------------------------
SETTING UP THE ENVIRONMENT VARIABLES
Run this .cmd file to set the PATH, INCLUDE, and LIB variables:
@echo off
path=%MSSdk%\bin\Win64;%PATH%
Call "%VCToolkitInstallDir%vcvars32.bat"
Call "%MSSdk%\setenv" /XP32 /RETAIL
Additional Note regarding environment variables: if you are using the
makefile.bat && makefile-dllmod.msvc to build Herc (see further below)
you may also wish to define the ZLIB_DIR and BZIP2_DIR variables in
order for Herc to support ZLIB && BZIP2 disk/tape compression. See also
the "Note Regarding ZLIB_DIR" and "Obtaining ZLIB" sections further
below (as well as the ones for BZIP2) for further information regarding
building Herc with compression support.
-----------------------------------------------------------------------
THE BUILD COMMAND
Before you can build Hercules, you must install the Visual C++ compiler
and the Windows SDK, as well as the msvcrt.lib file as explained below.
As an alternative, you may install Visual Studio (version 7 or above)
To build the MSVC version of Hercules:
nmake /f makefile-dllmod.msvc
The executable modules are placed in the msvc.dllmod.bin subdirectory.
DOWNLOAD THE MICROSOFT VISUAL C++ COMPILER AND SDK
http://msdn.microsoft.com/visualc/vctoolkit2003/
The Microsoft Visual C++ Toolkit 2003 includes the command line
versions of the Visual C/C++ compiler and linker, as well as the
standard C/C++ Library.
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
The Windows Server 2003 Core SDK contains the include files and
libraries needed to create applications for Win95/98/ME/NT/2000/XP.
Notes:
1. You may need to add "download.microsoft.com" to the Internet
Explorer trusted zone before you can install the SDK
2. You also need to download "Build Environment Intel 64 bit" to
obtain the nmake utility in mssdk/bin/win64
-----------------------------------------------------------------------
HOW TO OBTAIN THE MSVCRT.LIB FILE
If you want to build the DLL version of Hercules then you will
also need the Microsoft file msvcrt.lib which is not included in
the free Visual C++ Toolkit 2003. You can however obtain this
file by downloading and installing the
".NET Framework Version 1.1 Software Development Kit (SDK)"
which is available as a free download from:
http://msdn.microsoft.com/netframework/downloads/updates/default.aspx
Be aware, however, that this is a 108MB download, of which the only
directory you need is
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib
After installation, copy msvcrt.lib from this directory to
c:\Program Files\Microsoft Visual C++ Toolkit 2003\lib
You may also want to copy nmake.exe and msvcr71.dll from
C:\Program Files\Microsoft.NET\v1.1\Bin
after which you can delete the .NET Framework SDK.
-----------------------------------------------------------------------
GCC EXTENSIONS TO BE AVOIDED
1. Variadic macro definitions, eg #define logmsg(format,parms...)
2. __attribute__((unused)) should be replaced by UNREFERENCED macro
3. void* pointer arithmetic, eg (void*)p + 1
4. __attribute__((packed))
-----------------------------------------------------------------------
C99 EXTENSIONS TO BE AVOIDED
1. Field names in structure initialisers.
--rbowler
-----------------------------------------------------------------------
How to build Hercules using Visual Studio IDE:
Please see Fish's detailed instructions at:
http://www.softdevlabs.com/hercules-msvc-build.html
-----------------------------------------------------------------------
*** NOTE REGARDING PRECOMPILED HEADERS ***
EACH AND EVERY source file must start with :
#include "hstdinc.h"
These contain the system headers (those enclosed in <>) and that are not
dependent on the guest architecture.
This file, along with build_pch.c allows building a precompiled header file
that significantly speeds up the MSVC Windows build.
I REPEAT !!
EACH AND EVERY SOURCE FILE MUST START WITH THIS FILE !!
No macros (#define).. No nothing.
--Ivan
-----------------------------------------------------------------------
*** NOTE REGARDING ZLIB_DIR ***
ZLIB_DIR defines the location of the ZLIB libraries
If ZLIB_DIR is undefined, then an attempt is made to locate the ZLIB
library in winbuild\zlib\win32_32
If ZLIB_DIR contains a bad path, nmake exits with an error EXCEPT if
ZLIB_DIR is set to the special keyword "NONE".
ZLIB_DIR should contain the *BASE* path for ZLIB. That means that
the following files are expected :
- $(ZLIB_DIR)\zlib1.dll
- $(ZLIB_DIR)\lib\zdll.lib
- $(ZLIB_DIR)\include\zlib.h
- $(ZLIB_DIR)\include\zconf.h
REMEMBER TO "nmake clean" if the build type is changed, the ZLIB location
modified, etc..
NOTE : The zlib1.dll Dynamic Link Library will be copied to the appropriate
build target directory as part of the build process in order to ensure that
the DLL is obtainable by the platform PE(*) loader at run time.
--Ivan
(*) PE stands for Program Executable and designates WIndows .EXE & .DLL
executable file formats.
*** Obtaining ZLIB ***
Building from the distributed hercules source tree does not by default
incorporate ZLIB as a compression mechanism, since
1) ZLIB is an external project, completelly separate from the hercules
project itself.
2) MS Windows (tm) does not provide any well known location (if at all) for
the ZLIB library runtime and/or header files.
.. Therefore ..
In order for HERCULES to be built with ZLIB support (DASD, TAPE), go
to http://www.zlib.net - and locate the download for the 'zlib compiled DLL'.
NOTE : This is a 75KB download.
Extract that ZIP file to the winbuild\zlib\win32_32 directory, relative to
the source directory.
You may extract the file to an alternate location, and then set the ZLIB_DIR
environment variable accordingly (as explained above).
The hercules project is currently known to succesfully build with
version 1.2.2 (current at the time of writing) of the ZLIB compression library.
ZLIB is a compression algorithm written by Jean Loup Gailly and Mark Adler.
ZLIB is used in the hercules project pursuant to the ZLIB License
(http://www.zlib.net/zlib_license.html).
In source form, the hercules project DOES NOT contain ZLIB.
In Binary form, the hercules project MAY contain an UNMODIFIED version of
the ZLIB runtime.
--Ivan
-----------------------------------------------------------------------
*** NOTE REGARDING BZIP2_DIR ***
BZIP2_DIR defines the location of the BZIP2 libraries. If BZIP2_DIR is undefined,
If BZIP2_DIR contains a bad path, nmake exits with an error EXCEPT if BZIP2_DIR
is set to the special keyword "NONE". BZIP2_DIR should contain the *BASE* path for
BZIP2. That means that the following files are expected:
- $(BZIP2_DIR)\bzlib.h
- $(BZIP2_DIR)\libbz2.lib
- $(BZIP2_DIR)\libbz2.dll
REMEMBER TO "nmake clean" if the build type is changed, the BZIP2_DIR location
modified, etc..
NOTE : The libbz2.dll Dynamic Link Library will be copied to the appropriate
build target directory as part of the build process in order to ensure that
the DLL is obtainable by the platform PE(*) loader at run time.
-- Fish (copied blatantly from Ivan's ZLIB documentation further above)
(*) PE stands for Program Executable and designates WIndows .EXE & .DLL
executable file formats.
*** Obtaining BZIP2 ***
Building from the distributed Hercules source tree does not by default
incorporate BZIP2 as a compression mechanism, since
1) BZIP2 is an external project, completelly separate from the Hercules
project itself.
2) MS Windows (tm) does not provide any well known location (if at all) for
the BZIP2 library runtime and/or header files.
.. Therefore ..
In order for HERCULES to be built with BZIP2 support (DASD, TAPE), go to
"http://www.bzip.org/downloads.html" and locate the hyperlink entitled:
"Here is the 1.0.3 source tarball , which includes full documentation.
md5: 8a716bebecb6e647d2e8a29ea5d8447f"
(Yep, that's right! You're going to have to build the BZIP2 dll for yourself
from source!) (either that or obtain a pre-built copy of it (and associated
header/lib files) from someone else you trust). NOTE: This is a 650KB download,
and the file is in tar.gz format, so you'll need WinZip or other utility to
unzip it.
Extract the files to a directory of your choosing and build the DLL using
the supplied makefile.msc. Once it's built, then copy the resulting DLL, lib,
and bzip2.h header file to your defined BZIP2_DIR location and rebuild Herc.
BZIP2 is a freely available (open-source (BSD-style) license), patent free
(as far as the author knows), high-quality data compressor
written by Julian R Seward. It typically compresses files to within 10% to
15% of the best available techniques (the PPM family of statistical compressors),
whilst being around twice as fast at compression and six times faster at decompression.
In source form, the Hercules project does not contain any BZIP2 source code at all.
In binary form however, the Hercules project may include an unmodified version
of the BZIP2 runtime DLL in addition to its own distribution binaries.
-- Fish (updated 2005-12-02)
-----------------------------------------------------------------------
MSVC AND CRYPTO
Bernard Van Der Helm's crypto modules (Message Security Assist 1 & 2 Feature)
is now built automatically as part of the MSVC build.
Should it be necessary to build a version *WITHOUT* the crypto DLL, it is
possible to instruct the makefile-dllmod.msvc file to bypass building that
particular code by defining the environment variable NOCRYPTO.
Nov 22nd 2005
--Ivan Warren
-----------------------------------------------------------------------
*** NOTE REGARDING PCRE_DIR ***
The following is an excerpt from "makefile-dllmod.msvc"
# ---------------------------------------------------------------------
# To enable PCRE (Perl-Compatible Regular Expressions) support, first
# download 'Binaries' and 'Developer files' packages from the GNUWin32
# PCRE website at: http://gnuwin32.sourceforge.net/packages/pcre.htm.
# Then create a permanent directory somewhere called whatever you want
# with a 'bin', 'lib' and 'include' subdirectory, and then define an
# environment variable called "PCRE_DIR" pointing to that directory.
# Finally, make sure the below names of the include (header), lib and
# DLL names are correct, making whatever adjustments may be necessary.
# ---------------------------------------------------------------------
!IFDEF PCRE_DIR
!IF "$(PCRE_DIR)" == "NONE"
!UNDEF PCRE_DIR
!ELSE
PCRE_INCNAME = pcreposix.h
PCRE_LIBNAME1 = pcre.lib
PCRE_LIBNAME2 = pcreposix.lib
PCRE_DLLNAME1 = pcre3.dll
PCRE_DLLNAME2 = pcreposix3.dll
PCRE_INCDIR = $(PCRE_DIR)\include
PCRE_INCPATH = $(PCRE_DIR)\include\$(PCRE_INCNAME)
PCRE_LIBPATH1 = $(PCRE_DIR)\lib\$(PCRE_LIBNAME1)
PCRE_LIBPATH2 = $(PCRE_DIR)\lib\$(PCRE_LIBNAME2)
PCRE_DLLPATH1 = $(PCRE_DIR)\bin\$(PCRE_DLLNAME1)
PCRE_DLLPATH2 = $(PCRE_DIR)\bin\$(PCRE_DLLNAME2)
Sep 22 2006
-- Fish
-----------------------------------------------------------------------