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

Guilhem Saurel's avatar
Guilhem Saurel committed
3
4
# Exit on error
set -e
5
6
7
HOST_DIST=$(lsb_release -s -c)
case $HOST_DIST in
  xenial)
8
    APT_DEP="g++ cmake doxygen libboost-dev liburdfdom-dev \
9
10
11
12
13
      libassimp-dev ros-kinetic-xacro ros-kinetic-kdl-parser ros-kinetic-common-msgs \
      ros-kinetic-tf ros-kinetic-tf-conversions libccd-dev ros-kinetic-octomap \
      ros-kinetic-resource-retriever ros-kinetic-srdfdom ros-kinetic-pr2-description flex \
      bison asciidoc source-highlight git libomniorb4-dev omniorb-nameserver omniidl \
      omniidl-python libltdl-dev python-matplotlib libxml2 libtinyxml2-dev \
14
      liblog4cxx10-dev libltdl-dev qt4-dev-tools libqt4-opengl-dev libqtgui4 libqtwebkit-dev oxygen-icon-theme \
15
      libopenscenegraph-dev openscenegraph libpcre3-dev libcdd-dev"
16
17
18
    APT_BUILD_DEP=""
    CONFIG_FILE="ubuntu-16.04-kinetic.sh"
    ;;
19
  bionic)
20
21
22
23
24
25
26
27
28
29
30
31
    APT_DEP=
      "g++ cmake doxygen libboost-dev liburdfdom-dev libassimp-dev \
       libeigen3-dev libgraphviz-dev robotpkg-qpoases+doc \
       robotpkg-roboptim-core robotpkg-roboptim-trajectory
       robotpkg-romeo-description robotpkg-ros-baxter-common \
       robotpkg-ros-universal-robot robotpkg-py36-omniorbpy \
       ros-melodic-xacro libccd-dev ros-melodic-octomap \
       ros-melodic-resource-retriever ros-melodic-srdfdom \
       ros-melodic-pr2-description git libomniorb4-dev omniorb-nameserver \
       omniidl omniidl-python libltdl-dev python-matplotlib libxml2 \
       libtinyxml2-dev qt4-dev-tools libqt4-opengl-dev libqtgui4 \
       libqtwebkit-dev oxygen-icon-theme libopenscenegraph-dev \
32
       openscenegraph libpcre3-dev libcdd-dev wget"
33
34
35
    APT_BUILD_DEP=""
    CONFIG_FILE="ubuntu-18.04-melodic.sh"
    ;;
36
37
38
39
40
  *)
    echo "Unknow host distribution."
    exit 1
    ;;
esac
41

42
GITREPO="https://raw.githubusercontent.com/humanoid-path-planner/hpp-doc"
Joseph Mirabel's avatar
Joseph Mirabel committed
43
MAKE_TARBALL=false
Guilhem Saurel's avatar
Guilhem Saurel committed
44
TARGET=all
Joseph Mirabel's avatar
Joseph Mirabel committed
45

46
BRANCH=""
47
48
if [ -z ${DEVEL_HPP_DIR} ]; then
  export DEVEL_HPP_DIR=/local/devel/hpp
Joseph Mirabel's avatar
Joseph Mirabel committed
49
50
51
52
53
54
55
56
57
58
59
fi
if [ -z ${BUILD_TYPE} ]; then
  export BUILD_TYPE=Release
fi

while test $# -gt 0
do
  case $1 in
    --mktar)
      MAKE_TARBALL=true
      ;;
60
61
62
63
64
    --gitrepo)
      shift
      GITREPO=$1
      echo "Will download Makefile and config.sh from $GITREPO"
      ;;
Joseph Mirabel's avatar
Joseph Mirabel committed
65
66
67
68
69
70
71
    --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
72
73
74
75
76
    --target)
      shift
      TARGET=$1
      echo "Target set to $TARGET"
      ;;
77
78
79
80
81
    --branch)
      shift
      BRANCH=$1
      echo "Branch set to $BRANCH"
      ;;
Joseph Mirabel's avatar
Joseph Mirabel committed
82
83
    --help)
      echo "Options are"
84
      echo "--branch:         \tbranch which should be installed"
85
      echo "--gitrepo:        \trepository where to download makefile and config.sh"
Guilhem Saurel's avatar
Guilhem Saurel committed
86
87
88
89
      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
90
91
92
      exit 0
      ;;
    -v)
93
      for v in "DEVEL_HPP_DIR" "BUILD_TYPE" "MAKE_TARBALL" "BRANCH"
Joseph Mirabel's avatar
Joseph Mirabel committed
94
95
96
97
      do
        echo "$v=${!v}"
      done
      read -p "Continue (y/N)?" choice
98
      case "$choice" in
Joseph Mirabel's avatar
Joseph Mirabel committed
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
        y|Y )
          echo "yes"
          ;;
        * ) echo "no"
          exit 1
          ;;
      esac
      ;;
    *)
      echo "Option $1 not understood. Use --help"
      exit 1
      ;;
  esac
  shift
done

115
116
117
118
119
if [ -z "${BRANCH}" ]; then
  echo "A branch must be specified with argument --branch"
  exit 1
fi

Joseph Mirabel's avatar
Joseph Mirabel committed
120
# standard HPP installation
Guilhem Saurel's avatar
Guilhem Saurel committed
121
sudo apt-get update -qqy
Joseph Mirabel's avatar
Joseph Mirabel committed
122
sudo apt-get --assume-yes install ${APT_DEP}
Guilhem Saurel's avatar
Guilhem Saurel committed
123
[[ -z $APT_BUILD_DEP ]] || sudo apt-get --assume-yes build-dep ${APT_BUILD_DEP}
124

125
# Setup environment
126
127
128
mkdir --parents $DEVEL_HPP_DIR
mkdir --parents $DEVEL_HPP_DIR/src
mkdir --parents $DEVEL_HPP_DIR/install
129
130

# Get config script
131
132
wget -q -O $DEVEL_HPP_DIR/config.sh ${GITREPO}/${BRANCH}/doc/config/${CONFIG_FILE}
wget -q -O $DEVEL_HPP_DIR/src/Makefile ${GITREPO}/${BRANCH}/doc/Makefile
133

134
source $DEVEL_HPP_DIR/config.sh
135

136
cd $DEVEL_HPP_DIR/src
137

138
make -s -e iai_maps.install
139
source ../config.sh
Guilhem Saurel's avatar
make -s    
Guilhem Saurel committed
140
make -s -e $TARGET
Joseph Mirabel's avatar
Joseph Mirabel committed
141
142

if [ ${MAKE_TARBALL} = true ]; then
143
  cd $DEVEL_HPP_DIR/
Joseph Mirabel's avatar
Joseph Mirabel committed
144
145
  mkdir tarball
  SUFFIX="${BRANCH}-`date +%Y%m%d`-${BUILD_TYPE}"
146
147
  tar czf "tarball/hpp.src.${SUFFIX}.tar.gz" src/ install/ config.sh
  tar czf "tarball/hpp.${SUFFIX}.tar.gz" install/ config.sh
148
  INSTALL="$DEVEL_HPP_DIR/tarball/check.${SUFFIX}.sh"
Joseph Mirabel's avatar
Joseph Mirabel committed
149
150
151
152
153
154
155
156
  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