install 1.91 KB
Newer Older
1 2
#!/bin/bash

3 4
set -e

5 6 7 8 9
BUILD_DEBUG="yes"
BUILD_RELEASE="yes"

OPTIONS=""

10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
for option in "$@"; do
   case $option in
      --no-debug)
         BUILD_DEBUG="no"
         ;;
      --no-release)
         BUILD_RELEASE="no"
         ;;
      --build=*                     )
         BUILD="${option#*=}"
         if [[ "$BUILD" != "Release" ]]; then
            BUILD_RELEASE="no"
         fi
         if [[ "$BUILD" != "Debug" ]]; then
            BUILD_DEBUG="no"
         fi
         ;;
      *)
         OPTIONS="${OPTIONS} ${option}"
         ;;
   esac
31 32
done

33 34 35 36 37
if [[ ${BUILD_DEBUG} == "yes" ]]; then
   if [[ ! -d Debug ]]; then
      mkdir Debug
   fi
   pushd Debug
38 39 40 41
   if ! ../build --root-dir=.. --build=Debug --install=yes ${OPTIONS}; then
      echo "Debug build failed."
      exit 1
   fi
42
   popd
43
fi
44

45 46 47 48 49
if [[ ${BUILD_RELEASE} == "yes" ]]; then
   if [[ ! -d Release ]]; then
      mkdir Release
   fi
   pushd Release
50 51 52 53
   if ! ../build --root-dir=.. --build=Release --install=yes ${OPTIONS}; then
      echo "Release build failed."
      exit 1
   fi
54
   popd
55
fi
56

57 58 59 60 61 62 63 64 65 66

PREFIX=${HOME}/.local
for option in "$@"
do
    case $option in
        --prefix=*                     ) PREFIX="${option#*=}" ;;
    esac
done


67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
TNL_TEST=`which tnl-bindir`

if test x${TNL_TEST} = x;
then
    echo ""
    echo "WARNING !!!"
    echo ""
    echo "Your system does not see TNL which was installed right now."
    echo "You need to add it to your system variables PATH and LD_LIBRARY_PATH."
    echo "Add the following to your .bashrc file:"
    echo ""
    
    echo "if test x\${PATH} = x;"
    echo "then"
    echo "   PATH=${PREFIX}/bin"
    echo "else"
    echo "   PATH=\${PATH}:${PREFIX}/bin"
    echo "fi"
    echo "if test x\${LD_LIBRARY_PATH} = x;"
    echo "then"
    echo "   LD_LIBRARY_PATH=${PREFIX}/lib"
    echo "else"
    echo "   LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:${PREFIX}/lib"
    echo "fi"
    echo "export PATH"
    echo "export LD_LIBRARY_PATH"
fi