Skip to content

Instantly share code, notes, and snippets.

@pelrun
Created May 6, 2017 16:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pelrun/bdd3c09c22d25cfe4dae8e83f05f3aae to your computer and use it in GitHub Desktop.
Save pelrun/bdd3c09c22d25cfe4dae8e83f05f3aae to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "JeVois easy install 1.0 for Ubuntu 16.10 -- Welcome."
####################################################################################################
read -p "Install Ubuntu packages needed by JeVois [Y/n]? "
if [ "X$REPLY" != "Xn" ]; then
sudo apt-get update
packages=(
build-essential gcc-6 g++-6 guvcview subversion cmake emacs git mercurial doxygen-gui graphviz
libboost-all-dev libjpeg-turbo8-dev autoconf libeigen3-dev screen lsb lib32stdc++6
gcc-4.7-arm-linux-gnueabi gcc-6-arm-linux-gnueabihf g++-6-arm-linux-gnueabihf gawk u-boot-tools
libgtk2.0-dev pkg-config python-dev python-numpy libdc1394-22 libdc1394-22-dev libjpeg-dev
libpng-dev libtiff5-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libxine2-dev
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libv4l-dev libtbb-dev libqt4-dev libfaac-dev
libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev
libxvidcore-dev x264 v4l-utils unzip qt5-default python3-numpy
)
failed=""
for pack in "${packages[@]}"; do
sudo apt-get --assume-yes install $pack
if [ $? -ne 0 ]; then failed="$failed $pack"; fi
done
if [ "X$failed" != "X" ]; then
echo
echo
echo "### WARNING: Some packages failed to install #####"
echo
echo "Install failed for: $failed"
echo
echo
fi
sudo ln -s /usr/bin/arm-linux-gnueabi-gcc-4.7 /usr/bin/arm-linux-gnueabi-gcc
fi
####################################################################################################
read -p "Add JeVois environment variables to ~/.bashrc and create /jevois [Y/n]? "
if [ "X$REPLY" != "Xn" ]; then
echo "export JEVOIS_SRC_ROOT=${PWD}" >> ~/.bashrc
echo 'export JEVOIS_ROOT=/jevois' >> ~/.bashrc
sudo /bin/rm -rf /jevois
sudo mkdir /jevois
sudo chown ${USER}.${USER} /jevois
export JEVOIS_SRC_ROOT=${PWD}
export JEVOIS_ROOT=/jevois
fi
####################################################################################################
read -p "Compile and install OpenCV 3.2 to /usr/local [Y/n]? "
if [ "X$REPLY" != "Xn" ]; then
cd opencv32/opencv-3.2.0
sudo /bin/rm -rf build
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -DWITH_TBB=ON -DWITH_V4L=ON -DWITH_QT=ON -DWITH_OPENGL=OFF -DWITH_VTK=OFF -DWITH_CUDA=OFF -DBUILD_opencv_python2=OFF -DBUILD_opencv_python3=OFF -DWITH_PYTHON=OFF -DBUILD_EXAMPLES=ON -DINSTALL_C_EXAMPLES=OFF -DOPENCV_EXTRA_MODULES_PATH=${JEVOIS_SRC_ROOT}/opencv32/opencv_contrib-3.2.0/modules -DBUILD_opencv_hdf=OFF -DENABLE_PRECOMPILED_HEADERS=Off ..
np=`grep processor /proc/cpuinfo | wc -l`
if [ $np -lt 1 -o $np -gt 512 ]; then np=2; fi
make -j $np
sudo make install
cd ..
fi
####################################################################################################
read -p "Add /usr/local/lib to ldconfig [Y/n]? "
if [ "X$REPLY" != "Xn" ]; then
sudo sh -c 'echo /usr/local/lib > /etc/ld.so.conf.d/jevois'
sudo ldconfig
fi
####################################################################################################
read -p "Compile and install jevois and jevoisbase for host computer [Y/n]? "
if [ "X$REPLY" != "Xn" ]; then
cd ${JEVOIS_SRC_ROOT}/jevois
./rebuild-host.sh # compile jevois for host
cd hbuild
make doc # compile the documentation
cd ${JEVOIS_SRC_ROOT}/jevoisbase
./rebuild-host.sh # compile jevoisbase for host
sudo ldconfig # make sure the system knows where to find libjevois.so
fi
####################################################################################################
read -p "Cross-compile jevois and jevoisbase for embedded platform hardware [Y/n]? "
if [ "X$REPLY" != "Xn" ]; then
# avoid odd error about libisl.so.13 not found on vbox hosts:
export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:${JEVOIS_SRC_ROOT}/jevois-sdk/out/sun8iw5p1/linux/common/buildroot/host/usr/lib
cd ${JEVOIS_SRC_ROOT}/jevois
./rebuild-platform.sh # cross-compile jevois for embedded platform hardware
cd ${JEVOIS_SRC_ROOT}/jevoisbase
./rebuild-platform.sh # cross-compile jevoisbase for embedded platform hardware
sudo ldconfig # make sure the system knows where to find libjevoisbase.so
fi
echo "JeVois easy install 1.0 for Ubuntu 16.10 -- DONE."
echo "Plugin a USB camera and type: 'jevois-daemon' to try it out."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment