auto-install-hpp.sh 5.26 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
    APT_DEP="g++ cmake doxygen libboost-dev liburdfdom-dev libassimp-dev \
21
       libeigen3-dev libgraphviz-dev robotpkg-omniorb robotpkg-qpoases+doc \
22
       robotpkg-roboptim-core robotpkg-roboptim-trajectory
23
       robotpkg-romeo-description robotpkg-py36-omniorbpy \
24
25
26
       ros-melodic-xacro libccd-dev ros-melodic-octomap \
       ros-melodic-resource-retriever ros-melodic-srdfdom \
       ros-melodic-pr2-description git libomniorb4-dev omniorb-nameserver \
27
       libltdl-dev python-matplotlib python-omniorb \
28
       libxml2 robotpkg-openscenegraph robotpkg-qt5-osgqt \
29
       libtinyxml2-dev qt4-dev-tools libqt4-opengl-dev libqtgui4 \
30
31
       libqtwebkit-dev oxygen-icon-theme \
       libpcre3-dev libcdd-dev wget"
32
33
34
    APT_BUILD_DEP=""
    CONFIG_FILE="ubuntu-18.04-melodic.sh"
    ;;
35
36
37
38
39
40
  focal)
  APT_DEP="g++ cmake doxygen libboost-dev liburdfdom-dev libassimp-dev \
      libeigen3-dev libgraphviz-dev graphviz robotpkg-omniorb \
      robotpkg-qpoases+doc robotpkg-romeo-description robotpkg-py38-omniorbpy \
      ros-noetic-xacro libccd-dev ros-noetic-octomap \
      ros-noetic-resource-retriever ros-noetic-srdfdom \
Guilhem Saurel's avatar
Guilhem Saurel committed
41
      ros-noetic-pr2-description git libltdl-dev \
42
43
      python3-matplotlib qtbase5-private-dev qtdeclarative5-dev \
      qtmultimedia5-dev libqt5svg5-dev libxml2 libtinyxml2-dev robotpkg-qt5-osgqt \
44
45
46
47
      oxygen-icon-theme robotpkg-openscenegraph libpcre3-dev wget libcdd-dev"
    APT_BUILD_DEP=""
    CONFIG_FILE="ubuntu-20.04-noetic.sh"
    ;;
48
49
50
51
52
  *)
    echo "Unknow host distribution."
    exit 1
    ;;
esac
53

54
GITREPO="https://raw.githubusercontent.com/humanoid-path-planner/hpp-doc"
Joseph Mirabel's avatar
Joseph Mirabel committed
55
MAKE_TARBALL=false
Guilhem Saurel's avatar
Guilhem Saurel committed
56
TARGET=all
Joseph Mirabel's avatar
Joseph Mirabel committed
57

58
BRANCH=""
59
60
if [ -z ${DEVEL_HPP_DIR} ]; then
  export DEVEL_HPP_DIR=/local/devel/hpp
Joseph Mirabel's avatar
Joseph Mirabel committed
61
62
63
64
65
66
67
68
69
70
71
fi
if [ -z ${BUILD_TYPE} ]; then
  export BUILD_TYPE=Release
fi

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

127
128
129
130
131
if [ -z "${BRANCH}" ]; then
  echo "A branch must be specified with argument --branch"
  exit 1
fi

Joseph Mirabel's avatar
Joseph Mirabel committed
132
# standard HPP installation
Guilhem Saurel's avatar
Guilhem Saurel committed
133
sudo apt-get update -qqy
Joseph Mirabel's avatar
Joseph Mirabel committed
134
sudo apt-get --assume-yes install ${APT_DEP}
Guilhem Saurel's avatar
Guilhem Saurel committed
135
[[ -z $APT_BUILD_DEP ]] || sudo apt-get --assume-yes build-dep ${APT_BUILD_DEP}
136

137
# Setup environment
138
139
140
mkdir --parents $DEVEL_HPP_DIR
mkdir --parents $DEVEL_HPP_DIR/src
mkdir --parents $DEVEL_HPP_DIR/install
141
142

# Get config script
143
wget -q -O $DEVEL_HPP_DIR/config.sh ${GITREPO}/${BRANCH}/doc/config/${CONFIG_FILE}
Guilhem Saurel's avatar
Guilhem Saurel committed
144
wget -q -O $DEVEL_HPP_DIR/src/Makefile ${GITREPO}/${BRANCH}/makefiles/${BRANCH}.mk
145

146
source $DEVEL_HPP_DIR/config.sh
147

148
cd $DEVEL_HPP_DIR/src
149
150

source ../config.sh
Guilhem Saurel's avatar
make -s    
Guilhem Saurel committed
151
make -s -e $TARGET
Joseph Mirabel's avatar
Joseph Mirabel committed
152
153

if [ ${MAKE_TARBALL} = true ]; then
154
  cd $DEVEL_HPP_DIR/
Joseph Mirabel's avatar
Joseph Mirabel committed
155
156
  mkdir tarball
  SUFFIX="${BRANCH}-`date +%Y%m%d`-${BUILD_TYPE}"
157
158
  tar czf "tarball/hpp.src.${SUFFIX}.tar.gz" src/ install/ config.sh
  tar czf "tarball/hpp.${SUFFIX}.tar.gz" install/ config.sh
159
  INSTALL="$DEVEL_HPP_DIR/tarball/check.${SUFFIX}.sh"
Joseph Mirabel's avatar
Joseph Mirabel committed
160
161
162
163
164
165
166
167
  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