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