-
-
Notifications
You must be signed in to change notification settings - Fork 289
/
pkg_all.sh
executable file
·139 lines (119 loc) · 3.23 KB
/
pkg_all.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
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
#!/bin/bash
usage() {
echo ""
echo "${0} <build|clean|unpack> <package>"
echo ""
echo "Builds/cleans a package for all projects/devices/systems of Lakka"
echo ""
}
[ ${#} -lt 2 -o ${#} -gt 2 ] && { usage ; echo -e "Error: no or incorrect number of parameters!\n" ; exit 127 ; }
case ${1} in
clean)
action=${1}
script="./scripts/clean"
activity="Cleaning"
;;
build)
action=${1}
script="./scripts/build"
activity="Compilation"
;;
unpack)
action=${1}
script="./scripts/unpack"
activity="Unpacking"
;;
*)
usage
echo -e "Error: action '${1}' not valid!\n"
exit 128
;;
esac
# existing targets in format PROJECT|DEVICE|ARCH
targets="\
Allwinner|A64|aarch64| \
Allwinner|H2-plus|arm| \
Allwinner|H3|arm| \
Allwinner|H5|aarch64| \
Allwinner|H616|aarch64| \
Allwinner|H6|aarch64| \
Allwinner|R40|arm| \
Amlogic|AMLGX|aarch64| \
Ayn|Odin|aarch64| \
Generic|Generic|i386| \
Generic|Generic|x86_64| \
Generic|wayland|x86_64| \
Generic|x11|x86_64| \
L4T|Switch|aarch64| \
NXP|iMX6|arm| \
NXP|iMX8|aarch64| \
RPi|RPi|arm| \
RPi|RPi2|arm| \
RPi|RPi3|aarch64| \
RPi|RPi4-GPiCase2|aarch64| \
RPi|RPi4-PiBoyDmg|aarch64| \
RPi|RPi4-RetroDreamer|aarch64| \
RPi|RPi4|aarch64| \
RPi|RPi5|aarch64| \
RPi|RPiZero-GPiCase|arm| \
RPi|RPiZero2-GPiCase|arm| \
RPi|RPiZero2-GPiCase2W|aarch64| \
Rockchip|RK3288|arm| \
Rockchip|RK3328|aarch64| \
Rockchip|RK3399|aarch64| \
Samsung|Exynos|arm| \
"
package=${2}
declare -i failed=0
failed_targets=""
skipped_targets=""
for T in ${targets} ; do
IFS='|' read -r -a build <<< ${T}
project=${build[0]}
device=${build[1]}
arch=${build[2]}
target_name=${device:-${project}}.${arch}
[ -z "${DISTRO}" ] && distro="Lakka" || distro="${DISTRO}"
echo "Processing package '${package}' for '${target_name}':"
export DISTRO=${distro}
export PROJECT=${project}
export DEVICE=${device}
export ARCH=${arch}
opt_file="distributions/${distro}/options"
ver_file="distributions/${distro}/version"
[ -f ${opt_file} ] && source ${opt_file} || { echo "${ver_file}: not found!" ; exit 129 ; }
[ -f ${ver_file} ] && source ${ver_file} || { echo "${ver_file}: not found!" ; exit 130 ; }
BUILD=build.${DISTRO}-${DEVICE:-$PROJECT}.${ARCH}-${LIBREELEC_VERSION}
if [ "${LIBREELEC_VERSION}" = "devel" ] ; then
BUILD=build.${DISTRO}-${DEVICE:-$PROJECT}.${ARCH}-${OS_VERSION}-${LIBREELEC_VERSION}
fi
if [ "${BUILD_NO_VERSION}" = "yes" ]; then
BUILD=build.${DISTRO}-${DEVICE:-$PROJECT}.${ARCH}
fi
if [ -n "${BUILD_SUFFIX}" ]; then
BUILD=${BUILD}-${BUILD_SUFFIX}
fi
build_folder=${BUILD}
if [ ! -d "${build_folder}" ] ; then
skipped_targets+="${target_name}\n"
echo -e "No build folder - skipping.\n"
continue
fi
${script} ${package}
if [ ${?} -gt 0 ] ; then
failed+=1
failed_targets+="${target_name}\n"
echo -e "${activity} of package '${package}' failed for '${target_name}'.\n"
else
echo -e "${activity} of package '${package}' succeeded for '${target_name}'.\n"
fi
done
if [ -n "${skipped_targets}" ] ; then
echo -e "Following targets were skipped - could not find existing build folder:\n${skipped_targets}\n"
fi
if [ $failed -gt 0 ] ; then
echo -e "Failed to ${action} package '${package}' on following targets:\n${failed_targets}" >&2
else
echo "Done."
fi
exit ${failed}