diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2014-11-12 15:57:35 -0200 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2014-11-12 15:57:35 -0200 |
| commit | 5422c7ac6beb2231f41a523ddcd6dfbe16d8b952 (patch) | |
| tree | 81843337d144973c84d4f0a376485569c18d93da | |
| parent | a0ca710ceac45d41082ec5e48f2ae5a2320ae1cd (diff) | |
| parent | 8f2949974a6329296cb643bd9507983e8b589d9a (diff) | |
| download | luafilesystem-5422c7ac6beb2231f41a523ddcd6dfbe16d8b952.tar.gz luafilesystem-5422c7ac6beb2231f41a523ddcd6dfbe16d8b952.tar.bz2 luafilesystem-5422c7ac6beb2231f41a523ddcd6dfbe16d8b952.zip | |
Merge pull request #46 from moteus/master
Add. Travis files.
| -rw-r--r-- | .travis.yml | 33 | ||||
| -rw-r--r-- | .travis/platform.sh | 15 | ||||
| -rw-r--r-- | .travis/setup_lua.sh | 101 | ||||
| -rw-r--r-- | rockspecs/luafilesystem-cvs-3.rockspec | 27 | ||||
| -rw-r--r-- | src/lfs.c | 8 |
5 files changed, 184 insertions, 0 deletions
diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..67b5812 --- /dev/null +++ b/.travis.yml | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | language: c | ||
| 2 | |||
| 3 | env: | ||
| 4 | global: | ||
| 5 | - LUAROCKS=2.2.0-rc1 | ||
| 6 | matrix: | ||
| 7 | - LUA=lua5.1 | ||
| 8 | - LUA=lua5.2 | ||
| 9 | - LUA=lua5.3 | ||
| 10 | - LUA=luajit | ||
| 11 | |||
| 12 | branches: | ||
| 13 | only: | ||
| 14 | - master | ||
| 15 | |||
| 16 | before_install: | ||
| 17 | - bash .travis/setup_lua.sh | ||
| 18 | - sudo pip install cpp-coveralls | ||
| 19 | |||
| 20 | install: | ||
| 21 | - sudo luarocks make rockspecs/luafilesystem-cvs-3.rockspec CFLAGS="-O2 -fPIC -ftest-coverage -fprofile-arcs" LIBFLAG="-shared --coverage" | ||
| 22 | |||
| 23 | script: | ||
| 24 | - cd tests | ||
| 25 | - sudo lua test.lua | ||
| 26 | |||
| 27 | after_success: | ||
| 28 | - coveralls -b .. -r .. -E usr | ||
| 29 | |||
| 30 | notifications: | ||
| 31 | email: | ||
| 32 | on_success: change | ||
| 33 | on_failure: always | ||
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 @@ | |||
| 1 | if [ -z "$PLATFORM" ]; then | ||
| 2 | PLATFORM=$TRAVIS_OS_NAME; | ||
| 3 | fi | ||
| 4 | |||
| 5 | if [ "$PLATFORM" == "osx" ]; then | ||
| 6 | PLATFORM="macosx"; | ||
| 7 | fi | ||
| 8 | |||
| 9 | if [ -z "$PLATFORM" ]; then | ||
| 10 | if [ "$(uname)" == "Linux" ]; then | ||
| 11 | PLATFORM="linux"; | ||
| 12 | else | ||
| 13 | PLATFORM="macosx"; | ||
| 14 | fi; | ||
| 15 | fi | ||
diff --git a/.travis/setup_lua.sh b/.travis/setup_lua.sh new file mode 100644 index 0000000..373e24d --- /dev/null +++ b/.travis/setup_lua.sh | |||
| @@ -0,0 +1,101 @@ | |||
| 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 | |||
| 9 | LUAJIT_BASE="LuaJIT-2.0.3" | ||
| 10 | |||
| 11 | source .travis/platform.sh | ||
| 12 | |||
| 13 | LUAJIT="no" | ||
| 14 | |||
| 15 | if [ "$PLATFORM" == "macosx" ]; then | ||
| 16 | if [ "$LUA" == "luajit" ]; then | ||
| 17 | LUAJIT="yes"; | ||
| 18 | fi | ||
| 19 | if [ "$LUA" == "luajit2.0" ]; then | ||
| 20 | LUAJIT="yes"; | ||
| 21 | fi | ||
| 22 | if [ "$LUA" == "luajit2.1" ]; then | ||
| 23 | LUAJIT="yes"; | ||
| 24 | fi; | ||
| 25 | elif [ "$(expr substr $LUA 1 6)" == "luajit" ]; then | ||
| 26 | LUAJIT="yes"; | ||
| 27 | fi | ||
| 28 | |||
| 29 | if [ "$LUAJIT" == "yes" ]; then | ||
| 30 | |||
| 31 | if [ "$LUA" == "luajit" ]; then | ||
| 32 | curl http://luajit.org/download/$LUAJIT_BASE.tar.gz | tar xz; | ||
| 33 | else | ||
| 34 | git clone http://luajit.org/git/luajit-2.0.git $LUAJIT_BASE; | ||
| 35 | fi | ||
| 36 | |||
| 37 | cd $LUAJIT_BASE | ||
| 38 | |||
| 39 | if [ "$LUA" == "luajit2.1" ]; then | ||
| 40 | git checkout v2.1; | ||
| 41 | fi | ||
| 42 | |||
| 43 | make && sudo make install | ||
| 44 | |||
| 45 | if [ "$LUA" == "luajit2.1" ]; then | ||
| 46 | sudo ln -s /usr/local/bin/luajit-2.1.0-alpha /usr/local/bin/luajit | ||
| 47 | sudo ln -s /usr/local/bin/luajit /usr/local/bin/lua; | ||
| 48 | else | ||
| 49 | sudo ln -s /usr/local/bin/luajit /usr/local/bin/lua; | ||
| 50 | fi; | ||
| 51 | |||
| 52 | else | ||
| 53 | if [ "$LUA" == "lua5.1" ]; then | ||
| 54 | curl http://www.lua.org/ftp/lua-5.1.5.tar.gz | tar xz | ||
| 55 | cd lua-5.1.5; | ||
| 56 | elif [ "$LUA" == "lua5.2" ]; then | ||
| 57 | curl http://www.lua.org/ftp/lua-5.2.3.tar.gz | tar xz | ||
| 58 | cd lua-5.2.3; | ||
| 59 | elif [ "$LUA" == "lua5.3" ]; then | ||
| 60 | curl http://www.lua.org/work/lua-5.3.0-beta.tar.gz | tar xz | ||
| 61 | cd lua-5.3.0-beta; | ||
| 62 | fi | ||
| 63 | sudo make $PLATFORM install; | ||
| 64 | fi | ||
| 65 | |||
| 66 | cd $TRAVIS_BUILD_DIR; | ||
| 67 | |||
| 68 | LUAROCKS_BASE=luarocks-$LUAROCKS | ||
| 69 | |||
| 70 | # curl http://luarocks.org/releases/$LUAROCKS_BASE.tar.gz | tar xz | ||
| 71 | |||
| 72 | git clone https://github.com/keplerproject/luarocks.git $LUAROCKS_BASE | ||
| 73 | cd $LUAROCKS_BASE | ||
| 74 | |||
| 75 | git checkout v$LUAROCKS | ||
| 76 | |||
| 77 | if [ "$LUA" == "luajit" ]; then | ||
| 78 | ./configure --lua-suffix=jit --with-lua-include=/usr/local/include/luajit-2.0; | ||
| 79 | elif [ "$LUA" == "luajit2.0" ]; then | ||
| 80 | ./configure --lua-suffix=jit --with-lua-include=/usr/local/include/luajit-2.0; | ||
| 81 | elif [ "$LUA" == "luajit2.1" ]; then | ||
| 82 | ./configure --lua-suffix=jit --with-lua-include=/usr/local/include/luajit-2.1; | ||
| 83 | else | ||
| 84 | ./configure; | ||
| 85 | fi | ||
| 86 | |||
| 87 | make build && sudo make install | ||
| 88 | |||
| 89 | cd $TRAVIS_BUILD_DIR | ||
| 90 | |||
| 91 | rm -rf $LUAROCKS_BASE | ||
| 92 | |||
| 93 | if [ "$LUAJIT" == "yes" ]; then | ||
| 94 | rm -rf $LUAJIT_BASE; | ||
| 95 | elif [ "$LUA" == "lua5.1" ]; then | ||
| 96 | rm -rf lua-5.1.5; | ||
| 97 | elif [ "$LUA" == "lua5.2" ]; then | ||
| 98 | rm -rf lua-5.2.3; | ||
| 99 | elif [ "$LUA" == "lua5.3" ]; then | ||
| 100 | rm -rf lua-5.3.0-beta; | ||
| 101 | 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 @@ | |||
| 1 | package = "LuaFileSystem" | ||
| 2 | |||
| 3 | version = "cvs-3" | ||
| 4 | |||
| 5 | source = { | ||
| 6 | url = "git://github.com/keplerproject/luafilesystem.git", | ||
| 7 | } | ||
| 8 | |||
| 9 | description = { | ||
| 10 | summary = "File System Library for the Lua Programming Language", | ||
| 11 | detailed = [[ | ||
| 12 | LuaFileSystem is a Lua library developed to complement the set of | ||
| 13 | functions related to file systems offered by the standard Lua | ||
| 14 | distribution. LuaFileSystem offers a portable way to access the | ||
| 15 | underlying directory structure and file attributes. | ||
| 16 | ]] | ||
| 17 | } | ||
| 18 | |||
| 19 | dependencies = { | ||
| 20 | "lua >= 5.1, < 5.4" | ||
| 21 | } | ||
| 22 | |||
| 23 | build = { | ||
| 24 | type = "builtin", | ||
| 25 | modules = { lfs = "src/lfs.c" }, | ||
| 26 | copy_directories = { "doc", "tests" } | ||
| 27 | } | ||
| @@ -69,6 +69,14 @@ | |||
| 69 | #define LFS_VERSION "1.6.2" | 69 | #define LFS_VERSION "1.6.2" |
| 70 | #define LFS_LIBNAME "lfs" | 70 | #define LFS_LIBNAME "lfs" |
| 71 | 71 | ||
| 72 | #if LUA_VERSION_NUM >= 503 /* Lua 5.3 */ | ||
| 73 | |||
| 74 | #ifndef luaL_optlong | ||
| 75 | #define luaL_optlong luaL_optinteger | ||
| 76 | #endif | ||
| 77 | |||
| 78 | #endif | ||
| 79 | |||
| 72 | #if LUA_VERSION_NUM < 502 | 80 | #if LUA_VERSION_NUM < 502 |
| 73 | # define luaL_newlib(L,l) (lua_newtable(L), luaL_register(L,NULL,l)) | 81 | # define luaL_newlib(L,l) (lua_newtable(L), luaL_register(L,NULL,l)) |
| 74 | #endif | 82 | #endif |
