• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3set -e
4set -x
5
6if [ ! -d "$NDK" ]; then
7  echo 'Please set $NDK to the path to NDK'
8  exit 1
9fi
10
11cd $(dirname "$0")
12
13function 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} --without-zlib
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
38RunConfigure "aarch64-linux-android" "aarch64-linux-android28" "arm64"
39RunConfigure "arm-linux-androideabi" "armv7a-linux-androideabi28" "arm"
40RunConfigure "i686-linux-android" "i686-linux-android28" "x86"
41RunConfigure "x86_64-linux-android" "x86_64-linux-android28" "x86-64"
42