]> git.proxmox.com Git - ceph.git/blob - ceph/src/civetweb/ci/travis/setup_lua.sh
buildsys: switch source download to quincy
[ceph.git] / ceph / src / civetweb / ci / travis / setup_lua.sh
1 #!/usr/bin/env /bash
2 set -ev
3
4 # this script installs a lua / luarocks environment in .travis/lua
5 # this is necessary because travis docker architecture (the fast way)
6 # does not permit sudo, and does not contain a useful lua installation
7
8 # After this script is finished, you can configure your environment to
9 # use it by sourcing lua_env.sh
10
11 source ci/travis/platform.sh
12
13 # The current versions when this script was written
14 LUA_VERSION=5.2.4
15 LUAROCKS_VERSION=2.2.2
16
17 # directory where this script is located
18 SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
19
20 # civetweb base dir
21 PROJECT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../.. && pwd )
22
23 # fetch and unpack lua src
24 cd $SCRIPT_DIR
25 LUA_BASE=lua-$LUA_VERSION
26 rm -rf $LUA_BASE
27 curl http://www.lua.org/ftp/$LUA_BASE.tar.gz | tar zx
28
29 # build lua
30 cd $LUA_BASE
31 make $PLATFORM
32 make local
33
34 # mv built lua install to target Lua dir
35 LUA_DIR=$PROJECT_DIR/ci/lua
36 rm -rf $LUA_DIR
37 mv $SCRIPT_DIR/$LUA_BASE/install $LUA_DIR
38
39 # add to path required by luarocks installer
40 export PATH=$LUA_DIR/bin:$PATH
41
42
43 # fetch and unpack luarocks
44 cd $SCRIPT_DIR
45 LUAROCKS_BASE=luarocks-$LUAROCKS_VERSION
46 rm -rf ${LUAROCKS_BASE}
47 LUAROCKS_URL=http://luarocks.org/releases/${LUAROCKS_BASE}.tar.gz
48 # -L because it's a 302 redirect
49 curl -L $LUAROCKS_URL | tar xzp
50 cd $LUAROCKS_BASE
51
52 # build luarocks
53 ./configure --prefix=$LUA_DIR
54 make build
55 make install
56
57 # cleanup source dirs
58 cd $SCRIPT_DIR
59 rm -rf $LUAROCKS_BASE
60 rm -rf $LUA_BASE
61