3 ## Some configuration variables
4 number_of_processes="-j4"
6 ## Check input parameters and process inputs (if needed)
7 if [ "$#" -eq 1 ]; then
8 valid_extensions=("zip" "tar" "tar.gz" "tar.bz2")
10 for ext in ${valid_extensions[@]}; do
11 if [ `basename $1 $ext` != $1 ]; then
15 if [ "x$actual_ext" == "x" ]; then
16 echo "$0: Invalid file type."
19 canonical_path=`readlink -e $1`
20 source_dir=`dirname $canonical_path`/`basename $1 .$actual_ext`
21 build_dir=`dirname $canonical_path`/`basename $1 .$actual_ext`-build
22 echo -n "Cleaning directories... "
26 echo -n "Creating directories... "
30 echo -n "Extracting sources... "
31 if [ "$actual_ext" == "zip" ]; then
32 echo unzip $canonical_path
33 elif [ "$actual_ext" == "tar" ]; then
34 tar xf $canonical_path -C $source_dir --strip-components=1
35 elif [ "$actual_ext" == "tar.gz" ]; then
36 tar xzf $canonical_path -C $source_dir --strip-components=1
37 elif [ "$actual_ext" == "tar.bz2" ]; then
38 tar xjf $canonical_path -C $source_dir --strip-components=1
40 echo "$0: Invalid file type."
44 elif [ "$#" -eq 2 ]; then
45 source_dir=`dirname $1`
46 build_dir=`dirname $2`
48 echo "Usage: [cmake_package] or [cmake_source_dir cmake_build_dir]"
51 echo "Given source dir : \"$source_dir\""
52 echo "Given build dir : \"$build_dir\""
54 echo "Configuring sources... "
56 $source_dir/bootstrap --prefix=${HOME}/local
57 echo "Configuring sources... done."
59 echo "Compiling sources..."
61 make $number_of_processes
62 echo "Compiling sources... done."
64 echo "Installing package..."
67 echo "Installing package... done."