diff --git a/build.sh b/build.sh index ddf68d4..ec219f5 100755 --- a/build.sh +++ b/build.sh @@ -22,8 +22,8 @@ fi export CLANG=1 -if [ ! $ARCHS ]; then - ARCHS='armeabi armeabi-v7a arm64-v8a x86 x86_64' +if [ -z "$ARCHS" ]; then + ARCHS='arm64-v8a armeabi-v7a x86 x86_64' fi for ARCH in $ARCHS; do @@ -36,21 +36,6 @@ echo "ARCH $ARCH GCCPREFIX $GCCPREFIX" mkdir -p $ARCH cd $BUILDDIR/$ARCH -# =========== libandroid_support.a =========== - -[ -e libandroid_support.a ] || { - mkdir -p android_support - cd android_support - ln -sf $NDK/sources/android/support jni - - #ndk-build -j$NCPU APP_ABI=$ARCH APP_MODULES=android_support LIBCXX_FORCE_REBUILD=true CLANG=1 || exit 1 - #cp -f obj/local/$ARCH/libandroid_support.a ../ - ln -sf $NDK/sources/cxx-stl/llvm-libc++/libs/$ARCH/libandroid_support.a ../ - -} || exit 1 - -cd $BUILDDIR/$ARCH - # =========== libiconv.so =========== [ -e libiconv.so ] || [ $SKIP_ICONV ] || { @@ -68,8 +53,8 @@ cd $BUILDDIR/$ARCH sed -i,tmp 's/MB_CUR_MAX/1/g' lib/loop_wchar.h - env CFLAGS="-I$NDK/sources/android/support/include -D_IO_getc=getc" \ - LDFLAGS="-L$BUILDDIR/$ARCH -landroid_support" \ + env CFLAGS="-D_IO_getc=getc" \ + LDFLAGS="-L$BUILDDIR/$ARCH" \ $BUILDDIR/setCrossEnvironment-$ARCH.sh \ ./configure \ --host=$GCCPREFIX \ @@ -83,7 +68,7 @@ cd $BUILDDIR/$ARCH env PATH=`pwd`:$PATH \ $BUILDDIR/setCrossEnvironment-$ARCH.sh \ - sh -c '$LD $CFLAGS $LDFLAGS -shared libcharset/lib/.libs/*.o -o libcharset/lib/.libs/libcharset.so' || exit 1 + sh -c '$LD $CFLAGS $LDFLAGS -shared -Wl,-soname=libcharset.so libcharset/lib/.libs/*.o -o libcharset/lib/.libs/libcharset.so' || exit 1 env PATH=`pwd`:$PATH \ $BUILDDIR/setCrossEnvironment-$ARCH.sh \ @@ -91,7 +76,7 @@ cd $BUILDDIR/$ARCH env PATH=`pwd`:$PATH \ $BUILDDIR/setCrossEnvironment-$ARCH.sh \ - sh -c '$LD $CFLAGS $LDFLAGS -shared lib/.libs/*.o -o lib/.libs/libiconv.so' || exit 1 + sh -c '$LD $CFLAGS $LDFLAGS -shared -Wl,-soname=libiconv.so lib/.libs/*.o -o lib/.libs/libiconv.so' || exit 1 env PATH=`pwd`:$PATH \ $BUILDDIR/setCrossEnvironment-$ARCH.sh \ @@ -99,6 +84,9 @@ cd $BUILDDIR/$ARCH cp -f lib/.libs/libiconv.so preload/preloadable_libiconv.so + echo 'all install:' > src/Makefile + echo ' touch $@' >> src/Makefile + env PATH=`pwd`:$PATH \ $BUILDDIR/setCrossEnvironment-$ARCH.sh \ make V=1 || exit 1 @@ -110,6 +98,8 @@ cd $BUILDDIR/$ARCH cd .. for f in libiconv libcharset; do + cp -f lib64/$f.so ./ # libtool invents new dumb places to install libraries to + cp -f lib32/$f.so ./ cp -f lib/$f.so ./ $BUILDDIR/setCrossEnvironment-$ARCH.sh \ sh -c '$STRIP'" $f.so" @@ -131,9 +121,9 @@ cd $BUILDDIR/$ARCH sed -i,tmp 's/ld_shlibs=no/ld_shlibs=yes/g' ./configure - env CFLAGS="-I$NDK/sources/android/support/include -frtti -fexceptions -I$BUILDDIR/$ARCH/include" \ + env CFLAGS="-frtti -fexceptions -I$BUILDDIR/$ARCH/include" \ LDFLAGS="-frtti -fexceptions -L$BUILDDIR/$ARCH/lib" \ - LIBS="-L$BUILDDIR/$ARCH -landroid_support" \ + LIBS="-L$BUILDDIR/$ARCH" \ $BUILDDIR/setCrossEnvironment-$ARCH.sh \ ./configure \ --host=$GCCPREFIX \ @@ -160,6 +150,8 @@ cd $BUILDDIR/$ARCH $BUILDDIR/setCrossEnvironment-$ARCH.sh \ make V=1 install || exit 1 + mkdir -p ../lib + env PATH=`pwd`:$PATH \ $BUILDDIR/setCrossEnvironment-$ARCH.sh \ sh -c '$AR rcs ../lib/libharfbuzz.a src/.libs/*.o src/hb-ucdn/.libs/*.o' || exit 1 @@ -176,7 +168,7 @@ cd $BUILDDIR/$ARCH rm -rf icu - tar xvf ../icu4c-59_1-src.tgz + tar xvf ../icu4c-62_1-src.tgz # The ENVVAR LIBSUFFIX should add the suffix only to the libname and not to the symbols. # ToDo: Find the right way in Swift to refer to an alternative library with symbol prefixing or any other method to @@ -187,9 +179,6 @@ cd $BUILDDIR/$ARCH cd icu/source - cp -f $BUILDDIR/config.sub . - cp -f $BUILDDIR/config.guess . - [ -d cross ] || { mkdir cross cd cross @@ -198,8 +187,12 @@ cd $BUILDDIR/$ARCH cd .. } || exit 1 + cp -f $BUILDDIR/config.sub . + cp -f $BUILDDIR/config.guess . + sed -i,tmp "s@LD_SONAME *=.*@LD_SONAME =@g" config/mh-linux sed -i,tmp "s%ln -s *%cp -f \$(dir \$@)/%g" config/mh-linux + sed -i,tmp "s/#define U_OVERRIDE_CXX_ALLOCATION 1/#define U_OVERRIDE_CXX_ALLOCATION 0/g" common/unicode/uconfig.h if [ $SHARED_ICU ]; then libtype='--enable-shared --disable-static' @@ -207,10 +200,10 @@ cd $BUILDDIR/$ARCH libtype='--enable-static --disable-shared' fi - env CFLAGS="-I$NDK/sources/android/support/include -frtti -fexceptions" \ + env CFLAGS="-frtti -fexceptions" \ LDFLAGS="-frtti -fexceptions -L$BUILDDIR/$ARCH/lib" \ - LIBS="-L$BUILDDIR/$ARCH -landroid_support `$BUILDDIR/setCrossEnvironment-$ARCH.sh sh -c 'echo $LDFLAGS'`" \ - env ac_cv_func_strtod_l=no \ + LIBS="-L$BUILDDIR/$ARCH `$BUILDDIR/setCrossEnvironment-$ARCH.sh sh -c 'echo $LDFLAGS'`" \ + ac_cv_func_strtod_l=no \ $BUILDDIR/setCrossEnvironment-$ARCH.sh \ ./configure \ --host=$GCCPREFIX \ @@ -221,10 +214,6 @@ cd $BUILDDIR/$ARCH --with-data-packaging=archive \ || exit 1 -# ICULEHB_CFLAGS="-I$BUILDDIR/$ARCH/include" \ -# ICULEHB_LIBS="-licu-le-hb" \ -# --enable-layoutex \ - sed -i,tmp "s@^prefix *= *.*@prefix = .@" icudefs.mk || exit 1 env PATH=`pwd`:$PATH \ @@ -239,12 +228,14 @@ cd $BUILDDIR/$ARCH for f in libicudata$LIBSUFFIX libicutest$LIBSUFFIX libicui18n$LIBSUFFIX libicuio$LIBSUFFIX libicutu$LIBSUFFIX libicuuc$LIBSUFFIX; do if [ $SHARED_ICU ]; then + cp -f -H ../../lib64/$f.so ../../ # Maybe it's here, maybe not, who knows + cp -f -H ../../lib32/$f.so ../../ cp -f -H ../../lib/$f.so ../../ else + cp -f ../../lib64/$f.a ../../ # Different libtool versions do things differently + cp -f ../../lib32/$f.a ../../ cp -f ../../lib/$f.a ../../ fi - #$BUILDDIR/setCrossEnvironment-$ARCH.sh \ - # sh -c '$STRIP'" ../../$f.so" done } || exit 1 @@ -263,10 +254,16 @@ cd $BUILDDIR/$ARCH sed -i,tmp 's/ld_shlibs=no/ld_shlibs=yes/g' ./configure - env CFLAGS="-I$NDK/sources/android/support/include -frtti -fexceptions" \ + touch dummy.c + env PATH=`pwd`:$PATH \ + $BUILDDIR/setCrossEnvironment-$ARCH.sh \ + sh -c '$CC $CFLAGS -c dummy.c -o src/crtbegin_so.o' || exit 1 + cp -f src/crtbegin_so.o src/crtend_so.o + + env CFLAGS="-frtti -fexceptions" \ CXXFLAGS="-std=c++11" \ LDFLAGS="-frtti -fexceptions" \ - LIBS="-L$BUILDDIR/$ARCH -landroid_support" \ + LIBS="-L$BUILDDIR/$ARCH" \ HARFBUZZ_CFLAGS="-I$BUILDDIR/$ARCH/include/harfbuzz" \ HARFBUZZ_LIBS="-L$BUILDDIR/$ARCH/lib -lharfbuzz" \ ICU_CFLAGS="-I$BUILDDIR/$ARCH/include" \ @@ -347,6 +344,8 @@ EOF make V=1 install || exit 1 cd .. + cp -f lib64/libicu-le-hb.a ./ # Try every possibility + cp -f lib32/libicu-le-hb.a ./ cp -f lib/libicu-le-hb.a ./ } @@ -358,9 +357,9 @@ cd $BUILDDIR/$ARCH cd icu/source - env CFLAGS="-I$NDK/sources/android/support/include -frtti -fexceptions" \ + env CFLAGS="-frtti -fexceptions" \ LDFLAGS="-frtti -fexceptions -L$BUILDDIR/$ARCH/lib" \ - LIBS="-L$BUILDDIR/$ARCH -landroid_support `$BUILDDIR/setCrossEnvironment-$ARCH.sh sh -c 'echo $LDFLAGS'`" \ + LIBS="-L$BUILDDIR/$ARCH `$BUILDDIR/setCrossEnvironment-$ARCH.sh sh -c 'echo $LDFLAGS'`" \ ICULEHB_CFLAGS="-I$BUILDDIR/$ARCH/include/icu-le-hb" \ ICULEHB_LIBS="-licu-le-hb" \ $BUILDDIR/setCrossEnvironment-$ARCH.sh \ @@ -386,10 +385,7 @@ cd $BUILDDIR/$ARCH make V=1 install || exit 1 for f in libicudata libicutest libicui18n libicuio libicutu libicuuc libiculx; do - #cp -f -H ../../lib/$f.so ../../ - cp -f ../../lib/$f.a ../../ || exit 1 - #$BUILDDIR/setCrossEnvironment-$ARCH.sh \ - # sh -c '$STRIP'" ../../$f.so" + cp -f ../../lib/$f.a ../../ || cp -f ../../lib64/$f.a ../../ || cp -f ../../lib32/$f.a ../../ || exit 1 done } || exit 1 diff --git a/icu4c-59_1-src.tgz b/icu4c-62_1-src.tgz similarity index 68% rename from icu4c-59_1-src.tgz rename to icu4c-62_1-src.tgz index 14b8ac0..8a216e7 100644 Binary files a/icu4c-59_1-src.tgz and b/icu4c-62_1-src.tgz differ diff --git a/setCrossEnvironment-arm64-v8a.sh b/setCrossEnvironment-arm64-v8a.sh index 890e7cf..e7d79fa 100755 --- a/setCrossEnvironment-arm64-v8a.sh +++ b/setCrossEnvironment-arm64-v8a.sh @@ -16,9 +16,7 @@ elif uname -s | grep -i "windows" > /dev/null ; then fi #echo NDK $NDK -GCCPREFIX=aarch64-linux-android [ -z "$NDK_TOOLCHAIN_VERSION" ] && NDK_TOOLCHAIN_VERSION=4.9 -[ -z "$PLATFORMVER" ] && PLATFORMVER=android-21 LOCAL_PATH=`dirname $0` if which realpath > /dev/null ; then LOCAL_PATH=`realpath $LOCAL_PATH` @@ -26,70 +24,68 @@ else LOCAL_PATH=`cd $LOCAL_PATH && pwd` fi ARCH=arm64-v8a +GCCPREFIX=aarch64-linux-android +APILEVEL=21 CFLAGS=" --fexceptions --frtti +-g -ffunction-sections +-fdata-sections -funwind-tables -fstack-protector-strong --Wno-invalid-command-line-argument --Wno-unused-command-line-argument -no-canonical-prefixes --I$NDK/sources/cxx-stl/llvm-libc++/include --I$NDK/sources/cxx-stl/llvm-libc++abi/include --I$NDK/sources/android/support/include --DANDROID --Wa,--noexecstack -Wformat -Werror=format-security +-Oz -DNDEBUG --O2 --g --gcc-toolchain -$NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 --target -aarch64-none-linux-android --fpic ---sysroot $NDK/platforms/android-21/arch-arm64 --isystem $NDK/sysroot/usr/include --isystem $NDK/sysroot/usr/include/aarch64-linux-android --D__ANDROID_API__=21 +-fPIC $CFLAGS" CFLAGS="`echo $CFLAGS | tr '\n' ' '`" LDFLAGS=" +-fPIC +-g +-ffunction-sections +-fdata-sections +-Wl,--gc-sections +-funwind-tables +-fstack-protector-strong +-no-canonical-prefixes +-Oz +-Wl,--build-id +-Wl,--warn-shared-textrel +-Wl,--fatal-warnings +-Wl,--no-undefined +-Wl,-z,noexecstack +-Qunused-arguments +-Wl,-z,relro +-Wl,-z,now -shared ---sysroot $NDK/platforms/android-21/arch-arm64 -$NDK/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_static.a -$NDK/sources/cxx-stl/llvm-libc++abi/../llvm-libc++/libs/arm64-v8a/libc++abi.a -$NDK/sources/android/support/../../cxx-stl/llvm-libc++/libs/arm64-v8a/libandroid_support.a --latomic -Wl,--exclude-libs,libatomic.a --gcc-toolchain $NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 --target aarch64-none-linux-android -no-canonical-prefixes --Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings --lc -lm -lstdc++ +-landroid +-llog +-latomic +-lm $LDFLAGS" LDFLAGS="`echo $LDFLAGS | tr '\n' ' '`" -CC="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/clang" -CXX="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/clang++" +CC="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$GCCPREFIX$APILEVEL-clang" +CXX="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$GCCPREFIX$APILEVEL-clang++" CPP="$CC -E $CFLAGS" -env PATH=$NDK/toolchains/$GCCPREFIX-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin:$LOCAL_PATH:$PATH \ +env \ CFLAGS="$CFLAGS" \ CXXFLAGS="$CXXFLAGS $CFLAGS -frtti -fexceptions" \ LDFLAGS="$LDFLAGS" \ CC="$CC" \ CXX="$CXX" \ -RANLIB="$NDK/toolchains/$GCCPREFIX-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-ranlib" \ -LD="$CC" \ -AR="$NDK/toolchains/$GCCPREFIX-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-ar" \ +RANLIB="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$GCCPREFIX-ranlib" \ +LD="$CXX" \ +AR="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$GCCPREFIX-ar" \ CPP="$CPP" \ -NM="$NDK/toolchains/$GCCPREFIX-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-nm" \ -AS="$NDK/toolchains/$GCCPREFIX-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-as" \ -STRIP="$NDK/toolchains/$GCCPREFIX-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-strip" \ +NM="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$GCCPREFIX-nm" \ +AS="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$GCCPREFIX-as" \ +STRIP="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$GCCPREFIX-strip" \ "$@" diff --git a/setCrossEnvironment-armeabi-v7a.sh b/setCrossEnvironment-armeabi-v7a.sh index c735898..f68926e 100755 --- a/setCrossEnvironment-armeabi-v7a.sh +++ b/setCrossEnvironment-armeabi-v7a.sh @@ -16,9 +16,7 @@ elif uname -s | grep -i "windows" > /dev/null ; then fi #echo NDK $NDK -GCCPREFIX=arm-linux-androideabi [ -z "$NDK_TOOLCHAIN_VERSION" ] && NDK_TOOLCHAIN_VERSION=4.9 -[ -z "$PLATFORMVER" ] && PLATFORMVER=android-15 LOCAL_PATH=`dirname $0` if which realpath > /dev/null ; then LOCAL_PATH=`realpath $LOCAL_PATH` @@ -26,77 +24,75 @@ else LOCAL_PATH=`cd $LOCAL_PATH && pwd` fi ARCH=armeabi-v7a +GCCPREFIX=armv7a-linux-androideabi +BINUTILSPREFIX=arm-linux-androideabi +APILEVEL=16 CFLAGS=" --fexceptions --frtti +-g -ffunction-sections +-fdata-sections -funwind-tables -fstack-protector-strong --Wno-invalid-command-line-argument --Wno-unused-command-line-argument -no-canonical-prefixes --I$NDK/sources/cxx-stl/llvm-libc++/include --I$NDK/sources/cxx-stl/llvm-libc++abi/include --I$NDK/sources/android/support/include --DANDROID --Wa,--noexecstack +-mthumb -Wformat -Werror=format-security +-Oz -DNDEBUG --O2 --g --gcc-toolchain -$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 --target -armv7-none-linux-androideabi15 --march=armv7-a --mfloat-abi=softfp --mfpu=vfpv3-d16 --mthumb --fpic --fno-integrated-as ---sysroot $NDK/platforms/android-14/arch-arm --isystem $NDK/sysroot/usr/include --isystem $NDK/sysroot/usr/include/arm-linux-androideabi --D__ANDROID_API__=15 +-fPIC $CFLAGS" CFLAGS="`echo $CFLAGS | tr '\n' ' '`" LDFLAGS=" +-fPIC +-g +-ffunction-sections +-fdata-sections +-Wl,--gc-sections +-funwind-tables +-fstack-protector-strong +-no-canonical-prefixes +-mthumb +-Wformat +-Werror=format-security +-Oz +-DNDEBUG +-Wl,--build-id +-Wl,--warn-shared-textrel +-Wl,--fatal-warnings +-Wl,--no-undefined +-Wl,-z,noexecstack +-Qunused-arguments +-Wl,-z,relro +-Wl,-z,now -shared ---sysroot $NDK/platforms/android-14/arch-arm -$NDK/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_static.a -$NDK/sources/cxx-stl/llvm-libc++abi/../llvm-libc++/libs/armeabi-v7a/libc++abi.a -$NDK/sources/android/support/../../cxx-stl/llvm-libc++/libs/armeabi-v7a/libandroid_support.a -$NDK/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libunwind.a --latomic -Wl,--exclude-libs,libatomic.a --gcc-toolchain -$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 --no-canonical-prefixes -target armv7-none-linux-androideabi14 --Wl,--fix-cortex-a8 -Wl,--exclude-libs,libunwind.a -Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings --lc -lm -lstdc++ +-landroid +-llog +-latomic +-lm +-ldl $LDFLAGS" LDFLAGS="`echo $LDFLAGS | tr '\n' ' '`" -CC="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/clang" -CXX="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/clang++" +CC="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$GCCPREFIX$APILEVEL-clang" +CXX="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$GCCPREFIX$APILEVEL-clang++" CPP="$CC -E $CFLAGS" -env PATH=$NDK/toolchains/$GCCPREFIX-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin:$LOCAL_PATH:$PATH \ +env \ CFLAGS="$CFLAGS" \ CXXFLAGS="$CXXFLAGS $CFLAGS -frtti -fexceptions" \ LDFLAGS="$LDFLAGS" \ CC="$CC" \ CXX="$CXX" \ -RANLIB="$NDK/toolchains/$GCCPREFIX-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-ranlib" \ -LD="$CC" \ -AR="$NDK/toolchains/$GCCPREFIX-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-ar" \ +RANLIB="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$BINUTILSPREFIX-ranlib" \ +LD="$CXX" \ +AR="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$BINUTILSPREFIX-ar" \ CPP="$CPP" \ -NM="$NDK/toolchains/$GCCPREFIX-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-nm" \ -AS="$NDK/toolchains/$GCCPREFIX-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-as" \ -STRIP="$NDK/toolchains/$GCCPREFIX-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-strip" \ +NM="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$BINUTILSPREFIX-nm" \ +AS="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$BINUTILSPREFIX-as" \ +STRIP="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$BINUTILSPREFIX-strip" \ "$@" diff --git a/setCrossEnvironment-armeabi.sh b/setCrossEnvironment-armeabi.sh deleted file mode 100755 index f65d96f..0000000 --- a/setCrossEnvironment-armeabi.sh +++ /dev/null @@ -1,103 +0,0 @@ -#!/bin/sh - -IFS=' -' - -NDK=`which ndk-build` -NDK=`dirname $NDK` - -if uname -s | grep -i "linux" > /dev/null ; then - MYARCH=linux-$(arch) - NDK=`readlink -f $NDK` -elif uname -s | grep -i "darwin" > /dev/null ; then - MYARCH=darwin-x86_64 -elif uname -s | grep -i "windows" > /dev/null ; then - MYARCH=windows-x86_64 -fi - -#echo NDK $NDK -GCCPREFIX=arm-linux-androideabi -[ -z "$NDK_TOOLCHAIN_VERSION" ] && NDK_TOOLCHAIN_VERSION=4.9 -[ -z "$PLATFORMVER" ] && PLATFORMVER=android-15 -LOCAL_PATH=`dirname $0` -if which realpath > /dev/null ; then - LOCAL_PATH=`realpath $LOCAL_PATH` -else - LOCAL_PATH=`cd $LOCAL_PATH && pwd` -fi -ARCH=armeabi - - -CFLAGS=" --fexceptions --frtti --ffunction-sections --funwind-tables --fstack-protector-strong --Wno-invalid-command-line-argument --Wno-unused-command-line-argument --no-canonical-prefixes --I$NDK/sources/cxx-stl/llvm-libc++/include --I$NDK/sources/cxx-stl/llvm-libc++abi/include --I$NDK/sources/android/support/include --DANDROID --Wa,--noexecstack --Wformat --Werror=format-security --DNDEBUG --O2 --g --gcc-toolchain -$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 --target -armv5te-none-linux-androideabi14 --march=armv5te --mtune=xscale --msoft-float --mthumb --fpic --fno-integrated-as ---sysroot $NDK/platforms/android-14/arch-arm --isystem $NDK/sysroot/usr/include --isystem $NDK/sysroot/usr/include/arm-linux-androideabi --D__ANDROID_API__=14 -$CFLAGS" - -CFLAGS="`echo $CFLAGS | tr '\n' ' '`" - -LDFLAGS=" --shared ---sysroot $NDK/platforms/android-14/arch-arm -$NDK/sources/cxx-stl/llvm-libc++/libs/armeabi/libc++_static.a -$NDK/sources/cxx-stl/llvm-libc++abi/../llvm-libc++/libs/armeabi/libc++abi.a -$NDK/sources/android/support/../../cxx-stl/llvm-libc++/libs/armeabi/libandroid_support.a -$NDK/sources/cxx-stl/llvm-libc++/libs/armeabi/libunwind.a --latomic -Wl,--exclude-libs,libatomic.a --gcc-toolchain -$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 --no-canonical-prefixes -target armv5te-none-linux-androideabi14 --Wl,--exclude-libs,libunwind.a --Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings --lc -lm -lstdc++ -$LDFLAGS" - -LDFLAGS="`echo $LDFLAGS | tr '\n' ' '`" - -CC="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/clang" -CXX="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/clang++" -CPP="$CC -E $CFLAGS" - -env PATH=$NDK/toolchains/$GCCPREFIX-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin:$LOCAL_PATH:$PATH \ -CFLAGS="$CFLAGS" \ -CXXFLAGS="$CXXFLAGS $CFLAGS -frtti -fexceptions" \ -LDFLAGS="$LDFLAGS" \ -CC="$CC" \ -CXX="$CXX" \ -RANLIB="$NDK/toolchains/$GCCPREFIX-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-ranlib" \ -LD="$CC" \ -AR="$NDK/toolchains/$GCCPREFIX-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-ar" \ -CPP="$CPP" \ -NM="$NDK/toolchains/$GCCPREFIX-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-nm" \ -AS="$NDK/toolchains/$GCCPREFIX-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-as" \ -STRIP="$NDK/toolchains/$GCCPREFIX-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-strip" \ -"$@" diff --git a/setCrossEnvironment-x86.sh b/setCrossEnvironment-x86.sh index 456ab99..cb6f91a 100755 --- a/setCrossEnvironment-x86.sh +++ b/setCrossEnvironment-x86.sh @@ -16,9 +16,7 @@ elif uname -s | grep -i "windows" > /dev/null ; then fi #echo NDK $NDK -GCCPREFIX=i686-linux-android [ -z "$NDK_TOOLCHAIN_VERSION" ] && NDK_TOOLCHAIN_VERSION=4.9 -[ -z "$PLATFORMVER" ] && PLATFORMVER=android-15 LOCAL_PATH=`dirname $0` if which realpath > /dev/null ; then LOCAL_PATH=`realpath $LOCAL_PATH` @@ -26,73 +24,72 @@ else LOCAL_PATH=`cd $LOCAL_PATH && pwd` fi ARCH=x86 +GCCPREFIX=i686-linux-android +APILEVEL=16 CFLAGS=" --fexceptions --frtti +-g -ffunction-sections -funwind-tables +-fdata-sections -fstack-protector-strong --Wno-invalid-command-line-argument --Wno-unused-command-line-argument -no-canonical-prefixes --I$NDK/sources/cxx-stl/llvm-libc++/include --I$NDK/sources/cxx-stl/llvm-libc++abi/include --I$NDK/sources/android/support/include --DANDROID --Wa,--noexecstack -Wformat -Werror=format-security +-Oz -DNDEBUG --O2 --g --gcc-toolchain -$NDK/toolchains/x86-4.9/prebuilt/linux-x86_64 --target -i686-none-linux-android -fPIC --mstackrealign ---sysroot $NDK/platforms/android-14/arch-x86 --isystem $NDK/sysroot/usr/include --isystem $NDK/sysroot/usr/include/i686-linux-android --D__ANDROID_API__=15 $CFLAGS" CFLAGS="`echo $CFLAGS | tr '\n' ' '`" LDFLAGS=" +-fPIC +-g +-ffunction-sections +-fdata-sections +-Wl,--gc-sections +-funwind-tables +-fstack-protector-strong +-no-canonical-prefixes +-Wformat +-Werror=format-security +-Oz +-DNDEBUG +-Wl,--build-id +-Wl,--warn-shared-textrel +-Wl,--fatal-warnings +-Wl,--no-undefined +-Wl,-z,noexecstack +-Qunused-arguments +-Wl,-z,relro +-Wl,-z,now -shared ---sysroot $NDK/platforms/android-14/arch-x86 -$NDK/sources/cxx-stl/llvm-libc++/libs/x86/libc++_static.a -$NDK/sources/cxx-stl/llvm-libc++abi/../llvm-libc++/libs/x86/libc++abi.a -$NDK/sources/android/support/../../cxx-stl/llvm-libc++/libs/x86/libandroid_support.a --latomic -Wl,--exclude-libs,libatomic.a --gcc-toolchain -$NDK/toolchains/x86-4.9/prebuilt/linux-x86_64 --target i686-none-linux-android -no-canonical-prefixes --Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings --lc -lm -lstdc++ +-landroid +-llog +-latomic +-lm $LDFLAGS " LDFLAGS="`echo $LDFLAGS | tr '\n' ' '`" -CC="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/clang" -CXX="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/clang++" +CC="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$GCCPREFIX$APILEVEL-clang" +CXX="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$GCCPREFIX$APILEVEL-clang++" CPP="$CC -E $CFLAGS" -env PATH=$NDK/toolchains/$ARCH-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin:$LOCAL_PATH:$PATH \ +env \ CFLAGS="$CFLAGS" \ CXXFLAGS="$CXXFLAGS $CFLAGS -frtti -fexceptions" \ LDFLAGS="$LDFLAGS" \ CC="$CC" \ CXX="$CXX" \ -RANLIB="$NDK/toolchains/$ARCH-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-ranlib" \ -LD="$CC" \ -AR="$NDK/toolchains/$ARCH-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-ar" \ +RANLIB="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$GCCPREFIX-ranlib" \ +LD="$CXX" \ +AR="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$GCCPREFIX-ar" \ CPP="$CPP" \ -NM="$NDK/toolchains/$ARCH-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-nm" \ -AS="$NDK/toolchains/$ARCH-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-as" \ -STRIP="$NDK/toolchains/$ARCH-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-strip" \ +NM="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$GCCPREFIX-nm" \ +AS="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$GCCPREFIX-as" \ +STRIP="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$GCCPREFIX-strip" \ "$@" diff --git a/setCrossEnvironment-x86_64.sh b/setCrossEnvironment-x86_64.sh index 3abb6c9..a92e590 100755 --- a/setCrossEnvironment-x86_64.sh +++ b/setCrossEnvironment-x86_64.sh @@ -16,9 +16,7 @@ elif uname -s | grep -i "windows" > /dev/null ; then fi #echo NDK $NDK -GCCPREFIX=x86_64-linux-android [ -z "$NDK_TOOLCHAIN_VERSION" ] && NDK_TOOLCHAIN_VERSION=4.9 -[ -z "$PLATFORMVER" ] && PLATFORMVER=android-21 LOCAL_PATH=`dirname $0` if which realpath > /dev/null ; then LOCAL_PATH=`realpath $LOCAL_PATH` @@ -26,72 +24,72 @@ else LOCAL_PATH=`cd $LOCAL_PATH && pwd` fi ARCH=x86_64 +GCCPREFIX=x86_64-linux-android +APILEVEL=21 CFLAGS=" --fexceptions --frtti +-g -ffunction-sections +-fdata-sections -funwind-tables -fstack-protector-strong --Wno-invalid-command-line-argument --Wno-unused-command-line-argument -no-canonical-prefixes --I$NDK/sources/cxx-stl/llvm-libc++/include --I$NDK/sources/cxx-stl/llvm-libc++abi/include --I$NDK/sources/android/support/include --DANDROID --Wa,--noexecstack -Wformat -Werror=format-security +-Oz -DNDEBUG --O2 --g --gcc-toolchain -$NDK/toolchains/x86_64-4.9/prebuilt/linux-x86_64 --target -x86_64-none-linux-android -fPIC ---sysroot $NDK/platforms/android-21/arch-x86_64 --isystem $NDK/sysroot/usr/include --isystem $NDK/sysroot/usr/include/x86_64-linux-android --D__ANDROID_API__=21 $CFLAGS" CFLAGS="`echo $CFLAGS | tr '\n' ' '`" LDFLAGS=" +-fPIC +-g +-ffunction-sections +-fdata-sections +-Wl,--gc-sections +-funwind-tables +-fstack-protector-strong +-no-canonical-prefixes +-Wformat +-Werror=format-security +-Oz +-DNDEBUG +-Wl,--build-id +-Wl,--warn-shared-textrel +-Wl,--fatal-warnings +-Wl,--no-undefined +-Wl,-z,noexecstack +-Qunused-arguments +-Wl,-z,relro +-Wl,-z,now -shared ---sysroot $NDK/platforms/android-21/arch-x86_64 -$NDK/sources/cxx-stl/llvm-libc++/libs/x86_64/libc++_static.a -$NDK/sources/cxx-stl/llvm-libc++abi/../llvm-libc++/libs/x86_64/libc++abi.a -$NDK/sources/android/support/../../cxx-stl/llvm-libc++/libs/x86_64/libandroid_support.a --latomic -Wl,--exclude-libs,libatomic.a --gcc-toolchain -$NDK/toolchains/x86_64-4.9/prebuilt/linux-x86_64 --target x86_64-none-linux-android -no-canonical-prefixes --Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings --lc -lm -lstdc++ +-landroid +-llog +-latomic +-lm $LDFLAGS " LDFLAGS="`echo $LDFLAGS | tr '\n' ' '`" -CC="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/clang" -CXX="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/clang++" +CC="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$GCCPREFIX$APILEVEL-clang" +CXX="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$GCCPREFIX$APILEVEL-clang++" CPP="$CC -E $CFLAGS" -env PATH=$NDK/toolchains/$ARCH-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin:$LOCAL_PATH:$PATH \ +env \ CFLAGS="$CFLAGS" \ CXXFLAGS="$CXXFLAGS $CFLAGS -frtti -fexceptions" \ LDFLAGS="$LDFLAGS" \ CC="$CC" \ CXX="$CXX" \ -RANLIB="$NDK/toolchains/$ARCH-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-ranlib" \ -LD="$CC" \ -AR="$NDK/toolchains/$ARCH-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-ar" \ +RANLIB="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$GCCPREFIX-ranlib" \ +LD="$CXX" \ +AR="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$GCCPREFIX-ar" \ CPP="$CPP" \ -NM="$NDK/toolchains/$ARCH-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-nm" \ -AS="$NDK/toolchains/$ARCH-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-as" \ -STRIP="$NDK/toolchains/$ARCH-$NDK_TOOLCHAIN_VERSION/prebuilt/$MYARCH/bin/$GCCPREFIX-strip" \ +NM="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$GCCPREFIX-nm" \ +AS="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$GCCPREFIX-as" \ +STRIP="$NDK/toolchains/llvm/prebuilt/$MYARCH/bin/$GCCPREFIX-strip" \ "$@"