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

Guilhem Saurel's avatar
Guilhem Saurel committed
3
4
# Exit on error
set -e
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
HOST_DIST=$(lsb_release -s -c)
case $HOST_DIST in
  trusty)
    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 \
      ros-indigo-resource-retriever ros-indigo-srdfdom ros-indigo-pr2-description flex \
      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=""
    CONFIG_FILE="ubuntu-14.04-indigo.sh"
    ;;
  xenial)
    APT_DEP="autoconf g++ cmake doxygen libboost-dev liburdfdom-dev \
      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 \
      liblog4cxx10-dev libltdl-dev qt4-dev-tools libqt4-opengl-dev libqtgui4 oxygen-icon-theme \
      libopenscenegraph-dev openscenegraph libpcre3-dev"
    APT_BUILD_DEP=""
    CONFIG_FILE="ubuntu-16.04-kinetic.sh"
    ;;
  *)
    echo "Unknow host distribution."
    exit 1
    ;;
esac
36

Joseph Mirabel's avatar
Joseph Mirabel committed
37
MAKE_TARBALL=false
Guilhem Saurel's avatar
Guilhem Saurel committed
38
TARGET=all
Joseph Mirabel's avatar
Joseph Mirabel committed
39

40
BRANCH=devel
Joseph Mirabel's avatar
Joseph Mirabel committed
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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
61
62
63
64
65
    --target)
      shift
      TARGET=$1
      echo "Target set to $TARGET"
      ;;
Joseph Mirabel's avatar
Joseph Mirabel committed
66
67
    --help)
      echo "Options are"
Guilhem Saurel's avatar
Guilhem Saurel committed
68
69
70
71
      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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
      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
98
sudo apt-get update -qqy
Joseph Mirabel's avatar
Joseph Mirabel committed
99
sudo apt-get --assume-yes install ${APT_DEP}
Guilhem Saurel's avatar
Guilhem Saurel committed
100
[[ -z $APT_BUILD_DEP ]] || sudo apt-get --assume-yes build-dep ${APT_BUILD_DEP}
101

102
103
104
105
106
107
# Setup environment
mkdir --parents $DEVEL_DIR
mkdir --parents $DEVEL_DIR/src
mkdir --parents $DEVEL_DIR/install

# Get config script
108
wget -q -O $DEVEL_DIR/config.sh https://raw.githubusercontent.com/humanoid-path-planner/hpp-doc/${BRANCH}/doc/config/${CONFIG_FILE}
Guilhem Saurel's avatar
Guilhem Saurel committed
109
wget -q -O $DEVEL_DIR/src/Makefile https://raw.githubusercontent.com/humanoid-path-planner/hpp-doc/${BRANCH}/doc/Makefile
110
111
112
113
114

source $DEVEL_DIR/config.sh

cd $DEVEL_DIR/src

Guilhem Saurel's avatar
make -s    
Guilhem Saurel committed
115
make -s -e robot_state_chain_publisher.install
116
source ../config.sh
Guilhem Saurel's avatar
make -s    
Guilhem Saurel committed
117
make -s -e $TARGET
Joseph Mirabel's avatar
Joseph Mirabel committed
118
119
120
121
122

if [ ${MAKE_TARBALL} = true ]; then
  cd $DEVEL_DIR/
  mkdir tarball
  SUFFIX="${BRANCH}-`date +%Y%m%d`-${BUILD_TYPE}"
123
124
  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
125
126
127
128
129
130
131
132
133
  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