]> Creatis software - cpPlugins.git/blob - third_party_installers/cpPlugins_Install_QT4.sh
More macos issues...
[cpPlugins.git] / third_party_installers / cpPlugins_Install_QT4.sh
1 #!/bin/bash
2
3 ## Check input parameters and process inputs (if needed)
4 if [ "$#" -eq 1 ]; then
5     valid_extensions=("zip" "tar" "tar.gz" "tar.bz2")
6     actual_ext=""
7     for ext in ${valid_extensions[@]}; do
8         if [ `basename $1 $ext` != $1 ]; then
9             actual_ext=$ext
10         fi
11     done
12     if [ "x$actual_ext" == "x" ]; then
13         echo "$0: Invalid file type."
14         exit 1
15     fi
16     canonical_path=`readlink -e $1`
17     source_dir=`dirname $canonical_path`/`basename $1 .$actual_ext`
18     build_dir=`dirname $canonical_path`/`basename $1 .$actual_ext`-build
19     echo -n "Cleaning directories... "
20     rm -rf $source_dir
21     rm -rf $build_dir
22     echo "done."
23     echo -n "Creating directories... "
24     mkdir -p $source_dir
25     mkdir -p $build_dir
26     echo "done."
27     echo -n "Extracting sources... "
28     if [ "$actual_ext" == "zip" ]; then
29         echo unzip $canonical_path
30     elif [ "$actual_ext" == "tar" ]; then
31         tar xf $canonical_path -C $source_dir --strip-components=1
32     elif [ "$actual_ext" == "tar.gz" ]; then
33         tar xzf $canonical_path -C $source_dir --strip-components=1
34     elif [ "$actual_ext" == "tar.bz2" ]; then
35         tar xjf $canonical_path -C $source_dir --strip-components=1
36     else
37         echo "$0: Invalid file type."
38         exit 1
39     fi
40     echo "done!"
41 elif [ "$#" -eq 2 ]; then
42     source_dir=`dirname $1`
43     build_dir=`dirname $2`
44 else
45     echo "Usage: [qt4_package] or [qt4_source_dir qt4_build_dir]" 
46 fi
47
48 echo "Given source dir : \"$source_dir\""
49 echo "Given build dir  : \"$build_dir\""
50
51 echo "Configuring sources... "
52 cd $build_dir
53 $source_dir/configure \
54     -prefix ${HOME}/local \
55     -release -opensource -shared -fast -no-webkit \
56     -optimized-qmake -no-framework \
57     -confirm-license yes
58 echo "Configuring sources... done."
59
60 echo "Compiling sources..."
61 cd $build_dir
62 make
63 echo "Compiling sources... done."
64
65 echo "Installing package..."
66 cd $build_dir
67 make -j install
68 echo "Installing package... done."
69
70 ## eof - $RCSfile$