Created
October 3, 2018 20:54
-
-
Save giacobenin/f69abf54b62854f99b425e0fc21a82be to your computer and use it in GitHub Desktop.
Script to build protobuf 3.1.0 for Android
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Place this script in protobuf's root folder, where autogen.sh and configure are located | |
# Change config | |
API=21 | |
# No need to change henceforth | |
BIN_ROOT=/tmp/android-toolchain | |
BIN=${BIN_ROOT}/bin | |
# Create build chain | |
${NDK_HOME}/build/tools/make_standalone_toolchain.py --arch arm --api $API --install-dir ${BIN_ROOT} | |
# Configure using build chain | |
./autogen.sh | |
./configure --host=arm-linux-androideabi \ | |
CC=${BIN}/arm-linux-androideabi-gcc \ | |
CXX=${BIN}/arm-linux-androideabi-g++ CPPFLAGS="-I${NDK_HOME}/platforms/android-${API}/arch-arm/usr/include/ \ | |
-I${NDK_HOME}/sources/cxx-stl/gnu-libstdc++/4.9/include" \ | |
CFLAGS="-nostdlib" LDFLAGS="-Wl,-rpath-link=${NDK_HOME}/platforms/android-${API}/arch-arm/usr/lib/ \ | |
-L${NDK_HOME}/platforms/android-${API}/arch-arm/usr/lib/" \ | |
LIBS="-lc" | |
# Build | |
make |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment