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"
25 ## Locate cmake executable
26 cmake_locations=("/usr/bin" "/usr/local/bin" "${HOME}/local/bin")
29 for loc in ${cmake_locations[@]}; do
30 cmake_file="$loc/cmake"
31 if [ -x $cmake_file ]; then
32 str=`$cmake_file --version | grep version`
34 if [ "$cmake_ver" \< "$version" ]; then
36 cmake_exec=$cmake_file
40 if [ ! -x $cmake_exec ]; then
41 echo "$0: modify this script to put the correct location of cmake."
45 ## Locate qmake executable
46 qmake_locations=("/usr/bin" "/usr/local/bin" "${HOME}/local/bin")
48 for loc in ${qmake_locations[@]}; do
49 qmake_file="$loc/qmake"
50 if [ -x $qmake_file ]; then
51 str=`$qmake_file --version | grep Using\ Qt\ version`
52 version=`expr substr "$str" 18 3`
53 if [ "$version" == "4.8" ]; then
54 qmake_exec=$qmake_file
58 if [ ! -x $qmake_exec ]; then
59 echo "$0: modify this script to put the correct location of qmake."
63 ## Check input parameters and process inputs (if needed)
64 if [ "$#" -eq 1 ]; then
65 valid_extensions=("zip" "tar" "tar.gz" "tar.bz2")
67 for ext in ${valid_extensions[@]}; do
68 if [ `basename $1 $ext` != $1 ]; then
72 if [ "x$actual_ext" == "x" ]; then
73 echo "$0: Invalid file type."
76 canonical_path=`abspath $1`
77 source_dir=`dirname $canonical_path`/`basename $1 .$actual_ext`
78 build_dir=`dirname $canonical_path`/`basename $1 .$actual_ext`-build
79 echo -n "Cleaning directories... "
83 echo -n "Creating directories... "
87 echo -n "Extracting sources... "
88 if [ "$actual_ext" == "zip" ]; then
89 echo unzip $canonical_path
90 elif [ "$actual_ext" == "tar" ]; then
91 tar xf $canonical_path -C $source_dir --strip-components=1
92 elif [ "$actual_ext" == "tar.gz" ]; then
93 tar xzf $canonical_path -C $source_dir --strip-components=1
94 elif [ "$actual_ext" == "tar.bz2" ]; then
95 tar xjf $canonical_path -C $source_dir --strip-components=1
97 echo "$0: Invalid file type."
101 elif [ "$#" -eq 2 ]; then
102 source_dir=`dirname $1`
103 build_dir=`dirname $2`
105 echo "Usage: [vtk_package] or [vtk_source_dir vtk_build_dir]"
108 echo "Given source dir : \"$source_dir\""
109 echo "Given build dir : \"$build_dir\""
111 echo "Configuring sources... "
114 -DCMAKE_CXX_FLAGS:STRING=-std=c++11 \
115 -DBUILD_DOCUMENTATION:BOOL=OFF \
116 -DBUILD_EXAMPLES:BOOL=OFF \
117 -DBUILD_SHARED_LIBS:BOOL=ON \
118 -DBUILD_TESTING:BOOL=OFF \
119 -DQT_QMAKE_EXECUTABLE:PATH=$qmake_exec \
120 -DCMAKE_BUILD_TYPE:STRING=$comp_type \
121 -DModule_vtkGUISupportQt:BOOL=ON \
122 -DModule_vtkGUISupportQtOpenGL:BOOL=ON \
123 -DModule_vtkGUISupportQtSQL:BOOL=OFF \
124 -DModule_vtkGUISupportQtWebkit:BOOL=OFF \
125 -DCMAKE_INSTALL_PREFIX:PATH=${HOME}/local \
127 echo "Configuring sources... done."
129 echo "Compiling sources..."
131 make $number_of_processes
132 echo "Compiling sources... done."
134 echo "Installing package..."
137 echo "Installing package... done."