Skip to content

Commit

Permalink
Fix android build script for linux
Browse files Browse the repository at this point in the history
The build no longer uses libiconv but there were traces left. Also
boost patch had a typo for x86. With these changes, the build script
should work as expected.
  • Loading branch information
denizt committed Apr 25, 2016
1 parent 3070ca2 commit fee7bd3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 51 deletions.
8 changes: 3 additions & 5 deletions Build_android/boost-for-android-x86.patch
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,19 @@ index 40453f7..7ffc050 100755
;;
*)
echo "Undefined or not supported Android NDK version!"
@@ -392,6 +397,7 @@ echo "Building boost for android"
@@ -392,6 +397,6 @@ echo "Building boost for android"
export PATH=$AndroidBinariesPath:$PATH
export AndroidNDKRoot
export NO_BZIP2=1
+ export ICONV_PATH="`pwd`/../../libiconv/x86"

cxxflags=""
for flag in $CXXFLAGS; do cxxflags="$cxxflags cxxflags=$flag"; done
@@ -404,8 +410,12 @@ echo "Building boost for android"
@@ -404,8 +409,11 @@ echo "Building boost for android"
threading=multi \
--layout=versioned \
--prefix="./../$BUILD_DIR/" \
+ boost.locale.posix=off \
+ boost.locale.std=on \
+ boost.locale.iconv=on \
+ boost.locale.icu=off \
$LIBRARIES \
- install 2>&1 \
Expand Down Expand Up @@ -98,7 +96,7 @@ index 666d4c8..762753e 100644
+<linkflags>--sysroot=$(AndroidNDKRoot)/platforms/android-9/arch-x86
# @Moss - Above are the 'oficial' android flags
-<architecture>arm
+#<architecture>i686
+<architecture>i686
<compileflags>-fvisibility=hidden
<compileflags>-fvisibility-inlines-hidden
<compileflags>-fdata-sections
Expand Down
6 changes: 2 additions & 4 deletions Build_android/boost-for-android.patch
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,19 @@ index 40453f7..ad78ddf 100755
;;
*)
echo "Undefined or not supported Android NDK version!"
@@ -392,6 +397,7 @@ echo "Building boost for android"
@@ -392,6 +397,6 @@ echo "Building boost for android"
export PATH=$AndroidBinariesPath:$PATH
export AndroidNDKRoot
export NO_BZIP2=1
+ export ICONV_PATH="`pwd`/../../libiconv/armeabi-v7a"

cxxflags=""
for flag in $CXXFLAGS; do cxxflags="$cxxflags cxxflags=$flag"; done
@@ -404,8 +410,12 @@ echo "Building boost for android"
@@ -404,8 +409,11 @@ echo "Building boost for android"
threading=multi \
--layout=versioned \
--prefix="./../$BUILD_DIR/" \
+ boost.locale.posix=off \
+ boost.locale.std=on \
+ boost.locale.iconv=on \
+ boost.locale.icu=off \
$LIBRARIES \
- install 2>&1 \
Expand Down
45 changes: 3 additions & 42 deletions Build_android/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,15 @@ set -e
# Parse args
# -----------------

DO_LIBICONV=1
DO_BOOST=1
DO_OPENSSL=1
DO_CPPRESTSDK=1

function usage {
echo "Usage: $0 [--skip-boost] [--skip-openssl] [--skip-libiconv] [--skip-cpprestsdk] [-h] [--ndk <android-ndk>]"
echo "Usage: $0 [--skip-boost] [--skip-openssl] [--skip-cpprestsdk] [-h] [--ndk <android-ndk>]"
echo ""
echo " --skip-boost Skip fetching and compiling boost"
echo " --skip-openssl Skip fetching and compiling openssl"
echo " --skip-libiconv Skip fetching and compiling libiconv"
echo " --skip-cpprestsdk Skip compiling cpprestsdk"
echo " -h,--help,-? Display this information"
echo " --ndk <android-ndk> If specified, overrides the ANDROID_NDK environment variable"
Expand All @@ -59,9 +57,6 @@ do
"--skip-openssl")
DO_OPENSSL=0
;;
"--skip-libiconv")
DO_LIBICONV=0
;;
"--skip-cpprestsdk")
DO_CPPRESTSDK=0
;;
Expand Down Expand Up @@ -131,40 +126,6 @@ then
)
fi

# --------
# libiconv
# --------

# This steps are based on the blog post
# http://danilogiulianelli.blogspot.com/2012/12/how-to-cross-compile-libiconv-for.html
if [ "${DO_LIBICONV}" == "1" ]
then
(
if [ ! -e "libiconv-1.13.1.tar.gz" ]
then
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
fi
rm -rf libiconv
mkdir libiconv
cd libiconv
tar xzf ../libiconv-1.13.1.tar.gz
patch -b -p0 < "$DIR/libiconv/libiconv.patch"
cd libiconv-1.13.1
./configure
cp -r "$DIR/libiconv/jni" ..
cd ../jni
"${NDK_DIR}/ndk-build" || exit 1
cd ..
mkdir -p armeabi-v7a/include
mkdir -p armeabi-v7a/lib
mkdir -p x86/include
mkdir -p x86/lib
cp libiconv-1.13.1/include/iconv.h armeabi-v7a/include/
cp libiconv-1.13.1/include/iconv.h x86/include/
cp obj/local/x86/libiconv.a x86/lib/
cp obj/local/armeabi-v7a/libiconv.a armeabi-v7a/lib/
)
fi

# -----
# Boost
Expand All @@ -187,7 +148,7 @@ then
git apply "$DIR/boost-for-android.patch"
touch cpprestsdk.patched.stamp
fi
PATH="$PATH:$NDK_DIR" ./build-android.sh --boost=1.55.0 --with-libraries=locale,random,date_time,filesystem,system,thread,chrono "${NDK_DIR}" || exit 1
PATH="$PATH:$NDK_DIR" ./build-android.sh --boost=1.55.0 --with-libraries=atomic,locale,random,date_time,filesystem,system,thread,chrono "${NDK_DIR}" || exit 1
)

(
Expand All @@ -204,7 +165,7 @@ then
ln -s ../Boost-for-Android/boost_1_55_0.tar.bz2 .
touch cpprestsdk.patched.stamp
fi
PATH="$PATH:$NDK_DIR" ./build-android.sh --boost=1.55.0 --with-libraries=locale,random,date_time,filesystem,system,thread,chrono "${NDK_DIR}" || exit 1
PATH="$PATH:$NDK_DIR" ./build-android.sh --boost=1.55.0 --with-libraries=atomic,locale,random,date_time,filesystem,system,thread,chrono "${NDK_DIR}" || exit 1
)
)
fi
Expand Down

0 comments on commit fee7bd3

Please sign in to comment.