about summary refs log tree commit diff stats
path: root/makelynx.bat
blob: 9c1d0ee7b66f3349cab6789a0c91d6579e18895e (plain) (blame)
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
@echo off
@rem $LynxId: makelynx.bat,v 1.16 2011/06/04 00:59:22 tom Exp $
@echo Windows/Dos batch makefile for MingW32 and lynx.exe
@echo Remember to precede this by "command /E:8192" for Windows prior to
@echo W2000 and "cmd.exe /E:8192" for subsequent Window versions and to
@echo set the MingW32 C_INCLUDE_PATH and %C_INCLUDE_PATH%..\..\bin paths
@echo.
@echo Usage: makelynx [option]
@echo Default option: all
@echo Specifying "src" causes the libwww code to be skipped.
@echo Specifying "link" causes the batch file to skip to the final
@echo linking phase.
@echo.
@echo Note that you have to edit early versions of i386-mingw32\include\stdlib.h
@echo to put an "#ifndef WIN_EX" around the declaration for `sleep', or the
@echo compile won't work.  There is also an "#ifndef PDCURSES" around
@echo the declaration for `beep' for the same reason.
@echo.
@echo To change the console library from libpdcurses to libslang,
@echo put a "rem" before the `SET LIBRARY' line below.
@echo.
@echo If you don't have libz.a, either compile it
@echo or put a "rem" in front of the following USE_ZLIB line.
@echo This will cause the gzip.exe version of lynx
@echo to be compiled.  It doesn't work well at present:

SET LIBRARY=PDCURSES
SET USE_ZLIB=YES

rem Uncomment these lines if the slang/curses headers and libraries
rem are in the top-level lib directory:
rem set C_INCLUDE_PATH=..\lib;..\..\..\lib;%C_INCLUDE_PATH%
rem set LIBRARY_PATH=..\lib;..\..\..\lib;%LIBRARY_PATH%

echo Your compiler may not support -march=pentiumpro.
echo In that case, replace -march=pentiumpro with -mpentium or -m486 or nothing:

if "%OS%" == "Windows_NT" goto then0
rem command.com doesn't handle the 'a=b' option
set CC=gcc -mpentium
goto else0
:then0
rem assumes a cmd.exe, rather than command.com, environment
set CC=gcc -march=pentiumpro -mthreads
:else0


rem These definitions come from the Microsoft.msc makefile, with some
rem modification.  Note that -Dx=y didn't work in older versions
rem of Windows batch files, only -Dx, so a lynx_cfg.h was needed as
rem a workaround.
echo /* Generated lynx_cfg.h file in the lynx directory: */ > lynx_cfg.h
echo. >> lynx_cfg.h
echo. >> lynx_cfg.h
echo #define ANSI_VARARGS	 1 >> lynx_cfg.h
echo #define BOXHORI             0 >> lynx_cfg.h
echo #define BOXVERT             0 >> lynx_cfg.h
echo #define CAN_PIPE_TO_MAILER  0 >> lynx_cfg.h
echo #define HAVE_GETCWD	 1 >> lynx_cfg.h
echo #define HAVE_STRERROR	 1 >> lynx_cfg.h
echo #define LYNX_CFG_FILE "./lynx.cfg" >> lynx_cfg.h
echo #define LY_MAXPATH       1024 >> lynx_cfg.h
echo #define USE_BLAT_MAILER	 1 >> lynx_cfg.h
echo #define VC			2.14FM  >> lynx_cfg.h
echo #define _WIN_CC		 1 >> lynx_cfg.h
rem echo #define USE_SCROLLBAR	 1 >> lynx_cfg.h

SET DEFINES=-DCJK_EX
SET DEFINES=%DEFINES% -DUSE_ALT_BINDINGS
SET DEFINES=%DEFINES% -DEXP_NESTED_TABLES
SET DEFINES=%DEFINES% -DUSE_JUSTIFY_ELTS
SET DEFINES=%DEFINES% -DUSE_PERSISTENT_COOKIES
SET DEFINES=%DEFINES% -DUSE_READPROGRESS
if not "%OS%" == "Windows_NT" goto next11
SET DEFINES=%DEFINES% -DLY_MAXPATH=1024
rem The following is unnecessary and causes the
rem compile to fail:
rem SET DEFINES=%DEFINES% -DUSE_WINSOCK2_H
:next11
SET DEFINES=%DEFINES% -DACCESS_AUTH
SET DEFINES=%DEFINES% -DDIRED_SUPPORT
SET DEFINES=%DEFINES% -DDISP_PARTIAL
SET DEFINES=%DEFINES% -DDOSPATH
SET DEFINES=%DEFINES% -DHAVE_DIRENT_H
SET DEFINES=%DEFINES% -DHAVE_KEYPAD
SET DEFINES=%DEFINES% -DLONG_LIST
SET DEFINES=%DEFINES% -DNOSIGHUP
SET DEFINES=%DEFINES% -DNOUSERS
SET DEFINES=%DEFINES% -DNO_CONFIG_INFO
SET DEFINES=%DEFINES% -DNO_CUSERID
SET DEFINES=%DEFINES% -DNO_FILIO_H
SET DEFINES=%DEFINES% -DNO_TTYTYPE
SET DEFINES=%DEFINES% -DNO_UNISTD_H
SET DEFINES=%DEFINES% -DNO_UTMP
SET DEFINES=%DEFINES% -DSH_EX
SET DEFINES=%DEFINES% -DUSE_EXTERNALS
SET DEFINES=%DEFINES% -DUSE_PRETTYSRC
SET DEFINES=%DEFINES% -DUSE_SOURCE_CACHE
SET DEFINES=%DEFINES% -DWIN32
SET DEFINES=%DEFINES% -DWIN_EX
SET DEFINES=%DEFINES% -D_WINDOWS
if not "%USE_ZLIB%" == "YES" goto next1
SET DEFINES=%DEFINES% -DUSE_ZLIB
:next1
if "%LIBRARY%" == "PDCURSES" goto else1
SET DEFINES=%DEFINES% -DUSE_SLANG
goto endif1
:else1
SET DEFINES=%DEFINES% -DFANCY_CURSES
SET DEFINES=%DEFINES% -DCOLOR_CURSES
SET DEFINES=%DEFINES% -DPDCURSES
SET DEFINES=%DEFINES% -DUSE_MULTIBYTE_CURSES
:endif1

if not "%1" == "src" goto else
	cd src
	goto src
:else
if not "%1" == "link" goto endif
	cd src
	goto link
:endif

SET INCLUDES=-I. -I..\..\.. -I..\..\..\src

set CFLAGS=-O3 %INCLUDES% %DEFINES%
set COMPILE_CMD=%CC% -c %CFLAGS%

cd WWW\Library\Implementation
erase *.o

%COMPILE_CMD% HTAABrow.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTAAProt.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTAAUtil.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTAccess.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTAnchor.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTAssoc.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTAtom.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTBTree.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTChunk.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTDOS.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTFile.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTFinger.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTFormat.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTFTP.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTFWriter.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTGopher.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTGroup.c
if errorlevel 1 PAUSE

%COMPILE_CMD% HTLex.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTList.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTMIME.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTMLDTD.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTMLGen.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTNews.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTParse.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTPlain.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTRules.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTString.c
if errorlevel 1 PAUSE

%COMPILE_CMD% HTStyle.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTTCP.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTTelnet.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTTP.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTUU.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTWSRC.c
if errorlevel 1 PAUSE
%COMPILE_CMD% SGML.c
if errorlevel 1 PAUSE

ar crv libwww.a *.o

if errorlevel 1 PAUSE

cd ..\..\..\src\chrtrans
erase *.o

SET INCLUDES=-I. -I.. -I..\.. -I..\..\WWW\Library\Implementation
SET CFLAGS=-O3 %INCLUDES% %DEFINES%
SET COMPILE_CMD=%CC% -c %CFLAGS%

%COMPILE_CMD% makeuctb.c
if errorlevel 1 PAUSE
%CC% -o makeuctb.exe makeuctb.o
if errorlevel 1 PAUSE

call makew32.bat
if errorlevel 1 PAUSE
cd ..\

:src
SET INCLUDES=-I. -I.. -I.\chrtrans -I..\WWW\Library\Implementation
SET CFLAGS=-O3 %INCLUDES% %DEFINES%
SET COMPILE_CMD=%CC% -c %CFLAGS%
SET PATH=..\WWW\Library\Implementation;%PATH%
erase *.o

%COMPILE_CMD% DefaultStyle.c
if errorlevel 1 PAUSE
%COMPILE_CMD% GridText.c
if errorlevel 1 PAUSE
if not exist TRSTable.c goto notrstable
%COMPILE_CMD% TRSTable.c
if errorlevel 1 PAUSE
:notrstable
if not exist Xsystem.c goto noxsystem
%COMPILE_CMD% Xsystem.c
if errorlevel 1 PAUSE
:noxsystem
%COMPILE_CMD% HTAlert.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTFWriter.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTInit.c
if errorlevel 1 PAUSE
%COMPILE_CMD% HTML.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYBookmark.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYCgi.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYCharSets.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYCharUtils.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYClean.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYCookie.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYCurses.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYDownload.c
if errorlevel 1 PAUSE

%COMPILE_CMD% LYEdit.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYEditmap.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYexit.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYExtern.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYForms.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYGetFile.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYHash.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYHistory.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYJump.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYKeymap.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYLeaks.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYList.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYLocal.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYMail.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYMain.c
if errorlevel 1 PAUSE
%COMPILE_CMD%  LYMainLoop.c
if errorlevel 1 PAUSE

%COMPILE_CMD% LYMap.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYNews.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYOptions.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYPrettySrc.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYPrint.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYrcFile.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYReadCFG.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYSearch.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYSession.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYShowInfo.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYStrings.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYStyle.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYTraversal.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYUpload.c
if errorlevel 1 PAUSE
%COMPILE_CMD% LYUtils.c
if errorlevel 1 PAUSE
%COMPILE_CMD% UCAuto.c
if errorlevel 1 PAUSE
%COMPILE_CMD% UCAux.c
if errorlevel 1 PAUSE
%COMPILE_CMD% UCdomap.c
if errorlevel 1 PAUSE

:link
if not "%LIBRARY%" == "PDCURSES" goto else2
SET LIBS=-L..\WWW\Library\Implementation -lwww -lpdcurses
goto endif2
:else2
SET LIBS=-L..\WWW\Library\Implementation -lwww -lslang
:endif2

SET LIBS=%LIBS% -lwsock32 -luser32

if not "%USE_ZLIB%" == "YES" goto else4
SET LIBS=%LIBS% -lz
:else4

%CC% -s -o lynx *.o %LIBS%
if exist lynx.exe ECHO "Welcome to lynx!"