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 ## Check input parameters and process inputs (if needed)
46 if [ "$#" -eq 1 ]; then
47 valid_extensions=("zip" "tar" "tar.gz" "tar.bz2")
49 for ext in ${valid_extensions[@]}; do
50 if [ `basename $1 $ext` != $1 ]; then
54 if [ "x$actual_ext" == "x" ]; then
55 echo "$0: Invalid file type."
58 canonical_path=`abspath $1`
59 source_dir=`dirname $canonical_path`/`basename $1 .$actual_ext`
60 build_dir=`dirname $canonical_path`/`basename $1 .$actual_ext`-build
61 echo -n "Cleaning directories... "
65 echo -n "Creating directories... "
69 echo -n "Extracting sources... "
70 if [ "$actual_ext" == "zip" ]; then
71 echo unzip $canonical_path
72 elif [ "$actual_ext" == "tar" ]; then
73 tar xf $canonical_path -C $source_dir --strip-components=1
74 elif [ "$actual_ext" == "tar.gz" ]; then
75 tar xzf $canonical_path -C $source_dir --strip-components=1
76 elif [ "$actual_ext" == "tar.bz2" ]; then
77 tar xjf $canonical_path -C $source_dir --strip-components=1
79 echo "$0: Invalid file type."
83 elif [ "$#" -eq 2 ]; then
84 source_dir=`dirname $1`
85 build_dir=`dirname $2`
87 echo "Usage: [itk_package] or [itk_source_dir itk_build_dir]"
90 echo "Given source dir : \"$source_dir\""
91 echo "Given build dir : \"$build_dir\""
93 echo "Configuring sources... "
96 -DCMAKE_CXX_FLAGS:STRING=-std=c++11 \
97 -DBUILD_DOCUMENTATION:BOOL=OFF \
98 -DBUILD_EXAMPLES:BOOL=OFF \
99 -DBUILD_SHARED_LIBS:BOOL=ON \
100 -DBUILD_TESTING:BOOL=OFF \
101 -DCMAKE_BUILD_TYPE:STRING=$comp_type \
102 -DModule_ITKReview:BOOL=ON \
103 -DModule_ITKVtkGlue:BOOL=OFF \
104 -DCMAKE_INSTALL_PREFIX:PATH=${HOME}/local \
106 echo "Configuring sources... done."
108 echo "Compiling sources..."
110 make $number_of_processes
111 echo "Compiling sources... done."
113 echo "Installing package..."
116 echo "Installing package... done."