12 if [ "$cur_dir" == "/" ]; then
13 echo "$cur_dir`basename \"$1\"`"
15 echo "$cur_dir/`basename \"$1\"`"
21 ## Some configuration variables
22 number_of_processes="-j4"
24 ## Locate cmake executable
25 cmake_locations=("/usr/bin" "/usr/local/bin" "${HOME}/local/bin")
28 for loc in ${cmake_locations[@]}; do
29 cmake_file="$loc/cmake"
30 if [ -x $cmake_file ]; then
31 str=`$cmake_file --version | grep version`
33 if [ "$cmake_ver" \< "$version" ]; then
35 cmake_exec=$cmake_file
39 if [ ! -x $cmake_exec ]; then
40 echo "$0: modify this script to put the correct location of cmake."
44 # Locate qmake executable
45 qmake_locations=("/usr/bin" "/usr/local/bin" "${HOME}/local/bin")
47 for loc in ${qmake_locations[@]}; do
48 qmake_file="$loc/qmake"
49 if [ -x $qmake_file ]; then
50 version=`$qmake_file --version | grep Using\ Qt\ version | cut -d ' ' -f 4`
51 if [ "${version:0:3}" == "4.8" ]; then
52 qmake_exec=$qmake_file
57 if [ ! -x $qmake_exec ]; then
58 echo "$0: modify this script to put the correct location of qmake."
62 ## Check input parameters and process inputs (if needed)
63 if [ "$#" -eq 2 ]; then
64 valid_extensions=("zip" "tar" "tar.gz" "tar.bz2")
66 for ext in ${valid_extensions[@]}; do
67 if [ `basename $1 $ext` != $1 ]; then
71 if [ "x$actual_ext" == "x" ]; then
72 echo "$0: Invalid file type."
75 canonical_path=`abspath $1`
76 source_dir=`dirname $canonical_path`/`basename $1 .$actual_ext`
77 build_dir=`dirname $canonical_path`/`basename $1 .$actual_ext`-build
78 echo -n "Cleaning directories... "
82 echo -n "Creating directories... "
86 echo -n "Extracting sources... "
87 if [ "$actual_ext" == "zip" ]; then
88 echo unzip $canonical_path
89 elif [ "$actual_ext" == "tar" ]; then
90 tar xf $canonical_path -C $source_dir --strip-components=1
91 elif [ "$actual_ext" == "tar.gz" ]; then
92 tar xzf $canonical_path -C $source_dir --strip-components=1
93 elif [ "$actual_ext" == "tar.bz2" ]; then
94 tar xjf $canonical_path -C $source_dir --strip-components=1
96 echo "$0: Invalid file type."
101 elif [ "$#" -eq 3 ]; then
102 source_dir=`dirname $1`
103 build_dir=`dirname $2`
106 echo "Usage: [vtk_package] or [vtk_source_dir vtk_build_dir] [build_type]"
109 echo "Given source dir : \"$source_dir\""
110 echo "Given build dir : \"$build_dir\""
112 echo "Configuring sources... "
115 -DCMAKE_CXX_FLAGS:STRING=-std=c++11 \
116 -DBUILD_DOCUMENTATION:BOOL=OFF \
117 -DBUILD_EXAMPLES:BOOL=OFF \
118 -DBUILD_SHARED_LIBS:BOOL=ON \
119 -DBUILD_TESTING:BOOL=OFF \
120 -DQT_QMAKE_EXECUTABLE:PATH=$qmake_exec \
121 -DCMAKE_BUILD_TYPE:STRING=$build_type \
122 -DModule_vtkGUISupportQt:BOOL=ON \
123 -DModule_vtkGUISupportQtOpenGL:BOOL=ON \
124 -DModule_vtkGUISupportQtSQL:BOOL=OFF \
125 -DModule_vtkGUISupportQtWebkit:BOOL=OFF \
126 -DCMAKE_INSTALL_PREFIX:PATH=${HOME}/local \
128 echo "Configuring sources... done."
130 echo "Compiling sources..."
132 make $number_of_processes
133 echo "Compiling sources... done."
135 echo "Installing package..."
138 echo "Installing package... done."