diff options
Diffstat (limited to '.appveyor/build.bat')
-rw-r--r-- | .appveyor/build.bat | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/.appveyor/build.bat b/.appveyor/build.bat new file mode 100644 index 00000000..48e72514 --- /dev/null +++ b/.appveyor/build.bat | |||
@@ -0,0 +1,112 @@ | |||
1 | @echo off | ||
2 | Setlocal EnableDelayedExpansion EnableExtensions | ||
3 | |||
4 | cd %APPVEYOR_BUILD_FOLDER% | ||
5 | |||
6 | :: ========================================================= | ||
7 | :: Make sure some environment variables are set | ||
8 | if not defined LUA_VER call :die LUA_VER is not defined | ||
9 | if not defined LUA call :die LUA is not defined | ||
10 | if not defined LUA_SHORTV call :die LUA_SHORTV is not defined | ||
11 | if not defined LUA_DIR call :die LUA_DIR is not defined | ||
12 | |||
13 | :: ========================================================= | ||
14 | :: Set some defaults. Infer some variables. | ||
15 | :: | ||
16 | if not defined LUAROCKS_VER set LUAROCKS_VER=2.2.1 | ||
17 | |||
18 | set LUAROCKS_SHORTV=%LUAROCKS_VER:~0,3% | ||
19 | |||
20 | if not defined LR_EXTERNAL set LR_EXTERNAL=c:\external | ||
21 | if not defined LUAROCKS_INSTALL set LUAROCKS_INSTALL=%LUA_DIR%\LuaRocks | ||
22 | if not defined LR_ROOT set LR_ROOT=%LUAROCKS_INSTALL%\%LUAROCKS_SHORTV% | ||
23 | if not defined LR_SYSTREE set LR_SYSTREE=%LUAROCKS_INSTALL%\systree | ||
24 | |||
25 | :: | ||
26 | :: ========================================================= | ||
27 | |||
28 | |||
29 | if not exist %LUA_DIR%\bin\%LUA%.exe call :die "Missing Lua interpreter at %LUA_DIR%\bin\%LUA%.exe" | ||
30 | |||
31 | |||
32 | |||
33 | :: ========================================================= | ||
34 | :: LuaRocks | ||
35 | :: ========================================================= | ||
36 | |||
37 | cd %APPVEYOR_BUILD_FOLDER% | ||
38 | call install.bat /LUA %LUA_DIR% /Q /LV %LUA_SHORTV% /P "%LUAROCKS_INSTALL%" /TREE "%LR_SYSTREE%" | ||
39 | |||
40 | if not exist "%LR_ROOT%" call :die "LuaRocks not found at %LR_ROOT%" | ||
41 | |||
42 | set PATH=%LR_ROOT%;%LR_SYSTREE%\bin;%PATH% | ||
43 | |||
44 | :: Lua will use just the system rocks | ||
45 | set LUA_PATH=%LR_ROOT%\lua\?.lua;%LR_ROOT%\lua\?\init.lua | ||
46 | set LUA_PATH=%LUA_PATH%;%LR_SYSTREE%\share\lua\%LUA_SHORTV%\?.lua | ||
47 | set LUA_PATH=%LUA_PATH%;%LR_SYSTREE%\share\lua\%LUA_SHORTV%\?\init.lua | ||
48 | set LUA_CPATH=%LR_SYSTREE%\lib\lua\%LUA_SHORTV%\?.dll | ||
49 | |||
50 | call luarocks --version || call :die "Error with LuaRocks installation" | ||
51 | call luarocks list | ||
52 | |||
53 | |||
54 | if not exist "%LR_EXTERNAL%" ( | ||
55 | mkdir "%LR_EXTERNAL%" | ||
56 | mkdir "%LR_EXTERNAL%\lib" | ||
57 | mkdir "%LR_EXTERNAL%\include" | ||
58 | ) | ||
59 | |||
60 | set PATH=%LR_EXTERNAL%;%PATH% | ||
61 | |||
62 | :: Exports the following variables: | ||
63 | :: (beware of whitespace between & and ^ below) | ||
64 | endlocal & set PATH=%PATH%&^ | ||
65 | set LR_SYSTREE=%LR_SYSTREE%&^ | ||
66 | set LUA_PATH=%LUA_PATH%&^ | ||
67 | set LUA_CPATH=%LUA_CPATH%&^ | ||
68 | set LR_EXTERNAL=%LR_EXTERNAL% | ||
69 | |||
70 | echo. | ||
71 | echo ====================================================== | ||
72 | echo Installation of LuaRocks %LUAROCKS_VER% done. | ||
73 | echo . | ||
74 | echo LUA_PATH - %LUA_PATH% | ||
75 | echo LUA_CPATH - %LUA_CPATH% | ||
76 | echo. | ||
77 | echo LR_EXTERNAL - %LR_EXTERNAL% | ||
78 | echo ====================================================== | ||
79 | echo. | ||
80 | |||
81 | goto :eof | ||
82 | |||
83 | |||
84 | |||
85 | |||
86 | |||
87 | |||
88 | |||
89 | |||
90 | |||
91 | |||
92 | |||
93 | |||
94 | |||
95 | |||
96 | |||
97 | |||
98 | |||
99 | |||
100 | :: This blank space is intentional. If you see errors like "The system cannot find the batch label specified 'foo'" | ||
101 | :: then try adding or removing blank lines lines above. | ||
102 | :: Yes, really. | ||
103 | :: http://stackoverflow.com/questions/232651/why-the-system-cannot-find-the-batch-label-specified-is-thrown-even-if-label-e | ||
104 | |||
105 | :: helper functions: | ||
106 | |||
107 | :: for bailing out when an error occurred | ||
108 | :die %1 | ||
109 | echo %1 | ||
110 | exit /B 1 | ||
111 | goto :eof | ||
112 | |||