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