exit 1
fi
-ccmake=`find $prefix -type f -name "ccmake"`
-qt5config=`find $prefix -type f -name "Qt5Config.cmake"`
-use_vtk=`find $prefix -type f -name "UseVTK.cmake"`
-use_itk=`find $prefix -type f -name "UseITK.cmake"`
-cmake=`dirname $ccmake`/cmake
+# ccmake=`find $prefix -type f -name "ccmake"`
+# qt5config=`find $prefix -type f -name "Qt5Config.cmake"`
+# use_vtk=`find $prefix -type f -name "UseVTK.cmake"`
+# use_itk=`find $prefix -type f -name "UseITK.cmake"`
+# cmake=`dirname $ccmake`/cmake
-## -- Current dir
-curr_dir=`pwd`
-cd ..
+# ## -- Current dir
+# curr_dir=`pwd`
+# cd ..
-## -- Configure, build and install Qt5
-mkdir -p build
-cd build
-$cmake \
- -DCMAKE_BUILD_TYPE:STRING=$build_type \
- -DCMAKE_INSTALL_PREFIX:PATH=$prefix \
- -DcpPlugins_BUILD:BOOL=ON \
- -DcpPlugins_BUILD_APPLICATIONS:BOOL=ON \
- -DcpPlugins_BUILD_ivq:BOOL=ON \
- -DcpPlugins_BUILD_tclap:BOOL=ON \
- -DITK_DIR:PATH=`dirname $use_itk` \
- -DVTK_DIR:PATH=`dirname $use_vtk` \
- -DQt5_DIR:PATH=`dirname $qt5config` \
- ..
-make -s -j$cores -k
-make -s -j -k install
+# ## -- Configure, build and install Qt5
+# mkdir -p build
+# cd build
+# $cmake \
+# -DCMAKE_BUILD_TYPE:STRING=$build_type \
+# -DCMAKE_INSTALL_PREFIX:PATH=$prefix \
+# -DcpPlugins_BUILD:BOOL=ON \
+# -DcpPlugins_BUILD_APPLICATIONS:BOOL=ON \
+# -DcpPlugins_BUILD_ivq:BOOL=ON \
+# -DcpPlugins_BUILD_tclap:BOOL=ON \
+# -DITK_DIR:PATH=`dirname $use_itk` \
+# -DVTK_DIR:PATH=`dirname $use_vtk` \
+# -DQt5_DIR:PATH=`dirname $qt5config` \
+# ..
+# make -s -j$cores -k
+# make -s -j -k install
-## -- End
-cd $curr_dir
+# ## -- End
+# cd $curr_dir
## eof - $RCSfile$
#!/bin/bash
+## -- Configuration
+boost_version="1.65.1"
qt5_version="5.9.2"
cmake_version="3.9.5"
vtk_version="8.0.1"
itk_version="4.12.2"
+## -- Abortion code
+abort( )
+{
+ echo >&2 '
+***************
+*** ABORTED ***
+***************
+'
+ echo "An error occurred. Exiting..." >&2
+ exit 1
+}
+trap 'abort' 0
+trap 'abort' 2
+set -e
+
+## -- Download function
+download( )
+{
+ file=$1
+ url=$2
+ sum=`dirname $file`/sum.txt
+ mkdir -p `dirname $file`
+ if [ ! -f $sum ] ; then
+ echo >&2 "*** Receiving $url ***"
+ curl -L -o $file $url
+ if [ -n "$sum_cmd" ] && [ -f $file ] ; then
+ $sum_cmd $file > $sum
+ fi
+ fi
+}
+
+## -- Decompress function
+decompress( )
+{
+ file=$1
+ if [ -f $file ] ; then
+ echo >&2 "*** Decompressing $file ***"
+ mkdir -p `dirname $file`/src
+ mkdir -p `dirname $file`/bin
+ tar xf $file -C `dirname $file`/src --strip-components=1
+ fi
+}
+
+## -- Check platform
platform=`uname`
qt5extras_id="x11"
if [[ "$platform" == 'Darwin' ]]; then
qt5extras_id="mac"
fi
+## -- Get best checksum command
+sum_cmd=`command -v sha512sum`
+if [ -z "$sum_cmd" ] ; then
+ sum_cmd=`command -v sha384sum`
+fi
+if [ -z "$sum_cmd" ] ; then
+ sum_cmd=`command -v sha256sum`
+fi
+if [ -z "$sum_cmd" ] ; then
+ sum_cmd=`command -v sha224sum`
+fi
+if [ -z "$sum_cmd" ] ; then
+ sum_cmd=`command -v sha1sum`
+fi
+if [ -z "$sum_cmd" ] ; then
+ sum_cmd=`command -v md5sum`
+fi
+
+## -- Download information
+boost_url="https://downloads.sourceforge.net/project/boost/boost/$boost_version/boost_`echo $boost_version | sed 's/\./\_/g'`.tar.bz2"
qt5_short_version=`echo $qt5_version | sed 's/\.[^.]*$//'`
qt5_url="https://download.qt.io/official_releases/qt/$qt5_short_version/$qt5_version/submodules/qtbase-opensource-src-$qt5_version.tar.xz"
qt5extras_url="https://download.qt.io/official_releases/qt/$qt5_short_version/$qt5_version/submodules/qt${qt5extras_id}extras-opensource-src-$qt5_version.tar.xz"
fi
curr_dir=`pwd`
-## -- Create build directory
-mkdir -p $build_dir/qt5/src
-mkdir -p $build_dir/qt5extras/src
-mkdir -p $build_dir/qt5tools/src
-mkdir -p $build_dir/cmake/src
-mkdir -p $build_dir/vtk/src
-mkdir -p $build_dir/itk/src
-mkdir -p $build_dir/qt5/bin
-mkdir -p $build_dir/qt5extras/bin
-mkdir -p $build_dir/qt5tools/bin
-mkdir -p $build_dir/cmake/bin
-mkdir -p $build_dir/vtk/bin
-mkdir -p $build_dir/itk/bin
-if [[ "$platform" == 'Linux' ]]; then
- wget -O $build_dir/qt5/qt5.tar.xz $qt5_url
- wget -O $build_dir/qt5extras/qt5extras.tar.xz $qt5extras_url
- wget -O $build_dir/qt5tools/qt5tools.tar.xz $qt5tools_url
- wget -O $build_dir/cmake/cmake.tar.gz $cmake_url
- wget -O $build_dir/vtk/vtk.tar.gz $vtk_url
- wget -O $build_dir/itk/itk.tar.xz $itk_url
-elif [[ "$platform" == 'Darwin' ]]; then
- curl -o $build_dir/qt5/qt5.tar.xz $qt5_url
- curl -o $build_dir/qt5extras/qt5extras.tar.xz $qt5extras_url
- curl -o $build_dir/qt5tools/qt5tools.tar.xz $qt5tools_url
- curl -o $build_dir/cmake/cmake.tar.gz $cmake_url
- curl -o $build_dir/vtk/vtk.tar.gz $vtk_url
- curl -o $build_dir/itk/itk.tar.xz $itk_url
-fi
-tar xvf $build_dir/qt5/qt5.tar.xz -C $build_dir/qt5/src --strip-components=1
-tar xvf $build_dir/qt5extras/qt5extras.tar.xz -C $build_dir/qt5extras/src --strip-components=1
-tar xvf $build_dir/qt5tools/qt5tools.tar.xz -C $build_dir/qt5tools/src --strip-components=1
-tar xvf $build_dir/cmake/cmake.tar.gz -C $build_dir/cmake/src --strip-components=1
-tar xvf $build_dir/vtk/vtk.tar.gz -C $build_dir/vtk/src --strip-components=1
-tar xvf $build_dir/itk/itk.tar.xz -C $build_dir/itk/src --strip-components=1
+## -- Download files
+download $build_dir/boost/boost.tar.bz2 $boost_url
+download $build_dir/qt5/qt5.tar.xz $qt5_url
+download $build_dir/qt5extras/qt5extras.tar.xz $qt5extras_url
+download $build_dir/qt5tools/qt5tools.tar.xz $qt5tools_url
+download $build_dir/cmake/cmake.tar.gz $cmake_url
+download $build_dir/vtk/vtk.tar.gz $vtk_url
+download $build_dir/itk/itk.tar.xz $itk_url
+
+## -- Decompress files
+decompress $build_dir/boost/boost.tar.bz2
+decompress $build_dir/qt5/qt5.tar.xz
+decompress $build_dir/qt5extras/qt5extras.tar.xz
+decompress $build_dir/qt5tools/qt5tools.tar.xz
+decompress $build_dir/cmake/cmake.tar.gz
+decompress $build_dir/vtk/vtk.tar.gz
+decompress $build_dir/itk/itk.tar.xz
+
+## -- Configure, build and install boost
+cd $build_dir/boost/src
+./bootstrap.sh
+./b2 -a -q -j $cores \
+ link=shared \
+ cxxflags="-std=c++11" \
+ --prefix=$prefix \
+ install
## -- Configure, build and install Qt5
cd $build_dir/qt5/bin
-c++std c++11 -opengl desktop \
-nomake examples -nomake tests -no-harfbuzz \
-qt-xcb -qt-xkbcommon -qt-pcre
-make -s -j$cores -k
-make -s -j -k install
+make -j$cores -k
+make -j -k install
## -- Configure, build and install Qt5Extras
cd $build_dir/qt5extras/bin
$prefix/bin/qmake $build_dir/qt5extras/src
-make -s -j$cores -k
-make -s -j -k install
+make -j$cores -k
+make -j -k install
## -- Configure, build and install Qt5Tools
cd $build_dir/qt5tools/bin
$prefix/bin/qmake $build_dir/qt5tools/src
-make -s -j$cores -k
-make -s -j -k install
+make -j$cores -k
+make -j -k install
## -- Configure, build and install CMake
cd $build_dir/cmake/bin
-$build_dir/cmake/src/bootstrap \
- --parallel=$cores --prefix=$prefix --no-qt-gui
-make -s -j$cores -k
-make -s -j -k install
+$build_dir/cmake/src/bootstrap --parallel=$cores --prefix=$prefix --no-qt-gui
+make -j$cores -k
+make -j -k install
## -- Configure, build and install VTK
cd $build_dir/vtk/bin
-DVTK_Group_Qt:BOOL=ON \
-DCMAKE_MACOSX_RPATH:BOOL=ON \
$build_dir/vtk/src
-make -s -j$cores -k
+make -j$cores -k
use_vtk=`make -j -k -s install | grep UseVTK | sed 's/.*: //'`
## -- Configure, build and install VTK
-DModule_ITKVtkGlue:BOOL=ON \
-DCMAKE_MACOSX_RPATH:BOOL=ON \
$build_dir/itk/src
-make -s -j$cores -k
-make -s -j -k install
+make -j$cores -k
+make -j -k install
## -- End
cd $curr_dir
+trap : 0
+trap : 2
+echo >&2 '
+************
+*** DONE ***
+************
+'
+
## eof - $RCSfile$