-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathset-env-tshark.sh
75 lines (58 loc) · 2.48 KB
/
set-env-tshark.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
#!/bin/sh
# Android cross-compile environment setup script for Wireshark
# Author : Zengwen Yuan
# Date : 2016-07-16
# Version : 2.0
# All the sources and installed libs will be here
export DEV=${HOME}/tools
# This is just an empty directory where I want the built objects to be installed
export PREFIX=${HOME}/android64
# Don't mix up .pc files from your host and build target
export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
# GCC for Android version to use
# 4.9 is the only available version since NDK r11!
export GCC_VER=4.9
# The building system we are using -- Linux arch
export BUILD_SYS=x86_64-linux-gnu
# Set Android target API level
export ANDROID_API=21
# Set Android target arch
export ANDROID_ARCH=arm64
# Set Android target name, according to Table 2 in
# https://developer.android.com/ndk/guides/standalone_toolchain.html
# export ANDROID_TARGET=armv5te-none-linux-androideabi
# The cross-compile toolchain we use
export TOOLCHAIN=aarch64-linux-android
# This is a symlink pointing to the latest Android NDK r12b
export NDK=${DEV}/android-ndk
# The path of standalone NDK toolchain
# Refer to https://developer.android.com/ndk/guides/standalone_toolchain.html
export NDK_TOOLCHAIN=${DEV}/android64-ndk-toolchain
# Set Android Sysroot according to API and arch
export SYSROOT=${NDK_TOOLCHAIN}/sysroot
# this one is the absolute, prebuilt path
# export SYSROOT=${NDK}/platforms/android-${ANDROID_API}/arch-${ANDROID_ARCH}
# Binutils path
export CROSS_PREFIX=${NDK_TOOLCHAIN}/bin/${TOOLCHAIN}
# this one is the absolute, prebuilt path
# export CROSS_PREFIX=${NDK}/toolchains/${TOOLCHAIN}-${GCC_VER}/prebuilt/linux-x86_64/bin/${TOOLCHAIN}
# Non-exhaustive lists of compiler + binutils
export AR=${CROSS_PREFIX}-ar
export AS=${CROSS_PREFIX}-as
export LD=${CROSS_PREFIX}-ld
export NM=${CROSS_PREFIX}-nm
export CC=${CROSS_PREFIX}-gcc
export CXX=${CROSS_PREFIX}-g++
export CPP=${CROSS_PREFIX}-cpp
export CXXCPP=${CROSS_PREFIX}-cpp
export STRIP=${CROSS_PREFIX}-strip
export RANLIB=${CROSS_PREFIX}-ranlib
export STRINGS=${CROSS_PREFIX}-strings
# Needed for Wireshark building
export CC_FOR_BUILD="/usr/bin/cc"
# Make sure GLib's installation path is included in $PATH
export PATH=$PATH:${PREFIX}/bin:${PREFIX}/lib:${PREFIX}/lib64
# Set build flags
export CFLAGS="--sysroot=${SYSROOT} -I${SYSROOT}/usr/include -I${PREFIX}/include"
export CPPFLAGS="--sysroot=${SYSROOT} -I${SYSROOT}/usr/include -I${NDK_TOOLCHAIN}/include/c++/"
export LDFLAGS="${LDFLAGS} -L${SYSROOT}/usr/lib -L${PREFIX}/lib -L${NDK_TOOLCHAIN}/lib"