Changeset 4bd0f06 for core


Ignore:
Timestamp:
Jun 5, 2019 5:13:15 PM (10 months ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
c01bf47
Parents:
aab6529
Message:

jbigi: Support android builds using NDK
Prep for GMP 6.1.2

Location:
core/c/jbigi
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • core/c/jbigi/build.sh

    raab6529 r4bd0f06  
    77#     Set $JAVA_HOME to point to your Java SDK
    88#     build.sh
    9 #       This script downloads gmp-4.3.2.tar.bz2 to this directory
    10 #       (if a different version, change the GMP_VER= line below)
     9#       This script downloads gmp-6.1.2.tar.bz2 to this directory
     10#       (if a different version, change the GMP_VER= line in download_gmp.sh)
    1111#
    1212#  To build a dynamic library (you must have a libgmp.so somewhere in your system)
  • core/c/jbigi/build_jbigi.sh

    raab6529 r4bd0f06  
    7878        LINKFLAGS="-shared -Wl,-soname,libjbigi.so"
    7979        LIBFILE="libjbigi.so";;
     80android)
     81        BUILD_OS="linux"
     82        if [ $BITS -eq 32 ]; then
     83            COMPILEFLAGS="-O2 -pedantic -fomit-frame-pointer -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a5 -fPIC -DPIC"
     84        else
     85            COMPILEFLAGS="-O2 -pedantic -march=armv8-a -Wa,--noexecstack -fPIC -DPIC"
     86        fi
     87        LINKFLAGS="-shared -Wl,-soname,libjbigi.so"
     88        INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include -I$JAVA_HOME/include/$BUILD_OS -I/usr/local/include"
     89        LIBFILE="libjbigi.so";;
    8090*)
    8191        echo "Unsupported system type."
     
    111121echo "Link: \"$CC $LINKFLAGS $INCLUDES -o $LIBFILE jbigi.o $INCLUDELIBS $STATICLIBS $LIBPATH\""
    112122$CC $LINKFLAGS $INCLUDES -o $LIBFILE jbigi.o $INCLUDELIBS $STATICLIBS $LIBPATH || exit 1
    113 
     123if [ ! -z "$STRIP" ]; then
     124    echo "Strip: \"$STRIP $LIBFILE\""
     125    $STRIP $LIBFILE
     126fi
    114127exit 0
  • core/c/jbigi/download_gmp.sh

    raab6529 r4bd0f06  
    11#!/bin/sh
     2#
     3#       This script downloads gmp-6.1.2.tar.bz2 to this directory
     4#       (if a different version, change the GMP_VER= line below)
     5#
    26
    37export GMP_VER=6.1.2
  • core/c/jbigi/mbuild-all.sh

    raab6529 r4bd0f06  
    5151# starting with k10 added for 6.0.0
    5252# As of GMP 6.0.0, libgmp 3,
    53 X86_64_PLATFORMS="coreisbr coreihwl coreibwl bobcat jaguar bulldozer piledriver steamroller excavator atom athlon64 core2 corei nano pentium4 k10 x86_64"
     53X86_64_PLATFORMS="skylake coreisbr coreihwl coreibwl bobcat jaguar bulldozer piledriver steamroller excavator atom athlon64 core2 corei nano pentium4 k10 x86_64"
    5454TRANSLATE_NAME_x86_64="none" # Rename x86_64 to none_64, since that is what NativeBigInteger refers to it as
    5555
     
    6666NETBSD_PLATFORMS="${FREEBSD_PLATFORMS} ${MISC_LINUX_PLATFORMS} ${MISC_NETBSD_PLATFORMS}"
    6767OPENBSD_PLATFORM="${X86_PLATFORMS} ${MISC_OPENBSD_PLATFORMS}"
     68
     69# Android
     70# https://developer.android.com/ndk/guides/other_build_systems
     71ANDROID_64_PLATFORMS="aarch64"
     72ANDROID_32_PLATFORMS="armv7a"
     73
    6874
    6975
     
    115121fi
    116122
    117 # FIXME -m32 and -m64 are only for x86
     123# Allow TARGET to be overridden (e.g. for use with cross compilers)
     124[ -z $TARGET ] && TARGET=$(uname -s |tr "[A-Z]" "[a-z]")
     125
    118126if [ $BITS -eq 32 ]; then
    119127  export ABI=32
    120   export CFLAGS="-m32"
    121   export LDFLAGS="-m32"
     128  if [ "$TARGET" != "android" ]; then
     129      export CFLAGS="-m32"
     130      export LDFLAGS="-m32"
     131  fi
    122132elif [ $BITS -eq 64 ]; then
    123133  export ABI=64
    124   export CFLAGS="-m64"
    125   export LDFLAGS="-m64"
     134  if [ "$TARGET" != "android" ]; then
     135      export CFLAGS="-m64"
     136      export LDFLAGS="-m64"
     137  fi
    126138else
    127139  printf "\aBITS value \"$BITS\" not valid, please select 32 or 64\n\a" >&2
     
    135147
    136148# Set the "_64" filname filename suffix for 64-bit builds
    137 if [ $BITS -ne 32 ]; then
     149if [ $BITS -ne 32 -a "$TARGET" != "android" ]; then
    138150    [ -z $SUFFIX ] && SUFFIX="_64"
    139151fi
    140 
    141 # Allow TARGET to be overridden (e.g. for use with cross compilers)
    142 [ -z $TARGET ] && TARGET=$(uname -s |tr "[A-Z]" "[a-z]")
    143152
    144153# Note, this line does not support windows (and needs to generate a win32/win64 string for that to work)
     
    190199#     esac
    191200#   ;;
     201  android)
     202    ANDROID_NDK=`realpath ../../../../android-ndk-r19c`
     203    export TOOLCHAIN=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64
     204    if [ $BITS -eq 32 ]; then
     205        HOST_CONFIGURE_FLAG=armv7a-linux-androideabi
     206        export AR=$TOOLCHAIN/bin/arm-linux-androideabi-ar
     207        export AS=$TOOLCHAIN/bin/arm-linux-androideabi-as
     208        export CC=$TOOLCHAIN/bin/armv7a-linux-androideabi16-clang
     209        export CXX=$TOOLCHAIN/bin/armv7a-linux-androideabi16-clang++
     210        export LD=$TOOLCHAIN/bin/arm-linux-androideabi-ld
     211        export RANLIB=$TOOLCHAIN/bin/arm-linux-androideabi-ranlib
     212        export STRIP=$TOOLCHAIN/bin/arm-linux-androideabi-strip
     213     else
     214        HOST_CONFIGURE_FLAG=aarch64-linux-android
     215        export AR=$TOOLCHAIN/bin/aarch64-linux-android-ar
     216        export AS=$TOOLCHAIN/bin/aarch64-linux-android-as
     217        export CC=$TOOLCHAIN/bin/aarch64-linux-android21-clang
     218        export CXX=$TOOLCHAIN/bin/aarch64-linux-android21-clang++
     219        export LD=$TOOLCHAIN/bin/aarch64-linux-android-ld
     220        export RANLIB=$TOOLCHAIN/bin/aarch64-linux-android-ranlib
     221        export STRIP=$TOOLCHAIN/bin/aarch64-linux-android-strip
     222     fi
     223    ;;
    192224  esac
    193225fi
     
    278310        esac
    279311        echo "Building ${TARGET} .sos for ${ARCH}";;
     312android)
     313        NAME="libjbigi"
     314        TYPE="so"
     315        if [ $BITS -eq 32 ]; then
     316            PLATFORM_LIST="${ANDROID_32_PLATFORMS}"
     317            ARCH="armv7a"
     318        else
     319            PLATFORM_LIST="${ANDROID_64_PLATFORMS}"
     320            ARCH="aarch64"
     321        fi
     322        echo "Building Android .so for ${PLATFORM_LIST}";;
    280323*)
    281324        echo "Unsupported build environment"
Note: See TracChangeset for help on using the changeset viewer.