-
Notifications
You must be signed in to change notification settings - Fork 51
/
Setup.bat
112 lines (97 loc) · 2.88 KB
/
Setup.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
@echo off
Setlocal EnableDelayedExpansion
REM ---
REM Non-Haskell RGL build script for Windows machines
REM ---
REM Modules to compile for each language
REM TODO read from languages.csv
set langs=Afr Amh Ara Eus Bul Cat Chi Cze Dan Dut Eng Est Fin Fre Grc Gre Heb Hin Hun Ger Ice Ina Ita Jpn Lat Lav Mlt Mon Nep Nor Nno Pes Pol Por Pnb Ron Rus Slo Snd Spa Swe Tha Tur Urd
set modules_langs=All Symbol Compatibility
set modules_api=Try Symbolic
REM Defaults (may be overridden by options)
set gf=gf
set dest=
set verbose=false
REM Check command line options
:Loop
if '%1'=='' goto Continue
if %1==-v set verbose=true
if %1==--verbose set verbose=true
if %1==--gf set gf=%2
if %1==--dest set dest=%2
shift
goto Loop
:Continue
REM Try to determine install location
if "%dest%"=="" (
REM Separate paths with search path separator ; and pick first one
for %%p in ("%GF_LIB_PATH:;=";"%") do (
set dest=%%~p
goto BreakLibPath
)
)
:BreakLibPath
if "%dest%"=="" (
echo Unable to determine where to install the RGL. Please do one of the following:
echo - Pass the --dest=... flag to this script
echo - Set the GF_LIB_PATH environment variable
REM echo - Compile & install GF from the gf-core repository (must be in same directory as gf-rgl)
exit /b
)
REM A few more definitions before we get started
set src=src
set dist=dist
set gfc=%gf% --batch --gf-lib-path=%src%
REM Add quiet flag if not verbose
if %verbose%==false (
set gfc=%gfc% --quiet
)
REM Make directories if not present
if not exist %dist%\prelude mkdir %dist%\prelude
if not exist %dist%\present mkdir %dist%\present
if not exist %dist%\alltenses mkdir %dist%\alltenses
REM Build: prelude
echo Building [prelude]
for /r %src%\prelude %%m in (*.gf) do (
%gfc% --gfo-dir=%dist%\prelude %%m
)
REM Gather all language modules for building
set modules=
for %%l in (%langs%) do (
for %%m in (%modules_langs%) do (
set patt=%%m%%l.gf
for /r %src% %%n in (!patt!) do (
if exist %%n set modules=!modules! %%n
)
)
)
for %%l in (%langs%) do (
for %%m in (%modules_api%) do (
set patt=%%m%%l.gf
for /r %src%\api %%n in (!patt!) do (
if exist %%n set modules=!modules! %%n
)
)
)
REM Build: present
echo Building [present]
for %%m in (%modules%) do (
if %verbose%==true echo %%m
%gfc% --no-pmcfg --gfo-dir=%dist%\present --preproc=mkPresent %%m
)
REM Build: alltenses
echo Building [alltenses]
for %%m in (%modules%) do (
if %verbose%==true echo %%m
%gfc% --no-pmcfg --gfo-dir=%dist%\alltenses %%m
)
REM Make destination directories if not present
if not exist %dest% mkdir %dest%
if not exist %dest%\prelude mkdir %dest%\prelude
if not exist %dest%\present mkdir %dest%\present
if not exist %dest%\alltenses mkdir %dest%\alltenses
REM Copy
echo Copying to %dest%
copy %dist%\prelude\*.gfo %dest%\prelude\
copy %dist%\present\*.gfo %dest%\present\
copy %dist%\alltenses\*.gfo %dest%\alltenses\