updated on Sun Jan 15 16:02:00 UTC 2012
[aur-mirror.git] / kadu-git / PKGBUILD
blobffb11d3a2c0c29292719a8eae44e4e33bb81f2c7
1 # Contributor: Maciej Sitarz <macieks@freesco.pl>
3 pkgname=kadu-git
4 pkgver=20100924
5 pkgrel=1
6 pkgdesc="A Qt-based Gadu-Gadu client - git build"
7 url="http://www.kadu.net/"
8 license=(GPL)
9 depends=('qt>=4' 'libgadu-devel' 'hicolor-icon-theme')
10 makedepends=('git' 'cmake' 'inputproto')
11 optdepends=('libsndfile: module sound' \
12         'aspell: module spellchecker' \
13         'phonon: module phonon_sound' \
14         'qca-ossl: module encryption' \
15         'libxtst: module panelkadu' \
16         'libxss: module idle' \
17         'curl: module plus_pl_sms'
18         'geoip: module geoip_lookup')
19 conflicts=('kadu')
20 provides=('kadu')
21 arch=('i686' 'x86_64')
22 source=('kadu-git.install' 'kadu-git.modules')
23 md5sums=('ecabc475a3f80759f95a90aadb753f25'
24          '432da87b47f18020b9049a1d49ec7f2e')
25 install=kadu-git.install
27 _gitroot=git://gitorious.org/kadu/kadu.git
28 _gitname=kadu
30 build() {
31   cd ${srcdir}
33   msg "Connecting to GIT server...."
35   if [ -d ${_gitname} ]; then
36     cd ${_gitname} && git pull origin || return 1
37     msg "The local files are updated."
38   else
39     git clone ${_gitroot} -b 0.6.5.x || return 1
40     # -b master
41     # -b 0.6.5.x
42   fi
44   msg "GIT checkout done or server timeout"
45   msg "Starting make..."
47   [ -d ${srcdir}/kadu-build ] && rm -fr ${srcdir}/kadu-build
48   mkdir ${srcdir}/kadu-build || return 1
49   git clone ${srcdir}/kadu ${srcdir}/kadu-build || return 1
50   cd ${srcdir}/kadu-build || return 1
52   # Include file with modules list
53   source ${srcdir}/kadu-git.modules || return 1
55   check_new_modules || return 1
56   change_modules || return 1
58   mkdir -p ${srcdir}/BUILD
59   cd ${srcdir}/BUILD
61   cmake -D CMAKE_INSTALL_PREFIX=/usr -D CMAKE_BUILD_TYPE="Release" ../kadu-build || return 1
63   make || return 1
64   make DESTDIR=$startdir/pkg install
66   rm -rf $startdir/pkg/usr/share/kadu/{HISTORY,README}
69 change_modules() {
70         for MOD in $modules_static; do
71                 echo $MOD | grep '!' &> /dev/null
72                 if [ "$?" == "1" ]; then
73                         msg "Static... $MOD"
74                         if [ ! -z "`grep -w $MOD .config`" ]; then
75                                 sed -i "s/^$MOD=./$MOD=y/" .config
76                         else
77                                 error "$MOD not found in .config"
78                                 #return 1
79                         fi
80                 fi
81         done
82         for MOD in $modules_dynamic; do
83                 echo $MOD | grep '!' &> /dev/null
84                 if [ "$?" == "1" ]; then
85                         msg "As module... $MOD"
86                         if [ ! -z "`grep -w $MOD .config`" ]; then
87                                 sed -i "s/^$MOD=./$MOD=m/" .config
88                         else
89                                 error "$MOD not found in .config"
90                                 #return 1
91                         fi
92                 fi
93         done
94         for MOD in $modules_skip; do
95                 echo $MOD | grep '!' &> /dev/null
96                 if [ "$?" == "1" ]; then
97                         msg "Disabling module... $MOD"
98                         if [ ! -z "`grep -w $MOD .config`" ]; then
99                                 sed -i "s/^$MOD=./$MOD=n/" .config
100                         else
101                                 error "$MOD not found in .config"
102                                 #return 1
103                         fi
104                 fi
105         done
108 check_new_modules() {
109     ALL_MODULES="`awk '/\=[ynm]/ && sub("=[ynm]","")' .config`"
110     new_modules="0"
111     
112     for M in $ALL_MODULES; do
113         found="0"
114         for m in $modules_static $modules_dynamic $modules_skip; do
115             if [ "$M" == "$m" -o "!$M" == "$m" ]; then
116                     found="1"
117             fi
118         done
119         
120         if [ "$found" == "0" ]; then
121                 warning "$M not found in PKGBUILD variables"
122                 let new_modules++
123         fi
124     done
125     if [ "$new_modules" != "0" ]; then
126         sleep 10
127         return 0
128     fi
129     return 0