-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathconfigure.bat
362 lines (306 loc) · 10.3 KB
/
configure.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
@echo off
rem For help run: "configure --help"
rem ============================================================
rem Default the build directory to build, not the current dir
rem ============================================================
SET BUILDDIR=build
rem ============================================================
rem Set variables we will need to blank
rem ============================================================
SET ECBIN=
SET DISABLED_MANAGED_MEM=
SET SCP_CLIENT=pscp -C
SET SSH_CLIENT=plink -C
SET HG=hg
rem ============================================================
rem Be sure to start with a blank config.wat
rem by simply writing in a comment
rem ============================================================
echo # Configuration for Watcom > config.wat
echo ASSERT=1 >> config.wat
rem ============================================================
rem Detect some parameters
rem ============================================================
rem ============================================================
rem Read command line parameters
rem ============================================================
:Loop
IF "%1"=="" GOTO Continue
IF "%1"=="--without-euphoria" (
set NOEU=1
GOTO EndLoop
)
IF "%1" =="--prefix" (
echo PREFIX=%2 >> config.wat
SHIFT
GOTO EndLoop
)
IF "%1" =="--no-managed-mem" (
echo MANAGED_MEM=0 >> config.wat
SET DISABLED_MANAGED_MEM=1
GOTO EndLoop
)
IF "%1" =="--eubin" (
echo EUBIN=%2 >> config.wat
SET HAS_EUBIN=1
SET THIS_EUBIN=%2\
SHIFT
GOTO EndLoop
)
IF "%1" =="--use-binary-translator" (
SET ECBIN=1
GOTO EndLoop
)
IF "%1" =="--use-source-translator" (
SET ECBIN=0
GOTO EndLoop
)
IF "%1" =="--build" (
set BUILDDIR=%2
SHIFT
GOTO EndLoop
)
IF "%1" =="--plat" (
echo PLAT=%2 >> config.wat
SHIFT
GOTO EndLoop
)
IF "%1" =="--debug" (
set DEBUG=1
echo DEBUG=1 >> config.wat
GOTO EndLoop
)
IF "%1" =="--heapcheck" (
echo HEAP_CHECK=1 >> config.wat
GOTO EndLoop
)
IF "%1" == "--extrastats" (
echo EXTRA_STATS=1 >> config.wat
GOTO EndLoop
)
IF "%1" == "--extracheck" (
echo EXTRA_CHECK=1 >> config.wat
GOTO EndLoop
)
IF "%1" == "--align4" (
echo ALIGN4=1 >> config.wat
GOTO EndLoop
)
IF "%1" == "--noassert" (
echo ASSERT=0 >> config.wat
GOTO EndLoop
)
IF "%1" == "--release" (
echo EREL_TYPE = /dEREL_TYPE="%2" >> config.wat
SHIFT
GOTO EndLoop
)
IF "%1" =="--final" (
echo EREL_TYPE = /dEREL_TYPE=1 >> config.wat
GOTO EndLoop
)
IF "%1" == "--verbose-tests" (
echo VERBOSE_TESTS = -verbose >> config.wat
SHIFT
GOTO EndLoop
)
IF "%1" == "--oe-username" (
echo OE_USERNAME=%2 >> config.wat
SHIFT
GOTO EndLoop
)
IF "%1" == "--scp-client" (
set SCP_CLIENT=%2
SHIFT
GOTO EndLoop
)
IF "%1" == "--ssh-client" (
set SSH_CLIENT=%2
SHIFT
GOTO EndLoop
)
IF "%1" == "--hg" (
SET HG=%2
SHIFT
GOTO EndLoop
)
IF "%1" == "--help" (
GOTO Help
)
echo Unknown option '%1'
GOTO Help
:EndLoop
SHIFT
GOTO Loop
rem ============================================================
rem Store our options to the config.wat file
rem ============================================================
:Continue
echo SCP=%SCP_CLIENT% >> config.wat
echo SSH=%SSH_CLIENT% >> config.wat
echo HG=%HG% >> config.wat
if "%HAS_EUBIN%" == "1" (
SET NOEU=
) else (
eui.exe -? 1> NUL 2> NUL
if "%ERRORLEVEL%" == "9009" (
set NOEU=1
) else (
set NOEU=
)
)
echo ARCH=ix86 >> config.wat
IF "%NOEU%" == "" (
echo EUPHORIA=1 >> config.wat
) else (
echo EUPHORIA=0 >> config.wat
)
IF "%DISABLED_MANAGED_MEM%" == "" (
echo MANAGED_MEM=1 >> config.wat
)
IF "%ECBIN%" == "1" (
echo EC="$(EUBIN)\euc.exe" >> config.wat
)
IF not exist %WINDIR%\command\deltree.exe (
echo DELTREE=del /Q /S >> config.wat
echo RM=del /Q >> config.wat
echo RMDIR=rmdir /Q/S >> config.wat
)
IF exist %WINDIR%\command\deltree.exe (
echo DELTREE=deltree /y >> config.wat
echo RM=deltree /y >> config.wat
echo RMDIR=deltree /y >> config.wat
)
IF not exist %BUILDDIR% mkdir %BUILDDIR%
rem ============================================================
rem Get the full trunk directory name
rem ============================================================
cd ..
cd > config.tmp
set /p TRUNKDIR=<config.tmp
del config.tmp
cd source
rem ============================================================
rem Get the full build directory name
rem ============================================================
cd %BUILDDIR%
cd > config.tmp
set /p FULL_BUILDDIR=<config.tmp
del config.tmp
rem ============================================================
rem Going back to the source directory
rem ============================================================
cd %TRUNKDIR%\source
rem ============================================================
rem Determining where creolehtml and eudoc are
rem ============================================================
rem if exist %THIS_EUBIN%eudoc.exe (
rem echo EUDOC=%THIS_EUBIN%eudoc.exe >> config.wat
rem ) else (
rem if exist eudoc\eudoc.ex (
rem echo EUDOC=%THIS_EUBIN%eui.exe %TRUNKDIR%\source\eudoc\eudoc.ex >> config.wat
rem ) else (
rem echo EUDOC=eudoc.ex >> config.wat
rem )
rem )
echo EUDOC=eudoc.exe >> config.wat
rem if exist %THIS_EUBIN%creolehtml.exe (
rem echo CREOLEHTML=%THIS_EUBIN%creolehtml.exe >> config.wat
rem ) else (
rem if exist eudoc\creole\creolehtml.ex (
rem echo CREOLEHTML=%THIS_EUBIN%eui.exe %TRUNKDIR%\source\eudoc\creole\creolehtml.ex >> config.wat
rem ) else (
rem echo CREOLEHTML=creolehtml.ex >> config.wat
rem )
rem )
echo CREOLE=creole.exe >> config.wat
rem ============================================================
rem Writing our final configuration vars
rem ============================================================
echo TRUNKDIR=%TRUNKDIR% >> config.wat
echo BUILDDIR=%FULL_BUILDDIR% >> config.wat
rem ============================================================
rem Copy temporary .wat includes
rem ============================================================
if not exist %FULL_BUILDDIR%\transobj.wat copy transobj.dst %FULL_BUILDDIR%\transobj.wat
if not exist %FULL_BUILDDIR%\intobj.wat copy intobj.dst %FULL_BUILDDIR%\intobj.wat
if not exist %FULL_BUILDDIR%\backobj.wat copy backobj.dst %FULL_BUILDDIR%\backobj.wat
rem ============================================================
rem Make a generic Makefile that simply includes Makefile.wat
rem ============================================================
echo !include Makefile.wat > Makefile
rem ============================================================
rem Add a default eu.cfg to the build dir and source dir
rem ============================================================
echo [All] > %BUILDDIR%\eu.cfg
echo -i %TRUNKDIR%\include >> %BUILDDIR%\eu.cfg
echo -eudir %TRUNKDIR% >> %BUILDDIR%\eu.cfg
echo [translate] >> %BUILDDIR%\eu.cfg
echo -com %TRUNKDIR% >> %BUILDDIR%\eu.cfg
if "%DEBUG%" =="1" (
echo -lib %FULL_BUILDDIR%\eudbg.lib >> %BUILDDIR%\eu.cfg
) else (
echo -lib %FULL_BUILDDIR%\eu.lib >> %BUILDDIR%\eu.cfg
)
echo [bind] >> %BUILDDIR%\eu.cfg
echo -eub %FULL_BUILDDIR%\eub >> %BUILDDIR%\eu.cfg
copy %BUILDDIR%\eu.cfg %TRUNKDIR%\source\eu.cfg
echo Build directory is %BUILDDIR%
rem ============================================================
rem All Done
rem ============================================================
GOTO Completed
rem ============================================================
rem Display Help
rem ============================================================
:Help
echo Configures and prepares the euphoria source for building
echo.
echo CONFIGURE.BAT [options]
echo.
echo Options:
echo --without-euphoria Use this option if you are building Euphoria
echo with only a C compiler.
echo --prefix value Use this option to specify the location for euphoria to
echo be installed. The default is EUDIR, or c:\euphoria,
echo if EUDIR is not set.
echo --no-managed-mem disable managed memory
echo --align4 malloc allocates addresses that are
echo always 4 byte aligned.
echo --eubin value Use this option to specify the location of the
echo interpreter binary to use to translate the front end.
echo The default is ..\bin
echo --build value set the build directory
echo --release value set the release type for the version string
echo --final Use this option to so EUPHORIA doesn't report itself
echo as a development version.
echo --noassert Use this to remove 'assert()' processing in the C code.
echo --plat value set the OS that we will translate to.
echo values can be: WINDOWS, OSX, LINUX, FREEBSD, OPENBSD or NETBSD.
echo --use-binary-translator
echo Use the already built translator rather than
echo interpreting its source
echo --use-source-translator
echo Interpret the translator's source rather than
echo using the already built translator (default)
echo --verbose-tests Cause eutest to use the -verbose flag during testing
echo --oe-username Developer user name on openeuphoria.org for various scp
echo operations such as manual upload
echo --scp-client SCP program to use for scp uploads (default pscp)
echo --ssh-client SSH program to use for ssh commands (default plink)
echo --hg Full path to hg.exe (default hg)
echo.
echo Developer Options:
echo --debug turn debugging on
echo --heapcheck check memory management system
echo --extracheck check for data corruption
echo --extrastats generates statistics
echo.
rem ============================================================
rem Batch file is all done
rem ============================================================
:Completed
rem ============================================================
rem Set a variable we used to blank
rem ============================================================
SET DISABLED_MANAGED_MEM=