72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
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
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
unzip "${pkgarchive}" || die 'Unable to uncompress archive'
;;
*)
"${decompress}" -dc "${pkgarchive}" | tar -xf - || die 'Unable to uncompress archive'
;;
esac
}
function apply_patches() {
local patch
for patch in "${pkgdir}/patches"/*; do
if [ ! -e "${patch}" ]; then
continue
fi
case "${patch}" in
*.diff|*.patch)
;;
*)
continue
;;
esac
if [ -e "${patch}.sh" ]; then
if ! sh "${patch}.sh"; then
continue
fi
fi
patch -p1 < "${patch}"
done
}
function verifyRequiredPackages() {
local pkg pkgdomain pkgversion
local pkgdir pkgconfigdir pkgfound
for pkg in "${require[@]}"; do
pkgdomain=''
|
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
|
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
|
-
+
-
+
|
cd "${scriptdir}" || exit 1
if [ -f 'build.conf' ]; then
. 'build.conf'
fi
if [ -d "pkgs/${pkg}" ]; then
pkgdir="pkgs/${pkg}"
pkgdir="$(pwd)/pkgs/${pkg}"
pkgfile="${pkgdir}/info"
else
pkgfile="pkgs/${pkg}"
pkgfile="$(pwd)/pkgs/${pkg}"
pkgdir="${pkgfile}"
fi
if [ ! -e "${pkgfile}" ]; then
echo "Invalid package." >&2
exit 1
|
333
334
335
336
337
338
339
340
341
342
343
344
345
346
|
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
|
+
+
+
|
verifyPrerequisites || die 'Prerequisities failed'
# Start logging
set -x
# Determine properties
determinePrefix
# Apply patches
apply_patches
# Start the build
preconfigure || die 'preconfigure failed'
configure || die 'configure failed'
postconfigure || die 'postconfigure failed'
prebuild || die 'prebuild failed'
|