-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·92 lines (78 loc) · 2.51 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·92 lines (78 loc) · 2.51 KB
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
#!/bin/bash
source ../../AVP/android-setup-light.sh
LOCAL_PATH=$($READLINK -f .)
mkdir -p ../prebuilt/harfbuzz
PREBUILT_DIR=$($READLINK -f ../prebuilt/harfbuzz)
# Check if prebuilt libraries already exist
if [ -f "${PREBUILT_DIR}/lib/armeabi-v7a/libharfbuzz.a" ] && \
[ -f "${PREBUILT_DIR}/lib/arm64-v8a/libharfbuzz.a" ] && \
[ -f "${PREBUILT_DIR}/lib/x86/libharfbuzz.a" ] && \
[ -f "${PREBUILT_DIR}/lib/x86_64/libharfbuzz.a" ]; then
echo "All harfbuzz prebuilt libs already exist, skipping"
exit 0
fi
if [ ! -d "harfbuzz" ]
then
git clone https://github.com/harfbuzz/harfbuzz.git --depth=1 -b 14.3.1
fi
API_LEVEL=21
for ABI in armeabi-v7a arm64-v8a x86 x86_64
do
case "${ABI}" in
'arm64-v8a')
CPU_FAMILY='aarch64'
TARGET=aarch64-linux-android
;;
'armeabi-v7a')
CPU_FAMILY='arm'
TARGET=armv7a-linux-androideabi
;;
'x86')
CPU_FAMILY='x86'
TARGET=i686-linux-android
;;
'x86_64')
CPU_FAMILY='x86_64'
TARGET=x86_64-linux-android
;;
esac
PREFIX="${PREBUILT_DIR}"
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
TOOLCHAIN="${NDK_PATH}/toolchains/llvm/prebuilt/${OS}-x86_64"
export AR="${TOOLCHAIN}/bin/llvm-ar"
export STRIP="${TOOLCHAIN}/bin/llvm-strip"
export CC="${TOOLCHAIN}/bin/${TARGET}${API_LEVEL}-clang"
export CXX="${TOOLCHAIN}/bin/${TARGET}${API_LEVEL}-clang++"
ZLIB_PREBUILT=$($READLINK -f ../prebuilt/zlib)
LIBPNG_PREBUILT=$($READLINK -f ../prebuilt/libpng)
FREETYPE_PREBUILT=$($READLINK -f ../prebuilt/freetype)
# Create cross-file for this ABI
user_config="meson-cross-${ABI}.txt"
rm -f $user_config
cat <<EOF > $user_config
[binaries]
c = '$CC'
cpp = '$CXX'
ar = '$AR'
strip = '$STRIP'
pkg-config = 'pkg-config'
[properties]
pkg_config_libdir = ['${FREETYPE_PREBUILT}/lib/${ABI}/pkgconfig', '${ZLIB_PREBUILT}/lib/${ABI}/pkgconfig', '${LIBPNG_PREBUILT}/lib/${ABI}/pkgconfig']
[host_machine]
system = 'android'
cpu_family = '$CPU_FAMILY'
cpu = '$CPU_FAMILY'
endian = 'little'
EOF
if [ ! -f "${PREBUILT_DIR}/lib/${ABI}/libharfbuzz.a" ]
then
echo "Building harfbuzz for ${ABI}..."
cd harfbuzz
rm -rf "build-${ABI}"
meson setup "build-${ABI}" --cross-file "../meson-cross-${ABI}.txt" --prefix="${PREFIX}" --libdir="lib/${ABI}" --default-library=static -Dtests=disabled -Ddocs=disabled -Dfreetype=enabled -Dsubset=disabled -Draster=disabled -Dvector=disabled -Dgpu=disabled -Dutilities=disabled
ninja -C "build-${ABI}" install
cd ..
else
echo "Harfbuzz already built for ${ABI}"
fi
done