install 1.78 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 38 39
if [[ ${BUILD_DEBUG} == "yes" ]]; then
   if [[ ! -d Debug ]]; then
      mkdir Debug
   fi
   pushd Debug
   ../build --root-dir=.. --build=Debug --install=yes ${OPTIONS}
   popd
40
fi
41

42 43 44 45 46 47 48
if [[ ${BUILD_RELEASE} == "yes" ]]; then
   if [[ ! -d Release ]]; then
      mkdir Release
   fi
   pushd Release
   ../build --root-dir=.. --build=Release --install=yes ${OPTIONS};
   popd
49
fi
50

51 52 53 54 55 56 57 58 59 60

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


61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
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