Vignesh Venkatasubramanian | aaa3195 | 2023-04-25 12:37:09 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # This script will build dav1d for the default ABI targets supported by android. |
| 4 | # This script only works on linux. You must pass the path to the android NDK as |
| 5 | # a parameter to this script. |
| 6 | # |
| 7 | # Android NDK: https://developer.android.com/ndk/downloads |
| 8 | # |
| 9 | # The git tag below is known to work, and will occasionally be updated. Feel |
| 10 | # free to use a more recent commit. |
| 11 | |
James Zern | 41ed914 | 2023-07-14 16:45:33 -0700 | [diff] [blame] | 12 | set -e |
| 13 | |
Vignesh Venkatasubramanian | aaa3195 | 2023-04-25 12:37:09 -0700 | [diff] [blame] | 14 | if [ $# -ne 1 ]; then |
| 15 | echo "Usage: ${0} <path_to_android_ndk>" |
| 16 | exit 1 |
| 17 | fi |
Wan-Teh Chang | 6d64a8c | 2024-06-12 08:21:39 -0700 | [diff] [blame] | 18 | git clone -b 1.4.3 --depth 1 https://code.videolan.org/videolan/dav1d.git |
Vignesh Venkatasubramanian | aaa3195 | 2023-04-25 12:37:09 -0700 | [diff] [blame] | 19 | cd dav1d |
Vignesh Venkatasubramanian | aaa3195 | 2023-04-25 12:37:09 -0700 | [diff] [blame] | 20 | mkdir build |
| 21 | cd build |
| 22 | |
Vignesh Venkatasubramanian | b231410 | 2023-09-20 14:27:47 -0700 | [diff] [blame] | 23 | # This only works on linux and mac. |
| 24 | if [ "$(uname)" == "Darwin" ]; then |
| 25 | HOST_TAG="darwin" |
| 26 | else |
| 27 | HOST_TAG="linux" |
| 28 | fi |
| 29 | android_bin="${1}/toolchains/llvm/prebuilt/${HOST_TAG}-x86_64/bin" |
Vignesh Venkatasubramanian | aaa3195 | 2023-04-25 12:37:09 -0700 | [diff] [blame] | 30 | |
| 31 | ABI_LIST=("armeabi-v7a" "arm64-v8a" "x86" "x86_64") |
| 32 | ARCH_LIST=("arm" "aarch64" "x86" "x86_64") |
| 33 | for i in "${!ABI_LIST[@]}"; do |
| 34 | abi="${ABI_LIST[i]}" |
| 35 | mkdir "${abi}" |
| 36 | cd "${abi}" |
Wan-Teh Chang | ddd2414 | 2023-05-17 11:33:41 -0700 | [diff] [blame] | 37 | PATH=$PATH:${android_bin} meson setup --default-library=static --buildtype release \ |
Vignesh Venkatasubramanian | aaa3195 | 2023-04-25 12:37:09 -0700 | [diff] [blame] | 38 | --cross-file="../../package/crossfiles/${ARCH_LIST[i]}-android.meson" \ |
| 39 | -Denable_tools=false -Denable_tests=false ../.. |
| 40 | PATH=$PATH:${android_bin} ninja |
| 41 | cd .. |
| 42 | done |
| 43 | |
| 44 | cd ../.. |