File: compile_linux.sh

package info (click to toggle)
renderdoc 1.27%2Bdfsg-1
  • links: PTS, VCS
  • area: non-free
  • in suites: sid
  • size: 107,796 kB
  • sloc: cpp: 763,519; ansic: 326,847; python: 26,946; xml: 23,189; java: 11,382; cs: 7,181; makefile: 6,707; yacc: 5,682; ruby: 4,648; perl: 3,461; sh: 2,381; php: 2,119; lisp: 1,835; javascript: 1,525; tcl: 1,068; ml: 747
file content (118 lines) | stat: -rwxr-xr-x 3,322 bytes parent folder | download | duplicates (3)
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
#!/bin/bash

echo "Building renderdoc-build docker image"

# Ensure the docker image is prepared
pushd "${BUILD_ROOT}"/scripts/docker
docker build -t renderdoc-build . || exit 1
popd

echo "Docker image built. Running build"

# Run the docker compilation script inside the container above to build the main renderdoc project
mkdir -p /tmp/rdoc_docker
cp "${BUILD_ROOT}"/scripts/compile_docker.sh /tmp/rdoc_docker
docker run --rm -v /tmp/rdoc_docker:/io -v $(readlink -f "${REPO_ROOT}"):/renderdoc:ro renderdoc-build bash /io/compile_docker.sh

if [ -d /tmp/rdoc_docker/dist ]; then
	echo "Build successful.";
else
	echo "Error encountered during docker build.";
	exit 1;
fi

# pushd into the git checkout
pushd "${REPO_ROOT}"

# Copy the dist folder structure to the git checkout
cp -R /tmp/rdoc_docker/dist .

# TODO - here we could copy off the build with symbols?

# Strip the binaries
strip --strip-unneeded dist/bin/*
strip --strip-unneeded dist/lib/*

# Copy python modules to where they'd be built natively, for documentation build
mkdir build
cp -R /tmp/rdoc_docker/pymodules build/lib

# Step into the docs folder and build
pushd docs
make clean
make html

popd; # docs

# if we didn't produce an html file, bail out even if sphinx didn't return an error code above
if [ ! -f ./Documentation/html/index.html ]; then
	echo "Didn't get successful build of html docs."
	exit 1;
fi

# Build android libraries and apks
export PATH=$PATH:$ANDROID_SDK/tools/

# Check that we're set up to build for android
if [ ! -d $ANDROID_SDK/tools ] ; then
	echo "\$ANDROID_SDK is not correctly configured: '$ANDROID_SDK'"
	exit 0;
fi

if [ ! -d $LLVM_ARM32 ] || [ ! -d $LLVM_ARM64 ] ; then
	echo "llvm is not available, expected $LLVM_ARM32 and $LLVM_ARM64 respectively."
	exit 0;
fi

AAPT=$(ls $ANDROID_SDK/build-tools/*/aapt 2>/dev/null | tail -n 1)

# Check to see if we already have this built, and don't rebuild
VERSION32=$($AAPT dump badging build-android-arm32/bin/*apk 2>/dev/null | grep -Eo "versionName='[0-9a-f]*'" | grep -Eo "'.*'" | tr -d "'")
VERSION64=$($AAPT dump badging build-android-arm64/bin/*apk 2>/dev/null | grep -Eo "versionName='[0-9a-f]*'" | grep -Eo "'.*'" | tr -d "'")

if [ "$VERSION32" == "$GITTAG" ]; then

	echo "Found existing compatible arm32 build at $GITTAG, not rebuilding";

else

	# Build the arm32 variant
	rm -rf build-android-arm32
	mkdir build-android-arm32
	pushd build-android-arm32

	cmake -DBUILD_ANDROID=1 -DANDROID_ABI=armeabi-v7a -DANDROID_NATIVE_API_LEVEL=23 -DCMAKE_BUILD_TYPE=Release -DSTRIP_ANDROID_LIBRARY=On -DLLVM_DIR=$LLVM_ARM32/lib/cmake/llvm -DUSE_INTERCEPTOR_LIB=On -DCMAKE_MAKE_PROGRAM=make ..
	make -j8

	if ! ls bin/*.apk; then
		echo "Android build failed"
		exit 0;
	fi

	popd # build-android-arm32

fi

if [ "$VERSION64" == "$GITTAG" ]; then

	echo "Found existing compatible arm64 build at $GITTAG, not rebuilding";

else

	rm -rf build-android-arm64
	mkdir build-android-arm64
	pushd build-android-arm64

	cmake -DBUILD_ANDROID=1 -DANDROID_ABI=arm64-v8a -DANDROID_NATIVE_API_LEVEL=23 -DCMAKE_BUILD_TYPE=Release -DSTRIP_ANDROID_LIBRARY=On -DLLVM_DIR=$LLVM_ARM64/lib/cmake/llvm -DUSE_INTERCEPTOR_LIB=On -DCMAKE_MAKE_PROGRAM=make ..
	make -j8

	if ! ls bin/*.apk; then
		echo "Android build failed"
		exit 0;
	fi

	popd # build-android-arm64

fi

popd # $REPO_ROOT