Skip to content

Commit

Permalink
Added iOS & Android builds for protobuf 3.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoabinader committed Mar 13, 2018
1 parent c5a7745 commit ce92f75
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 10 deletions.
40 changes: 32 additions & 8 deletions scripts/protobuf/3.4.1/.travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,43 @@
language: generic
sudo: false

matrix:
include:
- os: osx
osx_image: xcode8.2
compiler: clang
- os: osx
env: MASON_PLATFORM=ios
osx_image: xcode8.2
compiler: clang
- os: linux
- os: linux
env: MASON_PLATFORM=android MASON_ANDROID_ABI=arm-v5
- os: linux
env: MASON_PLATFORM=android MASON_ANDROID_ABI=arm-v7
- os: linux
sudo: false
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- libstdc++-4.9-dev
env: MASON_PLATFORM=android MASON_ANDROID_ABI=arm-v8
- os: linux
env: MASON_PLATFORM=android MASON_ANDROID_ABI=x86
- os: linux
env: MASON_PLATFORM=android MASON_ANDROID_ABI=x86-64
- os: linux
env: MASON_PLATFORM=android MASON_ANDROID_ABI=mips
- os: linux
env: MASON_PLATFORM=android MASON_ANDROID_ABI=mips-64

addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- libstdc++-4.9-dev
- libstdc++6

script:
- |
if [[ ${MASON_PLATFORM} == 'ios' ]] || [[ ${MASON_PLATFORM} == 'android' ]]; then
MASON_PLATFORM= MASON_ANDROID_ABI= ./mason install ${MASON_NAME} ${MASON_VERSION}
export PATH=`MASON_PLATFORM= MASON_ANDROID_ABI= ./mason prefix ${MASON_NAME} ${MASON_VERSION}`/bin:$PATH
fi
- ./mason build ${MASON_NAME} ${MASON_VERSION}
- ./mason publish ${MASON_NAME} ${MASON_VERSION}
29 changes: 27 additions & 2 deletions scripts/protobuf/3.4.1/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@

MASON_NAME=protobuf
MASON_VERSION=3.4.1
MASON_LIB_FILE=lib/libprotobuf-lite.a
MASON_PKGCONFIG_FILE=lib/pkgconfig/protobuf-lite.pc

if [ ${MASON_PLATFORM} == 'ios' ]; then
MASON_LIB_FILE=lib-isim-i386/libprotobuf-lite.a
MASON_PKGCONFIG_FILE=lib-isim-i386/pkgconfig/protobuf-lite.pc
else
MASON_LIB_FILE=lib/libprotobuf-lite.a
MASON_PKGCONFIG_FILE=lib/pkgconfig/protobuf-lite.pc
fi

. ${MASON_DIR}/mason.sh

Expand All @@ -21,9 +27,28 @@ function mason_compile {
# note CFLAGS overrides defaults (-O2 -g -DNDEBUG) so we need to add optimization flags back
export CFLAGS="${CFLAGS} -O3 -DNDEBUG"
export CXXFLAGS="${CXXFLAGS} -O3 -DNDEBUG"

if [ ${MASON_PLATFORM} == 'android' ]; then
export LDFLAGS="${LDFLAGS} -llog"
fi

export PROTOBUF_XC_ARG=""
if [ ${MASON_PLATFORM} == 'android' ] || [ ${MASON_PLATFORM} == 'ios' ]; then
export PROTOBUF_XC_ARG="${PROTOBUF_XC_ARG} --with-protoc=protoc"
fi

if [ ${MASON_PLATFORM} == 'ios' ]; then
export MACOSX_DEPLOYMENT_TARGET="10.8"
fi

if [ -f Makefile ]; then
make distclean
fi

./configure \
--prefix=${MASON_PREFIX} \
${MASON_HOST_ARG} \
${PROTOBUF_XC_ARG} \
--enable-static --disable-shared \
--disable-debug --without-zlib \
--disable-dependency-tracking
Expand Down

0 comments on commit ce92f75

Please sign in to comment.