aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Melnichenko <mpeterval@gmail.com>2016-05-04 03:18:58 +0400
committerPeter Melnichenko <mpeterval@gmail.com>2016-05-04 03:18:58 +0400
commit83b8fa6c6b67f2b990652bc522945c14411e8b71 (patch)
tree42b66af8844973bb66769705a25ca00b5af47360
parent210322f493936db2511fa2f60316e140a7385d37 (diff)
parent1146cc2b33e06276583e9cd4063916d8a2fda6cd (diff)
downloadluafilesystem-83b8fa6c6b67f2b990652bc522945c14411e8b71.tar.gz
luafilesystem-83b8fa6c6b67f2b990652bc522945c14411e8b71.tar.bz2
luafilesystem-83b8fa6c6b67f2b990652bc522945c14411e8b71.zip
Merge pull request #70 from mpeterv/hererocks-ci
Use hererocks for CI
-rw-r--r--.appveyor/install.bat270
-rw-r--r--.appveyor/set_compiler_env.bat40
-rw-r--r--.appveyor/winmake.bat457
-rw-r--r--.travis.yml18
-rw-r--r--.travis/platform.sh15
-rw-r--r--.travis/setenv_lua.sh3
-rw-r--r--.travis/setup_lua.sh122
-rw-r--r--appveyor.yml46
8 files changed, 20 insertions, 951 deletions
diff --git a/.appveyor/install.bat b/.appveyor/install.bat
deleted file mode 100644
index 1ee346d..0000000
--- a/.appveyor/install.bat
+++ /dev/null
@@ -1,270 +0,0 @@
1@echo off
2
3cd %APPVEYOR_BUILD_FOLDER%
4
5:: =========================================================
6:: Set some defaults. Infer some variables.
7::
8:: These are set globally
9if "%LUA_VER%" NEQ "" (
10 set LUA=lua
11 set LUA_SHORTV=%LUA_VER:~0,3%
12) else (
13 set LUA=luajit
14 set LJ_SHORTV=%LJ_VER:~0,3%
15 set LUA_SHORTV=5.1
16)
17
18:: defines LUA_DIR so Cmake can find this Lua install
19if "%LUA%"=="luajit" (
20 set LUA_DIR=c:\lua\%platform%\lj%LJ_SHORTV%
21) else (
22 set LUA_DIR=c:\lua\%platform%\%LUA_VER%
23)
24
25:: Now we declare a scope
26Setlocal EnableDelayedExpansion EnableExtensions
27
28if not defined LUAROCKS_URL set LUAROCKS_URL=http://keplerproject.github.io/luarocks/releases
29if not defined LUAROCKS_REPO set LUAROCKS_REPO=https://luarocks.org
30if not defined LUA_URL set LUA_URL=http://www.lua.org/ftp
31if defined NOCOMPAT (
32 set COMPATFLAG=--nocompat
33) else (
34 set COMPATFLAG=
35)
36if not defined LUAJIT_GIT_REPO set LUAJIT_GIT_REPO=https://github.com/LuaJIT/LuaJIT.git
37if not defined LUAJIT_URL set LUAJIT_URL=https://github.com/LuaJIT/LuaJIT/archive
38
39if not defined LR_EXTERNAL set LR_EXTERNAL=c:\external
40if not defined LUAROCKS_INSTALL set LUAROCKS_INSTALL=%LUA_DIR%\LuaRocks
41
42
43:: LuaRocks <= 2.2.2 used a versioned directory
44:: HEAD and newer versions do not, so act accordingly.
45if defined LR_ROOT goto :skiplrver
46
47if "%LUAROCKS_VER%" EQU "HEAD" (
48 set LR_ROOT=%LUAROCKS_INSTALL%
49 goto :skiplrver
50)
51set LR_ROOT=%LUAROCKS_INSTALL%
52if %LUAROCKS_VER:~0,1% LEQ 2 (
53 if %LUAROCKS_VER:~2,1% LEQ 2 (
54 if %LUAROCKS_VER:~4,1% LEQ 3 (
55 set LR_ROOT=%LUAROCKS_INSTALL%\!LUAROCKS_VER:~0,3!
56 )
57 )
58)
59:skiplrver
60
61if not defined LR_SYSTREE set LR_SYSTREE=%LUAROCKS_INSTALL%\systree
62
63if not defined SEVENZIP set SEVENZIP=7z
64::
65:: =========================================================
66
67:: first create some necessary directories:
68mkdir downloads 2>NUL
69
70:: Download and compile Lua (or LuaJIT)
71if "%LUA%"=="luajit" (
72 if not exist %LUA_DIR% (
73 if "%LJ_SHORTV%"=="2.1" (
74 :: Clone repository and checkout 2.1 branch
75 set lj_source_folder=%APPVEYOR_BUILD_FOLDER%\downloads\luajit-%LJ_VER%
76 if not exist !lj_source_folder! (
77 echo Cloning git repo %LUAJIT_GIT_REPO% !lj_source_folder!
78 git clone %LUAJIT_GIT_REPO% !lj_source_folder! || call :die "Failed to clone repository"
79 ) else (
80 cd !lj_source_folder!
81 git pull || call :die "Failed to update repository"
82 )
83 cd !lj_source_folder!\src
84 git checkout v2.1 || call :die
85 ) else (
86 set lj_source_folder=%APPVEYOR_BUILD_FOLDER%\downloads\luajit-%LJ_VER%
87 if not exist !lj_source_folder! (
88 echo Downloading... %LUAJIT_URL%/v%LJ_VER%.tar.gz
89 curl --location --silent --fail --max-time 120 --connect-timeout 30 %LUAJIT_URL%/v%LJ_VER%.tar.gz | %SEVENZIP% x -si -so -tgzip | %SEVENZIP% x -si -ttar -aoa -odownloads
90 )
91 cd !lj_source_folder!\src
92 )
93 :: Compiles LuaJIT
94 if "%Configuration%"=="MinGW" (
95 call mingw32-make
96 ) else (
97 call msvcbuild.bat
98 )
99
100 mkdir %LUA_DIR% 2> NUL
101 for %%a in (bin bin\lua bin\lua\jit include lib) do ( mkdir "%LUA_DIR%\%%a" )
102
103 for %%a in (luajit.exe lua51.dll) do ( move "!lj_source_folder!\src\%%a" "%LUA_DIR%\bin" )
104 copy "%LUA_DIR%\bin\luajit.exe" "%LUA_DIR%\bin\lua.exe"
105
106 move "!lj_source_folder!\src\lua51.lib" "%LUA_DIR%\lib"
107 for %%a in (lauxlib.h lua.h lua.hpp luaconf.h lualib.h luajit.h) do (
108 copy "!lj_source_folder!\src\%%a" "%LUA_DIR%\include"
109 )
110
111 copy "!lj_source_folder!\src\jit\*.lua" "%LUA_DIR%\bin\lua\jit"
112
113 ) else (
114 echo LuaJIT %LJ_VER% already installed at %LUA_DIR%
115 )
116) else (
117 if not exist %LUA_DIR% (
118 :: Download and compile Lua
119 if not exist downloads\lua-%LUA_VER% (
120 curl --silent --fail --max-time 120 --connect-timeout 30 %LUA_URL%/lua-%LUA_VER%.tar.gz | %SEVENZIP% x -si -so -tgzip | %SEVENZIP% x -si -ttar -aoa -odownloads
121 )
122
123 mkdir downloads\lua-%LUA_VER%\etc 2> NUL
124 copy %~dp0\winmake.bat downloads\lua-%LUA_VER%\etc\winmake.bat
125
126 cd downloads\lua-%LUA_VER%
127 call etc\winmake %COMPATFLAG%
128 call etc\winmake install %LUA_DIR%
129 ) else (
130 echo Lua %LUA_VER% already installed at %LUA_DIR%
131 )
132)
133
134if not exist %LUA_DIR%\bin\%LUA%.exe call :die "Missing Lua interpreter at %LUA_DIR%\bin\%LUA%.exe"
135
136set PATH=%LUA_DIR%\bin;%PATH%
137call !LUA! -v
138
139
140
141:: ==========================================================
142:: LuaRocks
143:: ==========================================================
144
145if not exist "%LR_ROOT%" (
146 :: Downloads and installs LuaRocks
147 cd %APPVEYOR_BUILD_FOLDER%
148
149 if %LUAROCKS_VER%==HEAD (
150 set lr_source_folder=%APPVEYOR_BUILD_FOLDER%\downloads\luarocks-%LUAROCKS_VER%-win32
151 if not exist !lr_source_folder! (
152 git clone https://github.com/keplerproject/luarocks.git --single-branch --depth 1 !lr_source_folder! || call :die "Failed to clone LuaRocks repository"
153 ) else (
154 cd !lr_source_folder!
155 git pull || call :die "Failed to update LuaRocks repository"
156 )
157 ) else (
158 if not exist downloads\luarocks-%LUAROCKS_VER%-win32.zip (
159 echo Downloading LuaRocks...
160 curl --silent --fail --max-time 120 --connect-timeout 30 --output downloads\luarocks-%LUAROCKS_VER%-win32.zip %LUAROCKS_URL%/luarocks-%LUAROCKS_VER%-win32.zip
161 %SEVENZIP% x -aoa -odownloads downloads\luarocks-%LUAROCKS_VER%-win32.zip
162 )
163 )
164
165 cd downloads\luarocks-%LUAROCKS_VER%-win32
166 if "%Configuration%"=="MinGW" (
167 call install.bat /LUA %LUA_DIR% /Q /LV %LUA_SHORTV% /P "%LUAROCKS_INSTALL%" /TREE "%LR_SYSTREE%" /MW
168 ) else (
169 call install.bat /LUA %LUA_DIR% /Q /LV %LUA_SHORTV% /P "%LUAROCKS_INSTALL%" /TREE "%LR_SYSTREE%"
170 )
171
172 :: Configures LuaRocks to instruct CMake the correct generator to use. Else, CMake will pick the highest
173 :: Visual Studio version installed
174 if "%Configuration%"=="MinGW" (
175 echo cmake_generator = "MinGW Makefiles" >> %LUAROCKS_INSTALL%\config-%LUA_SHORTV%.lua
176 ) else (
177 set MSVS_GENERATORS[2008]=Visual Studio 9 2008
178 set MSVS_GENERATORS[2010]=Visual Studio 10 2010
179 set MSVS_GENERATORS[2012]=Visual Studio 11 2012
180 set MSVS_GENERATORS[2013]=Visual Studio 12 2013
181 set MSVS_GENERATORS[2015]=Visual Studio 14 2015
182
183 set CMAKE_GENERATOR=!MSVS_GENERATORS[%Configuration%]!
184 if "%platform%" EQU "x64" (set CMAKE_GENERATOR=!CMAKE_GENERATOR! Win64)
185
186 echo cmake_generator = "!CMAKE_GENERATOR!" >> %LUAROCKS_INSTALL%\config-%LUA_SHORTV%.lua
187 )
188)
189
190if not exist "%LR_ROOT%" call :die "LuaRocks not found at %LR_ROOT%"
191
192set PATH=%LR_ROOT%;%LR_SYSTREE%\bin;%PATH%
193
194:: Lua will use just the system rocks
195set LUA_PATH=%LR_ROOT%\lua\?.lua;%LR_ROOT%\lua\?\init.lua
196set LUA_PATH=%LUA_PATH%;%LR_SYSTREE%\share\lua\%LUA_SHORTV%\?.lua
197set LUA_PATH=%LUA_PATH%;%LR_SYSTREE%\share\lua\%LUA_SHORTV%\?\init.lua
198set LUA_PATH=%LUA_PATH%;.\?.lua;.\?\init.lua
199set LUA_CPATH=%LR_SYSTREE%\lib\lua\%LUA_SHORTV%\?.dll;.\?.dll
200
201call luarocks --version || call :die "Error with LuaRocks installation"
202call luarocks list
203
204
205if not exist "%LR_EXTERNAL%" (
206 mkdir "%LR_EXTERNAL%"
207 mkdir "%LR_EXTERNAL%\lib"
208 mkdir "%LR_EXTERNAL%\include"
209)
210
211set PATH=%LR_EXTERNAL%;%PATH%
212
213:: Exports the following variables:
214:: (beware of whitespace between & and ^ below)
215endlocal & set PATH=%PATH%&^
216set LR_SYSTREE=%LR_SYSTREE%&^
217set LUA_PATH=%LUA_PATH%&^
218set LUA_CPATH=%LUA_CPATH%&^
219set LR_EXTERNAL=%LR_EXTERNAL%
220
221echo.
222echo ======================================================
223if "%LUA%"=="luajit" (
224 echo Installation of LuaJIT %LJ_VER% and LuaRocks %LUAROCKS_VER% done.
225) else (
226 echo Installation of Lua %LUA_VER% and LuaRocks %LUAROCKS_VER% done.
227 if defined NOCOMPAT echo Lua was built with compatibility flags disabled.
228)
229echo Platform - %platform%
230echo LUA - %LUA%
231echo LUA_SHORTV - %LUA_SHORTV%
232echo LJ_SHORTV - %LJ_SHORTV%
233echo LUA_PATH - %LUA_PATH%
234echo LUA_CPATH - %LUA_CPATH%
235echo.
236echo LR_EXTERNAL - %LR_EXTERNAL%
237echo ======================================================
238echo.
239
240goto :eof
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259:: This blank space is intentional. If you see errors like "The system cannot find the batch label specified 'foo'"
260:: then try adding or removing blank lines lines above.
261:: Yes, really.
262:: http://stackoverflow.com/questions/232651/why-the-system-cannot-find-the-batch-label-specified-is-thrown-even-if-label-e
263
264:: helper functions:
265
266:: for bailing out when an error occurred
267:die %1
268echo %1
269exit /B 1
270goto :eof
diff --git a/.appveyor/set_compiler_env.bat b/.appveyor/set_compiler_env.bat
deleted file mode 100644
index 7e8462e..0000000
--- a/.appveyor/set_compiler_env.bat
+++ /dev/null
@@ -1,40 +0,0 @@
1@echo off
2
3:: Now we declare a scope
4Setlocal EnableDelayedExpansion EnableExtensions
5
6if not defined Configuration set Configuration=2015
7
8if "%Configuration%"=="MinGW" ( goto :mingw )
9
10set arch=x86
11
12if "%platform%" EQU "x64" ( set arch=x86_amd64 )
13
14if "%Configuration%"=="2015" (
15 set SET_VS_ENV="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
16)
17
18if "%Configuration%"=="2013" (
19 set SET_VS_ENV="C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"
20)
21
22if "%Configuration%"=="2012" (
23 set SET_VS_ENV="C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"
24)
25
26if "%Configuration%"=="2010" (
27 set SET_VS_ENV="C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
28)
29
30if "%Configuration%"=="2008" (
31 set SET_VS_ENV="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"
32)
33
34:: Visual Studio detected
35endlocal & call %SET_VS_ENV% %arch%
36goto :eof
37
38:: MinGW detected
39:mingw
40endlocal & set PATH=c:\mingw\bin;%PATH%
diff --git a/.appveyor/winmake.bat b/.appveyor/winmake.bat
deleted file mode 100644
index dcad55d..0000000
--- a/.appveyor/winmake.bat
+++ /dev/null
@@ -1,457 +0,0 @@
1@ECHO OFF
2SETLOCAL ENABLEDELAYEDEXPANSION
3
4REM *****************************
5REM * Customization section *
6REM *****************************
7
8REM use the /help option for generic usage information
9
10REM Where is the source code located (the unpacked Lua source archive, toplevel dir)
11SET SOURCETREE=.\
12
13REM set the toolchain to either MS or GCC (allcaps), leave blank to autodetect
14SET TOOLCHAIN=
15
16REM set the compatibility flags, defaults to empty for 5.1, -DLUA_COMPAT_ALL for 5.2,
17REM and -DLUA_COMPAT_5_2 for 5.3, which are the same as the unix make files
18REM This setting can be overridden with the --nocompat flag
19SET COMPATFLAG=
20
21
22
23
24
25
26
27
28
29REM **********************************
30REM * Nothing to customize below *
31REM **********************************
32
33SET BATCHNAME=%~n0
34SET SOURCE=%SOURCETREE%src\
35SET LUA_H=%SOURCE%lua.h
36SET CURDIR=%CD%
37
38REM the following line ends with a TAB. DO NOT REMOVE IT!
39SET TABCHAR=
40REM Define LF to contain a linefeed character
41set ^"LFCHAR=^
42
43^" The above empty line is critical. DO NOT REMOVE
44
45
46REM Supported toolchains (allcaps)
47SET TOOLCHAINS=MS GCC
48REM Commands which, if exiting without error, indicate presence of the toolchain
49SET CHECK_GCC=gcc --version
50SET CHECK_MS=cl
51
52REM **********************************
53REM * Check for help request *
54REM **********************************
55
56SET HELPCMDS=help -help --help /help ? -? /?
57for %%L in ("!LFCHAR!") do for /f %%a in ("!HELPCMDS: =%%~L!") do (
58 if "%%a"=="%~1" (
59 echo.
60 echo Builds a standalone Lua installation. Supports Lua version 5.1, 5.2 and 5.3.
61 echo Your compiler must be in the system path, and this "%BATCHNAME%.bat" file must be located
62 echo in ".\etc\" in the unpacked Lua source archive.
63 echo.
64 echo USAGE etc\%BATCHNAME% [FLAG] [COMMAND] [...]
65 echo ^(execute from the root of the unpacked archive^)
66 echo.
67 echo Commands;
68 echo clean : cleans the source tree of build ^(intermediate^) files
69 echo install [path] : installs the build results into "path"
70 echo local : installs into ".\local\" in the unpacked Lua source structure
71 echo [toolchain] : uses a specific toolchain to build. If not provided then supported
72 echo toolchains will be tested and the first available will be picked.
73 echo Supported toolchains are: "%TOOLCHAINS%" ^(must use ALLCAPS^)
74 echo.
75 echo Flags;
76 echo --nocompat : Specifies that no compatibility flags should be set when building.
77 echo If not specified, the default compatibility flags will be used.
78 echo.
79 echo Example use;
80 echo set PATH=C:\path\to\your\compiler\;%%PATH%%
81 echo etc\%BATCHNAME% clean
82 echo etc\%BATCHNAME%
83 echo etc\%BATCHNAME% --nocompat GCC
84 echo etc\%BATCHNAME% install "C:\Program Files\Lua"
85 echo.
86 goto :EXITOK
87 )
88)
89
90REM **********************************
91REM * Check commandline *
92REM **********************************
93
94SET CMDOK=FALSE
95if "%~1"=="" (
96 SET CMDOK=TRUE
97)
98for %%a in (local install clean) do (
99 if "%%a"=="%~1" (
100 SET CMDOK=TRUE
101 )
102)
103for %%a in (--nocompat) do (
104 if "%%a"=="%~1" (
105 SET NOCOMPAT=TRUE
106 if "%~2"=="" (
107 SET CMDOK=TRUE
108 )
109 SHIFT
110 )
111)
112for %%a in (%TOOLCHAINS%) do (
113 if "%%a"=="%~1" (
114 SET CMDOK=TRUE
115 SET TOOLCHAIN=%~1
116 )
117)
118if NOT %CMDOK%==TRUE (
119 echo.
120 echo Unknown command or toolchain specified.
121 goto :EXITERROR
122)
123
124REM **************************************
125REM * Check for cleaning *
126REM **************************************
127
128if "%1"=="clean" (
129 if NOT [%2]==[] (
130 echo.
131 echo ERROR: The clean command does not take extra parameters.
132 ) else (
133 echo Cleaning...
134 if exist "%SOURCE%*.exe" del "%SOURCE%*.exe"
135 if exist "%SOURCE%*.dll" del "%SOURCE%*.dll"
136 if exist "%SOURCE%*.o" del "%SOURCE%*.o"
137 if exist "%SOURCE%*.a" del "%SOURCE%*.a"
138 if exist "%SOURCE%*.obj" del "%SOURCE%*.obj"
139 if exist "%SOURCE%*.manifest" del "%SOURCE%*.manifest"
140 if exist "%SOURCE%*.lib" del "%SOURCE%*.lib"
141 echo Done.
142 )
143 goto :EXITOK
144)
145
146REM **************************************************
147REM * Fetch the Lua version from the source code *
148REM **************************************************
149
150Echo.
151Echo Checking source code to extract Lua version...
152IF NOT EXIST %LUA_H% (
153 Echo Cannot locate Lua header file; %LUA_H%
154 goto :EXITERROR
155)
156
157findstr /R /C:"#define[ %TABCHAR%][ %TABCHAR%]*LUA_VERSION_MAJOR" %LUA_H% > NUL
158if NOT %ERRORLEVEL%==0 (
159 rem ECHO We've got a Lua version 5.1
160 rem findstr /R /C:"#define[ %TABCHAR%][ %TABCHAR%]*LUA_VERSION[ %TABCHAR%]" %LUA_H%
161 SET LUA_VER=5.1
162) else (
163 rem ECHO We've got a Lua version 5.2+
164 rem findstr /R /C:"#define[ %TABCHAR%][ %TABCHAR%]*LUA_VERSION_MAJOR[ %TABCHAR%]" %LUA_H%
165 rem findstr /R /C:"#define[ %TABCHAR%][ %TABCHAR%]*LUA_VERSION_MINOR[ %TABCHAR%]" %LUA_H%
166
167 for /F "delims=" %%a in ('findstr /R /C:"#define[ %TABCHAR%][ %TABCHAR%]*LUA_VERSION_MAJOR[ %TABCHAR%]" %LUA_H%') do set LUA_MAJOR=%%a
168 SET LUA_MAJOR=!LUA_MAJOR:#define=!
169 SET LUA_MAJOR=!LUA_MAJOR:LUA_VERSION_MAJOR=!
170 SET LUA_MAJOR=!LUA_MAJOR: =!
171 SET LUA_MAJOR=!LUA_MAJOR:%TABCHAR%=!
172 SET LUA_MAJOR=!LUA_MAJOR:"=!
173 SET LUA_MAJOR=!LUA_MAJOR:~0,1!
174
175 for /F "delims=" %%a in ('findstr /R /C:"#define[ %TABCHAR%][ %TABCHAR%]*LUA_VERSION_MINOR[ %TABCHAR%]" %LUA_H%') do set LUA_MINOR=%%a
176 SET LUA_MINOR=!LUA_MINOR:#define=!
177 SET LUA_MINOR=!LUA_MINOR:LUA_VERSION_MINOR=!
178 SET LUA_MINOR=!LUA_MINOR: =!
179 SET LUA_MINOR=!LUA_MINOR:%TABCHAR%=!
180 SET LUA_MINOR=!LUA_MINOR:"=!
181 SET LUA_MINOR=!LUA_MINOR:~0,1!
182
183 SET LUA_VER=!LUA_MAJOR!.!LUA_MINOR!
184)
185SET LUA_SVER=!LUA_VER:.=!
186
187Echo Lua version found: %LUA_VER%
188Echo.
189
190REM **************************************
191REM * Set some Lua version specifics *
192REM **************************************
193
194REM FILES_CORE; files for Lua core (+lauxlib, needed for Luac)
195REM FILES_LIB; files for Lua standard libraries
196REM FILES_DLL; vm files to be build with dll option
197REM FILES_OTH; vm files to be build without dll, for static linking
198
199if %LUA_SVER%==51 (
200 set FILES_CORE=lapi lcode ldebug ldo ldump lfunc lgc llex lmem lobject lopcodes lparser lstate lstring ltable ltm lundump lvm lzio lauxlib
201 set FILES_LIB=lbaselib ldblib liolib lmathlib loslib ltablib lstrlib loadlib linit
202 set FILES_DLL=lua
203 set FILES_OTH=luac print
204 set INSTALL_H=lauxlib.h lua.h luaconf.h lualib.h ..\etc\lua.hpp
205)
206if %LUA_SVER%==52 (
207 set FILES_CORE=lapi lcode lctype ldebug ldo ldump lfunc lgc llex lmem lobject lopcodes lparser lstate lstring ltable ltm lundump lvm lzio lauxlib
208 set FILES_LIB=lbaselib lbitlib lcorolib ldblib liolib lmathlib loslib lstrlib ltablib loadlib linit
209 set FILES_DLL=lua
210 set FILES_OTH=luac
211 set INSTALL_H=lauxlib.h lua.h lua.hpp luaconf.h lualib.h
212 if "%COMPATFLAG%"=="" (
213 set COMPATFLAG=-DLUA_COMPAT_ALL
214 )
215)
216if %LUA_SVER%==53 (
217 set FILES_CORE=lapi lcode lctype ldebug ldo ldump lfunc lgc llex lmem lobject lopcodes lparser lstate lstring ltable ltm lundump lvm lzio lauxlib
218 set FILES_LIB=lbaselib lbitlib lcorolib ldblib liolib lmathlib loslib lstrlib ltablib lutf8lib loadlib linit
219 set FILES_DLL=lua
220 set FILES_OTH=luac
221 set INSTALL_H=lauxlib.h lua.h lua.hpp luaconf.h lualib.h
222 if "%COMPATFLAG%"=="" (
223 set COMPATFLAG=-DLUA_COMPAT_5_2
224 )
225)
226
227if "%NOCOMPAT%"=="TRUE" (
228 set COMPATFLAG=
229)
230
231SET FILES_BASE=%FILES_DLL% %FILES_CORE% %FILES_LIB%
232
233if "%FILES_BASE%"=="" (
234 Echo Unknown Lua version; %LUA_VER%
235 goto :EXITERROR
236)
237
238REM *********************************
239REM * Check available toolchain *
240REM *********************************
241
242if [%TOOLCHAIN%]==[] (
243 Echo Testing for MS...
244 %CHECK_MS%
245 IF !ERRORLEVEL!==0 SET TOOLCHAIN=MS
246)
247if [%TOOLCHAIN%]==[] (
248 Echo Testing for GCC...
249 %CHECK_GCC%
250 IF !ERRORLEVEL!==0 SET TOOLCHAIN=GCC
251)
252if [%TOOLCHAIN%]==[] (
253 Echo No supported toolchain found ^(please make sure it is in the system path^)
254 goto :EXITERROR
255)
256
257REM ***************************
258REM * Configure toolchain *
259REM ***************************
260
261if %TOOLCHAIN%==GCC (
262 echo Using GCC toolchain...
263 SET OBJEXT=o
264 SET LIBFILE=liblua%LUA_SVER%.a
265)
266if %TOOLCHAIN%==MS (
267 echo Using Microsoft toolchain...
268 SET OBJEXT=obj
269 SET LIBFILE=lua%LUA_SVER%.lib
270)
271echo.
272
273REM **************************************
274REM * Check for installing *
275REM **************************************
276
277if "%1"=="install" (
278 if "%~2"=="" (
279 echo.
280 echo ERROR: The install command requires a path where to install to.
281 goto :EXITERROR
282 )
283 SET TARGETPATH=%~2
284)
285if "%1"=="local" (
286 if NOT "%~2"=="" (
287 echo.
288 echo ERROR: The local command does not take extra parameters.
289 goto :EXITERROR
290 )
291 SET TARGETPATH=%SOURCETREE%local
292)
293if NOT "%TARGETPATH%"=="" (
294 mkdir "%TARGETPATH%\bin"
295 mkdir "%TARGETPATH%\include"
296 mkdir "%TARGETPATH%\lib\lua\%LUA_VER%"
297 mkdir "%TARGETPATH%\man\man1"
298 mkdir "%TARGETPATH%\share\lua\%LUA_VER%"
299 copy "%SOURCE%lua.exe" "%TARGETPATH%\bin"
300 copy "%SOURCE%luac.exe" "%TARGETPATH%\bin"
301 copy "%SOURCE%lua%LUA_SVER%.dll" "%TARGETPATH%\bin"
302 for %%a in (%INSTALL_H%) do ( copy "%SOURCE%%%a" "%TARGETPATH%\include" )
303 copy "%SOURCE%%LIBFILE%" "%TARGETPATH%\lib"
304 copy "%SOURCETREE%doc\lua.1" "%TARGETPATH%\man\man1"
305 copy "%SOURCETREE%doc\luac.1" "%TARGETPATH%\man\man1"
306
307 echo Installation completed in "%TARGETPATH%".
308 goto :EXITOK
309)
310
311REM ***********************
312REM * Compile sources *
313REM ***********************
314goto :after_compile_function
315:compile_function
316 REM Params: %1 is filelist (must be quoted)
317 REM Return: same list, with the object file extension included, will be stored in global OBJLIST
318
319 for %%a in (%~1) do (
320 SET FILENAME=%%a
321 if %TOOLCHAIN%==GCC (
322 SET COMPCMD=gcc -O2 -Wall !EXTRAFLAG! !COMPATFLAG! -c -o !FILENAME!.%OBJEXT% !FILENAME!.c
323 )
324 if %TOOLCHAIN%==MS (
325 SET COMPCMD=cl /nologo /MD /O2 /W3 /c /D_CRT_SECURE_NO_DEPRECATE !COMPATFLAG! !EXTRAFLAG! !FILENAME!.c
326 )
327 echo !COMPCMD!
328 !COMPCMD!
329 SET OBJLIST=!OBJLIST! !FILENAME!.%OBJEXT%
330 )
331
332goto :eof
333:after_compile_function
334
335CD %SOURCE%
336REM Traverse the 4 lists of source files
337
338for %%b in (CORE LIB DLL OTH) do (
339 SET LTYPE=%%b
340 SET OBJLIST=
341 if !LTYPE!==OTH (
342 REM OTH is the only list of files build without DLL option
343 SET EXTRAFLAG=
344 ) else (
345 SET EXTRAFLAG=-DLUA_BUILD_AS_DLL
346 )
347 if !LTYPE!==CORE SET FILELIST=%FILES_CORE%
348 if !LTYPE!==LIB SET FILELIST=%FILES_LIB%
349 if !LTYPE!==DLL SET FILELIST=%FILES_DLL%
350 if !LTYPE!==OTH SET FILELIST=%FILES_OTH%
351
352 echo Now compiling !LTYPE! file set...
353 call:compile_function "!FILELIST!"
354
355 if !LTYPE!==CORE SET FILES_CORE_O=!OBJLIST!
356 if !LTYPE!==LIB SET FILES_LIB_O=!OBJLIST!
357 if !LTYPE!==DLL SET FILES_DLL_O=!OBJLIST!
358 if !LTYPE!==OTH SET FILES_OTH_O=!OBJLIST!
359)
360
361
362REM ****************************
363REM * Link GCC based files *
364REM ****************************
365
366if %TOOLCHAIN%==GCC (
367 REM Link the LuaXX.dll file
368 SET LINKCMD=gcc -shared -o lua%LUA_SVER%.dll %FILES_CORE_O% %FILES_LIB_O%
369 echo !LINKCMD!
370 !LINKCMD!
371
372 REM strip from LuaXX.dll
373 SET RANCMD=strip --strip-unneeded lua%LUA_SVER%.dll
374 echo !RANCMD!
375 !RANCMD!
376
377 REM Link the Lua.exe file
378 SET LINKCMD=gcc -o lua.exe -s lua.%OBJEXT% lua%LUA_SVER%.dll -lm
379 echo !LINKCMD!
380 !LINKCMD!
381
382 REM create lib archive
383 SET LIBCMD=ar rcu liblua%LUA_SVER%.a %FILES_CORE_O% %FILES_LIB_O%
384 echo !LIBCMD!
385 !LIBCMD!
386
387 REM Speedup index using ranlib
388 SET RANCMD=ranlib liblua%LUA_SVER%.a
389 echo !RANCMD!
390 !RANCMD!
391
392 REM Link Luac.exe file
393 SET LINKCMD=gcc -o luac.exe %FILES_OTH_O% liblua%LUA_SVER%.a -lm
394 echo !LINKCMD!
395 !LINKCMD!
396
397)
398
399
400REM ****************************
401REM * Link MS based files *
402REM ****************************
403
404if %TOOLCHAIN%==MS (
405 REM Link the LuaXX.dll file, and LuaXX.obj
406 SET LINKCMD=link /nologo /DLL /out:lua%LUA_SVER%.dll %FILES_CORE_O% %FILES_LIB_O%
407 echo !LINKCMD!
408 !LINKCMD!
409
410 REM handle dll manifest
411 if exist lua%LUA_SVER%.dll.manifest (
412 SET MANICMD=mt /nologo -manifest lua%LUA_SVER%.dll.manifest -outputresource:lua%LUA_SVER%.dll;2
413 echo !MANICMD!
414 !MANICMD!
415 )
416
417 REM Link Lua.exe
418 SET LINKCMD=link /nologo /out:lua.exe lua.%OBJEXT% lua%LUA_SVER%.lib
419 echo !LINKCMD!
420 !LINKCMD!
421
422 REM handle manifest
423 if exist lua.exe.manifest (
424 SET MANICMD=mt /nologo -manifest lua.exe.manifest -outputresource:lua.exe
425 echo !MANICMD!
426 !MANICMD!
427 )
428
429 REM Link Luac.exe
430 SET LINKCMD=link /nologo /out:luac.exe %FILES_OTH_O% %FILES_CORE_O%
431 echo !LINKCMD!
432 !LINKCMD!
433
434 REM handle manifest
435 if exist luac.exe.manifest (
436 SET MANICMD=mt /nologo -manifest luac.exe.manifest -outputresource:luac.exe
437 echo !MANICMD!
438 !MANICMD!
439 )
440)
441
442CD %CURDIR%
443
444REM ****************************
445REM * Finished building *
446REM ****************************
447
448echo.
449echo Build completed.
450goto :EXITOK
451
452:EXITOK
453exit /B 0
454
455:EXITERROR
456echo For help try; etc\%BATCHNAME% /help
457exit /B 1
diff --git a/.travis.yml b/.travis.yml
index fd4ce5d..04d46ac 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,18 +3,16 @@ language: c
3sudo: false 3sudo: false
4 4
5env: 5env:
6 global: 6 - LUA="lua 5.1"
7 - LUAROCKS=2.3.0 7 - LUA="lua 5.2"
8 matrix: 8 - LUA="lua 5.3"
9 - LUA=lua5.1 9 - LUA="luajit 2.0"
10 - LUA=lua5.2
11 - LUA=lua5.3
12 - LUA=luajit
13 10
14before_install: 11before_install:
15 - source .travis/setenv_lua.sh 12 - pip install --user cpp-coveralls hererocks
16 - pip install --user cpp-coveralls 13 - hererocks env --$LUA --luarocks latest
17 - luarocks install Lua-cURL --server=https://luarocks.org/dev 14 - export PATH="$PWD/env/bin:$PATH"
15 - luarocks install Lua-cURL --server=https://luarocks.org/dev
18 - luarocks install lua-path 16 - luarocks install lua-path
19 - luarocks install lua-cjson 17 - luarocks install lua-cjson
20 - luarocks install luacov 18 - luarocks install luacov
diff --git a/.travis/platform.sh b/.travis/platform.sh
deleted file mode 100644
index 7259a7d..0000000
--- a/.travis/platform.sh
+++ /dev/null
@@ -1,15 +0,0 @@
1if [ -z "${PLATFORM:-}" ]; then
2 PLATFORM=$TRAVIS_OS_NAME;
3fi
4
5if [ "$PLATFORM" == "osx" ]; then
6 PLATFORM="macosx";
7fi
8
9if [ -z "$PLATFORM" ]; then
10 if [ "$(uname)" == "Linux" ]; then
11 PLATFORM="linux";
12 else
13 PLATFORM="macosx";
14 fi;
15fi
diff --git a/.travis/setenv_lua.sh b/.travis/setenv_lua.sh
deleted file mode 100644
index 8d8c825..0000000
--- a/.travis/setenv_lua.sh
+++ /dev/null
@@ -1,3 +0,0 @@
1export PATH=${PATH}:$HOME/.lua:$HOME/.local/bin:${TRAVIS_BUILD_DIR}/install/luarocks/bin
2bash .travis/setup_lua.sh
3eval `$HOME/.lua/luarocks path`
diff --git a/.travis/setup_lua.sh b/.travis/setup_lua.sh
deleted file mode 100644
index 6dcc0c6..0000000
--- a/.travis/setup_lua.sh
+++ /dev/null
@@ -1,122 +0,0 @@
1#! /bin/bash
2
3# A script for setting up environment for travis-ci testing.
4# Sets up Lua and Luarocks.
5# LUA must be "lua5.1", "lua5.2" or "luajit".
6# luajit2.0 - master v2.0
7# luajit2.1 - master v2.1
8
9set -eufo pipefail
10
11LUAJIT_VERSION="2.0.4"
12LUAJIT_BASE="LuaJIT-$LUAJIT_VERSION"
13
14source .travis/platform.sh
15
16LUA_HOME_DIR=$TRAVIS_BUILD_DIR/install/lua
17
18LR_HOME_DIR=$TRAVIS_BUILD_DIR/install/luarocks
19
20mkdir $HOME/.lua
21
22LUAJIT="no"
23
24if [ "$PLATFORM" == "macosx" ]; then
25 if [ "$LUA" == "luajit" ]; then
26 LUAJIT="yes";
27 fi
28 if [ "$LUA" == "luajit2.0" ]; then
29 LUAJIT="yes";
30 fi
31 if [ "$LUA" == "luajit2.1" ]; then
32 LUAJIT="yes";
33 fi;
34elif [ "$(expr substr $LUA 1 6)" == "luajit" ]; then
35 LUAJIT="yes";
36fi
37
38mkdir -p "$LUA_HOME_DIR"
39
40if [ "$LUAJIT" == "yes" ]; then
41
42 if [ "$LUA" == "luajit" ]; then
43 curl --location https://github.com/LuaJIT/LuaJIT/archive/v$LUAJIT_VERSION.tar.gz | tar xz;
44 else
45 git clone https://github.com/LuaJIT/LuaJIT.git $LUAJIT_BASE;
46 fi
47
48 cd $LUAJIT_BASE
49
50 if [ "$LUA" == "luajit2.1" ]; then
51 git checkout v2.1;
52 # force the INSTALL_TNAME to be luajit
53 perl -i -pe 's/INSTALL_TNAME=.+/INSTALL_TNAME= luajit/' Makefile
54 fi
55
56 make && make install PREFIX="$LUA_HOME_DIR"
57
58 ln -s $LUA_HOME_DIR/bin/luajit $HOME/.lua/luajit
59 ln -s $LUA_HOME_DIR/bin/luajit $HOME/.lua/lua;
60
61else
62
63 if [ "$LUA" == "lua5.1" ]; then
64 curl http://www.lua.org/ftp/lua-5.1.5.tar.gz | tar xz
65 cd lua-5.1.5;
66 elif [ "$LUA" == "lua5.2" ]; then
67 curl http://www.lua.org/ftp/lua-5.2.4.tar.gz | tar xz
68 cd lua-5.2.4;
69 elif [ "$LUA" == "lua5.3" ]; then
70 curl http://www.lua.org/ftp/lua-5.3.2.tar.gz | tar xz
71 cd lua-5.3.2;
72 fi
73
74 # Build Lua without backwards compatibility for testing
75 perl -i -pe 's/-DLUA_COMPAT_(ALL|5_2)//' src/Makefile
76 make $PLATFORM
77 make INSTALL_TOP="$LUA_HOME_DIR" install;
78
79 ln -s $LUA_HOME_DIR/bin/lua $HOME/.lua/lua
80 ln -s $LUA_HOME_DIR/bin/luac $HOME/.lua/luac;
81
82fi
83
84cd $TRAVIS_BUILD_DIR
85
86lua -v
87
88LUAROCKS_BASE=luarocks-$LUAROCKS
89
90curl --location http://luarocks.org/releases/$LUAROCKS_BASE.tar.gz | tar xz
91
92cd $LUAROCKS_BASE
93
94if [ "$LUA" == "luajit" ]; then
95 ./configure --lua-suffix=jit --with-lua-include="$LUA_HOME_DIR/include/luajit-2.0" --prefix="$LR_HOME_DIR";
96elif [ "$LUA" == "luajit2.0" ]; then
97 ./configure --lua-suffix=jit --with-lua-include="$LUA_HOME_DIR/include/luajit-2.0" --prefix="$LR_HOME_DIR";
98elif [ "$LUA" == "luajit2.1" ]; then
99 ./configure --lua-suffix=jit --with-lua-include="$LUA_HOME_DIR/include/luajit-2.1" --prefix="$LR_HOME_DIR";
100else
101 ./configure --with-lua="$LUA_HOME_DIR" --prefix="$LR_HOME_DIR"
102fi
103
104make build && make install
105
106ln -s $LR_HOME_DIR/bin/luarocks $HOME/.lua/luarocks
107
108cd $TRAVIS_BUILD_DIR
109
110luarocks --version
111
112rm -rf $LUAROCKS_BASE
113
114if [ "$LUAJIT" == "yes" ]; then
115 rm -rf $LUAJIT_BASE;
116elif [ "$LUA" == "lua5.1" ]; then
117 rm -rf lua-5.1.5;
118elif [ "$LUA" == "lua5.2" ]; then
119 rm -rf lua-5.2.4;
120elif [ "$LUA" == "lua5.3" ]; then
121 rm -rf lua-5.3.2;
122fi
diff --git a/appveyor.yml b/appveyor.yml
index a060db0..29e6442 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -7,44 +7,23 @@ version: 0.0.1.{build}-test
7shallow_clone: true 7shallow_clone: true
8 8
9environment: 9environment:
10 LUAROCKS_VER: 2.3.0
11 matrix: 10 matrix:
12 - LUA_VER: 5.1.5 11 - LUA: "lua 5.1"
13 - LUA_VER: 5.2.4 12 - LUA: "lua 5.2 --compat none"
14 NOCOMPAT: true 13 - LUA: "lua 5.3 --compat none"
15 - LUA_VER: 5.3.2 # Lua 5.3.2 with compatibility flags disabled. 14 - LUA: "luajit 2.0"
16 NOCOMPAT: true 15 - LUA: "luajit 2.1"
17 - LJ_VER: 2.0.4
18 - LJ_VER: 2.1
19
20matrix:
21 allow_failures:
22 - configuration: MinGW
23 platform: x64
24 16
25# Abuse this section so we can have a matrix with different Compiler versions 17# Abuse this section so we can have a matrix with different Compiler versions
26configuration: 18configuration:
27 - 2015 19 - mingw
28 - MinGW 20 - vs_32
29 21 - vs_64
30platform:
31 - x86
32 - x64
33
34cache:
35 - c:\lua -> appveyor.yml
36 - c:\external -> appveyor.yml
37
38# Skip unsupported combinations (ie, VS2008 for x64 is not supported)
39init:
40- if "%platform%" EQU "x64" ( for %%a in (2008 2010 MinGW) do ( if "%Configuration%"=="%%a" (echo "Skipping unsupported configuration" && exit /b 1 ) ) )
41
42 22
43install: 23install:
44# Make compiler command line tools available 24 - set PATH=%CD%\env\bin;C:\Python27\Scripts;C:\MinGW\bin;%PATH%
45- call .appveyor\set_compiler_env.bat 25 - pip install hererocks
46# Setup Lua development/build environment 26 - hererocks env --%LUA% --target %configuration% --luarocks latest
47- call .appveyor\install.bat
48 27
49before_build: 28before_build:
50# @todo 29# @todo
@@ -57,8 +36,7 @@ before_test:
57 36
58test_script: 37test_script:
59- echo "Testing..." 38- echo "Testing..."
60- cd %APPVEYOR_BUILD_FOLDER%\tests 39- lua tests/test.lua
61- lua test.lua
62 40
63after_test: 41after_test:
64# @todo 42# @todo