-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sh
executable file
·113 lines (79 loc) · 2.86 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
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
#!/bin/bash
set -x
# get current script path and use it as the base directory
SCRIPT=$(readlink -f "$0")
export BASE_DIR=$(dirname "$SCRIPT")
export BUILD_DIR=$BASE_DIR/build
export RPI_ROOT=$BASE_DIR/rpi
# clean raspberry root?
if true; then
rm -Rf $RPI_ROOT
mkdir -p $RPI_ROOT
cd $RPI_ROOT
qemu-debootstrap --foreign --arch armhf jessie $RPI_ROOT http://ftp.debian.org/debian
chroot $RPI_ROOT apt -q -y --force-yes install build-essential
chroot $RPI_ROOT apt -q -y --force-yes install gcc-multilib g++-multilib
chroot $RPI_ROOT apt -q -y --force-yes install libstdc++-4.8-dev
chroot $RPI_ROOT apt -q -y --force-yes install libfontconfig1-dev
fi
# clean build?
if true; then
rm -Rf $BUILD_DIR
mkdir -p $BUILD_DIR
cd $BUILD_DIR
git clone https://github.com/mono/SkiaSharp.git skia
cd skia
git checkout tags/v1.57.1
git submodule update --init --recursive
cd externals/skia
python tools/git-sync-deps
cd $BUILD_DIR/skia
git apply $BASE_DIR/skiasharp.patch
cd $BUILD_DIR/skia/externals/skia
git apply $BASE_DIR/skia-build-script-changes.patch
fi
cd $BUILD_DIR/skia/externals/skia
export PATH="$PATH:$BUILD_DIR/skia/externals/depot_tools"
if true; then
rm -Rf out
gn gen out/linux/arm --args='
target_cpu = "arm"
cc = "clang-3.8"
cxx = "clang++-3.8"
skia_enable_gpu = false
skia_use_libjpeg_turbo = false
is_official_build = true
skia_enable_tools = false
skia_use_icu = false
skia_use_sfntly = false
skia_use_system_freetype2 = false
is_debug = false
extra_cflags = [
"-g",
"-target", "armv7a-linux",
"-mfloat-abi=hard",
"-mfpu=neon",
"--sysroot='$RPI_ROOT'",
"-I'$RPI_ROOT'/usr/include/c++/4.9",
"-I'$RPI_ROOT'/usr/include/arm-linux-gnueabihf",
"-I'$RPI_ROOT'/usr/include/arm-linux-gnueabihf/c++/4.9",
"-I'$RPI_ROOT'/usr/include/freetype2",
"-DSKIA_C_DLL"
]
extra_asmflags = [
"-g",
"-target", "armv7a-linux",
"-mfloat-abi=hard",
"-mfpu=neon",
]
'
ninja -C out/linux/arm
fi
# now skiasharp
cd ../../native-builds/libSkiaSharp_linux
make clean
ARCH=arm SUPPORT_GPU=0 CXX=arm-linux-gnueabihf-g++ CC=arm-linux-gnueabihf-g++ LDFLAGS="-Wl,-L $RPI_ROOT/usr/lib/arm-linux-gnueabihf -Wl,-g -Wl,-lfreetype" CXXFLAGS="-march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard" make
# ARCH=arm SUPPORT_GPU=0 CXX=clang++ CC=clang++ LDFLAGS="-target armv7a-linux -mfloat-abi=hard -mfpu=vfpv3 -Wl,-L /root/rpi/usr/lib/arm-linux-gnueabihf -Wl,-g -Wl,-lfreetype" CXXFLAGS="-target armv7a-linux -mfloat-abi=hard -mfpu=vfpv3 --sysroot=/root/rpi -std=c++11" make
cp bin/arm/libSkiaSharp.so.0.0.0 ../../../
mv ../../../libSkiaSharp.so.0.0.0 ../../../libSkiaSharp.so
echo built.