-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild-sdk
executable file
·94 lines (77 loc) · 1.79 KB
/
build-sdk
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
#!/bin/bash
set -ex
fast_build=false
while getopts ":o:s:d:f" opt; do
case $opt in
o)
output_dir=$OPTARG
;;
s)
sdk_version=$OPTARG
;;
d)
sdk_distro=$OPTARG
;;
f)
fast_build=true
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Invalid option: $OPTARG requires an argument" >&2
exit
;;
esac
done
if [ -z "$output_dir" ]; then
echo "Build output directory must be specified via -o" >&2
exit 1
fi
if [ -z "$sdk_version" ]; then
echo "SDK version must be specified via -s" >&2
exit 1
fi
if [ -z "$sdk_distro" ]; then
echo "SDK distrobution must be specified via -d" >&2
exit 1
fi
package_dir=packages/$sdk_distro/
rm -rf $package_dir
mkdir -p $package_dir
distro_specific=distro-sdk/$sdk_distro
source $distro_specific/distro.sh
copy_distro_specific
find sdk-files -name "*~" -delete
cp -r sdk-files/* $sdk_output
while read line; do
array=($line)
location=${array[0]}
src=${array[1]}
dest=${array[2]}
exclusions=("${array[@]:3}")
exclusion_args=()
i=0
for e in "${exclusions[@]}"
do
exclusion_args[$i]=--exclude=$e
((++i))
done
mkdir -p $(dirname $sdk_output/$dest)
case $location in
OUTPUT)
src_dir=$output_dir
;;
REPO)
src_dir=".."
;;
*)
echo "Invalid source location: $location" >&2
exit 1
;;
esac
rsync -av --exclude='*~' "${exclusion_args[@]}" --exclude=.git* --exclude=.git --exclude=build \
$src_dir/$src $sdk_output/$dest
done < sdk-files.txt
build_package