auto-install-hpp.sh 3.08 KB
Newer Older
1
2
#!/bin/bash

Guilhem Saurel's avatar
Guilhem Saurel committed
3
4
5
# Exit on error
set -e

6
7
8
APT_DEP="autoconf g++ cmake libboost-dev liburdfdom-dev libassimp-dev \
ros-indigo-xacro ros-indigo-kdl-parser ros-indigo-common-msgs \
ros-indigo-tf ros-indigo-tf-conversions ros-indigo-libccd ros-indigo-octomap \
9
ros-indigo-resource-retriever ros-indigo-srdfdom ros-indigo-pr2-description flex \
10
11
12
13
14
bison asciidoc source-highlight git libomniorb4-dev omniorb-nameserver \
omniidl omniidl-python libltdl-dev python-matplotlib libtinyxml2-dev \
liblog4cxx10-dev libltdl-dev qt4-dev-tools libqt4-opengl-dev \
libqtgui4 oxygen-icon-theme libopenscenegraph-dev"
APT_BUILD_DEP=""
15

Joseph Mirabel's avatar
Joseph Mirabel committed
16
MAKE_TARBALL=false
Guilhem Saurel's avatar
Guilhem Saurel committed
17
TARGET=all
Joseph Mirabel's avatar
Joseph Mirabel committed
18

19
BRANCH=devel
Joseph Mirabel's avatar
Joseph Mirabel committed
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
if [ -z ${DEVEL_DIR} ]; then
  export DEVEL_DIR=/local/devel/hpp
fi
if [ -z ${BUILD_TYPE} ]; then
  export BUILD_TYPE=Release
fi

while test $# -gt 0
do
  case $1 in
    --mktar)
      MAKE_TARBALL=true
      ;;
    --show-dep)
      echo "Will install"
      echo "${APT_DEP}"
      echo "\nWill install build dependencies of"
      echo "${APT_BUILD_DEP}"
      exit 0
      ;;
Guilhem Saurel's avatar
Guilhem Saurel committed
40
41
42
43
44
    --target)
      shift
      TARGET=$1
      echo "Target set to $TARGET"
      ;;
Joseph Mirabel's avatar
Joseph Mirabel committed
45
46
    --help)
      echo "Options are"
Guilhem Saurel's avatar
Guilhem Saurel committed
47
48
49
50
      echo "--mktar:          \tmake tar balls after compilation"
      echo "--show-dep:       \tshow dependencies resolved by aptitude"
      echo "--target TARGET:  \tinstall TARGET (default: all)"
      echo "-v:               \tshow variables and ask for confirm (must be last arg)"
Joseph Mirabel's avatar
Joseph Mirabel committed
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
      exit 0
      ;;
    -v)
      for v in "DEVEL_DIR" "BUILD_TYPE" "MAKE_TARBALL"
      do
        echo "$v=${!v}"
      done
      read -p "Continue (y/N)?" choice
      case "$choice" in 
        y|Y )
          echo "yes"
          ;;
        * ) echo "no"
          exit 1
          ;;
      esac
      ;;
    *)
      echo "Option $1 not understood. Use --help"
      exit 1
      ;;
  esac
  shift
done

# standard HPP installation
Guilhem Saurel's avatar
Guilhem Saurel committed
77
sudo apt-get update -qqy
Joseph Mirabel's avatar
Joseph Mirabel committed
78
sudo apt-get --assume-yes install ${APT_DEP}
Guilhem Saurel's avatar
Guilhem Saurel committed
79
[[ -z $APT_BUILD_DEP ]] || sudo apt-get --assume-yes build-dep ${APT_BUILD_DEP}
80

81
82
83
84
85
86
# Setup environment
mkdir --parents $DEVEL_DIR
mkdir --parents $DEVEL_DIR/src
mkdir --parents $DEVEL_DIR/install

# Get config script
Guilhem Saurel's avatar
Guilhem Saurel committed
87
88
wget -q -O $DEVEL_DIR/config.sh https://raw.githubusercontent.com/humanoid-path-planner/hpp-doc/${BRANCH}/doc/config.sh
wget -q -O $DEVEL_DIR/src/Makefile https://raw.githubusercontent.com/humanoid-path-planner/hpp-doc/${BRANCH}/doc/Makefile
89
90
91
92
93

source $DEVEL_DIR/config.sh

cd $DEVEL_DIR/src

Joseph Mirabel's avatar
Joseph Mirabel committed
94
make -e robot_state_chain_publisher.install
95
source ../config.sh
Guilhem Saurel's avatar
Guilhem Saurel committed
96
make -e $TARGET
Joseph Mirabel's avatar
Joseph Mirabel committed
97
98
99
100
101

if [ ${MAKE_TARBALL} = true ]; then
  cd $DEVEL_DIR/
  mkdir tarball
  SUFFIX="${BRANCH}-`date +%Y%m%d`-${BUILD_TYPE}"
102
103
  tar czf "tarball/hpp.src.${SUFFIX}.tar.gz" src/ install/ config.sh
  tar czf "tarball/hpp.${SUFFIX}.tar.gz" install/ config.sh
Joseph Mirabel's avatar
Joseph Mirabel committed
104
105
106
107
108
109
110
111
112
  INSTALL="$DEVEL_DIR/tarball/check.${SUFFIX}.sh"
  echo "#!/bin/bash" > ${INSTALL}
  echo "# Dependencies" >> ${INSTALL}
  echo "sudo apt-get install $APT_DEP" >> ${INSTALL}
  echo "sudo apt-get build-dep $APT_BUILD_DEP" >> ${INSTALL}
  echo "" >> ${INSTALL}
  echo "# config.sh" >> ${INSTALL}
  echo "echo \"Configure using 'config.sh' file\"" >> ${INSTALL}
fi