updated on Sat Jan 14 12:12:45 UTC 2012
[aur-mirror.git] / qutim-svn-archangel / PKGBUILD
blob24b3a18ed697f21285706fbd5bef735e7d829c32
1 # qutIM smart builder system.
3 # Contributor: atommix aka Aleks Lifey <Aleks.Lifey@gmail.com> (mail and jid)
4 # I'm from Russia! :-D
6 # Code for ImagePub and Yandex.Narod plugins writing by Alexander Kazarin <boiler@co.ru>
7 # Regards 
9 #qutim_include = install src/qutim/include/qutim to /usr/include/
10 builds=(qutim icq jabber !mrim qutim_include \
11         protocolicon imagepub yandexnarod weather)
13 #Read more herŠµ http://www.qutim.org/forum/viewtopic.php?f=30&t=698&p=8720#p8720
14 #only one parametr for crypt please
15 #plugin_jabber_param=([-DGNUTLS=1 || -DOpenSSL=1 || -DWinTLS=1] [-DZLib=1] [-DPhonon=1])
16 #recommended
17 plugin_jabber_param=(-DGNUTLS=1 -DZLib=1)
19 #if 1 then true, if 0 then false
20 fully_stopping_building_if_error=0
22 #rm -rf $startdir/src/$_svnmod-build
23 remove_src_build=1
25 pkgname=qutim-svn-archangel
26 pkgver=90
27 pkgrel=5
28 pkgdesc="Multiplatform instant messenger, with plugin system. Currently support ICQ, Jabber, MRIM and other additional plugins"
29 arch=('i686' 'x86_64')
30 url="http://qutim.org"
31 license=('GPL')
32 makedepends=('subversion' 'cmake' 'qt' 'wget' 'tar' 'bzip2' 'gzip')
33 depends=('qt')
34 conflicts=('qutim' 'qutim-svn')                                                                          
35 provides=('qutim' 'qutim-svn')
36 source=()
37 md5sums=()
39 _svntrunk=http://qutim.org/svn/qutim
40 _svnmod=qutim
42 build()
44  exceptions=()
46  remove_src_build_func()
47  {
48   if [[ "$remove_src_build" = "1" ]]; then
49    rm -rf $startdir/src/$_svnmod-build
50   fi
51  }
53  exceptions_func()
54  {
55   #everythig first. else trouble.
56   s=$?
58   if [[ "$fully_stopping_building_if_error" = "1" ]]; then
59    echo "exceptions_func(): $1 $2 $s #######################################"
60    echo "exceptions_func(): fully_stopping_building_if_error = 1 #######################################"
61    exit
62   fi
63   echo "exceptions_func(): $1 $2 $s #######################################" 
64   exceptions[${#exceptions[@]}]="$1"
65   exceptions[${#exceptions[@]}]="$2"
66   exceptions[${#exceptions[@]}]="$s"
67  }
69  exceptions_result_func()
70  {
71   if [[ "${#exceptions[@]}" > "0" ]]; then
72    echo "exceptions_result_func():"
73    echo "WARNING! EXCEPTIONS ########################################"
74    echo "{"
75     for ((i=0; i<${#exceptions[@]}; i+=3))
76     do
77      #name (qutim, icq, jabber, mrim)
78      s=${exceptions[i]}
79      #build program
80      s1=${exceptions[i+1]}
81      #error number
82      s2=${exceptions[i+2]}
83      echo " $s <$s1> return error $s2"
84     done
85    echo "}"
86    echo "WARNING! EXCEPTIONS ########################################"
87   fi 
88  }
90  update_func()
91  {
92   for i in "${builds[@]}"
93   do
94    if [[ ${i:0:1} != "!" ]]; then
95     echo "update_func(): $i +++++++++++++++++++++++++++++++++++++++++"
96    fi
97    case $i in
98     qutim) 
99      svn co http://qutim.org/svn/$i || exceptions_func $i "svn"
100     ;;
101     icq | jabber)
102      cd $startdir/src/$_svnmod/plugins || exceptions_func $i "cd"
103      svn co http://qutim.org/svn/$i || exceptions_func $i "svn"
104     ;;
105     mrim)
106      cd $startdir/src/$_svnmod/plugins || exceptions_func $i "cd"
107      svn co http://qutim.org/svn/$i/trunk mrim || exceptions_func $i "svn"
108     ;;
109     protocolicon)
110      cd $startdir/src/$_svnmod/plugins || exceptions_func $i "cd"
111      wget -O $i.tar.bz2 http://qutim.org/downloads/$i.tar.bz2  || exceptions_func $i "wget"
112      tar jxvf $i.tar.bz2 || exceptions_func $i "tar"
113     ;;
114     imagepub | yandexnarod)                                        
115      cd $startdir/src/$_svnmod/plugins || exceptions_func $i "cd"      
116      wget -O $i.tar.gz http://boiler.co.ru/qutim/$i.tar.gz || exceptions_func $i "wget"
117      tar zxvf $i.tar.gz || exceptions_func $i "tar"
118     ;;
119     weather)
120      cd $startdir/src/$_svnmod/plugins || exceptions_func $i "cd"
121      wget -O $i.tar http://deltaz.ru/sites/default/files/archive.tar || exceptions_func $i "wget"
122      tar xvf $i.tar || exceptions_func $i "tar"
123     ;;
124    esac
125   done
128  build_func()
130   for i in "${builds[@]}"
131   do
132    if [[ ${i:0:1} != "!" ]]; then
133     echo "build_func(): $i +++++++++++++++++++++++++++++++++++++++++"
134    fi
135    case $i in
136     qutim)
137      cmake . || exceptions_func $i "cmake" 
138      make || exceptions_func $i "make"
139     ;;
140     icq | mrim | imagepub | yandexnarod | protocolicon | weather)
141      cd $startdir/src/$_svnmod-build/plugins/$i
142      qmake || exceptions_func $i "qmake"
143      make || exceptions_func $i "make"
144     ;;
145     jabber)
146      cd $startdir/src/$_svnmod-build/plugins/$i
147      echo "cmake ${plugin_jabber_param[@]} ."   
148      cmake ${plugin_jabber_param[@]} . || exceptions_func $i "cmake"
149      make || exceptions_func $i "make"
150     ;;
151    esac
152   done 
155  install_func()
157   for i in "${builds[@]}"
158   do
159    if [[ ${i:0:1} != "!" ]]; then
160     echo "install_func(): $i +++++++++++++++++++++++++++++++++++++++++"
161    fi
162    case $i in
163     qutim) 
164      install -D \
165       $startdir/src/$_svnmod-build/$i \
166       $pkgdir/usr/bin/$i || exceptions_func $i "install"
167     ;;
168     icq) 
169      install -D \
170       $startdir/src/$_svnmod-build/plugins/lib$i.so \
171       $pkgdir/usr/lib/$_svnmod/lib$i.so || exceptions_func $i "install"
172     ;;
173     jabber | mrim) 
174      install -D \
175       $startdir/src/$_svnmod-build/plugins/$i/lib$i.so \
176       $pkgdir/usr/lib/$_svnmod/lib$i.so || exceptions_func $i "install"
177     ;;
178     qutim_include) 
179      install -Dd \
180       $startdir/src/$_svnmod-build/include/qutim \
181       $pkgdir/usr/include/$_svnmod || exceptions_func $i "install_dir"
182      install -D \
183       $startdir/src/$_svnmod-build/include/qutim/*.h \
184       $pkgdir/usr/include/$_svnmod/ || exceptions_func $i "install_files"
185     ;;
186     imagepub | yandexnarod | protocolicon | weather) 
187      install -D \
188       $startdir/src/$_svnmod-build/plugins/lib$i.so \
189       $pkgdir/usr/lib/$_svnmod/lib$i.so || exceptions_func $i "install"
190     ;;
191    esac
192   done
195  cd $startdir/src
196  msg "Getting sources from SVN..."
198  update_func
200  remove_src_build_func
202  cp -rf $startdir/src/$_svnmod $startdir/src/$_svnmod-build
203  cd $startdir/src/$_svnmod-build
204  msg "SVN checkout done or server timeout"
205  msg "Starting make..."
207  build_func
208  install_func
210  exceptions_result_func
212  mkdir -p $pkgdir/usr/share/pixmaps
213  cp $startdir/src/$_svnmod-build/icons/qutim_64.png $pkgdir/usr/share/pixmaps/qutim.png
215  mkdir -p $pkgdir/usr/share/applications
217  echo "[Desktop Entry]
218 Type=Application
219 Encoding=UTF-8
220 Name=qutIM
221 Exec=qutim
222 Terminal=false
223 Icon=/usr/share/pixmaps/qutim.png
224 Categories=Application;Network;" > $pkgdir/usr/share/applications/qutim.desktop
226  remove_src_build_func