From c0552d59a4b82b7ee8cfaf0c08e1b7416fea61d1 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Thu, 14 Aug 2014 09:36:58 +0500 Subject: Add. Travis files. --- .travis/platform.sh | 15 +++++++++ .travis/setup_lua.sh | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 .travis/platform.sh create mode 100644 .travis/setup_lua.sh (limited to '.travis') diff --git a/.travis/platform.sh b/.travis/platform.sh new file mode 100644 index 0000000..4a3af0d --- /dev/null +++ b/.travis/platform.sh @@ -0,0 +1,15 @@ +if [ -z "$PLATFORM" ]; then + PLATFORM=$TRAVIS_OS_NAME; +fi + +if [ "$PLATFORM" == "osx" ]; then + PLATFORM="macosx"; +fi + +if [ -z "$PLATFORM" ]; then + if [ "$(uname)" == "Linux" ]; then + PLATFORM="linux"; + else + PLATFORM="macosx"; + fi; +fi diff --git a/.travis/setup_lua.sh b/.travis/setup_lua.sh new file mode 100644 index 0000000..1ead166 --- /dev/null +++ b/.travis/setup_lua.sh @@ -0,0 +1,92 @@ +#! /bin/bash + +# A script for setting up environment for travis-ci testing. +# Sets up Lua and Luarocks. +# LUA must be "lua5.1", "lua5.2" or "luajit". +# luajit2.0 - master v2.0 +# luajit2.1 - master v2.1 + +LUAJIT_BASE="LuaJIT-2.0.3" + +source .travis/platform.sh + +LUAJIT="no" + +if [ "$PLATFORM" == "macosx" ]; then + if [ "$LUA" == "luajit" ]; then + LUAJIT="yes"; + fi + if [ "$LUA" == "luajit2.0" ]; then + LUAJIT="yes"; + fi + if [ "$LUA" == "luajit2.1" ]; then + LUAJIT="yes"; + fi; +elif [ "$(expr substr $LUA 1 6)" == "luajit" ]; then + LUAJIT="yes"; +fi + +if [ "$LUAJIT" == "yes" ]; then + + if [ "$LUA" == "luajit" ]; then + curl http://luajit.org/download/$LUAJIT_BASE.tar.gz | tar xz; + else + git clone http://luajit.org/git/luajit-2.0.git $LUAJIT_BASE; + fi + + cd $LUAJIT_BASE + + if [ "$LUA" == "luajit2.1" ]; then + git checkout v2.1; + fi + + make && sudo make install + + if [ "$LUA" == "luajit2.1" ]; then + sudo ln -s /usr/local/bin/luajit-2.1.0-alpha /usr/local/bin/luajit + sudo ln -s /usr/local/bin/luajit /usr/local/bin/lua; + else + sudo ln -s /usr/local/bin/luajit /usr/local/bin/lua; + fi; + +else + if [ "$LUA" == "lua5.1" ]; then + curl http://www.lua.org/ftp/lua-5.1.5.tar.gz | tar xz + cd lua-5.1.5; + elif [ "$LUA" == "lua5.2" ]; then + curl http://www.lua.org/ftp/lua-5.2.3.tar.gz | tar xz + cd lua-5.2.3; + fi + sudo make $PLATFORM install; +fi + +cd $TRAVIS_BUILD_DIR + +LUAROCKS_BASE=luarocks-$LUAROCKS +git clone https://github.com/keplerproject/luarocks.git $LUAROCKS_BASE +cd $LUAROCKS_BASE +git checkout v$LUAROCKS + +if [ "$LUA" == "luajit" ]; then + ./configure --lua-suffix=jit --with-lua-include=/usr/local/include/luajit-2.0; +elif [ "$LUA" == "luajit2.0" ]; then + ./configure --lua-suffix=jit --with-lua-include=/usr/local/include/luajit-2.0; +elif [ "$LUA" == "luajit2.1" ]; then + ./configure --lua-suffix=jit --with-lua-include=/usr/local/include/luajit-2.1; +else + ./configure; +fi + +make build && sudo make install + +cd $TRAVIS_BUILD_DIR + +rm -rf $LUAROCKS_BASE + +if [ "$LUAJIT" == "yes" ]; then + rm -rf $LUAJIT_BASE; +elif [ "$LUA" == "lua5.1" ]; then + rm -rf lua-5.1.5; +elif [ "$LUA" == "lua5.2" ]; then + rm -rf lua-5.2.3; +fi -- cgit v1.2.3-55-g6feb From 8f2949974a6329296cb643bd9507983e8b589d9a Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Wed, 12 Nov 2014 14:44:53 +0400 Subject: Fix. Support Lua 5.3.beta --- .travis.yml | 3 ++- .travis/setup_lua.sh | 11 ++++++++++- rockspecs/luafilesystem-cvs-3.rockspec | 27 +++++++++++++++++++++++++++ src/lfs.c | 8 ++++++++ 4 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 rockspecs/luafilesystem-cvs-3.rockspec (limited to '.travis') diff --git a/.travis.yml b/.travis.yml index a2a79b3..67b5812 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ env: matrix: - LUA=lua5.1 - LUA=lua5.2 + - LUA=lua5.3 - LUA=luajit branches: @@ -17,7 +18,7 @@ before_install: - sudo pip install cpp-coveralls install: - - sudo luarocks make rockspecs/luafilesystem-cvs-2.rockspec CFLAGS="-O2 -fPIC -ftest-coverage -fprofile-arcs" LIBFLAG="-shared --coverage" + - sudo luarocks make rockspecs/luafilesystem-cvs-3.rockspec CFLAGS="-O2 -fPIC -ftest-coverage -fprofile-arcs" LIBFLAG="-shared --coverage" script: - cd tests diff --git a/.travis/setup_lua.sh b/.travis/setup_lua.sh index 1ead166..373e24d 100644 --- a/.travis/setup_lua.sh +++ b/.travis/setup_lua.sh @@ -56,15 +56,22 @@ else elif [ "$LUA" == "lua5.2" ]; then curl http://www.lua.org/ftp/lua-5.2.3.tar.gz | tar xz cd lua-5.2.3; + elif [ "$LUA" == "lua5.3" ]; then + curl http://www.lua.org/work/lua-5.3.0-beta.tar.gz | tar xz + cd lua-5.3.0-beta; fi sudo make $PLATFORM install; fi -cd $TRAVIS_BUILD_DIR +cd $TRAVIS_BUILD_DIR; LUAROCKS_BASE=luarocks-$LUAROCKS + +# curl http://luarocks.org/releases/$LUAROCKS_BASE.tar.gz | tar xz + git clone https://github.com/keplerproject/luarocks.git $LUAROCKS_BASE cd $LUAROCKS_BASE + git checkout v$LUAROCKS if [ "$LUA" == "luajit" ]; then @@ -89,4 +96,6 @@ elif [ "$LUA" == "lua5.1" ]; then rm -rf lua-5.1.5; elif [ "$LUA" == "lua5.2" ]; then rm -rf lua-5.2.3; +elif [ "$LUA" == "lua5.3" ]; then + rm -rf lua-5.3.0-beta; fi diff --git a/rockspecs/luafilesystem-cvs-3.rockspec b/rockspecs/luafilesystem-cvs-3.rockspec new file mode 100644 index 0000000..a4388cd --- /dev/null +++ b/rockspecs/luafilesystem-cvs-3.rockspec @@ -0,0 +1,27 @@ +package = "LuaFileSystem" + +version = "cvs-3" + +source = { + url = "git://github.com/keplerproject/luafilesystem.git", +} + +description = { + summary = "File System Library for the Lua Programming Language", + detailed = [[ + LuaFileSystem is a Lua library developed to complement the set of + functions related to file systems offered by the standard Lua + distribution. LuaFileSystem offers a portable way to access the + underlying directory structure and file attributes. + ]] +} + +dependencies = { + "lua >= 5.1, < 5.4" +} + +build = { + type = "builtin", + modules = { lfs = "src/lfs.c" }, + copy_directories = { "doc", "tests" } +} diff --git a/src/lfs.c b/src/lfs.c index ec3544b..0b0b786 100644 --- a/src/lfs.c +++ b/src/lfs.c @@ -65,6 +65,14 @@ #define LFS_VERSION "1.6.2" #define LFS_LIBNAME "lfs" +#if LUA_VERSION_NUM >= 503 /* Lua 5.3 */ + +#ifndef luaL_optlong +#define luaL_optlong luaL_optinteger +#endif + +#endif + #if LUA_VERSION_NUM < 502 # define luaL_newlib(L,l) (lua_newtable(L), luaL_register(L,NULL,l)) #endif -- cgit v1.2.3-55-g6feb