aboutsummaryrefslogtreecommitdiff
path: root/.appveyor/build.bat
diff options
context:
space:
mode:
Diffstat (limited to '.appveyor/build.bat')
-rw-r--r--.appveyor/build.bat112
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
2Setlocal EnableDelayedExpansion EnableExtensions
3
4cd %APPVEYOR_BUILD_FOLDER%
5
6:: =========================================================
7:: Make sure some environment variables are set
8if not defined LUA_VER call :die LUA_VER is not defined
9if not defined LUA call :die LUA is not defined
10if not defined LUA_SHORTV call :die LUA_SHORTV is not defined
11if not defined LUA_DIR call :die LUA_DIR is not defined
12
13:: =========================================================
14:: Set some defaults. Infer some variables.
15::
16if not defined LUAROCKS_VER set LUAROCKS_VER=2.2.1
17
18set LUAROCKS_SHORTV=%LUAROCKS_VER:~0,3%
19
20if not defined LR_EXTERNAL set LR_EXTERNAL=c:\external
21if not defined LUAROCKS_INSTALL set LUAROCKS_INSTALL=%LUA_DIR%\LuaRocks
22if not defined LR_ROOT set LR_ROOT=%LUAROCKS_INSTALL%\%LUAROCKS_SHORTV%
23if not defined LR_SYSTREE set LR_SYSTREE=%LUAROCKS_INSTALL%\systree
24
25::
26:: =========================================================
27
28
29if 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
37cd %APPVEYOR_BUILD_FOLDER%
38call install.bat /LUA %LUA_DIR% /Q /LV %LUA_SHORTV% /P "%LUAROCKS_INSTALL%" /TREE "%LR_SYSTREE%"
39
40if not exist "%LR_ROOT%" call :die "LuaRocks not found at %LR_ROOT%"
41
42set PATH=%LR_ROOT%;%LR_SYSTREE%\bin;%PATH%
43
44:: Lua will use just the system rocks
45set LUA_PATH=%LR_ROOT%\lua\?.lua;%LR_ROOT%\lua\?\init.lua
46set LUA_PATH=%LUA_PATH%;%LR_SYSTREE%\share\lua\%LUA_SHORTV%\?.lua
47set LUA_PATH=%LUA_PATH%;%LR_SYSTREE%\share\lua\%LUA_SHORTV%\?\init.lua
48set LUA_CPATH=%LR_SYSTREE%\lib\lua\%LUA_SHORTV%\?.dll
49
50call luarocks --version || call :die "Error with LuaRocks installation"
51call luarocks list
52
53
54if not exist "%LR_EXTERNAL%" (
55 mkdir "%LR_EXTERNAL%"
56 mkdir "%LR_EXTERNAL%\lib"
57 mkdir "%LR_EXTERNAL%\include"
58)
59
60set PATH=%LR_EXTERNAL%;%PATH%
61
62:: Exports the following variables:
63:: (beware of whitespace between & and ^ below)
64endlocal & set PATH=%PATH%&^
65set LR_SYSTREE=%LR_SYSTREE%&^
66set LUA_PATH=%LUA_PATH%&^
67set LUA_CPATH=%LUA_CPATH%&^
68set LR_EXTERNAL=%LR_EXTERNAL%
69
70echo.
71echo ======================================================
72echo Installation of LuaRocks %LUAROCKS_VER% done.
73echo .
74echo LUA_PATH - %LUA_PATH%
75echo LUA_CPATH - %LUA_CPATH%
76echo.
77echo LR_EXTERNAL - %LR_EXTERNAL%
78echo ======================================================
79echo.
80
81goto :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
109echo %1
110exit /B 1
111goto :eof
112