├── libprotobuf-lite.a ├── README.md ├── Android.mk ├── ios-config.sh └── config.h /libprotobuf-lite.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dinote/protobuf-mobile-build/HEAD/libprotobuf-lite.a -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | protobuf-mobile-build 2 | ===================== 3 | 4 | iOS/Android build for Protocol Buffer library -------------------------------------------------------------------------------- /Android.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009 The Android Open Source Project 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # 16 | 17 | LOCAL_PATH := $(call my-dir) 18 | include $(CLEAR_VARS) 19 | 20 | CC_LITE_SRC_FILES := \ 21 | src/google/protobuf/stubs/common.cc \ 22 | src/google/protobuf/stubs/once.cc \ 23 | src/google/protobuf/extension_set.cc \ 24 | src/google/protobuf/generated_message_util.cc \ 25 | src/google/protobuf/message_lite.cc \ 26 | src/google/protobuf/repeated_field.cc \ 27 | src/google/protobuf/wire_format_lite.cc \ 28 | src/google/protobuf/io/coded_stream.cc \ 29 | src/google/protobuf/io/zero_copy_stream.cc \ 30 | src/google/protobuf/io/zero_copy_stream_impl_lite.cc 31 | 32 | 33 | # C++ lite library 34 | # ======================================================= 35 | 36 | LOCAL_MODULE := protobuf_lite_static 37 | LOCAL_MODULE_FILENAME := libprotobuf_lite 38 | 39 | LOCAL_CPP_EXTENSION := .cc 40 | 41 | LOCAL_SRC_FILES := \ 42 | $(CC_LITE_SRC_FILES) 43 | 44 | 45 | LOCAL_C_INCLUDES := \ 46 | $(LOCAL_PATH)/android \ 47 | bionic \ 48 | $(LOCAL_PATH)/src \ 49 | $(JNI_H_INCLUDE) 50 | 51 | LOCAL_SHARED_LIBRARIES := \ 52 | libz libcutils libutils 53 | LOCAL_LDLIBS := -lz 54 | # stlport conflicts with the host stl library 55 | ifneq ($(TARGET_SIMULATOR),true) 56 | LOCAL_C_INCLUDES += external/stlport/stlport 57 | LOCAL_SHARED_LIBRARIES += libstlport 58 | endif 59 | 60 | LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/src 61 | 62 | LOCAL_CFLAGS := -DGOOGLE_PROTOBUF_NO_RTTI 63 | 64 | include $(BUILD_STATIC_LIBRARY) -------------------------------------------------------------------------------- /ios-config.sh: -------------------------------------------------------------------------------- 1 | configure_for_platform() { 2 | export PLATFORM=$1 3 | #export PLATFORM=iPhoneOS 4 | echo "Platform is ${PLATFORM}" 5 | 6 | if [ "$PLATFORM" == "iPhoneSimulator" ]; then 7 | export ARCHITECTURE=i386 8 | export ARCH=i686-apple-darwin10 9 | fi 10 | 11 | if [ "$PLATFORM" == "iPhoneOS" ]; then 12 | export ARCHITECTURE=$2 13 | export ARCH=arm-apple-darwin10 14 | fi 15 | 16 | export ARCH_PREFIX=$ARCH- 17 | export SDKVER="6.0" 18 | export DEVROOT=/Applications/Xcode.app/Contents/Developer/Platforms/${PLATFORM}.platform/Developer 19 | export SDKROOT="$DEVROOT/SDKs/${PLATFORM}$SDKVER.sdk" 20 | export PKG_CONFIG_PATH="$SDKROOT/usr/lib/pkgconfig:$DEVROOT/usr/lib/pkgconfig" 21 | export AS="$DEVROOT/usr/bin/as" 22 | export ASCPP="$DEVROOT/usr/bin/as" 23 | export AR="$DEVROOT/usr/bin/ar" 24 | export RANLIB="$DEVROOT/usr/bin/ranlib" 25 | #export CPP="$DEVROOT/usr/bin/c++" 26 | #export CXXCPP="$DEVROOT/usr/bin/c++" 27 | export CC="$DEVROOT/usr/bin/gcc" 28 | export CXX="$DEVROOT/usr/bin/g++" 29 | export LD="$DEVROOT/usr/bin/ld" 30 | export STRIP="$DEVROOT/usr/bin/strip" 31 | export LIBRARY_PATH="$SDKROOT/usr/lib" 32 | 33 | export CPPFLAGS="" 34 | #export CFLAGS="-arch armv7 -fmessage-length=0 -pipe -fpascal-strings -miphoneos-version-min=4.0 -isysroot=$SDKROOT -I$SDKROOT/usr/include -I$SDKROOT/usr/include/c++/4.2.1/" 35 | export CFLAGS="-arch ${ARCHITECTURE} -fmessage-length=0 -pipe -fpascal-strings -miphoneos-version-min=4.0 -isysroot=$SDKROOT -I$SDKROOT/usr/include -I$SDKROOT/usr/include/c++/4.2.1/" 36 | export CXXFLAGS="$CFLAGS" 37 | #export LDFLAGS="-isysroot='$SDKROOT' -L$SDKROOT/usr/lib/system -L$SDKROOT/usr/lib/" 38 | export LDFLAGS="-arch ${ARCHITECTURE} -isysroot='$SDKROOT' -L$SDKROOT/usr/lib/system -L$SDKROOT/usr/lib/" 39 | 40 | ./configure --host=${ARCH} --with-protoc=protoc --enable-static --disable-shared 41 | } 42 | 43 | 44 | mkdir ios-build 45 | 46 | #build for iPhoneSimulator 47 | configure_for_platform iPhoneSimulator 48 | make clean 49 | make 50 | cp src/.libs/libprotobuf-lite.a ios-build/libprotobuf-lite-i386.a 51 | 52 | #build for iPhoneOS armv7 53 | configure_for_platform iPhoneOS armv7 54 | make clean 55 | make 56 | cp src/.libs/libprotobuf-lite.a ios-build/libprotobuf-lite-armv7.a 57 | 58 | #build for iPhoneOS armv7s 59 | configure_for_platform iPhoneOS armv7s 60 | make clean 61 | make 62 | cp src/.libs/libprotobuf-lite.a ios-build/libprotobuf-lite-armv7s.a 63 | 64 | make clean 65 | 66 | #cerate a fat library containing all achitectures in libprotobuf-lite.a 67 | xcrun -sdk iphoneos lipo -arch armv7 ios-build/libprotobuf-lite-armv7.a -arch armv7s ios-build/libprotobuf-lite-armv7s.a -arch i386 ios-build/libprotobuf-lite-i386.a -create -output ios-build/libprotobuf-lite.a 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /config.h: -------------------------------------------------------------------------------- 1 | /* config.h. Generated from config.h.in by configure. */ 2 | /* config.h.in. Generated from configure.ac by autoheader. */ 3 | 4 | /* the name of */ 5 | #define HASH_MAP_CLASS unordered_map 6 | 7 | /* the location of or */ 8 | #define HASH_MAP_H 9 | 10 | /* the namespace of hash_map/hash_set */ 11 | #define HASH_NAMESPACE std::tr1 12 | 13 | /* the name of */ 14 | #define HASH_SET_CLASS unordered_set 15 | 16 | /* the location of or */ 17 | #define HASH_SET_H 18 | 19 | /* Define to 1 if you have the header file. */ 20 | #define HAVE_DLFCN_H 1 21 | 22 | /* Define to 1 if you have the header file. */ 23 | #define HAVE_FCNTL_H 1 24 | 25 | /* Define to 1 if you have the `ftruncate' function. */ 26 | #define HAVE_FTRUNCATE 1 27 | 28 | /* define if the compiler has hash_map */ 29 | //#define HAVE_HASH_MAP 1 30 | 31 | /* define if the compiler has hash_set */ 32 | //#define HAVE_HASH_SET 1 33 | 34 | /* Define to 1 if you have the header file. */ 35 | #define HAVE_INTTYPES_H 1 36 | 37 | /* Define to 1 if you have the header file. */ 38 | #define HAVE_LIMITS_H 1 39 | 40 | /* Define to 1 if you have the header file. */ 41 | #define HAVE_MEMORY_H 1 42 | 43 | /* Define to 1 if you have the `memset' function. */ 44 | #define HAVE_MEMSET 1 45 | 46 | /* Define to 1 if you have the `mkdir' function. */ 47 | #define HAVE_MKDIR 1 48 | 49 | /* Define if you have POSIX threads libraries and header files. */ 50 | #define HAVE_PTHREAD 1 51 | 52 | /* Define to 1 if you have the header file. */ 53 | #define HAVE_STDINT_H 1 54 | 55 | /* Define to 1 if you have the header file. */ 56 | #define HAVE_STDLIB_H 1 57 | 58 | /* Define to 1 if you have the `strchr' function. */ 59 | #define HAVE_STRCHR 1 60 | 61 | /* Define to 1 if you have the `strerror' function. */ 62 | #define HAVE_STRERROR 1 63 | 64 | /* Define to 1 if you have the header file. */ 65 | #define HAVE_STRINGS_H 1 66 | 67 | /* Define to 1 if you have the header file. */ 68 | #define HAVE_STRING_H 1 69 | 70 | /* Define to 1 if you have the `strtol' function. */ 71 | #define HAVE_STRTOL 1 72 | 73 | /* Define to 1 if you have the header file. */ 74 | #define HAVE_SYS_STAT_H 1 75 | 76 | /* Define to 1 if you have the header file. */ 77 | #define HAVE_SYS_TYPES_H 1 78 | 79 | /* Define to 1 if you have the header file. */ 80 | #define HAVE_UNISTD_H 1 81 | 82 | /* Enable classes using zlib compression. */ 83 | #define HAVE_ZLIB 1 84 | 85 | /* Define to the sub-directory in which libtool stores uninstalled libraries. 86 | */ 87 | #define LT_OBJDIR ".libs/" 88 | 89 | /* Name of package */ 90 | #define PACKAGE "protobuf" 91 | 92 | /* Define to the address where bug reports for this package should be sent. */ 93 | #define PACKAGE_BUGREPORT "protobuf@googlegroups.com" 94 | 95 | /* Define to the full name of this package. */ 96 | #define PACKAGE_NAME "Protocol Buffers" 97 | 98 | /* Define to the full name and version of this package. */ 99 | #define PACKAGE_STRING "Protocol Buffers 2.4.1" 100 | 101 | /* Define to the one symbol short name of this package. */ 102 | #define PACKAGE_TARNAME "protobuf" 103 | 104 | /* Define to the home page for this package. */ 105 | #define PACKAGE_URL "" 106 | 107 | /* Define to the version of this package. */ 108 | #define PACKAGE_VERSION "2.4.1" 109 | 110 | /* Define to necessary symbol if this constant uses a non-standard name on 111 | your system. */ 112 | /* #undef PTHREAD_CREATE_JOINABLE */ 113 | 114 | /* Define to 1 if you have the ANSI C header files. */ 115 | #define STDC_HEADERS 1 116 | 117 | /* Enable extensions on AIX 3, Interix. */ 118 | #ifndef _ALL_SOURCE 119 | # define _ALL_SOURCE 1 120 | #endif 121 | /* Enable GNU extensions on systems that have them. */ 122 | #ifndef _GNU_SOURCE 123 | # define _GNU_SOURCE 1 124 | #endif 125 | /* Enable threading extensions on Solaris. */ 126 | #ifndef _POSIX_PTHREAD_SEMANTICS 127 | # define _POSIX_PTHREAD_SEMANTICS 1 128 | #endif 129 | /* Enable extensions on HP NonStop. */ 130 | #ifndef _TANDEM_SOURCE 131 | # define _TANDEM_SOURCE 1 132 | #endif 133 | /* Enable general extensions on Solaris. */ 134 | #ifndef __EXTENSIONS__ 135 | # define __EXTENSIONS__ 1 136 | #endif 137 | 138 | 139 | /* Version number of package */ 140 | #define VERSION "2.4.1" 141 | 142 | /* Define to 1 if on MINIX. */ 143 | /* #undef _MINIX */ 144 | 145 | /* Define to 2 if the system does not provide POSIX.1 features except with 146 | this defined. */ 147 | /* #undef _POSIX_1_SOURCE */ 148 | 149 | /* Define to 1 if you need to in order for `stat' and other things to work. */ 150 | /* #undef _POSIX_SOURCE */ 151 | --------------------------------------------------------------------------------