summaryrefslogtreecommitdiffstats
path: root/arch/scripts/buildarchbinaries
blob: 01b9a3e05c36d4710626690d8ece168d2e3387c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
#!/bin/bash

# some of base things
version="3.5.13"
arch=`arch`
startdir=`pwd`
binariesdir="${startdir}/binaries-${arch}"
scriptname=`basename $0`

#usage function
function usage(){
   printf "Usage: %s [ OPTIONS ]\n\n" ${scriptname}
   printf "Options:\n"
   printf "  -a,  --all\t\tBuild all binaries.\n"
   printf "  -b,  --base\t\tBuild base components.\n"
   printf "  -x,  --extras\t\tBuild extras.\n"
   printf "  -d,  --deps\t\tBuild external dependencies.\n"
   printf "  -h,  --help\t\tDisplay this mesage.\n"
   printf "  -p,  --patch [dir]\tPatch PKGBUILDs using patches found in patch folder.\n"
   printf "\t\t\tThis files should be created manually.\n"
   printf "\t\t\tPatches should be named after PKGBUILD they correct.\n"
   printf "\t\t\tExample: kdebase.patch\n"
   printf "\t\t\tOptionally you can specify patches location (default\n"
   printf "\t\t\tpatch folder).\n"
   printf "  -c,  --dont-clean\tDont remove anything.\n"
   printf "Note: This script should be run on clean and out-of-box arch\n"
   printf "installation for the best outcome. There is no need to \n"
   printf "pull anything needed for building manually.\n"
   printf "Binaries will be automatically installed as build process\n"
   printf "progress and gethered in %s dir.\n" ${binariesdir}
   printf "\e[0;31m THIS SCRIPT SHOULD BE RUN AS ROOT\e[0m\n\n\n"
   exit 1
}

function build_pkg(){
   cd $1
   makepkg -i $cleanflag -s --noconfirm --asroot
   cd ..
}

function patch_pkgbuild(){
if [ -e ${startdir}/patch/${1}.patch ]; then
   patch ${1}/PKGBUILD < ${patchdir}/${1}.patch
fi
}

# Parse args
if [ $# -lt 1 ]; then
   usage
fi

args=`getopt -o abxdrhp::c \
      -l all,base,extras,asroot,deps,"help",patch::,dont-clean \
      -n $scriptname -- "$@"`
eval set -- "$args"
while true ; do
   case "$1" in
      -a|--all)
         buildbase=1
         fetch=1
         builddeps=1
         buildextras=1
         shift 1
         ;;
      -b|--base)
         buildbase=1
         fetch=1
         shift 1
         ;;
      -x|--extras)
         buildextras=1
         fetch=1
         shift 1
         ;;
      -d|--deps)
         builddeps=1
         shift 1
         ;;
      -h|--help)
         usage
         shift 1
         ;;
      -p|--patch)
         patch=1
         case $2 in
            "")
               patchdir=${curdir}/patch/
               shift 2
               ;;
            *)
               patchdir=${2}
               shift 2
               ;;
         esac
         ;;
      -c|--dont-clean)
         dontclean=1
         shift 1
         ;;
      --) shift ; break ;;
   esac
done

if [ ! $dontclean ]; then
   cleanflag="-c"
fi

if [ $builddeps ]; then
   printf "\e[0;34m=========================================\e[0m\n"
   printf "\n\e[0;34mBuilding dependencies form aur\e[0m\n"
   printf "\e[0;34m=========================================\e[0m\n"

   mkdir deps
   cd deps

   printf "\n\e[0;34mhal-info\e[0m\n"
   printf "\e[0;34m%b----------------------------------------\e[0m\n"

   wget http://aur.archlinux.org/packages/ha/hal-info/hal-info.tar.gz
   tar zxvf hal-info.tar.gz
   build_pkg hal-info

   printf "\n\e[0;34mhal-git\e[0m\n"
   printf "\e[0;34m%b----------------------------------------\e[0m\n"

   wget http://aur.archlinux.org/packages/ha/hal-git/hal-git.tar.gz
   tar zxvf hal-git.tar.gz
   build_pkg hal-git

   printf "\n\e[0;34mlibnjb\e[0m\n"
   printf "\e[0;34m%b----------------------------------------\e[0m\n"

   wget http://aur.archlinux.org/packages/li/libnjb/libnjb.tar.gz
   tar zxvf libnjb.tar.gz
   build_pkg libnjb

   # gather binaries
   cd $curdir
   mkdir -p ${binariesdir}/deps/
   mv aur/*/*.tar.xz ${binariesdir}/deps/
   if [ ! $dontclean ]; then
      rm -r deps
   fi
   printf "\e[0;34m=========================================\e[0m\n"
   printf "\e[0;34mFinished building external dependencies\e[0m\n"
   printf "\e[0;34m=========================================\e[0m\n"
fi

if [ $fetch ]; then
   printf "\e[0;34m=========================================\e[0m\n"
   printf "\n\e[0;34mFetching trinity PKGBUILDs\e[0m\n"
   printf "\e[0;34m=========================================\e[0m\n"

   # fetch PKGBUILD and remove useless things
   git clone http://scm.trinitydesktop.org/scm/git/tde-packaging
   cd tde-packaging
   git submodule init
   git submodule update
   rm -r ark debian ubuntu fedora mandriva opensuse redhat slackware README.GIT
   cd $startdir
   mv tde-packaging/arch/${version}/* .
   rm -r tde-packaging
   if [ ! $buildbase ]; then
      rm -r trinity-base
   fi
   if [ ! $buildextras ]; then
      rm -r trinity-extras
   fi

fi

if [ $buildbase ]; then
   cd trinity-base

   # build
   printf "\e[0;34m=========================================\e[0m\n"
   printf "Building base trinity components\n"
   printf "\e[0;34m=========================================\e[0m\n"

   printf "\n\e[0;34mtrinity-qt3\e[0m\n"
   printf "\e[0;34m%b----------------------------------------\e[0m\n"
   if [ $patch ]; then
      patch_pkgbuild qt3
   fi
   build_pkg trinity-qt3

   printf "\n\e[0;34mtrinity-pyqt3\e[0m\n"
   printf "\e[0;34m%b----------------------------------------\e[0m\n"
   if [ $patch ]; then
      patch_pkgbuild pyqt3
   fi
   build_pkg trinity-pyqt3

   printf "\n\e[0;34mtrinity-tqtinterface\e[0m\n"
   printf "\e[0;34m%b----------------------------------------\e[0m\n"
   if [ $patch ]; then
      patch_pkgbuild tqtinterface
   fi
   build_pkg trinity-tqtinterface

   printf "\n\e[0;34mtrinity-arts\e[0m\n"
   printf "\e[0;34m%b----------------------------------------\e[0m\n"
   if [ $patch ]; then
      patch_pkgbuild arts
   fi
   build_pkg trinity-arts

   printf "\n\e[0;34mtrinity-dbus-1-qt3\e[0m\n"
   printf "\e[0;34m%b----------------------------------------\e[0m\n"
   if [ $patch ]; then
      patch_pkgbuild dbus-1-qt3
   fi
   build_pkg trinity-dbus-1-qt3

   printf "\n\e[0;34mtrinity-dbus-tqt\e[0m\n"
   printf "\e[0;34m%b----------------------------------------\e[0m\n"
   if [ $patch ]; then
      patch_pkgbuild dbus-tqt
   fi
   build_pkg trinity-dbus-tqt

   printf "\n\e[0;34mtrinity-dbus-tqt-1\e[0m\n"
   printf "\e[0;34m%b----------------------------------------\e[0m\n"
   if [ $patch ]; then
      patch_pkgbuild dbus-tqt-1
   fi
   build_pkg trinity-dbus-tqt-1

   printf "\n\e[0;34mtrinity-kdelibs\e[0m\n\n"
   printf "\e[0;34m%b----------------------------------------\e[0m\n"
   if [ $patch ]; then
      patch_pkgbuild kdelibs
   fi
   build_pkg trinity-kdelibs

   printf "\n\e[0;34mtrinity-kdebase\e[0m\n"
   printf "\e[0;34m%b----------------------------------------\e[0m\n"
   if [ $patch ]; then
      patch_pkgbuild kdebase
   fi
   build_pkg trinity-kdebase
   
   # gather binaries and clean
   cd $curdir
   mkdir -p ${binariesdir}/trinity-base/
   mv aur/*/*.tar.xz ${binariesdir}/trinity-base/
   if [ ! $dontclean ]; then
      rm -r trinity-base
   fi

   printf "\e[0;34m=========================================\e[0m\n"
   printf "\e[0;34mFinished building base components\e[0m\n"
   printf "\e[0;34m=========================================\e[0m\n"
fi

if [ $buildextras ]; then

   cd trinity-extras

   printf "\e[0;34m=========================================\e[0m\n"
   printf "\n\e[0;34mBuilding trinity-extras\e[0m\n"
   printf "\e[0;34m=========================================\e[0m\n"

   printf "\n\e[0;34mtrinity-amarok\e[0m\n"
   printf "\e[0;34m%b----------------------------------------\e[0m\n"
   if [ $patch ]; then
      patch_pkgbuild amarok
   fi
   build_pkg trinity-amarok

   printf "\n\e[0;34mtrinity-gtk-qt-engine\e[0m\n"
   printf "\e[0;34m%b----------------------------------------\e[0m\n"
   if [ $patch ]; then
      patch_pkgbuild gtk-qt-engine
   fi
   build_pkg trinity-gtk-qt-engine

   printf "\n\e[0;34mtrinity-kdegraphics\e[0m\n"
   printf "\e[0;34m%b----------------------------------------\e[0m\n"
   if [ $patch ]; then
      patch_pkgbuild kdegraphics
   fi
   build_pkg trinity-kdegraphics

   printf "\n\e[0;34mtrinity-kdevelop\e[0m\n"
   printf "\e[0;34m%b----------------------------------------\e[0m\n"
   if [ $patch ]; then
      patch_pkgbuild kdevelop
   fi
   build_pkg trinity-kdevelop

   printf "\n\e[0;34mtrinity-konversation\e[0m\n"
   printf "\e[0;34m%b----------------------------------------\e[0m\n"
   if [ $patch ]; then
      patch_pkgbuild konversation
   fi
   build_pkg trinity-konversation

   printf "\n\e[0;34mtrinity-kpowersave\e[0m\n"
   printf "\e[0;34m%b----------------------------------------\e[0m\n"
   if [ $patch ]; then
      patch_pkgbuild kpowersave
   fi
   build_pkg trinity-kpowersave

   printf "\n\e[0;34mtrinity-amarok\e[0m\n"
   printf "\e[0;34m%b----------------------------------------\e[0m\n"
   if [ $patch ]; then
      patch_pkgbuild qtcurve
   fi
   build_pkg trinity-qtcurve

   # gather binaries and clean
   cd $curdir
   mkdir -p ${binariesdir}/trinity-extras/
   mv aur/*/*.tar.xz ${binariesdir}/trinity-extras/
   if [ ! $dontclean ]; then
      rm -r trinity-extras
   fi
   printf "\e[0;34m=========================================\e[0m\n"
   printf "\e[0;34mFinished building external dependencies\e[0m\n"
   printf "\e[0;34m=========================================\e[0m\n"
fi