Home | History | Annotate | Download | only in ImageMagick
      1 #!/bin/bash
      2 
      3 set -e
      4 set -x
      5 
      6 if [ ! -d "$NDK" ]; then
      7   echo 'Please set $NDK to the path to NDK'
      8   exit 1
      9 fi
     10 
     11 cd $(dirname "$0")
     12 
     13 function RunConfigure() {
     14   HOST=$1
     15   TARGET=$2
     16   ARCH=$3
     17 
     18   TOOLCHAIN=${NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/
     19 
     20   export AR=${TOOLCHAIN}${HOST}-ar
     21   export AS=${TOOLCHAIN}${TARGET}-clang
     22   export CC=${TOOLCHAIN}${TARGET}-clang
     23   export CXX=${TOOLCHAIN}${TARGET}-clang++
     24   export LD=${TOOLCHAIN}${HOST}-ld
     25   export STRIP=${TOOLCHAIN}${HOST}-strip
     26 
     27   # Tell configure what flags Android requires.
     28   export CFLAGS="-fPIE -fPIC"
     29   export LDFLAGS="-pie"
     30 
     31   ./configure --host=${HOST}
     32 
     33   mkdir -p configs/${ARCH}/MagickCore
     34   mv MagickCore/version.h configs/${ARCH}/MagickCore/
     35   mv MagickCore/magick-baseconfig.h configs/${ARCH}/MagickCore/
     36 }
     37 
     38 RunConfigure "aarch64-linux-android" "aarch64-linux-android28" "arm64"
     39 RunConfigure "arm-linux-androideabi" "armv7a-linux-androideabi28" "arm"
     40 RunConfigure "i686-linux-android" "i686-linux-android28" "x86"
     41 RunConfigure "x86_64-linux-android" "x86_64-linux-android28" "x86-64"
     42