From ec1f3ee564dfa6c7216bc80df678dcd7a021ceb1 Mon Sep 17 00:00:00 2001
From: Alexandre Lision <alexandre.lision@gmail.com>
Date: Mon, 4 Aug 2014 19:12:42 -0400
Subject: [PATCH] Adjustments on Makefile and compile

Refs: #52673
---
 Makefile   | 31 ++++++-------------------------
 compile.sh | 20 +++++++-------------
 2 files changed, 13 insertions(+), 38 deletions(-)

diff --git a/Makefile b/Makefile
index c453178a8..8d086d24f 100644
--- a/Makefile
+++ b/Makefile
@@ -5,11 +5,12 @@ export ANDROID_HOME=$(ANDROID_SDK)
 ARCH = $(ANDROID_ABI)
 
 SRC=sflphone-android
-JAVA_SOURCES=$(SRC)/src/org/sflphone/*.java
-JNI_SOURCES=$(SRC)/jni/*.c $(SRC)/jni/*.h
-
+export SFLPHONE_SRC=$(PWD)/sflphone
+LIBSFLPHONEJNI_H=sflphone/daemon/src/sflphone.h
 LIBSFLPHONEJNI=$(SRC)/obj/local/$(ARCH)/libsflphone.so
-LIBSFLPHONEJNI_H=$(SRC)/sflphone/daemon/src/sflphone.h
+
+JAVA_SOURCES=$(SRC)/src/org/sflphone/*.java
+JNI_SOURCES=$(SRC)/jni/*.cpp $(SRC)/jni/*.h
 
 ifneq ($(V),)
 ANT_OPTS += -v
@@ -40,23 +41,6 @@ $(SFLPHONE_APK): $(LIBSFLPHONEJNI) $(JAVA_SOURCES)
 	./gen-env.sh $(SRC)
 	$(VERBOSE)cd $(SRC) && ant $(ANT_OPTS) $(ANT_TARGET)
 
-SFLPHONE_MODULES=`./find_modules.sh $(SFLPHONE_BUILD_DIR)`
-
-$(LIBSFLPHONEJNI_H):
-	$(VERBOSE)if [ -z "$(SFLPHONE_BUILD_DIR)" ]; then echo "SFLPHONE_BUILD_DIR not defined" ; exit 1; fi
-	$(GEN)modules="$(SFLPHONE_MODULES)" ; \
-	if [ -z "$$modules" ]; then echo "No SFLPHONE modules found in $(SFLPHONE_BUILD_DIR)/modules"; exit 1; fi; \
-	DEFINITION=""; \
-	BUILTINS="const void *vlc_static_modules[] = {\n"; \
-	for file in $$modules; do \
-		name=`echo $$file | sed 's/.*\.libs\/lib//' | sed 's/_plugin\.a//'`; \
-		DEFINITION=$$DEFINITION"int vlc_entry__$$name (int (*)(void *, void *, int, ...), void *);\n"; \
-		BUILTINS="$$BUILTINS vlc_entry__$$name,\n"; \
-	done; \
-	BUILTINS="$$BUILTINS NULL\n};\n"; \
-	printf "/* Autogenerated from the list of modules */\n $$DEFINITION\n $$BUILTINS\n" > $@
-
-
 $(LIBSFLPHONEJNI): $(JNI_SOURCES) $(LIBSFLPHONEJNI_H)
 	@if [ -z "$(SFLPHONE_BUILD_DIR)" ]; then echo "SFLPHONE_BUILD_DIR not defined" ; exit 1; fi
 	@if [ -z "$(ANDROID_NDK)" ]; then echo "ANDROID_NDK not defined" ; exit 1; fi
@@ -65,9 +49,7 @@ $(LIBSFLPHONEJNI): $(JNI_SOURCES) $(LIBSFLPHONEJNI_H)
 	@echo
 	$(VERBOSE)if [ -z "$(SFLPHONE_SRC_DIR)" ] ; then SFLPHONE_SRC_DIR=./vlc; fi ; \
 	if [ -z "$(SFLPHONE_CONTRIB)" ] ; then SFLPHONE_CONTRIB="$$SFLPHONE_SRC_DIR/contrib/$(TARGET_TUPLE)"; fi ; \
-	vlc_modules="$(SFLPHONE_MODULES)" ; \
 	if [ `echo "$(SFLPHONE_BUILD_DIR)" | head -c 1` != "/" ] ; then \
-		vlc_modules="`echo $$vlc_modules|sed \"s|$(SFLPHONE_BUILD_DIR)|../$(SFLPHONE_BUILD_DIR)|g\"`" ; \
         SFLPHONE_BUILD_DIR="../$(SFLPHONE_BUILD_DIR)"; \
 	fi ; \
 	[ `echo "$$SFLPHONE_CONTRIB" | head -c 1` != "/" ] && SFLPHONE_CONTRIB="../$$SFLPHONE_CONTRIB"; \
@@ -76,7 +58,6 @@ $(LIBSFLPHONEJNI): $(JNI_SOURCES) $(LIBSFLPHONEJNI_H)
 		SFLPHONE_SRC_DIR="$$SFLPHONE_SRC_DIR" \
 		SFLPHONE_CONTRIB="$$SFLPHONE_CONTRIB" \
 		SFLPHONE_BUILD_DIR="$$SFLPHONE_BUILD_DIR" \
-		SFLPHONE_MODULES="$$vlc_modules" \
 		NDK_DEBUG=$(NDK_DEBUG) \
 		TARGET_CFLAGS="$$SFLPHONE_EXTRA_CFLAGS"
 
@@ -90,7 +71,7 @@ clean: lightclean
 	rm -rf $(SRC)/gen java-libs/*/gen java-libs/*/bin .sdk vlc-sdk/ vlc-sdk.7z
 
 jniclean: lightclean
-	rm -f $(LIBSFLPHONEJNI) $(LIBSFLPHONEJNI_H)
+	rm -f $(LIBSFLPHONEJNI)
 
 distclean: clean jniclean
 
diff --git a/compile.sh b/compile.sh
index a9f4cbdba..26e2698ce 100755
--- a/compile.sh
+++ b/compile.sh
@@ -96,7 +96,7 @@ ANDROID_PATH="`pwd`"
 if [ ! -z "$FETCH" ]
 then
     # 1/ libsflphone
-    TESTED_HASH=f4f162d3e503fad882f332d95386dbc04157d463
+    TESTED_HASH=855de64eca93b7a153c8c5c01f1dbcef6b64ecdc
     if [ ! -d "sflphone" ]; then
         echo "Ring source not found, cloning"
         git clone git@gitlab.savoirfairelinux.com:sfl-ports/sflphone.git sflphone
@@ -104,11 +104,11 @@ then
         echo android/ >> .git/info/exclude
         echo contrib/android/ >> .git/info/exclude
         #git checkout -B android ${TESTED_HASH}
-	git checkout contrib
+	    git checkout contrib
     else
         echo "Ring source found"
         cd sflphone
-	git checkout contrib
+	    git checkout contrib
 #        if ! git cat-file -e ${TESTED_HASH}; then
 #            cat << EOF
 #***
@@ -207,7 +207,7 @@ Cflags:" > contrib/${TARGET_TUPLE}/lib/pkgconfig/`echo $1|tr 'A-Z' 'a-z'`.pc
 mkdir -p contrib/${TARGET_TUPLE}/lib/pkgconfig
 
 cd contrib/contrib-android-${TARGET_TUPLE}
-../bootstrap --host=${TARGET_TUPLE} 
+../bootstrap --host=${TARGET_TUPLE}
 
 # Some libraries have arm assembly which won't build in thumb mode
 # We append -marm to the CFLAGS of these libs to disable thumb mode
@@ -228,12 +228,13 @@ echo "EXTRA_CFLAGS= -g ${EXTRA_CFLAGS}" >> config.mak
 export SFLPHONE_EXTRA_CFLAGS="${EXTRA_CFLAGS}"
 
 make install
+echo ${PWD}
 # We already have zlib available
 [ -e .zlib ] || (mkdir -p zlib; touch .zlib)
 which autopoint >/dev/null || make $MAKEFLAGS .gettext
 export PATH="$PATH:$PWD/../$TARGET_TUPLE/bin"
-make $MAKEFLAGS
 
+export SFLPHONE_BUILD_DIR=sflphone/build-android-${TARGET_TUPLE}
 ############
 # Make SFLPHONE #
 ############
@@ -248,6 +249,7 @@ else
         echo "Bootstraping"
         pushd ../../
         ./configure.sh
+        cd sflphone/daemon
         echo "Building"
         make $MAKEFLAGS
         popd
@@ -261,13 +263,6 @@ fi
 echo "Building Ring for Android"
 cd ../../
 
-export ANDROID_SYS_HEADERS_GINGERBREAD=${PWD}/android-headers-gingerbread
-export ANDROID_SYS_HEADERS_HC=${PWD}/android-headers-hc
-export ANDROID_SYS_HEADERS_ICS=${PWD}/android-headers-ics
-
-export ANDROID_LIBS=${PWD}/android-libs
-export SFLPHONE_BUILD_DIR=sflphone/build-android-${TARGET_TUPLE}
-
 make $CLEAN
 make -j1 TARGET_TUPLE=$TARGET_TUPLE PLATFORM_SHORT_ARCH=$PLATFORM_SHORT_ARCH CXXSTL=$CXXSTL RELEASE=$RELEASE $TARGET
 
@@ -305,7 +300,6 @@ export CXXSTL=$CXXSTL
 export ANDROID_SYS_HEADERS_GINGERBREAD=$ANDROID_SYS_HEADERS_GINGERBREAD
 export ANDROID_SYS_HEADERS_HC=$ANDROID_SYS_HEADERS_HC
 export ANDROID_SYS_HEADERS_ICS=$ANDROID_SYS_HEADERS_ICS
-export ANDROID_LIBS=$ANDROID_LIBS
 export SFLPHONE_BUILD_DIR=$PWD/sflphone/android
 export TARGET_TUPLE=$TARGET_TUPLE
 export PATH_HOST=$PATH_HOST
-- 
GitLab