Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/shaderc
Path: blob/main/kokoro/ndk-build/build-docker.sh
1560 views
1
#!/bin/bash
2
# Copyright (c) 2018 Google LLC.
3
#
4
# Licensed under the Apache License, Version 2.0 (the "License");
5
# you may not use this file except in compliance with the License.
6
# You may obtain a copy of the License at
7
#
8
# http://www.apache.org/licenses/LICENSE-2.0
9
#
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
15
#
16
# Linux Build Script.
17
18
# Fail on any error.
19
set -e
20
# Display commands being run.
21
set -x
22
23
# This is required to run any git command in the docker since owner will
24
# have changed between the clone environment, and the docker container.
25
# Marking the root of the repo as safe for ownership changes.
26
git config --global --add safe.directory $ROOT_DIR
27
28
. /bin/using.sh # Declare the bash `using` function for configuring toolchains.
29
30
cd $ROOT_DIR
31
32
function clean_dir() {
33
dir=$1
34
if [[ -d "$dir" ]]; then
35
rm -fr "$dir"
36
fi
37
mkdir "$dir"
38
}
39
40
# Get source for dependencies, as specified in the DEPS file
41
/usr/bin/python3 utils/git-sync-deps --treeless
42
43
using ndk-r25c
44
45
clean_dir "$ROOT_DIR/build"
46
cd "$ROOT_DIR/build"
47
48
function do_ndk_build () {
49
echo $(date): Starting ndk-build $@...
50
$ANDROID_NDK_HOME/ndk-build \
51
-C $ROOT_DIR/android_test \
52
NDK_PROJECT_PATH=. \
53
NDK_LIBS_OUT=./libs \
54
NDK_APP_OUT=./app \
55
V=1 \
56
SPVTOOLS_LOCAL_PATH=$ROOT_DIR/third_party/spirv-tools \
57
SPVHEADERS_LOCAL_PATH=$ROOT_DIR/third_party/spirv-headers \
58
-j8 $@
59
}
60
61
# Builds all the ABIs (see APP_ABI in jni/Application.mk)
62
do_ndk_build
63
64
# Check that libshaderc_combined builds
65
# Explicitly set each ABI, otherwise it will only pick x86.
66
# It seems to be the behaviour when specifying an explicit target.
67
for abi in x86 x86_64 armeabi-v7a arm64-v8a; do
68
do_ndk_build APP_ABI=$abi libshaderc_combined
69
done
70
71
echo $(date): ndk-build completed.
72
73