forked from sezero/watt32
-
Notifications
You must be signed in to change notification settings - Fork 8
/
appveyor-script.bat
643 lines (547 loc) · 22.6 KB
/
appveyor-script.bat
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
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
@echo off
setlocal EnableDelayedExpansion
prompt $P$G
::
:: Download-links for djgpp + OpenWatcom files used by 'build_x' on AppVeyor or
:: for local testing if this .bat-file.
::
:: These can be rather slow:
::
set URL_DJ_WIN_ZIP=http://www.watt-32.net/CI/dj-win.zip
set URL_WATCOM_ZIP=http://www.watt-32.net/CI/watcom20.zip
set URL_BORLAND_ZIP=http://www.watt-32.net/CI/borland.zip
set URL_WINPCAP_EXE=https://www.winpcap.org/install/bin/WinPcap_4_1_3.exe
set URL_NPCAP_EXE=https://github.com/UAVCAN/pyuavcan/blob/master/.test_deps/npcap-0.96.exe
set URL_CLANG_32_EXE=https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.0/LLVM-16.0.0-win32.exe
set URL_CLANG_64_EXE=https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.0/LLVM-16.0.0-win32.exe
::
:: D/L from MS's OneDrive instead with the below cryptic 'URL_x' strings.
::
:: I got these with the help of "CurlWget". An great Chrome extension:
:: https://chrome.google.com/webstore/detail/curlwget/jmocjfidanebdlinpbcdkcmgdifblncg
::
:: set URL_DJ_WIN_ZIP="https://public.am.files.1drv.com/y4mj1hIt_E5LjPPG9V7PywEz9lsuoYtMOEP1-jEcUkZ06M9ZK3kN7SXPw2AOgn9sf2_RbqhRQgvhMOgaJxyIL_O2GTjzp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w63GgzyAN92DRw3orkR3NFzpzOCU07wDU6FzFYbwZ9ANFPlgXGoZLo7xPxV%2bo2ENrciUbYqsDe3tNqfcXZwV2wJ7sRbqEyRPglSLz7cEIXxNV7vW/jkNK%2b2VUiXgpZnZm0hFtN6TCa3PwiNj92GoUJKSnxKwiucKyOGFrg0YcoOfvAv4r4Ncq4%2bIADOWBhRHUcURB1hFmjAIJGBet%2beXdNwW/kOpctMSyROf0XO2%2b3W2yKlxS1utzy1aeIb19BzaD4DbLRChFe6u3MpphQDJq/Bcj5oU6iR79wr5Vmu13HR8HUj0RSJ1xamF74t9l84LPJKBnD10PoZ5k2BV7fJiusS7U5%2bqs8F626wNkTq%2b6Bk499Zg0hhgKsedrEq%2bAUvUCMLTl4cTfEBjWO3YlN5Z%2bd%2bpkLB1BV7SpS9A1Y9Cq%2b6HJ3LgRNgRVvdSQS7J7Iclhzq2gTngPZzsR/XlMCa6jIQ3wYKl5z4poMjnWl%2b6nt6VV1LdDMgIlNRvIBpbOgY9OxwomTJCGX9K7kwwZWLljmcn9K%2blgz5Js/6/2AEjrZ2uk6nJIudfhRXf1pba%2b2UrYfi8r5r5VkW/iTPNHYu7tEmQHblEgzHaiyd1NAwI%3d"
::
:: 'APPVEYOR_PROJECT_NAME==Watt-32' unless testing this as:
:: c:\net\watt-32\> cmd /c appveyor-script.bat [build_src | build_bin | build_tests]
::
:: locally.
:: Change this for an 'echo.exe' with colour support. Like Cygwin.
::
set _ECHO=%CYGWIN_ROOT%\bin\echo.exe -e
if %APPVEYOR_PROJECT_NAME%. == . (
set LOCAL_TEST=1
if %BUILDER%. == . (
echo BUILDER not set!
exit /b 1
)
if %WATT_ROOT%. == . (
echo WATT_ROOT not set!
exit /b 1
)
set APPVEYOR_BUILD_FOLDER=%WATT_ROOT%
set APPVEYOR_BUILD_FOLDER_UNIX=e:/net/watt
) else (
set LOCAL_TEST=0
set WATT_ROOT=c:\projects\watt-32
set APPVEYOR_BUILD_FOLDER=c:\projects\watt-32
set APPVEYOR_BUILD_FOLDER_UNIX=c:/projects/watt-32
set _ECHO=c:\msys64\usr\bin\echo.exe -e
set CYGWIN=nodosfilewarning
)
::
:: Download stuff to here:
::
set CI_ROOT=%APPVEYOR_BUILD_FOLDER%\CI-temp
md %CI_ROOT% 2> NUL
::
:: Since only 'watcom' has a '%MODEL%' set in 'appveyor.yml'
::
if %BUILDER%. == watcom. (
%_ECHO% "\n\e[1;33mDoing '%1' for 'BUILDER=%BUILDER%', 'MODEL=%MODEL%'.\e[0m"
) else (
%_ECHO% "\n\e[1;33mDoing '%1' for 'BUILDER=%BUILDER%'.\e[0m"
)
::
:: Stuff common to '[build_src | build_bin | build_tests]'
::
:: mingw64: Stuff for 'util/pkg-conf.mak'.
::
md lib\pkgconfig 2> NUL
set MINGW64=%APPVEYOR_BUILD_FOLDER_UNIX%
::
:: Set the dir for djgpp cross-environment.
:: Use forward slashes for this. Otherwise 'sh' + 'make' will get confused.
:: 7z can create only 1 level of missing directories. So a '%CI_ROOT%\djgpp' will not work
::
set DJGPP=%APPVEYOR_BUILD_FOLDER_UNIX%/CI-temp
set DJGPP_PREFIX=%DJGPP%/bin/i586-pc-msdosdjgpp
set 7Z=7z x -y
::
:: Set env-var for building with Watcom 2.0
::
set WATCOM=%CI_ROOT%
set NT_INCLUDE=%WATCOM%\h;%WATCOM%\h\nt
set DOS_INCLUDE=%WATCOM%\h
::
:: Set env-var for building with Borland/CBuilder (Win32 only)
::
set BCCDIR=%CI_ROOT%
if %BUILDER%. == borland. set CBUILDER_IS_LLVM_BASED=1
if %BUILDER%. == borland. set INCLUDE=%BCCDIR%\include\windows;%BCCDIR%\include\windows\sdk;%INCLUDE%
if %LOCAL_TEST% == 1 goto local_test_1
::
:: Shit for brains 'cmd' cannot have this inside a 'if x (' block since
:: on a AppVeyor build several "c:\Program Files (x86)\Microsoft xxx" strings
:: are in the 'PATH'.
::
:: This is the PATH to the 64-bit 'clang-cl' already on AppVeyor.
:: set PATH=%PATH%;c:\Program Files\LLVM\bin
::
:: These are needed by 'clang-release_32.mak' and 'clang-release_64.mak'
::
set CLANG_32=c:/Program Files (x86)/LLVM
set CLANG_64=c:/Program Files/LLVM
set CLANG_MAJOR_VER=11
::
:: And append the '%WATCOM%\binnt' to the 'PATH' since Watcom has an 'cl.exe'
:: which we do not want to use for 'BUILDER=visualc'.
::
set PATH=%PATH%;%WATCOM%\binnt
::
:: And append the '%BCCDIR%\bin' to the 'PATH' too.
::
set PATH=%PATH%;%BCCDIR%\bin
:local_test_1
::
:: In case my curl was built with Wsock-Trace
::
set WSOCK_TRACE_LEVEL=0
::
:: Sanity check:
::
if %BUILDER%. == . (
%_ECHO% "\e[1;31mBUILDER target not specified!\e[0m"
exit /b 1
)
::
:: Assume 'CPU=x86'
::
set BITS=32
if %CPU%. == x64. set BITS=64
if %1. == build_src. goto :build_src
if %1. == build_bin. goto :build_bin
if %1. == build_tests. goto :build_tests
if %1. == build_python. goto :build_python
if %1. == run_programs. goto :run_programs
echo Usage: %~dp0%0 ^[build_src ^| build_bin ^| build_tests ^| build_python ^]
exit /b 1
:build_src
cd src
::
:: Local 'cmd' test for '(' in env-vars:
:: This is what AppVeyor have first in their PATH:
:: c:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin
::
:: Hence cannot use a 'if x (what-ever) else (something else)' syntax with that.
::
if %LOCAL_TEST% == 1 (
echo on
if not exist "%APPVEYOR_BUILD_FOLDER%" (echo No '%APPVEYOR_BUILD_FOLDER%'. Edit this .bat-file & exit /b 1)
)
::
:: Generate a 'src/oui-generated.c' file from 'src/oui.txt (do not download it every time).
:: This is needed for many Win32 targets since it's mentioned in the 'build/*/watt32.dep' file.
:: Otherwise some Make programs (Cbuilder make) will exit.
::
set CL=
if %LOCAL_TEST% == 0 (
%_ECHO% "\e[1;33mGenerating 'src/oui-generated.c'.\e[0m"
python.exe make-oui.py > oui-generated.c
if errorlevel 0 set CL=-DHAVE_OUI_GENERATED_C
)
%_ECHO% "\e[1;33m--------------------------------------------------------------------------------------------------\e[0m"
%_ECHO% "\e[1;33m[%CPU%]: call configur.bat %BUILDER%:\e[0m"
if %BUILDER%. == visualc. (
call configur.bat visualc
%_ECHO% "\e[1;33m[%CPU%]: Building release:\e[0m"
nmake -nologo -f visualc-release_%BITS%.mak
exit /b
)
::
:: Need to do 'call :install_CLANG_%BITS%' here to set the PATH for 'clang-cl.exe'!
::
if %BUILDER%. == clang. (
cd ..
call :install_CLANG_%BITS%
cd src
call configur.bat clang
call :show_clang_info
%_ECHO% "\e[1;33m[%CPU%]: Building release:\e[0m"
make -f clang-release_%BITS%.mak
exit /b
)
if %BUILDER%. == mingw64. (
call configur.bat mingw64
call :show_gcc_info
%_ECHO% "\e[1;33m[%CPU%]: Building:\e[0m"
make -f MinGW64_%BITS%.mak
exit /b
)
if %BUILDER%. == cygwin. (
call configur.bat cygwin
call :show_gcc_info
%_ECHO% "\e[1;33m[%CPU%]: Building:\e[0m"
make -f cygwin_%BITS%.mak
exit /b
)
if %BUILDER%. == djgpp. (
call :install_djgpp
call configur.bat djgpp
call :show_gcc_info
%_ECHO% "\e[1;33m[%CPU%]: Building:\e[0m"
make -f djgpp.mak
exit /b
)
if %BUILDER%. == borland. (
call :install_borland
call configur.bat borland
%_ECHO% "\e[1;33m[%CPU%]: Building:\e[0m"
%BCCDIR%\bin\make -f bcc_w.mak
exit /b
)
if %BUILDER%. == watcom. (
call :install_watcom
call configur.bat watcom
if %MODEL%. == win32. (
%_ECHO% "\e[1;33m[%CPU%]: Building for Watcom/Win32:\e[0m"
wmake -h -f watcom_w.mak
) else if %MODEL%. == flat. (
%_ECHO% "\e[1;33m[%CPU%]: Building for Watcom/flat:\e[0m"
wmake -h -f watcom_f.mak
) else if %MODEL%. == large. (
%_ECHO% "\e[1;33m[%CPU%]: Building for Watcom/large:\e[0m"
wmake -h -f watcom_l.mak
) else (
%_ECHO% "\e[1;31m[%CPU%]: BUILDER 'watcom' needs a 'MODEL'!\e[0m"
exit /b 1
)
exit /b
)
%_ECHO% "\e[1;31mIllegal BUILDER / CPU (BUILDER=%BUILDER%, CPU=%CPU%) values! Remember cmd.exe is case-sensitive.\e[0m"
exit /b 1
::
:: './bin/' programs to build for djgpp, Visual-C, MinGW-w64, Cygwin, clang-cl and Borland:
::
:build_bin
set PROGS_DJ=bping.exe ping.exe finger.exe ident.exe htget.exe tcpinfo.exe tracert.exe country.exe
set PROGS_VC=ping.exe finger.exe tcpinfo.exe host.exe htget.exe tracert.exe con-test.exe gui-test.exe lpq.exe lpr.exe ntime.exe whois.exe ident.exe country.exe
set PROGS_CYG=ping.exe finger.exe tcpinfo.exe host.exe htget.exe tracert.exe lpq.exe lpr.exe ntime.exe whois.exe ident.exe country.exe
set PROGS_MW=%PROGS_VC%
set PROGS_CL=%PROGS_VC%
set PROGS_BC=%PROGS_VC%
::
:: './bin/' programs to build for Watcom (Win32 + large + flat):
::
set PROGS_WC_WIN=ping.exe htget.exe finger.exe tcpinfo.exe con-test.exe gui-test.exe htget.exe tracert.exe whois.exe
set PROGS_WC_LARGE=ping.exe htget.exe finger.exe tcpinfo.exe htget.exe whois.exe
set PROGS_WC_FLAT=%PROGS_WC_LARGE%
set PROGS_WC_SMALL32=%PROGS_WC_LARGE%
cd bin
if %BUILDER%. == djgpp. (
%_ECHO% "\e[1;33m[%CPU%]: Building PROGS_DJ=%PROGS_DJ%:\e[0m"
make -f djgpp_win.mak DPMI_STUB=0 %PROGS_DJ%
exit /b
)
if %BUILDER%. == visualc. (
%_ECHO% "\e[1;33m[%CPU%]: Building PROGS_VC=%PROGS_VC%:\e[0m"
nmake -nologo -f visualc.mak %PROGS_VC%
exit /b
)
if %BUILDER%. == mingw64. (
%_ECHO% "\e[1;33m[%CPU%]: Building PROGS_MW=%PROGS_MW%:\e[0m"
make -f mingw64.mak %PROGS_MW%
exit /b
)
if %BUILDER%. == cygwin. (
%_ECHO% "\e[1;33m[%CPU%]: Building PROGS_CYG=%PROGS_CYG%:\e[0m"
make -f cygwin.mak %PROGS_CYG%
exit /b
)
::
:: Need to do 'call :install_CLANG_%BITS%' here to set the PATH for 'clang-cl.exe' again.
::
if %BUILDER%. == clang. (
cd ..
call :install_CLANG_%BITS%
cd bin
%_ECHO% "\e[1;33m[%CPU%]: Building PROGS_CL=%PROGS_CL%:\e[0m"
make -f clang.mak check_CPU %PROGS_CL%
exit /b
)
if %BUILDER%. == borland. (
%_ECHO% "\e[1;33m[%CPU%]: Building PROGS_BC=%PROGS_BC%:\e[0m"
%BCCDIR%\bin\make -f bcc_win.mak %PROGS_BC%
exit /b
)
if %BUILDER%. == watcom. (
if %MODEL%. == win32. (
%_ECHO% "\e[1;33mwatcom/Win32: Building PROGS_WC_WIN=%PROGS_WC_WIN%:\e[0m"
rm -f %PROGS_WC_WIN%
wmake -h -f wc_win.mak %PROGS_WC_WIN%
) else if %MODEL%. == flat. (
%_ECHO% "\e[1;33mwatcom/flat: Building PROGS_WC_FLAT=%PROGS_WC_FLAT%:\e[0m"
rm -f %PROGS_WC_LARGE%
wmake -h -f causeway.mak %PROGS_WC_FLAT%
) else if %MODEL%. == large. (
%_ECHO% "\e[1;33mwatcom/large: Building PROGS_WC_LARGE=%PROGS_WC_LARGE%:\e[0m"
rm -f %PROGS_WC_LARGE%
wmake -h -f watcom.mak %PROGS_WC_LARGE%
) else (
%_ECHO% "\e[1;31mThe 'watcom' needs a 'MODEL'!\e[0m"
exit /b 1
)
exit /b
)
%_ECHO% "\e[1;31m[%CPU%]: No 'build_bin' for 'BUILDER=%BUILDER%' yet.\e[0m"
exit /b 0
::
:: Run the './bin/tcpinfo.exe' program if it exists.
:: But try to install NPcap first.
::
:run_programs
call :install_npcap
cd bin
if exist tcpinfo.exe (
set WATTCP_CFG=c:/projects/watt-32
%_ECHO% "\e[1;33mRunning test 'tcpinfo.exe -d' ---------------------------------------------------------------\e[0m"
tcpinfo.exe -d
)
exit /b
::
:: Build and run some test programs in './src/tests'.
:: (But djgpp, small, large and flat programs cannot run on AppVeyor).
::
:: Build all except for the 'watcom' MODELS 'small' and 'small32' (DOS).
:: All these generated makefiles requires GNU-make (a 'make' should already be on 'PATH').
::
:build_tests
if %LOCAL_TEST%. == 0. if %CPU%. == x86. set PATH=c:\Program Files (x86)\LLVM\bin;%PATH%
if %LOCAL_TEST%. == 0. (
set WATTCP_CFG=c:/projects/watt-32
%_ECHO% "\n\e[1;33mGenerating '%%WATTCP_CFG%%/wattcp.cfg'.\e[0m"
call :generate_wattcp_cfg
)
cd src\tests
set USE_WSOCK_TRACE=0
%_ECHO% "\n\e[1;33m[%CPU%]: Configuring 'build_tests' for 'BUILDER=%BUILDER%'.\e[0m"
call configur.bat %BUILDER%
if %BUILDER%. == borland. make -f bcc_w.mak
if %BUILDER%. == djgpp. make -f djgpp.mak
if %BUILDER%. == clang. make -f clang_%BITS%.mak
if %BUILDER%. == mingw64. make -f MinGW64_%BITS%.mak
if %BUILDER%. == cygwin. make -f Cygwin_%BITS%.mak
if %BUILDER%. == visualc. make -f visualc_%BITS%.mak
if %BUILDER%. == watcom. (
if %MODEL%. == large. (make -f watcom_l.mak & if not errorlevel == 0 goto test_failed)
if %MODEL%. == flat. (make -f watcom_f.mak & if not errorlevel == 0 goto test_failed)
if %MODEL%. == win32. (make -f watcom_w.mak & if not errorlevel == 0 goto test_failed)
)
%_ECHO% "\n\e[1;33mRunning test 'cpu.exe' ---------------------------------------------------------------\e[0m"
cpu.exe
%_ECHO% "\n\e[1;33mRunning test 'cpuspeed.exe 1 1' ------------------------------------------------------\e[0m"
cpuspeed.exe 1 1
%_ECHO% "\n\e[1;33mRunning test 'chksum.exe -s' ---------------------------------------------------------\e[0m"
chksum.exe -s
::
:: Not built for 'BUILDER==cygwin'
::
if exist swap.exe (
%_ECHO% "\n\e[1;33mRunning test 'swap.exe' --------------------------------------------------------------\e[0m"
swap.exe
%_ECHO% "\n\e[1;33mRunning test 'swap.exe -o' -----------------------------------------------------------\e[0m"
swap.exe -o
)
exit /b 0
:test_failed
exit /b 1
:no_tests
exit /b 0
::
:: Try to build the '_watt32.pyd' module
::
:build_python
cd src\Python
if %BUILDER%. == visualc. (
%_ECHO% "\e[1;33m[%CPU%]: Building 'build_python' for 'BUILDER=visualc'.\e[0m"
make PYTHON=python.exe CC=cl
) else if %BUILDER%. == clang. (
%_ECHO% "\e[1;33m[%CPU%]: Building 'build_python' for 'BUILDER=clang-cl'.\e[0m"
make PYTHON=python.exe CC=clang-cl
) else if %BUILDER%. == mingw64. (
%_ECHO% "\e[1;33m[%CPU%]: Building 'build_python' for 'BUILDER=MinGW64'.\e[0m"
make PYTHON=python.exe CC=gcc
) else (
%_ECHO% "\e[1;33m[%CPU%]: Not doing 'build_python' for 'BUILDER=%BUILDER%'.\e[0m"
)
exit /b 0
::
:: Download the '%CI_ROOT%\LLVM-16.0.0-win32.exe' for 32-bit 'clang-cl'.
:: A 300 MByte download which silently installs to "c:\Program Files (x86)\LLVM"
::
:install_CLANG_32
if %LOCAL_TEST% == 1 exit /B
if exist "c:\Program Files (x86)\LLVM\bin\clang-cl.exe" exit /b
if exist %CD%\CI\LLVM-32-bit\bin\clang-cl.exe exit /b
if not exist %CI_ROOT%\LLVM-16.0.0-win32.exe call :download_CLANG_32
%_ECHO% "\e[1;33mInstalling 32-bit LLVM to 'c:\Program Files (x86)\LLVM' ...\e[0m"
start /wait %CI_ROOT%\LLVM-16.0.0-win32.exe /S
%CD%\CI\LLVM-32-bit\bin\clang-cl -v
%_ECHO% "\e[1;33mDone\n--------------------------------------------------------\e[0m"
exit /b
::
:: Download the '%CI_ROOT%\LLVM-16.0.0-win64.exe' for 64-bit 'clang-cl'.
:: A 300 MByte download which silently installs to "c:\Program Files\LLVM"
::
:install_CLANG_64
if %LOCAL_TEST% == 1 exit /B
if exist "c:\Program Files\LLVM\bin\clang-cl.exe" exit /b
if exist %CD%\CI\LLVM-64-bit\bin\clang-cl.exe exit /b
if not exist %CI_ROOT%\LLVM-16.0.0-win64.exe call :download_CLANG_64
%_ECHO% "\e[1;33mInstalling 64-bit LLVM to 'c:\Program Files\LLVM' ...\e[0m"
start /wait %CI_ROOT%\LLVM-16.0.0-win64.exe /S
%CD%\CI\LLVM-64-bit\bin\clang-cl -v
%_ECHO% "\e[1;33mDone\n--------------------------------------------------------\e[0m"
exit /b
:download_CLANG_32
%_ECHO% "\e[1;33mDownloading 32-bit LLVM...'.\e[0m"
curl -# -Lo %CI_ROOT%\LLVM-16.0.0-win32.exe %URL_CLANG_32_EXE%
if not errorlevel == 0 (
%_ECHO% "\e[1;31mThe curl download failed!\e[0m"
exit /b 1
)
exit /b
:download_CLANG_64
%_ECHO% "\e[1;33mDownloading 64-bit LLVM...'.\e[0m"
curl -# -Lo %CI_ROOT%\LLVM-16.0.0-win64.exe %URL_CLANG_64_EXE%
if not errorlevel == 0 (
%_ECHO% "\e[1;31mThe curl download failed!\e[0m"
exit /b 1
)
exit /b
::
:: Download and install cross compiler for djgpp
::
:install_djgpp
if exist %DJGPP%\bin\i586-pc-msdosdjgpp-gcc.exe exit /b
call :download_djgpp
7z x -y -o%DJGPP% %CI_ROOT%\dj-win.zip > NUL
%_ECHO% "\e[1;33mDone\n--------------------------------------------------------\e[0m"
exit /b
:download_djgpp
%_ECHO% "\e[1;33mDownloading Andrew Wu's DJGPP cross compiler:\e[0m"
curl -# -Lo %CI_ROOT%\dj-win.zip %URL_DJ_WIN_ZIP%
if not errorlevel == 0 (
%_ECHO% "\e[1;31mThe curl download failed!\e[0m"
exit /b 1
)
exit /b
::
:: Download and install Borland/CBuilder
::
:install_borland
if exist %BCCDIR%\bin\make.exe exit /b
%_ECHO% "\e[1;33mDownloading Borland:\e[0m"
curl -# -Lo %CI_ROOT%\borland.zip %URL_BORLAND_ZIP%
if not errorlevel == 0 (
%_ECHO% "\e[1;31mThe curl download failed!\e[0m"
exit /b
)
7z x -y -o%BCCDIR% %CI_ROOT%\borland.zip > NUL
exit /b
::
:: Download and install OpenWatcom
::
:install_watcom
if exist %WATCOM%\binnt\wmake.exe exit /b
%_ECHO% "\e[1;33mDownloading OpenWatcom 2.0:\e[0m"
curl -# -Lo %CI_ROOT%\watcom20.zip %URL_WATCOM_ZIP%
if not errorlevel == 0 (
%_ECHO% "\e[1;31mThe curl download failed!\e[0m"
exit /b
)
7z x -y -o%WATCOM% %CI_ROOT%\watcom20.zip > NUL
exit /b
::
:: Download and install WinPcap
::
:install_winpcap
if exist %CI_ROOT%\WinPcap\Uninstall.exe exit /b
%_ECHO% "\e[1;33mDownloading WinPcap 4.1.3:\e[0m"
curl -# -Lo %CI_ROOT%\WinPcap_4_1_3.exe %URL_WINPCAP_EXE%
if not errorlevel == 0 (
%_ECHO% "\e[1;31mThe curl download failed!\e[0m"
exit /b
)
%CI_ROOT%\WinPcap_4_1_3.exe
exit /b
::
:: Download and install the NPcap silent installer.
::
:install_npcap
if exist "C:\Program Files\NPcap\Uninstall.exe" exit /b
%_ECHO% "\e[1;33mDownloading NPcap 0.96:\e[0m"
curl -# -Lo %CI_ROOT%\npcap-0.96.exe %URL_NPCAP_EXE%
if not errorlevel == 0 (
%_ECHO% "\e[1;31mThe curl download failed!\e[0m"
exit /b
)
%CI_ROOT%\npcap-0.96.exe /loopback_support=yes /winpcap_mode=yes /S
exit /b
::
:: Show some 'gcc -v' output.
:: Called for 'BUILDER = [cygwin | mingw64 | djgpp]'
::
:: This should print:
:: for 'cygwin' and 'CPU=x86': gcc 7.4.0
:: for 'cygwin' and 'CPU=x64': gcc 9.1.0
:: for 'mingw64': gcc version 9.1.0 (Rev3, Built by MSYS2 project)
:: for 'djgpp': gcc version 12.2.0
::
:show_gcc_info
%_ECHO% "\e[1;33m[%CPU%]: gcc version-info:\e[0m"
gcc -v
echo.
exit /b
::
:: Ditto for 'clang-cl'
::
:show_clang_info
%_ECHO% "\e[1;33m[%CPU%]: clang-cl version-info:\e[0m"
clang-cl -v
echo.
exit /b
::
:: Generate a 'c:\projects\watt-32\wattcp.cfg' for AppVeyor only.
::
:generate_wattcp_cfg
echo # A generated %WATTCP_CFG%/wattcp.cfg for AppVeyor > %WATTCP_CFG%/wattcp.cfg
echo debug = 2 >> %WATTCP_CFG%/wattcp.cfg
echo nameserver = 8.8.8.8 >> %WATTCP_CFG%/wattcp.cfg
echo winpkt.device = >> %WATTCP_CFG%/wattcp.cfg
echo winpkt.dumpfile = $(WATT_ROOT)\winpkt_dump.txt >> %WATTCP_CFG%/wattcp.cfg
echo winpkt.trace = 2 >> %WATTCP_CFG%/wattcp.cfg
echo winpkt.rxmode = 0x20 >> %WATTCP_CFG%/wattcp.cfg
echo my_ip = 10.0.0.2 >> %WATTCP_CFG%/wattcp.cfg
echo gateway = 10.0.0.1 >> %WATTCP_CFG%/wattcp.cfg
echo netmask = 255.255.255.0 >> %WATTCP_CFG%/wattcp.cfg
echo hosts = $(WATT_ROOT)\bin\hosts >> %WATTCP_CFG%/wattcp.cfg
echo hosts6 = $(WATT_ROOT)\bin\hosts6 >> %WATTCP_CFG%/wattcp.cfg
echo services = $(WATT_ROOT)\bin\services >> %WATTCP_CFG%/wattcp.cfg
echo protocols = $(WATT_ROOT)\bin\protocol >> %WATTCP_CFG%/wattcp.cfg
echo networks = $(WATT_ROOT)\bin\networks >> %WATTCP_CFG%/wattcp.cfg
echo ethers = $(WATT_ROOT)\bin\ethers >> %WATTCP_CFG%/wattcp.cfg
type "%WATTCP_CFG%\wattcp.cfg"
exit /b