Merge branch 'master' of https://github.com/eighthave/orbot into hans_build_patches

Conflicts:
	external/Makefile
This commit is contained in:
Nathan Freitas 2014-01-02 13:49:33 -05:00
commit 0b024c9efa
2 changed files with 78 additions and 41 deletions

5
BUILD
View File

@ -16,6 +16,11 @@ Please install the following prerequisites (instructions for each follows):
You will need to run the 'android' command in the SDK to install the necessary Android platform supports (ICS 4.x or android-15) You will need to run the 'android' command in the SDK to install the necessary Android platform supports (ICS 4.x or android-15)
Be sure that you have all of the git submodules up-to-date:
git submodule init
git submodule update
To begin building, from the Orbot root directory, you first need to build all external C/native dependencies: To begin building, from the Orbot root directory, you first need to build all external C/native dependencies:
export NDK_BASE={PATH TO YOUR NDK INSTALL} export NDK_BASE={PATH TO YOUR NDK INSTALL}

110
external/Makefile vendored
View File

@ -5,54 +5,73 @@
# on Debian or Ubuntu # on Debian or Ubuntu
### these modify the calling shell ### these modify the calling shell
# point pkg-config to the .pc files generated from these builds
export PKG_CONFIG_PATH=$(LOCAL)/lib/pkgconfig
# workaround for cross-compiling bug in autoconf # workaround for cross-compiling bug in autoconf
export ac_cv_func_malloc_0_nonnull=yes export ac_cv_func_malloc_0_nonnull=yes
export ac_cv_func_setpgrp_void=yes export ac_cv_func_setpgrp_void=yes
CWD = $(shell pwd) EXTERNAL_ROOT := $(shell pwd)
PROJECT_ROOT = $(CWD)/..
EXTERNAL_ROOT = $(CWD)
# Android NDK setup: # Android now has 64-bit and 32-bit versions of the NDK for GNU/Linux. We
NDK_BASE ?= /usr/local/android-ndk # assume that the build platform uses the appropriate version, otherwise the
NDK_PLATFORM_LEVEL ?= 9 # user building this will have to manually set NDK_PROCESSOR or NDK_TOOLCHAIN.
NDK_TOOLCHAIN_VERSION=4.6 CPU := $(shell uname -m)
NDK_SYSROOT=$(NDK_BASE)/platforms/android-$(NDK_PLATFORM_LEVEL)/arch-arm ifeq ($(CPU),x86_64)
NDK_UNAME:=`uname -s | tr '[A-Z]' '[a-z]'` NDK_PROCESSOR=x86_64
NDK_PROCESSOR:=`uname -m` else
NDK_PROCESSOR=x86
endif
NDK_TOOLCHAIN=$(NDK_BASE)/toolchains/arm-linux-androideabi-4.6/prebuilt/$(NDK_UNAME)-$(NDK_PROCESSOR) # Android NDK setup
NDK_BASE ?= /opt/android-ndk
NDK_ABI=arm
APP_ABI=armeabi
# NDK platform level, aka APP_PLATFORM, is equivalent to minSdkVersion
APP_PLATFORM := android-$(shell sed -n 's,.*android:minSdkVersion="\([0-9][0-9]*\)".*,\1,p' \
$(EXTERNAL_ROOT)/../AndroidManifest.xml)
NDK_SYSROOT=$(NDK_BASE)/platforms/$(APP_PLATFORM)/arch-$(NDK_ABI)
NDK_TOOLCHAIN_VERSION=4.7
NDK_UNAME := $(shell uname -s | tr '[A-Z]' '[a-z]')
ifeq ($(NDK_ABI),x86)
HOST = i686-linux-android
NDK_TOOLCHAIN = $(NDK_ABI)-$(NDK_TOOLCHAIN_VERSION)
else
HOST = $(NDK_ABI)-linux-androideabi
NDK_TOOLCHAIN = $(HOST)-$(NDK_TOOLCHAIN_VERSION)
endif
NDK_TOOLCHAIN_BASE=$(NDK_BASE)/toolchains/$(NDK_TOOLCHAIN)/prebuilt/$(NDK_UNAME)-$(NDK_PROCESSOR)
# to use the real HOST tag, you need the latest libtool files: # include Android's build flags
# http://stackoverflow.com/questions/4594736/configure-does-not-recognize-androideabi TARGET_ARCH_ABI = $(APP_ABI)
#HOST := arm-none-linux-gnueabi include $(NDK_BASE)/toolchains/$(NDK_TOOLCHAIN)/setup.mk
HOST := arm-linux-androideabi
# install root for built files CC := $(NDK_TOOLCHAIN_BASE)/bin/$(HOST)-gcc --sysroot=$(NDK_SYSROOT)
DESTDIR = $(EXTERNAL_ROOT) CXX := $(NDK_TOOLCHAIN_BASE)/bin/$(HOST)-g++
# TODO try adding the Android-style /data/app.name here CPP := $(NDK_TOOLCHAIN_BASE)/bin/$(HOST)-cpp
prefix = LD := $(NDK_TOOLCHAIN_BASE)/bin/$(HOST)-ld
LOCAL := $(DESTDIR)$(prefix) AR := $(NDK_TOOLCHAIN_BASE)/bin/$(HOST)-ar
RANLIB := $(NDK_TOOLCHAIN_BASE)/bin/$(HOST)-ranlib
export PATH := ${PATH}:$(NDK_TOOLCHAIN)/bin:$(LOCAL)/bin STRIP := $(NDK_TOOLCHAIN_BASE)/bin/$(HOST)-strip \
CC := $(NDK_TOOLCHAIN)/bin/arm-linux-androideabi-gcc --sysroot=$(NDK_SYSROOT)
CXX := $(NDK_TOOLCHAIN)/bin/arm-linux-androideabi-g++
CPP := $(NDK_TOOLCHAIN)/bin/arm-linux-androideabi-cpp
LD := $(NDK_TOOLCHAIN)/bin/arm-linux-androideabi-ld
AR := $(NDK_TOOLCHAIN)/bin/arm-linux-androideabi-ar
RANLIB := $(NDK_TOOLCHAIN)/bin/arm-linux-androideabi-ranlib
STRIP := $(NDK_TOOLCHAIN)/bin/arm-linux-androideabi-strip \
--strip-unneeded -R .note -R .comment --strip-unneeded -R .note -R .comment
CFLAGS = -DANDROID -I$(LOCAL) -I$(LOCAL)/include -I$(NDK_SYSROOT)/usr/include CFLAGS = -DANDROID $(TARGET_CFLAGS)
LDFLAGS = -L$(LOCAL) -L$(LOCAL)/lib -L$(NDK_SYSROOT)/usr/lib LDFLAGS = -llog $(TARGET_LDFLAGS)
# build as small as possible, mostly useful for static binaries # change 'release' to 'debug' for unoptimized debug builds
CFLAGS += -fdata-sections -ffunction-sections -Os ifeq ($(APP_ABI),armeabi-v7a)
LDFLAGS += -Wl,--gc-sections CFLAGS += $(TARGET_arm_release_CFLAGS)
endif
ifeq ($(APP_ABI),armeabi)
CFLAGS += $(TARGET_thumb_release_CFLAGS)
endif
.PHONY = clean showsetup \
assets assets-clean \
openssl-static openssl-static-clean \
libevent libevent-clean \
iptables iptables-clean \
tor tor-clean \
obfsproxy obfsproxy-clean \
privoxy privoxy-clean
all: assets all: assets
@ -169,7 +188,6 @@ tor/Makefile: tor/configure
LIBS="-L$(EXTERNAL_ROOT)/lib" CFLAGS="-I$(EXTERNAL_ROOT)/include -I$(EXTERNAL_ROOT)/include/event2" \ LIBS="-L$(EXTERNAL_ROOT)/lib" CFLAGS="-I$(EXTERNAL_ROOT)/include -I$(EXTERNAL_ROOT)/include/event2" \
./configure \ ./configure \
--host=$(HOST) \ --host=$(HOST) \
--prefix=$(NDK_TOOLCHAIN) \
--disable-asciidoc \ --disable-asciidoc \
--enable-static-libevent --with-libevent-dir=$(EXTERNAL_ROOT) \ --enable-static-libevent --with-libevent-dir=$(EXTERNAL_ROOT) \
--enable-static-openssl --with-openssl-dir=$(EXTERNAL_ROOT) \ --enable-static-openssl --with-openssl-dir=$(EXTERNAL_ROOT) \
@ -208,7 +226,6 @@ obfsproxy/Makefile:
libcrypto_LIBS="-L$(EXTERNAL_ROOT)/lib -lcrypto" libcrypto_CFLAGS="-I$(EXTERNAL_ROOT)/include" \ libcrypto_LIBS="-L$(EXTERNAL_ROOT)/lib -lcrypto" libcrypto_CFLAGS="-I$(EXTERNAL_ROOT)/include" \
./configure \ ./configure \
--host=$(HOST) \ --host=$(HOST) \
--prefix=$(NDK_TOOLCHAIN) \
obfsproxy-build-stamp: obfsproxy/Makefile obfsproxy-build-stamp: obfsproxy/Makefile
$(MAKE) -C obfsproxy $(MAKE) -C obfsproxy
@ -303,3 +320,18 @@ assets-clean:
# cleanup, cleanup, put the toys away # cleanup, cleanup, put the toys away
clean: openssl-clean libevent-clean tor-clean privoxy-clean jtorctl-clean assets-clean clean: openssl-clean libevent-clean tor-clean privoxy-clean jtorctl-clean assets-clean
#------------------------------------------------------------------------------#
# debugging stuff
showsetup:
@echo "NDK_TOOLCHAIN_VERSION: $(NDK_TOOLCHAIN_VERSION)"
@echo "NDK_TOOLCHAIN: $(NDK_TOOLCHAIN)"
@echo "NDK_SYSROOT: $(NDK_SYSROOT)"
@echo "APP_PLATFORM: $(APP_PLATFORM)"
@echo "APP_ABI: $(APP_ABI)"
@echo "HOST: $(HOST)"
@echo "CC: $(CC)"
@echo "LD: $(LD)"
@echo "CFLAGS: $(CFLAGS)"
@echo "LDFLAGS: $(LDFLAGS)"