diff options
| author | Ignacio Burgueño <ignaciob@inconcertcc.com> | 2016-01-21 15:28:14 -0300 |
|---|---|---|
| committer | Ignacio Burgueño <ignaciob@inconcertcc.com> | 2016-01-21 15:28:14 -0300 |
| commit | 22d539e199507679d7cd40548d2b33eae10ac0b0 (patch) | |
| tree | 425b6701cc340b098dcd648ef17362ecc562d030 | |
| parent | 3674e4f52fdd5fda3fe8cdd153b7a8c93dfb8491 (diff) | |
| download | luafilesystem-22d539e199507679d7cd40548d2b33eae10ac0b0.tar.gz luafilesystem-22d539e199507679d7cd40548d2b33eae10ac0b0.tar.bz2 luafilesystem-22d539e199507679d7cd40548d2b33eae10ac0b0.zip | |
Adds AppVeyor integration
| -rw-r--r-- | .appveyor/install.bat | 270 | ||||
| -rw-r--r-- | .appveyor/set_compiler_env.bat | 40 | ||||
| -rw-r--r-- | .appveyor/winmake.bat | 457 | ||||
| -rw-r--r-- | appveyor.yml | 64 |
4 files changed, 831 insertions, 0 deletions
diff --git a/.appveyor/install.bat b/.appveyor/install.bat new file mode 100644 index 0000000..1ee346d --- /dev/null +++ b/.appveyor/install.bat | |||
| @@ -0,0 +1,270 @@ | |||
| 1 | @echo off | ||
| 2 | |||
| 3 | cd %APPVEYOR_BUILD_FOLDER% | ||
| 4 | |||
| 5 | :: ========================================================= | ||
| 6 | :: Set some defaults. Infer some variables. | ||
| 7 | :: | ||
| 8 | :: These are set globally | ||
| 9 | if "%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 | ||
| 19 | if "%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 | ||
| 26 | Setlocal EnableDelayedExpansion EnableExtensions | ||
| 27 | |||
| 28 | if not defined LUAROCKS_URL set LUAROCKS_URL=http://keplerproject.github.io/luarocks/releases | ||
| 29 | if not defined LUAROCKS_REPO set LUAROCKS_REPO=https://luarocks.org | ||
| 30 | if not defined LUA_URL set LUA_URL=http://www.lua.org/ftp | ||
| 31 | if defined NOCOMPAT ( | ||
| 32 | set COMPATFLAG=--nocompat | ||
| 33 | ) else ( | ||
| 34 | set COMPATFLAG= | ||
| 35 | ) | ||
| 36 | if not defined LUAJIT_GIT_REPO set LUAJIT_GIT_REPO=https://github.com/LuaJIT/LuaJIT.git | ||
| 37 | if not defined LUAJIT_URL set LUAJIT_URL=https://github.com/LuaJIT/LuaJIT/archive | ||
| 38 | |||
| 39 | if not defined LR_EXTERNAL set LR_EXTERNAL=c:\external | ||
| 40 | if 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. | ||
| 45 | if defined LR_ROOT goto :skiplrver | ||
| 46 | |||
| 47 | if "%LUAROCKS_VER%" EQU "HEAD" ( | ||
| 48 | set LR_ROOT=%LUAROCKS_INSTALL% | ||
| 49 | goto :skiplrver | ||
| 50 | ) | ||
| 51 | set LR_ROOT=%LUAROCKS_INSTALL% | ||
| 52 | if %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 | |||
| 61 | if not defined LR_SYSTREE set LR_SYSTREE=%LUAROCKS_INSTALL%\systree | ||
| 62 | |||
| 63 | if not defined SEVENZIP set SEVENZIP=7z | ||
| 64 | :: | ||
| 65 | :: ========================================================= | ||
| 66 | |||
| 67 | :: first create some necessary directories: | ||
| 68 | mkdir downloads 2>NUL | ||
| 69 | |||
| 70 | :: Download and compile Lua (or LuaJIT) | ||
| 71 | if "%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 | |||
| 134 | if not exist %LUA_DIR%\bin\%LUA%.exe call :die "Missing Lua interpreter at %LUA_DIR%\bin\%LUA%.exe" | ||
| 135 | |||
| 136 | set PATH=%LUA_DIR%\bin;%PATH% | ||
| 137 | call !LUA! -v | ||
| 138 | |||
| 139 | |||
| 140 | |||
| 141 | :: ========================================================== | ||
| 142 | :: LuaRocks | ||
| 143 | :: ========================================================== | ||
| 144 | |||
| 145 | if 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 | |||
| 190 | if not exist "%LR_ROOT%" call :die "LuaRocks not found at %LR_ROOT%" | ||
| 191 | |||
| 192 | set PATH=%LR_ROOT%;%LR_SYSTREE%\bin;%PATH% | ||
| 193 | |||
| 194 | :: Lua will use just the system rocks | ||
| 195 | set LUA_PATH=%LR_ROOT%\lua\?.lua;%LR_ROOT%\lua\?\init.lua | ||
| 196 | set LUA_PATH=%LUA_PATH%;%LR_SYSTREE%\share\lua\%LUA_SHORTV%\?.lua | ||
| 197 | set LUA_PATH=%LUA_PATH%;%LR_SYSTREE%\share\lua\%LUA_SHORTV%\?\init.lua | ||
| 198 | set LUA_PATH=%LUA_PATH%;.\?.lua;.\?\init.lua | ||
| 199 | set LUA_CPATH=%LR_SYSTREE%\lib\lua\%LUA_SHORTV%\?.dll;.\?.dll | ||
| 200 | |||
| 201 | call luarocks --version || call :die "Error with LuaRocks installation" | ||
| 202 | call luarocks list | ||
| 203 | |||
| 204 | |||
| 205 | if not exist "%LR_EXTERNAL%" ( | ||
| 206 | mkdir "%LR_EXTERNAL%" | ||
| 207 | mkdir "%LR_EXTERNAL%\lib" | ||
| 208 | mkdir "%LR_EXTERNAL%\include" | ||
| 209 | ) | ||
| 210 | |||
| 211 | set PATH=%LR_EXTERNAL%;%PATH% | ||
| 212 | |||
| 213 | :: Exports the following variables: | ||
| 214 | :: (beware of whitespace between & and ^ below) | ||
| 215 | endlocal & set PATH=%PATH%&^ | ||
| 216 | set LR_SYSTREE=%LR_SYSTREE%&^ | ||
| 217 | set LUA_PATH=%LUA_PATH%&^ | ||
| 218 | set LUA_CPATH=%LUA_CPATH%&^ | ||
| 219 | set LR_EXTERNAL=%LR_EXTERNAL% | ||
| 220 | |||
| 221 | echo. | ||
| 222 | echo ====================================================== | ||
| 223 | if "%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 | ) | ||
| 229 | echo Platform - %platform% | ||
| 230 | echo LUA - %LUA% | ||
| 231 | echo LUA_SHORTV - %LUA_SHORTV% | ||
| 232 | echo LJ_SHORTV - %LJ_SHORTV% | ||
| 233 | echo LUA_PATH - %LUA_PATH% | ||
| 234 | echo LUA_CPATH - %LUA_CPATH% | ||
| 235 | echo. | ||
| 236 | echo LR_EXTERNAL - %LR_EXTERNAL% | ||
| 237 | echo ====================================================== | ||
| 238 | echo. | ||
| 239 | |||
| 240 | goto :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 | ||
| 268 | echo %1 | ||
| 269 | exit /B 1 | ||
| 270 | goto :eof | ||
diff --git a/.appveyor/set_compiler_env.bat b/.appveyor/set_compiler_env.bat new file mode 100644 index 0000000..7e8462e --- /dev/null +++ b/.appveyor/set_compiler_env.bat | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | @echo off | ||
| 2 | |||
| 3 | :: Now we declare a scope | ||
| 4 | Setlocal EnableDelayedExpansion EnableExtensions | ||
| 5 | |||
| 6 | if not defined Configuration set Configuration=2015 | ||
| 7 | |||
| 8 | if "%Configuration%"=="MinGW" ( goto :mingw ) | ||
| 9 | |||
| 10 | set arch=x86 | ||
| 11 | |||
| 12 | if "%platform%" EQU "x64" ( set arch=x86_amd64 ) | ||
| 13 | |||
| 14 | if "%Configuration%"=="2015" ( | ||
| 15 | set SET_VS_ENV="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" | ||
| 16 | ) | ||
| 17 | |||
| 18 | if "%Configuration%"=="2013" ( | ||
| 19 | set SET_VS_ENV="C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" | ||
| 20 | ) | ||
| 21 | |||
| 22 | if "%Configuration%"=="2012" ( | ||
| 23 | set SET_VS_ENV="C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" | ||
| 24 | ) | ||
| 25 | |||
| 26 | if "%Configuration%"=="2010" ( | ||
| 27 | set SET_VS_ENV="C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" | ||
| 28 | ) | ||
| 29 | |||
| 30 | if "%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 | ||
| 35 | endlocal & call %SET_VS_ENV% %arch% | ||
| 36 | goto :eof | ||
| 37 | |||
| 38 | :: MinGW detected | ||
| 39 | :mingw | ||
| 40 | endlocal & set PATH=c:\mingw\bin;%PATH% | ||
diff --git a/.appveyor/winmake.bat b/.appveyor/winmake.bat new file mode 100644 index 0000000..dcad55d --- /dev/null +++ b/.appveyor/winmake.bat | |||
| @@ -0,0 +1,457 @@ | |||
| 1 | @ECHO OFF | ||
| 2 | SETLOCAL ENABLEDELAYEDEXPANSION | ||
| 3 | |||
| 4 | REM ***************************** | ||
| 5 | REM * Customization section * | ||
| 6 | REM ***************************** | ||
| 7 | |||
| 8 | REM use the /help option for generic usage information | ||
| 9 | |||
| 10 | REM Where is the source code located (the unpacked Lua source archive, toplevel dir) | ||
| 11 | SET SOURCETREE=.\ | ||
| 12 | |||
| 13 | REM set the toolchain to either MS or GCC (allcaps), leave blank to autodetect | ||
| 14 | SET TOOLCHAIN= | ||
| 15 | |||
| 16 | REM set the compatibility flags, defaults to empty for 5.1, -DLUA_COMPAT_ALL for 5.2, | ||
| 17 | REM and -DLUA_COMPAT_5_2 for 5.3, which are the same as the unix make files | ||
| 18 | REM This setting can be overridden with the --nocompat flag | ||
| 19 | SET COMPATFLAG= | ||
| 20 | |||
| 21 | |||
| 22 | |||
| 23 | |||
| 24 | |||
| 25 | |||
| 26 | |||
| 27 | |||
| 28 | |||
| 29 | REM ********************************** | ||
| 30 | REM * Nothing to customize below * | ||
| 31 | REM ********************************** | ||
| 32 | |||
| 33 | SET BATCHNAME=%~n0 | ||
| 34 | SET SOURCE=%SOURCETREE%src\ | ||
| 35 | SET LUA_H=%SOURCE%lua.h | ||
| 36 | SET CURDIR=%CD% | ||
| 37 | |||
| 38 | REM the following line ends with a TAB. DO NOT REMOVE IT! | ||
| 39 | SET TABCHAR= | ||
| 40 | REM Define LF to contain a linefeed character | ||
| 41 | set ^"LFCHAR=^ | ||
| 42 | |||
| 43 | ^" The above empty line is critical. DO NOT REMOVE | ||
| 44 | |||
| 45 | |||
| 46 | REM Supported toolchains (allcaps) | ||
| 47 | SET TOOLCHAINS=MS GCC | ||
| 48 | REM Commands which, if exiting without error, indicate presence of the toolchain | ||
| 49 | SET CHECK_GCC=gcc --version | ||
| 50 | SET CHECK_MS=cl | ||
| 51 | |||
| 52 | REM ********************************** | ||
| 53 | REM * Check for help request * | ||
| 54 | REM ********************************** | ||
| 55 | |||
| 56 | SET HELPCMDS=help -help --help /help ? -? /? | ||
| 57 | for %%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 | |||
| 90 | REM ********************************** | ||
| 91 | REM * Check commandline * | ||
| 92 | REM ********************************** | ||
| 93 | |||
| 94 | SET CMDOK=FALSE | ||
| 95 | if "%~1"=="" ( | ||
| 96 | SET CMDOK=TRUE | ||
| 97 | ) | ||
| 98 | for %%a in (local install clean) do ( | ||
| 99 | if "%%a"=="%~1" ( | ||
| 100 | SET CMDOK=TRUE | ||
| 101 | ) | ||
| 102 | ) | ||
| 103 | for %%a in (--nocompat) do ( | ||
| 104 | if "%%a"=="%~1" ( | ||
| 105 | SET NOCOMPAT=TRUE | ||
| 106 | if "%~2"=="" ( | ||
| 107 | SET CMDOK=TRUE | ||
| 108 | ) | ||
| 109 | SHIFT | ||
| 110 | ) | ||
| 111 | ) | ||
| 112 | for %%a in (%TOOLCHAINS%) do ( | ||
| 113 | if "%%a"=="%~1" ( | ||
| 114 | SET CMDOK=TRUE | ||
| 115 | SET TOOLCHAIN=%~1 | ||
| 116 | ) | ||
| 117 | ) | ||
| 118 | if NOT %CMDOK%==TRUE ( | ||
| 119 | echo. | ||
| 120 | echo Unknown command or toolchain specified. | ||
| 121 | goto :EXITERROR | ||
| 122 | ) | ||
| 123 | |||
| 124 | REM ************************************** | ||
| 125 | REM * Check for cleaning * | ||
| 126 | REM ************************************** | ||
| 127 | |||
| 128 | if "%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 | |||
| 146 | REM ************************************************** | ||
| 147 | REM * Fetch the Lua version from the source code * | ||
| 148 | REM ************************************************** | ||
| 149 | |||
| 150 | Echo. | ||
| 151 | Echo Checking source code to extract Lua version... | ||
| 152 | IF NOT EXIST %LUA_H% ( | ||
| 153 | Echo Cannot locate Lua header file; %LUA_H% | ||
| 154 | goto :EXITERROR | ||
| 155 | ) | ||
| 156 | |||
| 157 | findstr /R /C:"#define[ %TABCHAR%][ %TABCHAR%]*LUA_VERSION_MAJOR" %LUA_H% > NUL | ||
| 158 | if 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 | ) | ||
| 185 | SET LUA_SVER=!LUA_VER:.=! | ||
| 186 | |||
| 187 | Echo Lua version found: %LUA_VER% | ||
| 188 | Echo. | ||
| 189 | |||
| 190 | REM ************************************** | ||
| 191 | REM * Set some Lua version specifics * | ||
| 192 | REM ************************************** | ||
| 193 | |||
| 194 | REM FILES_CORE; files for Lua core (+lauxlib, needed for Luac) | ||
| 195 | REM FILES_LIB; files for Lua standard libraries | ||
| 196 | REM FILES_DLL; vm files to be build with dll option | ||
| 197 | REM FILES_OTH; vm files to be build without dll, for static linking | ||
| 198 | |||
| 199 | if %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 | ) | ||
| 206 | if %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 | ) | ||
| 216 | if %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 | |||
| 227 | if "%NOCOMPAT%"=="TRUE" ( | ||
| 228 | set COMPATFLAG= | ||
| 229 | ) | ||
| 230 | |||
| 231 | SET FILES_BASE=%FILES_DLL% %FILES_CORE% %FILES_LIB% | ||
| 232 | |||
| 233 | if "%FILES_BASE%"=="" ( | ||
| 234 | Echo Unknown Lua version; %LUA_VER% | ||
| 235 | goto :EXITERROR | ||
| 236 | ) | ||
| 237 | |||
| 238 | REM ********************************* | ||
| 239 | REM * Check available toolchain * | ||
| 240 | REM ********************************* | ||
| 241 | |||
| 242 | if [%TOOLCHAIN%]==[] ( | ||
| 243 | Echo Testing for MS... | ||
| 244 | %CHECK_MS% | ||
| 245 | IF !ERRORLEVEL!==0 SET TOOLCHAIN=MS | ||
| 246 | ) | ||
| 247 | if [%TOOLCHAIN%]==[] ( | ||
| 248 | Echo Testing for GCC... | ||
| 249 | %CHECK_GCC% | ||
| 250 | IF !ERRORLEVEL!==0 SET TOOLCHAIN=GCC | ||
| 251 | ) | ||
| 252 | if [%TOOLCHAIN%]==[] ( | ||
| 253 | Echo No supported toolchain found ^(please make sure it is in the system path^) | ||
| 254 | goto :EXITERROR | ||
| 255 | ) | ||
| 256 | |||
| 257 | REM *************************** | ||
| 258 | REM * Configure toolchain * | ||
| 259 | REM *************************** | ||
| 260 | |||
| 261 | if %TOOLCHAIN%==GCC ( | ||
| 262 | echo Using GCC toolchain... | ||
| 263 | SET OBJEXT=o | ||
| 264 | SET LIBFILE=liblua%LUA_SVER%.a | ||
| 265 | ) | ||
| 266 | if %TOOLCHAIN%==MS ( | ||
| 267 | echo Using Microsoft toolchain... | ||
| 268 | SET OBJEXT=obj | ||
| 269 | SET LIBFILE=lua%LUA_SVER%.lib | ||
| 270 | ) | ||
| 271 | echo. | ||
| 272 | |||
| 273 | REM ************************************** | ||
| 274 | REM * Check for installing * | ||
| 275 | REM ************************************** | ||
| 276 | |||
| 277 | if "%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 | ) | ||
| 285 | if "%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 | ) | ||
| 293 | if 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 | |||
| 311 | REM *********************** | ||
| 312 | REM * Compile sources * | ||
| 313 | REM *********************** | ||
| 314 | goto :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 | |||
| 332 | goto :eof | ||
| 333 | :after_compile_function | ||
| 334 | |||
| 335 | CD %SOURCE% | ||
| 336 | REM Traverse the 4 lists of source files | ||
| 337 | |||
| 338 | for %%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 | |||
| 362 | REM **************************** | ||
| 363 | REM * Link GCC based files * | ||
| 364 | REM **************************** | ||
| 365 | |||
| 366 | if %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 | |||
| 400 | REM **************************** | ||
| 401 | REM * Link MS based files * | ||
| 402 | REM **************************** | ||
| 403 | |||
| 404 | if %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 | |||
| 442 | CD %CURDIR% | ||
| 443 | |||
| 444 | REM **************************** | ||
| 445 | REM * Finished building * | ||
| 446 | REM **************************** | ||
| 447 | |||
| 448 | echo. | ||
| 449 | echo Build completed. | ||
| 450 | goto :EXITOK | ||
| 451 | |||
| 452 | :EXITOK | ||
| 453 | exit /B 0 | ||
| 454 | |||
| 455 | :EXITERROR | ||
| 456 | echo For help try; etc\%BATCHNAME% /help | ||
| 457 | exit /B 1 | ||
diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..a060db0 --- /dev/null +++ b/appveyor.yml | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | version: 0.0.1.{build}-test | ||
| 2 | |||
| 3 | # Use default image unless needed | ||
| 4 | #os: | ||
| 5 | #- Windows Server 2012 R2 | ||
| 6 | |||
| 7 | shallow_clone: true | ||
| 8 | |||
| 9 | environment: | ||
| 10 | LUAROCKS_VER: 2.3.0 | ||
| 11 | matrix: | ||
| 12 | - LUA_VER: 5.1.5 | ||
| 13 | - LUA_VER: 5.2.4 | ||
| 14 | NOCOMPAT: true | ||
| 15 | - LUA_VER: 5.3.2 # Lua 5.3.2 with compatibility flags disabled. | ||
| 16 | NOCOMPAT: true | ||
| 17 | - LJ_VER: 2.0.4 | ||
| 18 | - LJ_VER: 2.1 | ||
| 19 | |||
| 20 | matrix: | ||
| 21 | allow_failures: | ||
| 22 | - configuration: MinGW | ||
| 23 | platform: x64 | ||
| 24 | |||
| 25 | # Abuse this section so we can have a matrix with different Compiler versions | ||
| 26 | configuration: | ||
| 27 | - 2015 | ||
| 28 | - MinGW | ||
| 29 | |||
| 30 | platform: | ||
| 31 | - x86 | ||
| 32 | - x64 | ||
| 33 | |||
| 34 | cache: | ||
| 35 | - c:\lua -> appveyor.yml | ||
| 36 | - c:\external -> appveyor.yml | ||
| 37 | |||
| 38 | # Skip unsupported combinations (ie, VS2008 for x64 is not supported) | ||
| 39 | init: | ||
| 40 | - if "%platform%" EQU "x64" ( for %%a in (2008 2010 MinGW) do ( if "%Configuration%"=="%%a" (echo "Skipping unsupported configuration" && exit /b 1 ) ) ) | ||
| 41 | |||
| 42 | |||
| 43 | install: | ||
| 44 | # Make compiler command line tools available | ||
| 45 | - call .appveyor\set_compiler_env.bat | ||
| 46 | # Setup Lua development/build environment | ||
| 47 | - call .appveyor\install.bat | ||
| 48 | |||
| 49 | before_build: | ||
| 50 | # @todo | ||
| 51 | - echo "Installing external deps" | ||
| 52 | |||
| 53 | build_script: | ||
| 54 | - luarocks make rockspecs/luafilesystem-cvs-3.rockspec | ||
| 55 | |||
| 56 | before_test: | ||
| 57 | |||
| 58 | test_script: | ||
| 59 | - echo "Testing..." | ||
| 60 | - cd %APPVEYOR_BUILD_FOLDER%\tests | ||
| 61 | - lua test.lua | ||
| 62 | |||
| 63 | after_test: | ||
| 64 | # @todo | ||
