Skip to content

Commit

Permalink
fix opus and zrtp, split sysroot for INC and LIB
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredh committed Feb 8, 2018
1 parent ecf56e9 commit 5e6b03e
Showing 1 changed file with 28 additions and 9 deletions.
37 changes: 28 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ endif


# Tools
SYSROOT := $(NDK_PATH)/sysroot
SYSROOT := $(NDK_PATH)/platforms/$(PLATFORM)/arch-arm
SYSROOT_INC := $(NDK_PATH)/sysroot
PREBUILT := $(NDK_PATH)/toolchains/arm-linux-androideabi-4.9/prebuilt
BIN := $(PREBUILT)/$(HOST_OS)/bin
CC := $(BIN)/arm-linux-androideabi-gcc
Expand All @@ -61,8 +62,8 @@ PWD := $(shell pwd)
# NOTE: use -isystem to avoid warnings in system header files
CFLAGS := \
-D__ANDROID_API__=$(API_LEVEL) \
-isystem $(SYSROOT)/usr/include/ \
-isystem $(SYSROOT)/usr/include/$(TRIPLE) \
-isystem $(SYSROOT_INC)/usr/include/ \
-isystem $(SYSROOT_INC)/usr/include/$(TRIPLE) \
-I$(PWD)/openssl/include \
-I$(PWD)/opus/include_opus \
-I$(PWD)/speex/include \
Expand Down Expand Up @@ -90,8 +91,10 @@ COMMON_FLAGS := CC=$(CC) \
EXTRA_CFLAGS="$(CFLAGS) -DANDROID" \
EXTRA_CXXFLAGS="$(CFLAGS) -DANDROID" \
EXTRA_LFLAGS="$(LFLAGS)" \
SYSROOT=$(SYSROOT)/usr \
SYSROOT_ALT= \
SYSROOT=$(SYSROOT_INC)/usr \
SYSROOT_ALT=$(SYSROOT)/usr \
HAVE_INTTYPES_H=1 \
HAVE_GETOPT=1 \
HAVE_LIBRESOLV= \
HAVE_RESOLV= \
HAVE_PTHREAD=1 \
Expand Down Expand Up @@ -176,7 +179,8 @@ clean:
OPENSSL_FLAGS := \
no-shared \
-D__ANDROID_API__=$(API_LEVEL) \
-I$(SYSROOT)/usr/include/$(TRIPLE)
-I$(SYSROOT_INC)/usr/include \
-I$(SYSROOT_INC)/usr/include/$(TRIPLE)

.PHONY: openssl
openssl:
Expand All @@ -187,13 +191,21 @@ openssl:
CROSS_SYSROOT="$(SYSROOT)" \
make build_libs


OPUS_CFLAGS := \
-D__ANDROID_API__=$(API_LEVEL) \
-isystem $(SYSROOT_INC)/usr/include/ \
-isystem $(SYSROOT_INC)/usr/include/$(TRIPLE) \
-march=armv7-a \
-fPIE

.PHONY: opus
opus:
cd opus && \
rm -rf include_opus && \
CC="$(CC) --sysroot $(SYSROOT)" \
RANLIB=$(RANLIB) AR=$(AR) PATH=$(BIN):$(PATH) \
./configure --host=arm-linux-androideabi --disable-shared CFLAGS="-march=armv7-a" && \
./configure --host=arm-linux-androideabi --disable-shared CFLAGS="$(OPUS_CFLAGS)" && \
CC="$(CC) --sysroot $(SYSROOT)" \
RANLIB=$(RANLIB) AR=$(AR) PATH=$(BIN):$(PATH) \
make && \
Expand All @@ -211,17 +223,24 @@ speex:
RANLIB=$(RANLIB) AR=$(AR) PATH=$(BIN):$(PATH) \
make

ZRTP_CFLAGS := \
-D__ANDROID_API__=$(API_LEVEL) \
-isystem $(SYSROOT_INC)/usr/include/ \
-isystem $(SYSROOT_INC)/usr/include/$(TRIPLE) \
-march=armv7-a \
-fPIE

.PHONY: zrtp
zrtp:
cd libzrtp && \
./bootstrap.sh && \
CC="$(CC) --sysroot $(SYSROOT)" \
RANLIB=$(RANLIB) AR=$(AR) PATH=$(BIN):$(PATH) \
./configure --host=arm-linux-androideabi CFLAGS="-march=armv7-a" && \
./configure --host=arm-linux-androideabi CFLAGS="$(ZRTP_CFLAGS)" && \
cd third_party/bnlib/ && \
CC="$(CC) --sysroot $(SYSROOT)" \
RANLIB=$(RANLIB) AR=$(AR) PATH=$(BIN):$(PATH) \
./configure --host=arm-linux-androideabi CFLAGS="-march=armv7-a" && \
./configure --host=arm-linux-androideabi CFLAGS="$(ZRTP_CFLAGS)" && \
cd ../.. && \
CC="$(CC) --sysroot $(SYSROOT)" \
RANLIB=$(RANLIB) AR=$(AR) PATH=$(BIN):$(PATH) \
Expand Down

0 comments on commit 5e6b03e

Please sign in to comment.