auto-install-hpp.sh 2.92 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
17
MAKE_TARBALL=false

18
BRANCH=devel
Joseph Mirabel's avatar
Joseph Mirabel committed
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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
      ;;
    --help)
      echo "Options are"
      echo "--mktar:   \tmake tar balls after compilation"
      echo "--show-dep:\tshow dependencies resolved by aptitude"
      echo "-v:        \tshow variables and ask for confirm (must be last arg)"
      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
70
sudo apt-get update -qqy
Joseph Mirabel's avatar
Joseph Mirabel committed
71
sudo apt-get --assume-yes install ${APT_DEP}
Guilhem Saurel's avatar
Guilhem Saurel committed
72
[[ -z $APT_BUILD_DEP ]] || sudo apt-get --assume-yes build-dep ${APT_BUILD_DEP}
73

74
75
76
77
78
79
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
wget -O $DEVEL_DIR/config.sh https://raw.githubusercontent.com/humanoid-path-planner/hpp-doc/${BRANCH}/doc/config.sh
wget -O $DEVEL_DIR/src/Makefile https://raw.githubusercontent.com/humanoid-path-planner/hpp-doc/${BRANCH}/doc/Makefile

source $DEVEL_DIR/config.sh

cd $DEVEL_DIR/src

Joseph Mirabel's avatar
Joseph Mirabel committed
87
make -e robot_state_chain_publisher.install
88
source ../config.sh
Guilhem Saurel's avatar
Guilhem Saurel committed
89
90
make -e doxygen-1.8.10.install
make -e all
Joseph Mirabel's avatar
Joseph Mirabel committed
91
92
93
94
95

if [ ${MAKE_TARBALL} = true ]; then
  cd $DEVEL_DIR/
  mkdir tarball
  SUFFIX="${BRANCH}-`date +%Y%m%d`-${BUILD_TYPE}"
96
97
  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
98
99
100
101
102
103
104
105
106
  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