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 ## Check input parameters and process inputs (if needed)
25 if [ "$#" -eq 1 ]; then
26 valid_extensions=("zip" "tar" "tar.gz" "tar.bz2")
28 for ext in ${valid_extensions[@]}; do
29 if [ `basename $1 $ext` != $1 ]; then
33 if [ "x$actual_ext" == "x" ]; then
34 echo "$0: Invalid file type."
37 canonical_path=`abspath $1`
38 source_dir=`dirname $canonical_path`/`basename $1 .$actual_ext`
39 build_dir=`dirname $canonical_path`/`basename $1 .$actual_ext`-build
40 echo -n "Cleaning directories... "
44 echo -n "Creating directories... "
48 echo -n "Extracting sources... "
49 if [ "$actual_ext" == "zip" ]; then
50 echo unzip $canonical_path
51 elif [ "$actual_ext" == "tar" ]; then
52 tar xf $canonical_path -C $source_dir --strip-components=1
53 elif [ "$actual_ext" == "tar.gz" ]; then
54 tar xzf $canonical_path -C $source_dir --strip-components=1
55 elif [ "$actual_ext" == "tar.bz2" ]; then
56 tar xjf $canonical_path -C $source_dir --strip-components=1
58 echo "$0: Invalid file type."
62 elif [ "$#" -eq 2 ]; then
63 source_dir=`dirname $1`
64 build_dir=`dirname $2`
66 echo "Usage: [cmake_package] or [cmake_source_dir cmake_build_dir]"
69 echo "Given source dir : \"$source_dir\""
70 echo "Given build dir : \"$build_dir\""
72 echo "Configuring sources... "
74 $source_dir/bootstrap --prefix=${HOME}/local
75 echo "Configuring sources... done."
77 echo "Compiling sources..."
79 make $number_of_processes
80 echo "Compiling sources... done."
82 echo "Installing package..."
85 echo "Installing package... done."