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 qmake executable
25 qmake_locations=("/usr/bin" "/usr/local/bin" "${HOME}/local/bin")
27 for loc in ${qmake_locations[@]}; do
28 qmake_file="$loc/qmake"
29 if [ -x $qmake_file ]; then
30 version=`$qmake_file --version | grep Using\ Qt\ version | cut -d ' ' -f 4`
31 if [ "${version:0:3}" == "4.8" ]; then
32 qmake_exec=$qmake_file
37 if [ -x $qmake_exec ]; then
38 qt_options="--qt-gui --qt-qmake=$qmake_exec"
40 qt_options="--no-qt-gui"
43 ## Check input parameters and process inputs (if needed)
44 if [ "$#" -eq 1 ]; then
45 valid_extensions=("zip" "tar" "tar.gz" "tar.bz2")
47 for ext in ${valid_extensions[@]}; do
48 if [ `basename $1 $ext` != $1 ]; then
52 if [ "x$actual_ext" == "x" ]; then
53 echo "$0: Invalid file type."
56 canonical_path=`abspath $1`
57 source_dir=`dirname $canonical_path`/`basename $1 .$actual_ext`
58 build_dir=`dirname $canonical_path`/`basename $1 .$actual_ext`-build
59 echo -n "Cleaning directories... "
63 echo -n "Creating directories... "
67 echo -n "Extracting sources... "
68 if [ "$actual_ext" == "zip" ]; then
69 echo unzip $canonical_path
70 elif [ "$actual_ext" == "tar" ]; then
71 tar xf $canonical_path -C $source_dir --strip-components=1
72 elif [ "$actual_ext" == "tar.gz" ]; then
73 tar xzf $canonical_path -C $source_dir --strip-components=1
74 elif [ "$actual_ext" == "tar.bz2" ]; then
75 tar xjf $canonical_path -C $source_dir --strip-components=1
77 echo "$0: Invalid file type."
81 elif [ "$#" -eq 2 ]; then
82 source_dir=`dirname $1`
83 build_dir=`dirname $2`
85 echo "Usage: [cmake_package] or [cmake_source_dir cmake_build_dir]"
88 echo "Given source dir : \"$source_dir\""
89 echo "Given build dir : \"$build_dir\""
91 echo "Configuring sources... "
93 $source_dir/bootstrap --prefix=${HOME}/local $qt_options
94 echo "Configuring sources... done."
96 echo "Compiling sources..."
98 make $number_of_processes
99 echo "Compiling sources... done."
101 echo "Installing package..."
104 echo "Installing package... done."