-
Notifications
You must be signed in to change notification settings - Fork 14
/
build.sh
executable file
·59 lines (47 loc) · 1.33 KB
/
build.sh
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
#!/bin/bash
# build.sh by davidgfnet
# Will build the specified package or all of them if none are specified
# Example:
# ./build.sh # Builds all packages
# ./build.sh sdl2 # Builds package SDL2 (and all its dependencies)
#
# It is also possible to install the packages with --install
# Example:
# ./build.sh --install # Builds all packages and installs them too
# ./build.sh --install sdl2 # Builds package SDL2 + deps and installs them
set -e
doinstall=""
if [ "$1" == "--install" ]; then
doinstall="true"
shift
fi
if [ -z "$1" ]
then
# By default build them all
PKG_LIST=$(find . -name "PSPBUILD" -exec sh -c 'echo $(basename $(dirname $0))' {} \;)
else
PKG_LIST=$1
fi
for pkgdir in $PKG_LIST;
do
if [[ ! -f "$pkgdir/PSPBUILD" ]]; then
echo "Package $pkgdir does not exist!"
continue
fi
for pkgdep in $(bash -c "./parse_pspbuild.sh $pkgdir/PSPBUILD depends"); do
if [ -z $doinstall ]; then
./build.sh "$pkgdep"
else
./build.sh --install "$pkgdep"
fi
done
pkgfile=$(bash -c "./parse_pspbuild.sh $pkgdir/PSPBUILD pkgoutput")
if [[ ! -f "${pkgdir}/${pkgfile}" ]]; then
echo "Building $pkgdir ..."
(cd $pkgdir && psp-makepkg)
fi
if [ ! -z "$doinstall" ]; then
echo "Installing $pkgdir"
psp-pacman -U --noconfirm "${pkgdir}/${pkgfile}" --overwrite '*'
fi
done