1#!/bin/bash 2# This is a convenience script to automate installation of libaom in MXE 3failMsg() 4{ 5 echo "** $1 **" 6 exit 1 7} 8 9#AOM_HOME=/home/eumagga/adm 10#MXE_ROOT=${AOM_HOME}/mxe 11 12MXE_ROOT="$1" 13 14if [ "x${MXE_ROOT}" = "x" ]; then 15 echo "Usage: $0 /path/to/MXE/root/directory" 16 exit 1 17fi 18if ! [ -d "${MXE_ROOT}" ]; then 19 failMsg "${MXE_ROOT} does not exist or is not a directory" 20fi 21if ! [ -f "${MXE_ROOT}/mxe.github.mk" ]; then 22 failMsg "${MXE_ROOT} does look like a MXE root directory" 23fi 24 25CROSS_PREFIX=x86_64-w64-mingw32.shared 26 27if [ "x${AOM_HOME}" = "x" ]; then 28 export AOM_HOME="$(pwd)" 29fi 30if ! [ -d "${AOM_HOME}" ]; then 31 failMsg "${AOM_HOME} does not exist or is not a directory" 32fi 33cd "${AOM_HOME}" 34if [ -d "${AOM_HOME}/aom" ] && ! [ -d "${AOM_HOME}/aom/.git" ]; then 35 echo "${AOM_HOME}/aom is not a git repository, will try to remove it" 36 rm -rf "${AOM_HOME}/aom" || failMsg "Cannot remove ${AOM_HOME}/aom" 37fi 38if ! [ -d "${AOM_HOME}/aom" ]; then 39 echo "Will clone aom source in ${AOM_HOME} directory" 40 git clone https://aomedia.googlesource.com/aom || failMsg "Failed cloning aom source" 41fi 42cd "${AOM_HOME}/aom" 43git checkout tags/v2.0.0 || failMsg "Cannot checkout v2.0.0" 44 45cd .. 46if [ -d build-aom ]; then 47 rm -rf build-aom || failMsg "Cannot remove old ${AOM_HOME}/build-aom directory" 48fi 49mkdir build-aom || failMsg "Cannot create ${AOM_HOME}/build-aom directory" 50cd build-aom 51 52export PATH=${PATH}:${MXE_ROOT}/usr/bin 53 54cmake ../aom/ \ 55 -DCROSS="${CROSS_PREFIX}-" \ 56 -DCMAKE_TOOLCHAIN_FILE=../aom/build/cmake/toolchains/x86_64-mingw-gcc.cmake \ 57 -DENABLE_DOCS=0 \ 58 -DENABLE_EXAMPLES=0 \ 59 -DENABLE_TOOLS=0 \ 60 -DBUILD_SHARED_LIBS=1 \ 61 -DCONFIG_AV1_ENCODER=0 \ 62 -DCONFIG_ANALYZER=0 \ 63 -DFORCE_HIGHBITDEPTH_DECODING=0 \ 64 -DCMAKE_INSTALL_PREFIX=${MXE_ROOT}/usr/${CROSS_PREFIX} || failMsg "Failed at cmake" 65make -j $(nproc) || failMsg "Failed at make" 66make install || failMsg "Failed at make install" 67DLL="${MXE_ROOT}/usr/${CROSS_PREFIX}/lib/libaom.dll" 68mv -v "${DLL}" "${MXE_ROOT}/usr/${CROSS_PREFIX}/bin/" || failMsg "Failed moving ${DLL} to ${MXE_ROOT}/usr/${CROSS_PREFIX}/bin/" 69echo "All done" 70exit 0 71