summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorruki <[email protected]>2017-05-25 13:13:30 +0800
committerGitHub <[email protected]>2017-05-25 13:13:30 +0800
commit0c98817adb9e37ba3ca9e1c276e52f297976ea53 (patch)
tree12cf30f239a65e356990f329e98a8bbeb0f16554 /scripts
parent3768a8200a7699e1531c07ee5ab490e7d4f27b11 (diff)
parent67a5ad78de9453d14b562cd7c3f2a4364e370d24 (diff)
Merge pull request #115 from TitanSnow/installtest
add tests for install & uninstall
Diffstat (limited to 'scripts')
-rw-r--r--scripts/.travis/copyright1
-rw-r--r--scripts/.travis/platform.sh15
-rw-r--r--scripts/.travis/setenv_lua.sh3
-rw-r--r--scripts/.travis/setup_lua.sh124
-rwxr-xr-xscripts/get.sh53
5 files changed, 33 insertions, 163 deletions
diff --git a/scripts/.travis/copyright b/scripts/.travis/copyright
deleted file mode 100644
index 0346e778f..000000000
--- a/scripts/.travis/copyright
+++ /dev/null
@@ -1 +0,0 @@
-Copyright (c) 2015-2017 codecov
diff --git a/scripts/.travis/platform.sh b/scripts/.travis/platform.sh
deleted file mode 100644
index 7259a7d63..000000000
--- a/scripts/.travis/platform.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-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/scripts/.travis/setenv_lua.sh b/scripts/.travis/setenv_lua.sh
deleted file mode 100644
index 499949342..000000000
--- a/scripts/.travis/setenv_lua.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-export PATH=${PATH}:$HOME/.lua:$HOME/.local/bin:${TRAVIS_BUILD_DIR}/install/luarocks/bin
-bash scripts/.travis/setup_lua.sh
-eval `$HOME/.lua/luarocks path`
diff --git a/scripts/.travis/setup_lua.sh b/scripts/.travis/setup_lua.sh
deleted file mode 100644
index 153b99d90..000000000
--- a/scripts/.travis/setup_lua.sh
+++ /dev/null
@@ -1,124 +0,0 @@
-#! /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
-
-set -eufo pipefail
-
-LUAJIT_BASE="LuaJIT-2.0.4"
-
-source scripts/.travis/platform.sh
-
-LUA_HOME_DIR=$TRAVIS_BUILD_DIR/install/lua
-
-LR_HOME_DIR=$TRAVIS_BUILD_DIR/install/luarocks
-
-mkdir $HOME/.lua
-
-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
-
-mkdir -p "$LUA_HOME_DIR"
-
-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 && make install PREFIX="$LUA_HOME_DIR"
-
- if [ "$LUA" == "luajit2.1" ]; then
- ln -s $LUA_HOME_DIR/bin/luajit-2.1.0-alpha $HOME/.lua/luajit
- ln -s $LUA_HOME_DIR/bin/luajit-2.1.0-alpha $HOME/.lua/lua;
- else
- ln -s $LUA_HOME_DIR/bin/luajit $HOME/.lua/luajit
- ln -s $LUA_HOME_DIR/bin/luajit $HOME/.lua/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.4.tar.gz | tar xz
- cd lua-5.2.4;
- elif [ "$LUA" == "lua5.3" ]; then
- curl http://www.lua.org/ftp/lua-5.3.1.tar.gz | tar xz
- cd lua-5.3.1;
- fi
-
- # Build Lua without backwards compatibility for testing
- perl -i -pe 's/-DLUA_COMPAT_(ALL|5_2)//' src/Makefile
- make $PLATFORM
- make INSTALL_TOP="$LUA_HOME_DIR" install;
-
- ln -s $LUA_HOME_DIR/bin/lua $HOME/.lua/lua
- ln -s $LUA_HOME_DIR/bin/luac $HOME/.lua/luac;
-
-fi
-
-cd $TRAVIS_BUILD_DIR
-
-lua -v
-
-LUAROCKS_BASE=luarocks-$LUAROCKS
-
-curl --location http://luarocks.org/releases/$LUAROCKS_BASE.tar.gz | tar xz
-
-cd $LUAROCKS_BASE
-
-if [ "$LUA" == "luajit" ]; then
- ./configure --lua-suffix=jit --with-lua-include="$LUA_HOME_DIR/include/luajit-2.0" --prefix="$LR_HOME_DIR";
-elif [ "$LUA" == "luajit2.0" ]; then
- ./configure --lua-suffix=jit --with-lua-include="$LUA_HOME_DIR/include/luajit-2.0" --prefix="$LR_HOME_DIR";
-elif [ "$LUA" == "luajit2.1" ]; then
- ./configure --lua-suffix=jit --with-lua-include="$LUA_HOME_DIR/include/luajit-2.1" --prefix="$LR_HOME_DIR";
-else
- ./configure --with-lua="$LUA_HOME_DIR" --prefix="$LR_HOME_DIR"
-fi
-
-make build && make install
-
-ln -s $LR_HOME_DIR/bin/luarocks $HOME/.lua/luarocks
-
-cd $TRAVIS_BUILD_DIR
-
-luarocks --version
-
-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.4;
-elif [ "$LUA" == "lua5.3" ]; then
- rm -rf lua-5.3.1;
-fi
diff --git a/scripts/get.sh b/scripts/get.sh
index e780b34cf..f4c605bdc 100755
--- a/scripts/get.sh
+++ b/scripts/get.sh
@@ -98,29 +98,42 @@ then
my_exit 'Build Fail' $rv
fi
fi
-PATHclone=$PATH
-patharr=($PATHclone)
-prefix=
-for st in "${patharr[@]}"
-do
- if [[ "$st" = "$HOME"* ]]
- then
- cwd=$PWD
- mkdir -p "$st"
- cd "$st" || continue
- echo $$ > $$xmake_getter_test 2>/dev/null || continue
- rm $$xmake_getter_test 2>/dev/null || continue
- cd .. || continue
- mkdir -p share 2>/dev/null || continue
- prefix=$(pwd)
- cd "$cwd" || my_exit 'Chdir Error'
- break
- fi
-done
+# PATHclone=$PATH
+# patharr=($PATHclone)
+if [ "$prefix" = "" ]
+then
+ prefix=~/.local
+fi
+# for st in "${patharr[@]}"
+# do
+# if [[ "$st" = "$HOME"* ]]
+# then
+# cwd=$PWD
+# mkdir -p "$st"
+# cd "$st" || continue
+# echo $$ > $$xmake_getter_test 2>/dev/null || continue
+# rm $$xmake_getter_test 2>/dev/null || continue
+# cd .. || continue
+# mkdir -p share 2>/dev/null || continue
+# prefix=$(pwd)
+# cd "$cwd" || my_exit 'Chdir Error'
+# break
+# fi
+# done
if [ "x$prefix" != x ]
then
make -C /tmp/$$xmake_getter --no-print-directory install prefix="$prefix"|| my_exit 'Install Fail'
else
$sudoprefix make -C /tmp/$$xmake_getter --no-print-directory install || my_exit 'Install Fail'
fi
-xmake --version
+shell_profile(){
+ if [[ "$SHELL" = */zsh ]]; then echo ~/.zshrc
+ elif [[ "$SHELL" = */ksh ]]; then echo ~/.kshrc
+ else echo ~/.bash_profile; fi
+}
+xmake --version >/dev/null 2>&1 && xmake --version || {
+ echo "export PATH=$prefix/bin:\$PATH" >> $(shell_profile)
+ export PATH=$prefix/bin:$PATH
+ xmake --version
+ echo -e "Reload shell profile by running \x1b[1msource '$(shell_profile)'\x1b[0m now!"
+}