Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

Commit

Permalink
use build host and target host in build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
tanersener committed Feb 24, 2020
1 parent 4605e77 commit efe1c59
Show file tree
Hide file tree
Showing 87 changed files with 178 additions and 176 deletions.
2 changes: 1 addition & 1 deletion build/android-chromaprint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 28,7 @@ LIB_NAME="chromaprint"
set_toolchain_clang_paths ${LIB_NAME}

# PREPARING FLAGS
TARGET_HOST=$(get_target_host)
BUILD_HOST=$(get_build_host)
CFLAGS=$(get_cflags ${LIB_NAME})
CXXFLAGS=$(get_cxxflags ${LIB_NAME})
LDFLAGS=$(get_ldflags ${LIB_NAME})
Expand Down
24 changes: 12 additions & 12 deletions build/android-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 75,7 @@ get_arch_name() {
esac
}

get_target_host() {
get_build_host() {
case ${ARCH} in
arm-v7a | arm-v7a-neon)
echo "arm-linux-androideabi"
Expand Down Expand Up @@ -359,7 359,7 @@ get_cxxflags() {
}

get_common_linked_libraries() {
local COMMON_LIBRARY_PATHS="-L${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/${TARGET_HOST}/lib -L${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot/usr/lib/${TARGET_HOST}/${API} -L${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/lib"
local COMMON_LIBRARY_PATHS="-L${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/${BUILD_HOST}/lib -L${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot/usr/lib/${BUILD_HOST}/${API} -L${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/lib"

case $1 in
ffmpeg)
Expand Down Expand Up @@ -1003,16 1003,16 @@ download_gpl_library_source() {
set_toolchain_clang_paths() {
export PATH=$PATH:${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin

TARGET_HOST=$(get_target_host)
BUILD_HOST=$(get_build_host)

export AR=${TARGET_HOST}-ar
export AR=${BUILD_HOST}-ar
export CC=$(get_clang_target_host)-clang
export CXX=$(get_clang_target_host)-clang

if [ "$1" == "x264" ]; then
export AS=${CC}
else
export AS=${TARGET_HOST}-as
export AS=${BUILD_HOST}-as
fi

case ${ARCH} in
Expand All @@ -1021,9 1021,9 @@ set_toolchain_clang_paths() {
;;
esac

export LD=${TARGET_HOST}-ld
export RANLIB=${TARGET_HOST}-ranlib
export STRIP=${TARGET_HOST}-strip
export LD=${BUILD_HOST}-ld
export RANLIB=${BUILD_HOST}-ranlib
export STRIP=${BUILD_HOST}-strip

export INSTALL_PKG_CONFIG_DIR="${BASEDIR}/prebuilt/android-$(get_target_build)/pkgconfig"
export ZLIB_PACKAGE_CONFIG_PATH="${INSTALL_PKG_CONFIG_DIR}/zlib.pc"
Expand All @@ -1050,14 1050,14 @@ build_cpufeatures() {

set_toolchain_clang_paths "cpu-features"

TARGET_HOST=$(get_target_host)
BUILD_HOST=$(get_build_host)
export CFLAGS=$(get_cflags "cpu-features")
export CXXFLAGS=$(get_cxxflags "cpu-features")
export LDFLAGS=$(get_ldflags "cpu-features")

# THEN BUILD FOR THIS ABI
$(get_clang_target_host)-clang -c ${ANDROID_NDK_ROOT}/sources/android/cpufeatures/cpu-features.c -o ${ANDROID_NDK_ROOT}/sources/android/cpufeatures/cpu-features.o 1>>${BASEDIR}/build.log 2>&1
${TARGET_HOST}-ar rcs ${ANDROID_NDK_ROOT}/sources/android/cpufeatures/libcpufeatures.a ${ANDROID_NDK_ROOT}/sources/android/cpufeatures/cpu-features.o 1>>${BASEDIR}/build.log 2>&1
${BUILD_HOST}-ar rcs ${ANDROID_NDK_ROOT}/sources/android/cpufeatures/libcpufeatures.a ${ANDROID_NDK_ROOT}/sources/android/cpufeatures/cpu-features.o 1>>${BASEDIR}/build.log 2>&1
$(get_clang_target_host)-clang -shared ${ANDROID_NDK_ROOT}/sources/android/cpufeatures/cpu-features.o -o ${ANDROID_NDK_ROOT}/sources/android/cpufeatures/libcpufeatures.so 1>>${BASEDIR}/build.log 2>&1

create_cpufeatures_package_config
Expand All @@ -1076,13 1076,13 @@ build_android_lts_support() {
set_toolchain_clang_paths ${LIB_NAME}

# PREPARING FLAGS
TARGET_HOST=$(get_target_host)
BUILD_HOST=$(get_build_host)
CFLAGS=$(get_cflags ${LIB_NAME})
LDFLAGS=$(get_ldflags ${LIB_NAME})

# THEN BUILD FOR THIS ABI
$(get_clang_target_host)-clang ${CFLAGS} -Wno-unused-command-line-argument -c ${BASEDIR}/android/app/src/main/cpp/android_lts_support.c -o ${BASEDIR}/android/app/src/main/cpp/android_lts_support.o ${LDFLAGS} 1>>${BASEDIR}/build.log 2>&1
${TARGET_HOST}-ar rcs ${BASEDIR}/android/app/src/main/cpp/libandroidltssupport.a ${BASEDIR}/android/app/src/main/cpp/android_lts_support.o 1>>${BASEDIR}/build.log 2>&1
${BUILD_HOST}-ar rcs ${BASEDIR}/android/app/src/main/cpp/libandroidltssupport.a ${BASEDIR}/android/app/src/main/cpp/android_lts_support.o 1>>${BASEDIR}/build.log 2>&1
}

autoreconf_library() {
Expand Down
4 changes: 2 additions & 2 deletions build/android-expat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 28,7 @@ LIB_NAME="expat"
set_toolchain_clang_paths ${LIB_NAME}

# PREPARING FLAGS
TARGET_HOST=$(get_target_host)
BUILD_HOST=$(get_build_host)
export CFLAGS=$(get_cflags ${LIB_NAME})
export CXXFLAGS=$(get_cxxflags ${LIB_NAME})
export LDFLAGS=$(get_ldflags ${LIB_NAME})
Expand All @@ -51,7 51,7 @@ fi
--enable-static \
--disable-shared \
--disable-fast-install \
--host=${TARGET_HOST} || exit 1
--host=${BUILD_HOST} || exit 1

make -j$(get_cpu_count) || exit 1

Expand Down
4 changes: 2 additions & 2 deletions build/android-ffmpeg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 34,7 @@ LIB_NAME="ffmpeg"
set_toolchain_clang_paths ${LIB_NAME}

# PREPARING FLAGS
TARGET_HOST=$(get_target_host)
BUILD_HOST=$(get_build_host)
CFLAGS=$(get_cflags ${LIB_NAME})
CXXFLAGS=$(get_cxxflags ${LIB_NAME})
LDFLAGS=$(get_ldflags ${LIB_NAME})
Expand Down Expand Up @@ -341,7 341,7 @@ rm -f ${BASEDIR}/src/${LIB_NAME}/libswscale/aarch64/hscale.S 1>>${BASEDIR}/build
cp ${BASEDIR}/tools/make/ffmpeg/libswscale/aarch64/hscale.S ${BASEDIR}/src/${LIB_NAME}/libswscale/aarch64/hscale.S 1>>${BASEDIR}/build.log 2>&1

./configure \
--cross-prefix="${TARGET_HOST}-" \
--cross-prefix="${BUILD_HOST}-" \
--sysroot="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot" \
--prefix="${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME}" \
--pkg-config="${HOST_PKG_CONFIG_PATH}" \
Expand Down
4 changes: 2 additions & 2 deletions build/android-fontconfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 28,7 @@ LIB_NAME="fontconfig"
set_toolchain_clang_paths ${LIB_NAME}

# PREPARING FLAGS
TARGET_HOST=$(get_target_host)
BUILD_HOST=$(get_build_host)
export CFLAGS=$(get_cflags ${LIB_NAME})
export CXXFLAGS=$(get_cxxflags ${LIB_NAME})
export LDFLAGS=$(get_ldflags ${LIB_NAME})
Expand All @@ -55,7 55,7 @@ fi
--disable-rpath \
--disable-libxml2 \
--disable-docs \
--host=${TARGET_HOST} || exit 1
--host=${BUILD_HOST} || exit 1

make -j$(get_cpu_count) || exit 1

Expand Down
4 changes: 2 additions & 2 deletions build/android-freetype.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 28,7 @@ LIB_NAME="freetype"
set_toolchain_clang_paths ${LIB_NAME}

# PREPARING FLAGS
TARGET_HOST=$(get_target_host)
BUILD_HOST=$(get_build_host)
export CFLAGS=$(get_cflags ${LIB_NAME})
export CXXFLAGS=$(get_cxxflags ${LIB_NAME})
export LDFLAGS=$(get_ldflags ${LIB_NAME})
Expand Down Expand Up @@ -58,7 58,7 @@ export LIBPNG_LIBS="-L${BASEDIR}/prebuilt/android-$(get_target_build)/libpng/lib
--disable-shared \
--disable-fast-install \
--disable-mmap \
--host=${TARGET_HOST} || exit 1
--host=${BUILD_HOST} || exit 1

make -j$(get_cpu_count) || exit 1

Expand Down
4 changes: 2 additions & 2 deletions build/android-fribidi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 28,7 @@ LIB_NAME="fribidi"
set_toolchain_clang_paths ${LIB_NAME}

# PREPARING FLAGS
TARGET_HOST=$(get_target_host)
BUILD_HOST=$(get_build_host)
export CFLAGS=$(get_cflags ${LIB_NAME})
export CXXFLAGS=$(get_cxxflags ${LIB_NAME})
export LDFLAGS=$(get_ldflags ${LIB_NAME})
Expand All @@ -52,7 52,7 @@ fi
--disable-fast-install \
--disable-debug \
--disable-deprecated \
--host=${TARGET_HOST} || exit 1
--host=${BUILD_HOST} || exit 1

make -j$(get_cpu_count) || exit 1

Expand Down
4 changes: 2 additions & 2 deletions build/android-giflib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 28,7 @@ LIB_NAME="giflib"
set_toolchain_clang_paths ${LIB_NAME}

# PREPARING FLAGS
TARGET_HOST=$(get_target_host)
BUILD_HOST=$(get_build_host)
export CFLAGS=$(get_cflags ${LIB_NAME})" -DS_IREAD=S_IRUSR -DS_IWRITE=S_IWUSR"
export CXXFLAGS=$(get_cxxflags ${LIB_NAME})
export LDFLAGS=$(get_ldflags ${LIB_NAME})
Expand All @@ -50,7 50,7 @@ fi
--enable-static \
--disable-shared \
--disable-fast-install \
--host=${TARGET_HOST} || exit 1
--host=${BUILD_HOST} || exit 1

make -j$(get_cpu_count) || exit 1

Expand Down
4 changes: 2 additions & 2 deletions build/android-gmp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 28,7 @@ LIB_NAME="gmp"
set_toolchain_clang_paths ${LIB_NAME}

# PREPARING FLAGS
TARGET_HOST=$(get_target_host)
BUILD_HOST=$(get_build_host)
export CFLAGS=$(get_cflags ${LIB_NAME})
export CXXFLAGS=$(get_cxxflags ${LIB_NAME})
export LDFLAGS=$(get_ldflags ${LIB_NAME})
Expand All @@ -51,7 51,7 @@ fi
--disable-shared \
--disable-fast-install \
--disable-maintainer-mode \
--host=${TARGET_HOST} || exit 1
--host=${BUILD_HOST} || exit 1

make -j$(get_cpu_count) || exit 1

Expand Down
4 changes: 2 additions & 2 deletions build/android-gnutls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 28,7 @@ LIB_NAME="gnutls"
set_toolchain_clang_paths ${LIB_NAME}

# PREPARING FLAGS
TARGET_HOST=$(get_target_host)
BUILD_HOST=$(get_build_host)
COMMON_CFLAGS=$(get_cflags ${LIB_NAME})
COMMON_CXXFLAGS=$(get_cxxflags ${LIB_NAME})
COMMON_LDFLAGS=$(get_ldflags ${LIB_NAME})
Expand Down Expand Up @@ -83,7 83,7 @@ fi
--disable-tests \
--disable-tools \
--disable-maintainer-mode \
--host=${TARGET_HOST} || exit 1
--host=${BUILD_HOST} || exit 1

make -j$(get_cpu_count) || exit 1

Expand Down
2 changes: 1 addition & 1 deletion build/android-jpeg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 28,7 @@ LIB_NAME="jpeg"
set_toolchain_clang_paths ${LIB_NAME}

# PREPARING FLAGS
TARGET_HOST=$(get_target_host)
BUILD_HOST=$(get_build_host)
export CFLAGS=$(get_cflags ${LIB_NAME})
export CXXFLAGS=$(get_cxxflags ${LIB_NAME})
export LDFLAGS=$(get_ldflags ${LIB_NAME})
Expand Down
4 changes: 2 additions & 2 deletions build/android-kvazaar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 28,7 @@ LIB_NAME="kvazaar"
set_toolchain_clang_paths ${LIB_NAME}

# PREPARING FLAGS
TARGET_HOST=$(get_target_host)
BUILD_HOST=$(get_build_host)
export CFLAGS=$(get_cflags ${LIB_NAME})
export CXXFLAGS=$(get_cxxflags ${LIB_NAME})
export LDFLAGS=$(get_ldflags ${LIB_NAME})
Expand Down Expand Up @@ -62,7 62,7 @@ LIBS="${ARCH_SPECIFIC_LIBS}" ./configure \
--enable-static \
--disable-shared \
--disable-fast-install \
--host=${TARGET_HOST} || exit 1
--host=${BUILD_HOST} || exit 1

make || exit 1

Expand Down
4 changes: 2 additions & 2 deletions build/android-lame.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 28,7 @@ LIB_NAME="lame"
set_toolchain_clang_paths ${LIB_NAME}

# PREPARING FLAGS
TARGET_HOST=$(get_target_host)
BUILD_HOST=$(get_build_host)
export CFLAGS=$(get_cflags ${LIB_NAME})
export CXXFLAGS=$(get_cxxflags ${LIB_NAME})
export LDFLAGS=$(get_ldflags ${LIB_NAME})
Expand All @@ -55,7 55,7 @@ fi
--disable-frontend \
--disable-efence \
--disable-gtktest \
--host=${TARGET_HOST} || exit 1
--host=${BUILD_HOST} || exit 1

make -j$(get_cpu_count) || exit 1

Expand Down
4 changes: 2 additions & 2 deletions build/android-leptonica.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 28,7 @@ LIB_NAME="leptonica"
set_toolchain_clang_paths ${LIB_NAME}

# PREPARING FLAGS
TARGET_HOST=$(get_target_host)
BUILD_HOST=$(get_build_host)
export CFLAGS=$(get_cflags ${LIB_NAME})
export CXXFLAGS=$(get_cxxflags ${LIB_NAME})
export CPPFLAGS="-I${BASEDIR}/prebuilt/android-$(get_target_build)/giflib/include"
Expand Down Expand Up @@ -72,7 72,7 @@ fi
--disable-shared \
--disable-fast-install \
--disable-programs \
--host=${TARGET_HOST} || exit 1
--host=${BUILD_HOST} || exit 1

make -j$(get_cpu_count) || exit 1

Expand Down
2 changes: 1 addition & 1 deletion build/android-libaom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 28,7 @@ LIB_NAME="libaom"
set_toolchain_clang_paths ${LIB_NAME}

# PREPARING FLAGS
TARGET_HOST=$(get_target_host)
BUILD_HOST=$(get_build_host)
CFLAGS=$(get_cflags ${LIB_NAME})
CXXFLAGS=$(get_cxxflags ${LIB_NAME})
LDFLAGS=$(get_ldflags ${LIB_NAME})
Expand Down
4 changes: 2 additions & 2 deletions build/android-libass.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 28,7 @@ LIB_NAME="libass"
set_toolchain_clang_paths ${LIB_NAME}

# PREPARING FLAGS
TARGET_HOST=$(get_target_host)
BUILD_HOST=$(get_build_host)
export CFLAGS=$(get_cflags ${LIB_NAME})
export CXXFLAGS=$(get_cxxflags ${LIB_NAME})
export LDFLAGS=$(get_ldflags ${LIB_NAME})
Expand Down Expand Up @@ -69,7 69,7 @@ esac
--disable-profile \
--disable-coretext \
${ASM_FLAGS} \
--host=${TARGET_HOST} || exit 1
--host=${BUILD_HOST} || exit 1

make -j$(get_cpu_count) || exit 1

Expand Down
4 changes: 2 additions & 2 deletions build/android-libiconv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 28,7 @@ LIB_NAME="libiconv"
set_toolchain_clang_paths ${LIB_NAME}

# PREPARING FLAGS
TARGET_HOST=$(get_target_host)
BUILD_HOST=$(get_build_host)
export CFLAGS=$(get_cflags ${LIB_NAME})
export CXXFLAGS=$(get_cxxflags ${LIB_NAME})
export LDFLAGS=$(get_ldflags ${LIB_NAME})
Expand All @@ -50,7 50,7 @@ fi
--disable-shared \
--disable-fast-install \
--disable-rpath \
--host=${TARGET_HOST} || exit 1
--host=${BUILD_HOST} || exit 1

make -j$(get_cpu_count) || exit 1

Expand Down
4 changes: 2 additions & 2 deletions build/android-libilbc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 28,7 @@ LIB_NAME="libilbc"
set_toolchain_clang_paths ${LIB_NAME}

# PREPARING FLAGS
TARGET_HOST=$(get_target_host)
BUILD_HOST=$(get_build_host)
export CFLAGS=$(get_cflags ${LIB_NAME})
export CXXFLAGS=$(get_cxxflags ${LIB_NAME})
export LDFLAGS=$(get_ldflags ${LIB_NAME})
Expand All @@ -49,7 49,7 @@ fi
--enable-static \
--disable-shared \
--disable-fast-install \
--host=${TARGET_HOST} || exit 1
--host=${BUILD_HOST} || exit 1

make -j$(get_cpu_count) || exit 1

Expand Down
4 changes: 2 additions & 2 deletions build/android-libogg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 28,7 @@ LIB_NAME="libogg"
set_toolchain_clang_paths ${LIB_NAME}

# PREPARING FLAGS
TARGET_HOST=$(get_target_host)
BUILD_HOST=$(get_build_host)
export CFLAGS=$(get_cflags ${LIB_NAME})
export CXXFLAGS=$(get_cxxflags ${LIB_NAME})
export LDFLAGS=$(get_ldflags ${LIB_NAME})
Expand All @@ -49,7 49,7 @@ fi
--enable-static \
--disable-shared \
--disable-fast-install \
--host=${TARGET_HOST} || exit 1
--host=${BUILD_HOST} || exit 1

make -j$(get_cpu_count) || exit 1

Expand Down
4 changes: 2 additions & 2 deletions build/android-libpng.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 28,7 @@ LIB_NAME="libpng"
set_toolchain_clang_paths ${LIB_NAME}

# PREPARING FLAGS
TARGET_HOST=$(get_target_host)
BUILD_HOST=$(get_build_host)
export CFLAGS=$(get_cflags ${LIB_NAME})
export CXXFLAGS=$(get_cxxflags ${LIB_NAME})
export LDFLAGS=$(get_ldflags ${LIB_NAME})
Expand Down Expand Up @@ -68,7 68,7 @@ fi
--disable-unversioned-libpng-pc \
--disable-unversioned-libpng-config \
${CPU_SPECIFIC_OPTIONS} \
--host=${TARGET_HOST} || exit 1
--host=${BUILD_HOST} || exit 1

make -j$(get_cpu_count) || exit 1

Expand Down
Loading

0 comments on commit efe1c59

Please sign in to comment.