diff --git a/README.md b/README.md index 96ab096..fb8ed9f 100644 --- a/README.md +++ b/README.md @@ -21,9 +21,9 @@ FFmpeg kit for applications. Supports Android, iOS, tvOS. - Concurrent execution - Exposes both FFmpeg library and FFmpegKit wrapper library capabilities -- Includes cross-compile instructions for 47 open-source libraries +- Includes cross-compile instructions for 48 open-source libraries - `chromaprint`, `expat`, `ffmpeg`, `fontconfig`, `freetype`, `fribidi`, `giflib`, `gmp`, `gnutls`, `kvazaar`, `lame`, `leptonica`, `libaom`, `libass`, `libiconv`, `libilbc`, `libjpeg`, `libjpeg-turbo`, `libogg`, `libpng`, `libsamplerate`, `libsndfile`, `libtheora`, `libuuid`, `libvorbis`, `libvpx`, `libwebp`, `libxml2`, `nettle`, `opencore-amr`, `openh264`, `opus`, `rubberband`, `sdl`, `shine`, `snappy`, `soxr`, `speex`, `tesseract`, `tiff`, `twolame`, `vid.stab`, `vo-amrwbenc`, `wavpack`, `x264`, `x265`, `xvidcore` + `chromaprint`, `expat`, `ffmpeg`, `fontconfig`, `freetype`, `fribidi`, `giflib`, `gmp`, `gnutls`, `harfbuzz`, `kvazaar`, `lame`, `leptonica`, `libaom`, `libass`, `libiconv`, `libilbc`, `libjpeg`, `libjpeg-turbo`, `libogg`, `libpng`, `libsamplerate`, `libsndfile`, `libtheora`, `libuuid`, `libvorbis`, `libvpx`, `libwebp`, `libxml2`, `nettle`, `opencore-amr`, `openh264`, `opus`, `rubberband`, `sdl`, `shine`, `snappy`, `soxr`, `speex`, `tesseract`, `tiff`, `twolame`, `vid.stab`, `vo-amrwbenc`, `wavpack`, `x264`, `x265`, `xvidcore` - Licensed under LGPL 3.0, can be customized to support GPL v3.0 @@ -141,12 +141,12 @@ Please remember that some parts of `FFmpeg` are licensed under the `GPL` and onl @Override public void apply(final long executionId, final int returnCode) { - if (rc == RETURN_CODE_SUCCESS) { + if (returnCode == RETURN_CODE_SUCCESS) { Log.i(Config.TAG, "Async command execution completed successfully."); - } else if (rc == RETURN_CODE_CANCEL) { + } else if (returnCode == RETURN_CODE_CANCEL) { Log.i(Config.TAG, "Async command execution cancelled by user."); } else { - Log.i(Config.TAG, String.format("Async command execution failed with rc=%d.", rc)); + Log.i(Config.TAG, String.format("Async command execution failed with returnCode=%d.", returnCode)); } } }); diff --git a/android.sh b/android.sh index 947ccef..95286a2 100755 --- a/android.sh +++ b/android.sh @@ -132,7 +132,7 @@ fi # PROCESS FULL OPTION AS LAST OPTION if [[ -n ${BUILD_FULL} ]]; then - for library in {0..57}; do + for library in {0..58}; do if [ ${GPL_ENABLED} == "yes" ]; then enable_library "$(get_library_name $library)" 1 else @@ -176,6 +176,9 @@ done echo -n -e "\nDownloading sources: " echo -e "INFO: Downloading source code of ffmpeg and enabled external libraries.\n" 1>>"${BASEDIR}"/build.log 2>&1 +# DOWNLOAD GNU CONFIG +download_gnu_config + # DOWNLOAD LIBRARY SOURCES downloaded_enabled_library_sources "${ENABLED_LIBRARIES[@]}" @@ -183,7 +186,7 @@ downloaded_enabled_library_sources "${ENABLED_LIBRARIES[@]}" export ORIGINAL_API=${API} # BUILD ENABLED LIBRARIES ON ENABLED ARCHITECTURES -for run_arch in {0..10}; do +for run_arch in {0..12}; do if [[ ${ENABLED_ARCHITECTURES[$run_arch]} -eq 1 ]]; then if [[ (${run_arch} -eq ${ARCH_ARM64_V8A} || ${run_arch} -eq ${ARCH_X86_64}) && ${API} -lt 21 ]]; then @@ -201,7 +204,7 @@ for run_arch in {0..10}; do . "${BASEDIR}"/scripts/main-android.sh "${ENABLED_LIBRARIES[@]}" || exit 1 # CLEAR FLAGS - for library in {0..57}; do + for library in {0..58}; do library_name=$(get_library_name ${library}) unset "$(echo "OK_${library_name}" | sed "s/\-/\_/g")" unset "$(echo "DEPENDENCY_REBUILT_${library_name}" | sed "s/\-/\_/g")" @@ -272,7 +275,7 @@ if [[ -n ${ANDROID_ARCHITECTURES} ]]; then fi # COPY ANDROID ARCHIVE TO PREBUILT DIRECTORY - FFMPEG_KIT_AAR="${BASEDIR}"/prebuilt/android-aar/ffmpeg-kit + FFMPEG_KIT_AAR="${BASEDIR}/prebuilt/$(get_target_aar_directory)/ffmpeg-kit" rm -rf "${FFMPEG_KIT_AAR}" 1>>"${BASEDIR}"/build.log 2>&1 mkdir -p "${FFMPEG_KIT_AAR}" 1>>"${BASEDIR}"/build.log 2>&1 cp "${BASEDIR}"/android/app/build/outputs/aar/ffmpeg-kit-release.aar "${FFMPEG_KIT_AAR}"/ffmpeg-kit.aar 1>>"${BASEDIR}"/build.log 2>&1 diff --git a/android/jni/Android.mk b/android/jni/Android.mk index bfc02fc..9ef41b2 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -11,12 +11,23 @@ ifeq ($(TARGET_ARCH_ABI), armeabi-v7a) MY_ARMV7_NEON := true endif endif -ifeq ($(MY_ARMV7_NEON), true) - FFMPEG_INCLUDES := $(MY_LOCAL_PATH)/../../prebuilt/android-$(TARGET_ARCH)-neon/ffmpeg/include + +ifeq ($(TARGET_PLATFORM),android-16) + ifeq ($(MY_ARMV7_NEON), true) + MY_BUILD_DIR := android-$(TARGET_ARCH)-neon-lts + else + MY_BUILD_DIR := android-$(TARGET_ARCH)-lts + endif else - FFMPEG_INCLUDES := $(MY_LOCAL_PATH)/../../prebuilt/android-$(TARGET_ARCH)/ffmpeg/include + ifeq ($(MY_ARMV7_NEON), true) + MY_BUILD_DIR := android-$(TARGET_ARCH)-neon + else + MY_BUILD_DIR := android-$(TARGET_ARCH) + endif endif +FFMPEG_INCLUDES := $(MY_LOCAL_PATH)/../../prebuilt/$(MY_BUILD_DIR)/ffmpeg/include + MY_ARM_MODE := arm MY_ARM_NEON := false LOCAL_PATH := $(MY_LOCAL_PATH)/../app/src/main/cpp diff --git a/android/jni/cpu-features/Android.mk b/android/jni/cpu-features/Android.mk index da4fd45..5d38c82 100644 --- a/android/jni/cpu-features/Android.mk +++ b/android/jni/cpu-features/Android.mk @@ -1,8 +1,4 @@ -ifeq ($(MY_ARMV7_NEON), true) - LOCAL_PATH := $(call my-dir)/../../../prebuilt/android-$(TARGET_ARCH)-neon/cpu-features/lib -else - LOCAL_PATH := $(call my-dir)/../../../prebuilt/android-$(TARGET_ARCH)/cpu-features/lib -endif +LOCAL_PATH := $(call my-dir)/../../../prebuilt/$(MY_BUILD_DIR)/cpu-features/lib include $(CLEAR_VARS) LOCAL_ARM_MODE := $(MY_ARM_MODE) diff --git a/android/jni/ffmpeg/Android.mk b/android/jni/ffmpeg/Android.mk index 445fa77..7be0e4b 100644 --- a/android/jni/ffmpeg/Android.mk +++ b/android/jni/ffmpeg/Android.mk @@ -1,4 +1,8 @@ -LOCAL_PATH := $(call my-dir)/../../../prebuilt/android-$(TARGET_ARCH)/ffmpeg/lib +ifeq ($(TARGET_PLATFORM),android-16) + LOCAL_PATH := $(call my-dir)/../../../prebuilt/android-$(TARGET_ARCH)-lts/ffmpeg/lib +else + LOCAL_PATH := $(call my-dir)/../../../prebuilt/android-$(TARGET_ARCH)/ffmpeg/lib +endif MY_ARM_MODE := arm diff --git a/android/jni/ffmpeg/neon/Android.mk b/android/jni/ffmpeg/neon/Android.mk index fbd015a..f5ee8d9 100644 --- a/android/jni/ffmpeg/neon/Android.mk +++ b/android/jni/ffmpeg/neon/Android.mk @@ -1,4 +1,8 @@ -LOCAL_PATH := $(call my-dir)/../../../../prebuilt/android-$(TARGET_ARCH)-neon/ffmpeg/lib +ifeq ($(TARGET_PLATFORM),android-16) + LOCAL_PATH := $(call my-dir)/../../../../prebuilt/android-$(TARGET_ARCH)-neon-lts/ffmpeg/lib +else + LOCAL_PATH := $(call my-dir)/../../../../prebuilt/android-$(TARGET_ARCH)-neon/ffmpeg/lib +endif MY_ARM_MODE := arm MY_ARM_NEON := true diff --git a/objc/.gitignore b/apple/.gitignore similarity index 100% rename from objc/.gitignore rename to apple/.gitignore diff --git a/objc/Doxyfile b/apple/Doxyfile similarity index 100% rename from objc/Doxyfile rename to apple/Doxyfile diff --git a/objc/Makefile.am b/apple/Makefile.am similarity index 100% rename from objc/Makefile.am rename to apple/Makefile.am diff --git a/objc/Makefile.in b/apple/Makefile.in similarity index 100% rename from objc/Makefile.in rename to apple/Makefile.in diff --git a/objc/aclocal.m4 b/apple/aclocal.m4 similarity index 100% rename from objc/aclocal.m4 rename to apple/aclocal.m4 diff --git a/objc/ar-lib b/apple/ar-lib similarity index 100% rename from objc/ar-lib rename to apple/ar-lib diff --git a/objc/autogen.sh b/apple/autogen.sh similarity index 100% rename from objc/autogen.sh rename to apple/autogen.sh diff --git a/objc/compile b/apple/compile similarity index 100% rename from objc/compile rename to apple/compile diff --git a/objc/config.guess b/apple/config.guess similarity index 84% rename from objc/config.guess rename to apple/config.guess index 45001cf..699b3a1 100755 --- a/objc/config.guess +++ b/apple/config.guess @@ -2,7 +2,7 @@ # Attempt to guess a canonical system name. # Copyright 1992-2020 Free Software Foundation, Inc. -timestamp='2020-01-01' +timestamp='2020-11-19' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -27,12 +27,12 @@ timestamp='2020-01-01' # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: -# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess +# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess # # Please send patches to . -me=`echo "$0" | sed -e 's,.*/,,'` +me=$(echo "$0" | sed -e 's,.*/,,') usage="\ Usage: $0 [OPTION] @@ -103,7 +103,7 @@ set_cc_for_build() { test "$tmp" && return 0 : "${TMPDIR=/tmp}" # shellcheck disable=SC2039 - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { tmp=$( (umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null) && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } @@ -131,16 +131,14 @@ if test -f /.attbin/uname ; then PATH=$PATH:/.attbin ; export PATH fi -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +UNAME_MACHINE=$( (uname -m) 2>/dev/null) || UNAME_MACHINE=unknown +UNAME_RELEASE=$( (uname -r) 2>/dev/null) || UNAME_RELEASE=unknown +UNAME_SYSTEM=$( (uname -s) 2>/dev/null) || UNAME_SYSTEM=unknown +UNAME_VERSION=$( (uname -v) 2>/dev/null) || UNAME_VERSION=unknown case "$UNAME_SYSTEM" in Linux|GNU|GNU/*) - # If the system lacks a compiler, then just pick glibc. - # We could probably try harder. - LIBC=gnu + LIBC=unknown set_cc_for_build cat <<-EOF > "$dummy.c" @@ -149,17 +147,29 @@ Linux|GNU|GNU/*) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc - #else + #elif defined(__GLIBC__) LIBC=gnu + #else + #include + /* First heuristic to detect musl libc. */ + #ifdef __DEFINED_va_list + LIBC=musl + #endif #endif EOF - eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" + eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g')" - # If ldd exists, use it to detect musl libc. - if command -v ldd >/dev/null && \ - ldd --version 2>&1 | grep -q ^musl - then - LIBC=musl + # Second heuristic to detect musl libc. + if [ "$LIBC" = unknown ] && + command -v ldd >/dev/null && + ldd --version 2>&1 | grep -q ^musl; then + LIBC=musl + fi + + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + if [ "$LIBC" = unknown ]; then + LIBC=gnu fi ;; esac @@ -179,19 +189,20 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + UNAME_MACHINE_ARCH=$( (uname -p 2>/dev/null || \ "/sbin/$sysctl" 2>/dev/null || \ "/usr/sbin/$sysctl" 2>/dev/null || \ - echo unknown)` + echo unknown)) case "$UNAME_MACHINE_ARCH" in + aarch64eb) machine=aarch64_be-unknown ;; armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) - arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` - endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` + arch=$(echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,') + endian=$(echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p') machine="${arch}${endian}"-unknown ;; *) machine="$UNAME_MACHINE_ARCH"-unknown ;; @@ -222,7 +233,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in case "$UNAME_MACHINE_ARCH" in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' - abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` + abi=$(echo "$UNAME_MACHINE_ARCH" | sed -e "$expr") ;; esac # The OS release @@ -235,7 +246,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in release='-gnu' ;; *) - release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` + release=$(echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2) ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: @@ -244,15 +255,15 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in echo "$machine-${os}${release}${abi-}" exit ;; *:Bitrig:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + UNAME_MACHINE_ARCH=$(arch | sed 's/Bitrig.//') echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" exit ;; *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + UNAME_MACHINE_ARCH=$(arch | sed 's/OpenBSD.//') echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" exit ;; *:LibertyBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + UNAME_MACHINE_ARCH=$(arch | sed 's/^.*BSD\.//') echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" exit ;; *:MidnightBSD:*:*) @@ -288,17 +299,17 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $3}') ;; *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $4}') ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + ALPHA_CPU_TYPE=$(/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1) case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE=alpha ;; @@ -336,7 +347,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" + echo "$UNAME_MACHINE"-dec-osf"$(echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz)" # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 @@ -370,7 +381,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then + if test "$( (/bin/universe) 2>/dev/null)" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd @@ -383,17 +394,17 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in + case $(/usr/bin/uname -p) in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) - echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" + echo "$UNAME_MACHINE"-ibm-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')" exit ;; sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + echo sparc-hal-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" + echo sparc-sun-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')" exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux"$UNAME_RELEASE" @@ -404,7 +415,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. - if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null @@ -412,30 +423,30 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in SUN_ARCH=x86_64 fi fi - echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + echo "$SUN_ARCH"-pc-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + echo sparc-sun-solaris3"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" exit ;; sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in + case "$(/usr/bin/arch -k)" in Series*|S4*) - UNAME_RELEASE=`uname -v` + UNAME_RELEASE=$(uname -v) ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" + echo sparc-sun-sunos"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/')" exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos"$UNAME_RELEASE" exit ;; sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + UNAME_RELEASE=$( (sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null) test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 - case "`/bin/arch`" in + case "$(/bin/arch)" in sun3) echo m68k-sun-sunos"$UNAME_RELEASE" ;; @@ -515,8 +526,8 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && - dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`"$dummy" "$dummyarg"` && + dummyarg=$(echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p') && + SYSTEM_NAME=$("$dummy" "$dummyarg") && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos"$UNAME_RELEASE" exit ;; @@ -543,11 +554,11 @@ EOF exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] + UNAME_PROCESSOR=$(/usr/bin/uname -p) + if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 then - if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ - [ "$TARGET_BINARY_INTERFACE"x = x ] + if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ + test "$TARGET_BINARY_INTERFACE"x = x then echo m88k-dg-dgux"$UNAME_RELEASE" else @@ -571,17 +582,17 @@ EOF echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) - echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" + echo mips-sgi-irix"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/g')" exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + exit ;; # Note that: echo "'$(uname -s)'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` + if test -x /usr/bin/oslevel ; then + IBM_REV=$(/usr/bin/oslevel) else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi @@ -601,7 +612,7 @@ EOF exit(0); } EOF - if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` + if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy") then echo "$SYSTEM_NAME" else @@ -614,15 +625,15 @@ EOF fi exit ;; *:AIX:*:[4567]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + IBM_CPU_ID=$(/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }') if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi - if [ -x /usr/bin/lslpp ] ; then - IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | - awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` + if test -x /usr/bin/lslpp ; then + IBM_REV=$(/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/) else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi @@ -650,14 +661,14 @@ EOF echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` + HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//') case "$UNAME_MACHINE" in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + if test -x /usr/bin/getconf; then + sc_cpu_version=$(/usr/bin/getconf SC_CPU_VERSION 2>/dev/null) + sc_kernel_bits=$(/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null) case "$sc_cpu_version" in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 @@ -669,7 +680,7 @@ EOF esac ;; esac fi - if [ "$HP_ARCH" = "" ]; then + if test "$HP_ARCH" = ""; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" @@ -704,11 +715,11 @@ EOF exit (0); } EOF - (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` + (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=$("$dummy") test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac - if [ "$HP_ARCH" = hppa2.0w ] + if test "$HP_ARCH" = hppa2.0w then set_cc_for_build @@ -732,7 +743,7 @@ EOF echo "$HP_ARCH"-hp-hpux"$HPUX_REV" exit ;; ia64:HP-UX:*:*) - HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` + HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//') echo ia64-hp-hpux"$HPUX_REV" exit ;; 3050*:HI-UX:*:*) @@ -762,7 +773,7 @@ EOF exit (0); } EOF - $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy") && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; @@ -782,7 +793,7 @@ EOF echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then + if test -x /usr/sbin/sysversion ; then echo "$UNAME_MACHINE"-unknown-osf1mk else echo "$UNAME_MACHINE"-unknown-osf1 @@ -831,14 +842,14 @@ EOF echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` - FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` - FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` + FUJITSU_PROC=$(uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz) + FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///') + FUJITSU_REL=$(echo "$UNAME_RELEASE" | sed -e 's/ /_/') echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` - FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` + FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///') + FUJITSU_REL=$(echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/') echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) @@ -851,25 +862,25 @@ EOF echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" exit ;; arm:FreeBSD:*:*) - UNAME_PROCESSOR=`uname -p` + UNAME_PROCESSOR=$(uname -p) set_cc_for_build if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabi + echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabi else - echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabihf + echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabihf fi exit ;; *:FreeBSD:*:*) - UNAME_PROCESSOR=`/usr/bin/uname -p` + UNAME_PROCESSOR=$(/usr/bin/uname -p) case "$UNAME_PROCESSOR" in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac - echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" + echo "$UNAME_PROCESSOR"-unknown-freebsd"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')" exit ;; i*:CYGWIN*:*) echo "$UNAME_MACHINE"-pc-cygwin @@ -905,15 +916,15 @@ EOF echo x86_64-pc-cygwin exit ;; prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + echo powerpcle-unknown-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" exit ;; *:GNU:*:*) # the GNU system - echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" + echo "$(echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,')-unknown-$LIBC$(echo "$UNAME_RELEASE"|sed -e 's,/.*$,,')" exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" + echo "$UNAME_MACHINE-unknown-$(echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]")$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')-$LIBC" exit ;; *:Minix:*:*) echo "$UNAME_MACHINE"-unknown-minix @@ -926,7 +937,7 @@ EOF echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in + case $(sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null) in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; @@ -1035,7 +1046,7 @@ EOF #endif #endif EOF - eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`" + eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI')" test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } ;; mips64el:Linux:*:*) @@ -1055,7 +1066,7 @@ EOF exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + case $(grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2) in PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; *) echo hppa-unknown-linux-"$LIBC" ;; @@ -1095,7 +1106,17 @@ EOF echo "$UNAME_MACHINE"-dec-linux-"$LIBC" exit ;; x86_64:Linux:*:*) - echo "$UNAME_MACHINE"-pc-linux-"$LIBC" + set_cc_for_build + LIBCABI=$LIBC + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_X32 >/dev/null + then + LIBCABI="$LIBC"x32 + fi + fi + echo "$UNAME_MACHINE"-pc-linux-"$LIBCABI" exit ;; xtensa*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" @@ -1135,7 +1156,7 @@ EOF echo "$UNAME_MACHINE"-pc-msdosdjgpp exit ;; i*86:*:4.*:*) - UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` + UNAME_REL=$(echo "$UNAME_RELEASE" | sed 's/\/MP$//') if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" else @@ -1144,7 +1165,7 @@ EOF exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in + case $(/bin/uname -X | grep "^Machine") in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; @@ -1153,10 +1174,10 @@ EOF exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + UNAME_REL=$( (/bin/uname -X|grep Release|sed -e 's/.*= //')) (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 @@ -1206,7 +1227,7 @@ EOF 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + && OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ @@ -1217,7 +1238,7 @@ EOF NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + && OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ @@ -1250,7 +1271,7 @@ EOF exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` + UNAME_MACHINE=$( (uname -p) 2>/dev/null) echo "$UNAME_MACHINE"-sni-sysv4 else echo ns32k-sni-sysv @@ -1284,7 +1305,7 @@ EOF echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then + if test -d /usr/nec; then echo mips-nec-sysv"$UNAME_RELEASE" else echo mips-unknown-sysv"$UNAME_RELEASE" @@ -1332,8 +1353,11 @@ EOF *:Rhapsody:*:*) echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" exit ;; + arm64:Darwin:*:*) + echo aarch64-apple-darwin"$UNAME_RELEASE" + exit ;; *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` + UNAME_PROCESSOR=$(uname -p) case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac @@ -1346,7 +1370,7 @@ EOF else set_cc_for_build fi - if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null @@ -1370,7 +1394,7 @@ EOF echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` + UNAME_PROCESSOR=$(uname -p) if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc @@ -1438,10 +1462,10 @@ EOF echo mips-sei-seiux"$UNAME_RELEASE" exit ;; *:DragonFly:*:*) - echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" + echo "$UNAME_MACHINE"-unknown-dragonfly"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')" exit ;; *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` + UNAME_MACHINE=$( (uname -p) 2>/dev/null) case "$UNAME_MACHINE" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; @@ -1451,7 +1475,7 @@ EOF echo i386-pc-xenix exit ;; i*86:skyos:*:*) - echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" + echo "$UNAME_MACHINE"-pc-skyos"$(echo "$UNAME_RELEASE" | sed -e 's/ .*$//')" exit ;; i*86:rdos:*:*) echo "$UNAME_MACHINE"-pc-rdos @@ -1509,7 +1533,7 @@ main () #define __ARCHITECTURE__ "m68k" #endif int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + version=$( (hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null); if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else @@ -1601,7 +1625,7 @@ main () } EOF -$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`$dummy` && +$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=$($dummy) && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. @@ -1626,9 +1650,15 @@ This script (version $timestamp), has failed to recognize the operating system you are using. If your script is old, overwrite *all* copies of config.guess and config.sub with the latest versions from: - https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess + https://git.savannah.gnu.org/cgit/config.git/plain/config.guess and - https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub + https://git.savannah.gnu.org/cgit/config.git/plain/config.sub +EOF + +year=$(echo $timestamp | sed 's,-.*,,') +# shellcheck disable=SC2003 +if test "$(expr "$(date +%Y)" - "$year")" -lt 3 ; then + cat >&2 </dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` +uname -m = $( (uname -m) 2>/dev/null || echo unknown) +uname -r = $( (uname -r) 2>/dev/null || echo unknown) +uname -s = $( (uname -s) 2>/dev/null || echo unknown) +uname -v = $( (uname -v) 2>/dev/null || echo unknown) -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` +/usr/bin/uname -p = $( (/usr/bin/uname -p) 2>/dev/null) +/bin/uname -X = $( (/bin/uname -X) 2>/dev/null) -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` +hostinfo = $( (hostinfo) 2>/dev/null) +/bin/universe = $( (/bin/universe) 2>/dev/null) +/usr/bin/arch -k = $( (/usr/bin/arch -k) 2>/dev/null) +/bin/arch = $( (/bin/arch) 2>/dev/null) +/usr/bin/oslevel = $( (/usr/bin/oslevel) 2>/dev/null) +/usr/convex/getsysinfo = $( (/usr/convex/getsysinfo) 2>/dev/null) UNAME_MACHINE = "$UNAME_MACHINE" UNAME_RELEASE = "$UNAME_RELEASE" UNAME_SYSTEM = "$UNAME_SYSTEM" UNAME_VERSION = "$UNAME_VERSION" EOF +fi exit 1 diff --git a/objc/config.sub b/apple/config.sub similarity index 79% rename from objc/config.sub rename to apple/config.sub index f02d43a..19c9553 100755 --- a/objc/config.sub +++ b/apple/config.sub @@ -2,7 +2,7 @@ # Configuration validation subroutine script. # Copyright 1992-2020 Free Software Foundation, Inc. -timestamp='2020-01-01' +timestamp='2020-12-02' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -33,7 +33,7 @@ timestamp='2020-01-01' # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: -# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub +# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases @@ -50,7 +50,7 @@ timestamp='2020-01-01' # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. -me=`echo "$0" | sed -e 's,.*/,,'` +me=$(echo "$0" | sed -e 's,.*/,,') usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS @@ -124,28 +124,27 @@ case $1 in ;; *-*-*-*) basic_machine=$field1-$field2 - os=$field3-$field4 + basic_os=$field3-$field4 ;; *-*-*) # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two # parts maybe_os=$field2-$field3 case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc \ - | linux-newlib* | linux-musl* | linux-uclibc* | uclinux-uclibc* \ + nto-qnx* | linux-* | uclinux-uclibc* \ | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ | storm-chaos* | os2-emx* | rtmk-nova*) basic_machine=$field1 - os=$maybe_os + basic_os=$maybe_os ;; android-linux) basic_machine=$field1-unknown - os=linux-android + basic_os=linux-android ;; *) basic_machine=$field1-$field2 - os=$field3 + basic_os=$field3 ;; esac ;; @@ -154,7 +153,7 @@ case $1 in case $field1-$field2 in decstation-3100) basic_machine=mips-dec - os= + basic_os= ;; *-*) # Second component is usually, but not always the OS @@ -162,7 +161,7 @@ case $1 in # Prevent following clause from handling this valid os sun*os*) basic_machine=$field1 - os=$field2 + basic_os=$field2 ;; # Manufacturers dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ @@ -175,11 +174,11 @@ case $1 in | microblaze* | sim | cisco \ | oki | wec | wrs | winbond) basic_machine=$field1-$field2 - os= + basic_os= ;; *) basic_machine=$field1 - os=$field2 + basic_os=$field2 ;; esac ;; @@ -191,447 +190,451 @@ case $1 in case $field1 in 386bsd) basic_machine=i386-pc - os=bsd + basic_os=bsd ;; a29khif) basic_machine=a29k-amd - os=udi + basic_os=udi ;; adobe68k) basic_machine=m68010-adobe - os=scout + basic_os=scout ;; alliant) basic_machine=fx80-alliant - os= + basic_os= ;; altos | altos3068) basic_machine=m68k-altos - os= + basic_os= ;; am29k) basic_machine=a29k-none - os=bsd + basic_os=bsd ;; amdahl) basic_machine=580-amdahl - os=sysv + basic_os=sysv ;; amiga) basic_machine=m68k-unknown - os= + basic_os= ;; amigaos | amigados) basic_machine=m68k-unknown - os=amigaos + basic_os=amigaos ;; amigaunix | amix) basic_machine=m68k-unknown - os=sysv4 + basic_os=sysv4 ;; apollo68) basic_machine=m68k-apollo - os=sysv + basic_os=sysv ;; apollo68bsd) basic_machine=m68k-apollo - os=bsd + basic_os=bsd ;; aros) basic_machine=i386-pc - os=aros + basic_os=aros ;; aux) basic_machine=m68k-apple - os=aux + basic_os=aux ;; balance) basic_machine=ns32k-sequent - os=dynix + basic_os=dynix ;; blackfin) basic_machine=bfin-unknown - os=linux + basic_os=linux ;; cegcc) basic_machine=arm-unknown - os=cegcc + basic_os=cegcc ;; convex-c1) basic_machine=c1-convex - os=bsd + basic_os=bsd ;; convex-c2) basic_machine=c2-convex - os=bsd + basic_os=bsd ;; convex-c32) basic_machine=c32-convex - os=bsd + basic_os=bsd ;; convex-c34) basic_machine=c34-convex - os=bsd + basic_os=bsd ;; convex-c38) basic_machine=c38-convex - os=bsd + basic_os=bsd ;; cray) basic_machine=j90-cray - os=unicos + basic_os=unicos ;; crds | unos) basic_machine=m68k-crds - os= + basic_os= ;; da30) basic_machine=m68k-da30 - os= + basic_os= ;; decstation | pmax | pmin | dec3100 | decstatn) basic_machine=mips-dec - os= + basic_os= ;; delta88) basic_machine=m88k-motorola - os=sysv3 + basic_os=sysv3 ;; dicos) basic_machine=i686-pc - os=dicos + basic_os=dicos ;; djgpp) basic_machine=i586-pc - os=msdosdjgpp + basic_os=msdosdjgpp ;; ebmon29k) basic_machine=a29k-amd - os=ebmon + basic_os=ebmon ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson - os=ose + basic_os=ose ;; gmicro) basic_machine=tron-gmicro - os=sysv + basic_os=sysv ;; go32) basic_machine=i386-pc - os=go32 + basic_os=go32 ;; h8300hms) basic_machine=h8300-hitachi - os=hms + basic_os=hms ;; h8300xray) basic_machine=h8300-hitachi - os=xray + basic_os=xray ;; h8500hms) basic_machine=h8500-hitachi - os=hms + basic_os=hms ;; harris) basic_machine=m88k-harris - os=sysv3 + basic_os=sysv3 ;; hp300 | hp300hpux) basic_machine=m68k-hp - os=hpux + basic_os=hpux ;; hp300bsd) basic_machine=m68k-hp - os=bsd + basic_os=bsd ;; hppaosf) basic_machine=hppa1.1-hp - os=osf + basic_os=osf ;; hppro) basic_machine=hppa1.1-hp - os=proelf + basic_os=proelf ;; i386mach) basic_machine=i386-mach - os=mach + basic_os=mach ;; isi68 | isi) basic_machine=m68k-isi - os=sysv + basic_os=sysv ;; m68knommu) basic_machine=m68k-unknown - os=linux + basic_os=linux ;; magnum | m3230) basic_machine=mips-mips - os=sysv + basic_os=sysv ;; merlin) basic_machine=ns32k-utek - os=sysv + basic_os=sysv ;; mingw64) basic_machine=x86_64-pc - os=mingw64 + basic_os=mingw64 ;; mingw32) basic_machine=i686-pc - os=mingw32 + basic_os=mingw32 ;; mingw32ce) basic_machine=arm-unknown - os=mingw32ce + basic_os=mingw32ce ;; monitor) basic_machine=m68k-rom68k - os=coff + basic_os=coff ;; morphos) basic_machine=powerpc-unknown - os=morphos + basic_os=morphos ;; moxiebox) basic_machine=moxie-unknown - os=moxiebox + basic_os=moxiebox ;; msdos) basic_machine=i386-pc - os=msdos + basic_os=msdos ;; msys) basic_machine=i686-pc - os=msys + basic_os=msys ;; mvs) basic_machine=i370-ibm - os=mvs + basic_os=mvs ;; nacl) basic_machine=le32-unknown - os=nacl + basic_os=nacl ;; ncr3000) basic_machine=i486-ncr - os=sysv4 + basic_os=sysv4 ;; netbsd386) basic_machine=i386-pc - os=netbsd + basic_os=netbsd ;; netwinder) basic_machine=armv4l-rebel - os=linux + basic_os=linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony - os=newsos + basic_os=newsos ;; news1000) basic_machine=m68030-sony - os=newsos + basic_os=newsos ;; necv70) basic_machine=v70-nec - os=sysv + basic_os=sysv ;; nh3000) basic_machine=m68k-harris - os=cxux + basic_os=cxux ;; nh[45]000) basic_machine=m88k-harris - os=cxux + basic_os=cxux ;; nindy960) basic_machine=i960-intel - os=nindy + basic_os=nindy ;; mon960) basic_machine=i960-intel - os=mon960 + basic_os=mon960 ;; nonstopux) basic_machine=mips-compaq - os=nonstopux + basic_os=nonstopux ;; os400) basic_machine=powerpc-ibm - os=os400 + basic_os=os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson - os=ose + basic_os=ose ;; os68k) basic_machine=m68k-none - os=os68k + basic_os=os68k ;; paragon) basic_machine=i860-intel - os=osf + basic_os=osf ;; parisc) basic_machine=hppa-unknown - os=linux + basic_os=linux + ;; + psp) + basic_machine=mipsallegrexel-sony + basic_os=psp ;; pw32) basic_machine=i586-unknown - os=pw32 + basic_os=pw32 ;; rdos | rdos64) basic_machine=x86_64-pc - os=rdos + basic_os=rdos ;; rdos32) basic_machine=i386-pc - os=rdos + basic_os=rdos ;; rom68k) basic_machine=m68k-rom68k - os=coff + basic_os=coff ;; sa29200) basic_machine=a29k-amd - os=udi + basic_os=udi ;; sei) basic_machine=mips-sei - os=seiux + basic_os=seiux ;; sequent) basic_machine=i386-sequent - os= + basic_os= ;; sps7) basic_machine=m68k-bull - os=sysv2 + basic_os=sysv2 ;; st2000) basic_machine=m68k-tandem - os= + basic_os= ;; stratus) basic_machine=i860-stratus - os=sysv4 + basic_os=sysv4 ;; sun2) basic_machine=m68000-sun - os= + basic_os= ;; sun2os3) basic_machine=m68000-sun - os=sunos3 + basic_os=sunos3 ;; sun2os4) basic_machine=m68000-sun - os=sunos4 + basic_os=sunos4 ;; sun3) basic_machine=m68k-sun - os= + basic_os= ;; sun3os3) basic_machine=m68k-sun - os=sunos3 + basic_os=sunos3 ;; sun3os4) basic_machine=m68k-sun - os=sunos4 + basic_os=sunos4 ;; sun4) basic_machine=sparc-sun - os= + basic_os= ;; sun4os3) basic_machine=sparc-sun - os=sunos3 + basic_os=sunos3 ;; sun4os4) basic_machine=sparc-sun - os=sunos4 + basic_os=sunos4 ;; sun4sol2) basic_machine=sparc-sun - os=solaris2 + basic_os=solaris2 ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun - os= + basic_os= ;; sv1) basic_machine=sv1-cray - os=unicos + basic_os=unicos ;; symmetry) basic_machine=i386-sequent - os=dynix + basic_os=dynix ;; t3e) basic_machine=alphaev5-cray - os=unicos + basic_os=unicos ;; t90) basic_machine=t90-cray - os=unicos + basic_os=unicos ;; toad1) basic_machine=pdp10-xkl - os=tops20 + basic_os=tops20 ;; tpf) basic_machine=s390x-ibm - os=tpf + basic_os=tpf ;; udi29k) basic_machine=a29k-amd - os=udi + basic_os=udi ;; ultra3) basic_machine=a29k-nyu - os=sym1 + basic_os=sym1 ;; v810 | necv810) basic_machine=v810-nec - os=none + basic_os=none ;; vaxv) basic_machine=vax-dec - os=sysv + basic_os=sysv ;; vms) basic_machine=vax-dec - os=vms + basic_os=vms ;; vsta) basic_machine=i386-pc - os=vsta + basic_os=vsta ;; vxworks960) basic_machine=i960-wrs - os=vxworks + basic_os=vxworks ;; vxworks68) basic_machine=m68k-wrs - os=vxworks + basic_os=vxworks ;; vxworks29k) basic_machine=a29k-wrs - os=vxworks + basic_os=vxworks ;; xbox) basic_machine=i686-pc - os=mingw32 + basic_os=mingw32 ;; ymp) basic_machine=ymp-cray - os=unicos + basic_os=unicos ;; *) basic_machine=$1 - os= + basic_os= ;; esac ;; @@ -683,17 +686,17 @@ case $basic_machine in bluegene*) cpu=powerpc vendor=ibm - os=cnk + basic_os=cnk ;; decsystem10* | dec10*) cpu=pdp10 vendor=dec - os=tops10 + basic_os=tops10 ;; decsystem20* | dec20*) cpu=pdp10 vendor=dec - os=tops20 + basic_os=tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) @@ -703,7 +706,7 @@ case $basic_machine in dpx2*) cpu=m68k vendor=bull - os=sysv3 + basic_os=sysv3 ;; encore | umax | mmax) cpu=ns32k @@ -712,7 +715,7 @@ case $basic_machine in elxsi) cpu=elxsi vendor=elxsi - os=${os:-bsd} + basic_os=${basic_os:-bsd} ;; fx2800) cpu=i860 @@ -725,7 +728,7 @@ case $basic_machine in h3050r* | hiux*) cpu=hppa1.1 vendor=hitachi - os=hiuxwe2 + basic_os=hiuxwe2 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) cpu=hppa1.0 @@ -766,38 +769,38 @@ case $basic_machine in vendor=hp ;; i*86v32) - cpu=`echo "$1" | sed -e 's/86.*/86/'` + cpu=$(echo "$1" | sed -e 's/86.*/86/') vendor=pc - os=sysv32 + basic_os=sysv32 ;; i*86v4*) - cpu=`echo "$1" | sed -e 's/86.*/86/'` + cpu=$(echo "$1" | sed -e 's/86.*/86/') vendor=pc - os=sysv4 + basic_os=sysv4 ;; i*86v) - cpu=`echo "$1" | sed -e 's/86.*/86/'` + cpu=$(echo "$1" | sed -e 's/86.*/86/') vendor=pc - os=sysv + basic_os=sysv ;; i*86sol2) - cpu=`echo "$1" | sed -e 's/86.*/86/'` + cpu=$(echo "$1" | sed -e 's/86.*/86/') vendor=pc - os=solaris2 + basic_os=solaris2 ;; j90 | j90-cray) cpu=j90 vendor=cray - os=${os:-unicos} + basic_os=${basic_os:-unicos} ;; iris | iris4d) cpu=mips vendor=sgi - case $os in + case $basic_os in irix*) ;; *) - os=irix4 + basic_os=irix4 ;; esac ;; @@ -808,26 +811,26 @@ case $basic_machine in *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) cpu=m68k vendor=atari - os=mint + basic_os=mint ;; news-3600 | risc-news) cpu=mips vendor=sony - os=newsos + basic_os=newsos ;; next | m*-next) cpu=m68k vendor=next - case $os in + case $basic_os in openstep*) ;; nextstep*) ;; ns2*) - os=nextstep2 + basic_os=nextstep2 ;; *) - os=nextstep3 + basic_os=nextstep3 ;; esac ;; @@ -838,12 +841,12 @@ case $basic_machine in op50n-* | op60c-*) cpu=hppa1.1 vendor=oki - os=proelf + basic_os=proelf ;; pa-hitachi) cpu=hppa1.1 vendor=hitachi - os=hiuxwe2 + basic_os=hiuxwe2 ;; pbd) cpu=sparc @@ -880,12 +883,12 @@ case $basic_machine in sde) cpu=mipsisa32 vendor=sde - os=${os:-elf} + basic_os=${basic_os:-elf} ;; simso-wrs) cpu=sparclite vendor=wrs - os=vxworks + basic_os=vxworks ;; tower | tower-32) cpu=m68k @@ -902,7 +905,7 @@ case $basic_machine in w89k-*) cpu=hppa1.1 vendor=winbond - os=proelf + basic_os=proelf ;; none) cpu=none @@ -914,7 +917,7 @@ case $basic_machine in ;; leon-*|leon[3-9]-*) cpu=sparc - vendor=`echo "$basic_machine" | sed 's/-.*//'` + vendor=$(echo "$basic_machine" | sed 's/-.*//') ;; *-*) @@ -955,11 +958,11 @@ case $cpu-$vendor in # some cases the only manufacturer, in others, it is the most popular. craynv-unknown) vendor=cray - os=${os:-unicosmp} + basic_os=${basic_os:-unicosmp} ;; c90-unknown | c90-cray) vendor=cray - os=${os:-unicos} + basic_os=${Basic_os:-unicos} ;; fx80-unknown) vendor=alliant @@ -1003,7 +1006,7 @@ case $cpu-$vendor in dpx20-unknown | dpx20-bull) cpu=rs6000 vendor=bull - os=${os:-bosx} + basic_os=${basic_os:-bosx} ;; # Here we normalize CPU types irrespective of the vendor @@ -1012,7 +1015,7 @@ case $cpu-$vendor in ;; blackfin-*) cpu=bfin - os=linux + basic_os=linux ;; c54x-*) cpu=tic54x @@ -1025,7 +1028,7 @@ case $cpu-$vendor in ;; e500v[12]-*) cpu=powerpc - os=$os"spe" + basic_os=${basic_os}"spe" ;; mips3*-*) cpu=mips64 @@ -1035,7 +1038,7 @@ case $cpu-$vendor in ;; m68knommu-*) cpu=m68k - os=linux + basic_os=linux ;; m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*) cpu=s12z @@ -1045,7 +1048,7 @@ case $cpu-$vendor in ;; parisc-*) cpu=hppa - os=linux + basic_os=linux ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) cpu=i586 @@ -1081,7 +1084,7 @@ case $cpu-$vendor in cpu=mipsisa64sb1el ;; sh5e[lb]-*) - cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'` + cpu=$(echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/') ;; spur-*) cpu=spur @@ -1099,13 +1102,16 @@ case $cpu-$vendor in cpu=x86_64 ;; xscale-* | xscalee[bl]-*) - cpu=`echo "$cpu" | sed 's/^xscale/arm/'` + cpu=$(echo "$cpu" | sed 's/^xscale/arm/') + ;; + arm64-*) + cpu=aarch64 ;; # Recognize the canonical CPU Types that limit and/or modify the # company names they are paired with. cr16-*) - os=${os:-elf} + basic_os=${basic_os:-elf} ;; crisv32-* | etraxfs*-*) cpu=crisv32 @@ -1116,7 +1122,7 @@ case $cpu-$vendor in vendor=axis ;; crx-*) - os=${os:-elf} + basic_os=${basic_os:-elf} ;; neo-tandem) cpu=neo @@ -1138,16 +1144,12 @@ case $cpu-$vendor in cpu=nsx vendor=tandem ;; - s390-*) - cpu=s390 - vendor=ibm - ;; - s390x-*) - cpu=s390x - vendor=ibm + mipsallegrexel-sony) + cpu=mipsallegrexel + vendor=sony ;; tile*-*) - os=${os:-linux-gnu} + basic_os=${basic_os:-linux-gnu} ;; *) @@ -1164,7 +1166,7 @@ case $cpu-$vendor in | am33_2.0 \ | amdgcn \ | arc | arceb \ - | arm | arm[lb]e | arme[lb] | armv* \ + | arm | arm[lb]e | arme[lb] | armv* \ | avr | avr32 \ | asmjs \ | ba \ @@ -1229,6 +1231,7 @@ case $cpu-$vendor in | pyramid \ | riscv | riscv32 | riscv64 \ | rl78 | romp | rs6000 | rx \ + | s390 | s390x \ | score \ | sh | shl \ | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \ @@ -1238,6 +1241,7 @@ case $cpu-$vendor in | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ | spu \ | tahoe \ + | thumbv7* \ | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ | tron \ | ubicom32 \ @@ -1275,8 +1279,47 @@ esac # Decode manufacturer-specific aliases for certain operating systems. -if [ x$os != x ] +if test x$basic_os != x then + +# First recognize some ad-hoc caes, or perhaps split kernel-os, or else just +# set os. +case $basic_os in + gnu/linux*) + kernel=linux + os=$(echo $basic_os | sed -e 's|gnu/linux|gnu|') + ;; + os2-emx) + kernel=os2 + os=$(echo $basic_os | sed -e 's|os2-emx|emx|') + ;; + nto-qnx*) + kernel=nto + os=$(echo $basic_os | sed -e 's|nto-qnx|qnx|') + ;; + *-*) + # shellcheck disable=SC2162 + IFS="-" read kernel os <&2 - exit 1 + # No normalization, but not necessarily accepted, that comes below. ;; esac + else # Here we handle the default operating systems that come with various machines. @@ -1528,6 +1498,7 @@ else # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. +kernel= case $cpu-$vendor in score-*) os=elf @@ -1539,7 +1510,8 @@ case $cpu-$vendor in os=riscix1.2 ;; arm*-rebel) - os=linux + kernel=linux + os=gnu ;; arm*-semi) os=aout @@ -1705,84 +1677,173 @@ case $cpu-$vendor in os=none ;; esac + fi +# Now, validate our (potentially fixed-up) OS. +case $os in + # Sometimes we do "kernel-abi", so those need to count as OSes. + musl* | newlib* | uclibc*) + ;; + # Likewise for "kernel-libc" + eabi | eabihf | gnueabi | gnueabihf) + ;; + # Now accept the basic system types. + # The portable systems comes first. + # Each alternative MUST end in a * to match a version number. + gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ + | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \ + | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ + | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ + | hiux* | abug | nacl* | netware* | windows* \ + | os9* | macos* | osx* | ios* \ + | mpw* | magic* | mmixware* | mon960* | lnews* \ + | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ + | aos* | aros* | cloudabi* | sortix* | twizzler* \ + | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ + | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ + | mirbsd* | netbsd* | dicos* | openedition* | ose* \ + | bitrig* | openbsd* | solidbsd* | libertybsd* | os108* \ + | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \ + | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ + | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ + | udi* | lites* | ieee* | go32* | aux* | hcos* \ + | chorusrdb* | cegcc* | glidix* \ + | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ + | midipix* | mingw32* | mingw64* | mint* \ + | uxpv* | beos* | mpeix* | udk* | moxiebox* \ + | interix* | uwin* | mks* | rhapsody* | darwin* \ + | openstep* | oskit* | conix* | pw32* | nonstopux* \ + | storm-chaos* | tops10* | tenex* | tops20* | its* \ + | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \ + | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \ + | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ + | skyos* | haiku* | rdos* | toppers* | drops* | es* \ + | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ + | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ + | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx*) + ;; + # This one is extra strict with allowed versions + sco3.2v2 | sco3.2v[4-9]* | sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + ;; + none) + ;; + *) + echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2 + exit 1 + ;; +esac + +# As a final step for OS-related things, validate the OS-kernel combination +# (given a valid OS), if there is a kernel. +case $kernel-$os in + linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | linux-musl* | linux-uclibc* ) + ;; + uclinux-uclibc* ) + ;; + -dietlibc* | -newlib* | -musl* | -uclibc* ) + # These are just libc implementations, not actual OSes, and thus + # require a kernel. + echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 + exit 1 + ;; + kfreebsd*-gnu* | kopensolaris*-gnu*) + ;; + nto-qnx*) + ;; + os2-emx) + ;; + *-eabi* | *-gnueabi*) + ;; + -*) + # Blank kernel with real OS is always fine. + ;; + *-*) + echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 + exit 1 + ;; +esac + # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. case $vendor in unknown) - case $os in - riscix*) + case $cpu-$os in + *-riscix*) vendor=acorn ;; - sunos*) + *-sunos*) vendor=sun ;; - cnk*|-aix*) + *-cnk* | *-aix*) vendor=ibm ;; - beos*) + *-beos*) vendor=be ;; - hpux*) + *-hpux*) vendor=hp ;; - mpeix*) + *-mpeix*) vendor=hp ;; - hiux*) + *-hiux*) vendor=hitachi ;; - unos*) + *-unos*) vendor=crds ;; - dgux*) + *-dgux*) vendor=dg ;; - luna*) + *-luna*) vendor=omron ;; - genix*) + *-genix*) vendor=ns ;; - clix*) + *-clix*) vendor=intergraph ;; - mvs* | opened*) + *-mvs* | *-opened*) vendor=ibm ;; - os400*) + *-os400*) vendor=ibm ;; - ptx*) + s390-* | s390x-*) + vendor=ibm + ;; + *-ptx*) vendor=sequent ;; - tpf*) + *-tpf*) vendor=ibm ;; - vxsim* | vxworks* | windiss*) + *-vxsim* | *-vxworks* | *-windiss*) vendor=wrs ;; - aux*) + *-aux*) vendor=apple ;; - hms*) + *-hms*) vendor=hitachi ;; - mpw* | macos*) + *-mpw* | *-macos*) vendor=apple ;; - *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) + *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) vendor=atari ;; - vos*) + *-vos*) vendor=stratus ;; esac ;; esac -echo "$cpu-$vendor-$os" +echo "$cpu-$vendor-${kernel:+$kernel-}$os" exit # Local variables: diff --git a/objc/configure b/apple/configure similarity index 100% rename from objc/configure rename to apple/configure diff --git a/objc/configure.ac b/apple/configure.ac similarity index 100% rename from objc/configure.ac rename to apple/configure.ac diff --git a/objc/depcomp b/apple/depcomp similarity index 100% rename from objc/depcomp rename to apple/depcomp diff --git a/objc/install-sh b/apple/install-sh similarity index 100% rename from objc/install-sh rename to apple/install-sh diff --git a/objc/libtool b/apple/libtool similarity index 100% rename from objc/libtool rename to apple/libtool diff --git a/objc/ltmain.sh b/apple/ltmain.sh similarity index 100% rename from objc/ltmain.sh rename to apple/ltmain.sh diff --git a/objc/m4/libtool.m4 b/apple/m4/libtool.m4 similarity index 100% rename from objc/m4/libtool.m4 rename to apple/m4/libtool.m4 diff --git a/objc/m4/ltoptions.m4 b/apple/m4/ltoptions.m4 similarity index 100% rename from objc/m4/ltoptions.m4 rename to apple/m4/ltoptions.m4 diff --git a/objc/m4/ltsugar.m4 b/apple/m4/ltsugar.m4 similarity index 100% rename from objc/m4/ltsugar.m4 rename to apple/m4/ltsugar.m4 diff --git a/objc/m4/ltversion.m4 b/apple/m4/ltversion.m4 similarity index 100% rename from objc/m4/ltversion.m4 rename to apple/m4/ltversion.m4 diff --git a/objc/m4/lt~obsolete.m4 b/apple/m4/lt~obsolete.m4 similarity index 100% rename from objc/m4/lt~obsolete.m4 rename to apple/m4/lt~obsolete.m4 diff --git a/objc/missing b/apple/missing similarity index 100% rename from objc/missing rename to apple/missing diff --git a/objc/src/.gitignore b/apple/src/.gitignore similarity index 100% rename from objc/src/.gitignore rename to apple/src/.gitignore diff --git a/objc/src/ArchDetect.h b/apple/src/ArchDetect.h similarity index 100% rename from objc/src/ArchDetect.h rename to apple/src/ArchDetect.h diff --git a/objc/src/ArchDetect.m b/apple/src/ArchDetect.m similarity index 100% rename from objc/src/ArchDetect.m rename to apple/src/ArchDetect.m diff --git a/objc/src/AtomicLong.h b/apple/src/AtomicLong.h similarity index 100% rename from objc/src/AtomicLong.h rename to apple/src/AtomicLong.h diff --git a/objc/src/AtomicLong.m b/apple/src/AtomicLong.m similarity index 100% rename from objc/src/AtomicLong.m rename to apple/src/AtomicLong.m diff --git a/objc/src/ExecuteDelegate.h b/apple/src/ExecuteDelegate.h similarity index 100% rename from objc/src/ExecuteDelegate.h rename to apple/src/ExecuteDelegate.h diff --git a/objc/src/FFmpegExecution.h b/apple/src/FFmpegExecution.h similarity index 100% rename from objc/src/FFmpegExecution.h rename to apple/src/FFmpegExecution.h diff --git a/objc/src/FFmpegExecution.m b/apple/src/FFmpegExecution.m similarity index 100% rename from objc/src/FFmpegExecution.m rename to apple/src/FFmpegExecution.m diff --git a/objc/src/FFmpegKit.h b/apple/src/FFmpegKit.h similarity index 100% rename from objc/src/FFmpegKit.h rename to apple/src/FFmpegKit.h diff --git a/objc/src/FFmpegKit.m b/apple/src/FFmpegKit.m similarity index 100% rename from objc/src/FFmpegKit.m rename to apple/src/FFmpegKit.m diff --git a/objc/src/FFmpegKitConfig.h b/apple/src/FFmpegKitConfig.h similarity index 100% rename from objc/src/FFmpegKitConfig.h rename to apple/src/FFmpegKitConfig.h diff --git a/objc/src/FFmpegKitConfig.m b/apple/src/FFmpegKitConfig.m similarity index 100% rename from objc/src/FFmpegKitConfig.m rename to apple/src/FFmpegKitConfig.m diff --git a/objc/src/FFprobeKit.h b/apple/src/FFprobeKit.h similarity index 100% rename from objc/src/FFprobeKit.h rename to apple/src/FFprobeKit.h diff --git a/objc/src/FFprobeKit.m b/apple/src/FFprobeKit.m similarity index 100% rename from objc/src/FFprobeKit.m rename to apple/src/FFprobeKit.m diff --git a/objc/src/LogDelegate.h b/apple/src/LogDelegate.h similarity index 100% rename from objc/src/LogDelegate.h rename to apple/src/LogDelegate.h diff --git a/objc/src/Makefile.am b/apple/src/Makefile.am similarity index 100% rename from objc/src/Makefile.am rename to apple/src/Makefile.am diff --git a/objc/src/Makefile.in b/apple/src/Makefile.in similarity index 100% rename from objc/src/Makefile.in rename to apple/src/Makefile.in diff --git a/objc/src/MediaInformation.h b/apple/src/MediaInformation.h similarity index 100% rename from objc/src/MediaInformation.h rename to apple/src/MediaInformation.h diff --git a/objc/src/MediaInformation.m b/apple/src/MediaInformation.m similarity index 100% rename from objc/src/MediaInformation.m rename to apple/src/MediaInformation.m diff --git a/objc/src/MediaInformationParser.h b/apple/src/MediaInformationParser.h similarity index 100% rename from objc/src/MediaInformationParser.h rename to apple/src/MediaInformationParser.h diff --git a/objc/src/MediaInformationParser.m b/apple/src/MediaInformationParser.m similarity index 100% rename from objc/src/MediaInformationParser.m rename to apple/src/MediaInformationParser.m diff --git a/objc/src/Statistics.h b/apple/src/Statistics.h similarity index 100% rename from objc/src/Statistics.h rename to apple/src/Statistics.h diff --git a/objc/src/Statistics.m b/apple/src/Statistics.m similarity index 100% rename from objc/src/Statistics.m rename to apple/src/Statistics.m diff --git a/objc/src/StatisticsDelegate.h b/apple/src/StatisticsDelegate.h similarity index 100% rename from objc/src/StatisticsDelegate.h rename to apple/src/StatisticsDelegate.h diff --git a/objc/src/StreamInformation.h b/apple/src/StreamInformation.h similarity index 100% rename from objc/src/StreamInformation.h rename to apple/src/StreamInformation.h diff --git a/objc/src/StreamInformation.m b/apple/src/StreamInformation.m similarity index 100% rename from objc/src/StreamInformation.m rename to apple/src/StreamInformation.m diff --git a/objc/src/ffmpegkit_exception.h b/apple/src/ffmpegkit_exception.h similarity index 100% rename from objc/src/ffmpegkit_exception.h rename to apple/src/ffmpegkit_exception.h diff --git a/objc/src/ffmpegkit_exception.m b/apple/src/ffmpegkit_exception.m similarity index 100% rename from objc/src/ffmpegkit_exception.m rename to apple/src/ffmpegkit_exception.m diff --git a/objc/src/fftools_cmdutils.c b/apple/src/fftools_cmdutils.c similarity index 100% rename from objc/src/fftools_cmdutils.c rename to apple/src/fftools_cmdutils.c diff --git a/objc/src/fftools_cmdutils.h b/apple/src/fftools_cmdutils.h similarity index 100% rename from objc/src/fftools_cmdutils.h rename to apple/src/fftools_cmdutils.h diff --git a/objc/src/fftools_ffmpeg.c b/apple/src/fftools_ffmpeg.c similarity index 100% rename from objc/src/fftools_ffmpeg.c rename to apple/src/fftools_ffmpeg.c diff --git a/objc/src/fftools_ffmpeg.h b/apple/src/fftools_ffmpeg.h similarity index 100% rename from objc/src/fftools_ffmpeg.h rename to apple/src/fftools_ffmpeg.h diff --git a/objc/src/fftools_ffmpeg_filter.c b/apple/src/fftools_ffmpeg_filter.c similarity index 100% rename from objc/src/fftools_ffmpeg_filter.c rename to apple/src/fftools_ffmpeg_filter.c diff --git a/objc/src/fftools_ffmpeg_hw.c b/apple/src/fftools_ffmpeg_hw.c similarity index 100% rename from objc/src/fftools_ffmpeg_hw.c rename to apple/src/fftools_ffmpeg_hw.c diff --git a/objc/src/fftools_ffmpeg_opt.c b/apple/src/fftools_ffmpeg_opt.c similarity index 100% rename from objc/src/fftools_ffmpeg_opt.c rename to apple/src/fftools_ffmpeg_opt.c diff --git a/objc/src/fftools_ffmpeg_videotoolbox.c b/apple/src/fftools_ffmpeg_videotoolbox.c similarity index 100% rename from objc/src/fftools_ffmpeg_videotoolbox.c rename to apple/src/fftools_ffmpeg_videotoolbox.c diff --git a/objc/src/fftools_ffprobe.c b/apple/src/fftools_ffprobe.c similarity index 100% rename from objc/src/fftools_ffprobe.c rename to apple/src/fftools_ffprobe.c diff --git a/ios.sh b/ios.sh index 75991f2..ce6b443 100755 --- a/ios.sh +++ b/ios.sh @@ -132,12 +132,12 @@ fi # PROCESS FULL OPTION AS LAST OPTION if [[ -n ${BUILD_FULL} ]]; then - for library in {0..57}; do + for library in {0..58}; do if [ ${GPL_ENABLED} == "yes" ]; then - enable_library "$(get_library_name $library)" 1 + enable_library "$(get_library_name "$library")" 1 else - if [[ $(is_gpl_licensed $library) -eq 1 ]]; then - enable_library "$(get_library_name $library)" 1 + if [[ $(is_gpl_licensed "$library") -eq 1 ]]; then + enable_library "$(get_library_name "$library")" 1 fi fi done @@ -150,32 +150,42 @@ if [[ -n ${DISPLAY_HELP} ]]; then fi # DISABLE NOT SUPPORTED ARCHITECTURES -disable_architecture_not_supported_on_detected_sdk_version "${ARCH_ARMV7}" "${DETECTED_IOS_SDK_VERSION}" -disable_architecture_not_supported_on_detected_sdk_version "${ARCH_ARMV7S}" "${DETECTED_IOS_SDK_VERSION}" -disable_architecture_not_supported_on_detected_sdk_version "${ARCH_I386}" "${DETECTED_IOS_SDK_VERSION}" -disable_architecture_not_supported_on_detected_sdk_version "${ARCH_ARM64E}" "${DETECTED_IOS_SDK_VERSION}" -disable_architecture_not_supported_on_detected_sdk_version "${ARCH_X86_64_MAC_CATALYST}" "${DETECTED_IOS_SDK_VERSION}" +disable_ios_architecture_not_supported_on_detected_sdk_version "${ARCH_ARMV7}" "${DETECTED_IOS_SDK_VERSION}" +disable_ios_architecture_not_supported_on_detected_sdk_version "${ARCH_ARMV7S}" "${DETECTED_IOS_SDK_VERSION}" +disable_ios_architecture_not_supported_on_detected_sdk_version "${ARCH_I386}" "${DETECTED_IOS_SDK_VERSION}" +disable_ios_architecture_not_supported_on_detected_sdk_version "${ARCH_ARM64E}" "${DETECTED_IOS_SDK_VERSION}" +disable_ios_architecture_not_supported_on_detected_sdk_version "${ARCH_X86_64_MAC_CATALYST}" "${DETECTED_IOS_SDK_VERSION}" +disable_ios_architecture_not_supported_on_detected_sdk_version "${ARCH_ARM64_MAC_CATALYST}" "${DETECTED_IOS_SDK_VERSION}" +disable_ios_architecture_not_supported_on_detected_sdk_version "${ARCH_ARM64_SIMULATOR}" "${DETECTED_IOS_SDK_VERSION}" # CHECK SOME RULES FOR .xcframework BUNDLES -# 1. DISABLE x86-64-mac-catalyst WHEN x86-64 IS ENABLED IN xcframework BUNDLES -if [[ -z ${FFMPEG_KIT_XCF_BUILD} ]] && [[ ${ENABLED_ARCHITECTURES[${ARCH_X86_64}]} -eq 1 ]] && [[ ${ENABLED_ARCHITECTURES[${ARCH_X86_64_MAC_CATALYST}]} -eq 1 ]]; then - echo -e "INFO: Disabled x86-64-mac-catalyst architecture which can not co-exist with x86-64 in a framework bundle / universal fat library.\n" 1>>"${BASEDIR}"/build.log 2>&1 - disable_arch "x86-64-mac-catalyst" -fi - -# 2. DISABLE arm64e WHEN arm64 IS ENABLED IN xcframework BUNDLES -if [[ -n ${FFMPEG_KIT_XCF_BUILD} ]] && [[ ${ENABLED_ARCHITECTURES[${ARCH_ARM64E}]} -eq 1 ]] && [[ ${ENABLED_ARCHITECTURES[${ARCH_ARM64}]} -eq 1 ]]; then - echo -e "INFO: Disabled arm64e architecture which can not co-exist with arm64 in an xcframework bundle.\n" 1>>"${BASEDIR}"/build.log 2>&1 - disable_arch "arm64e" -fi - -# 3. DO NOT ALLOW --lts AND --xcframework OPTIONS TOGETHER +# 1. DO NOT ALLOW --lts AND --xcframework OPTIONS TOGETHER if [[ -n ${FFMPEG_KIT_XCF_BUILD} ]] && [[ -n ${FFMPEG_KIT_LTS_BUILD} ]]; then echo -e "\n(*) LTS packages does not support xcframework bundles.\n" exit 1 fi +# CHECK SOME RULES FOR .framework BUNDLES + +# 1. DISABLE arm64-mac-catalyst WHEN arm64 IS ENABLED IN framework BUNDLES +if [[ -z ${FFMPEG_KIT_XCF_BUILD} ]] && [[ ${ENABLED_ARCHITECTURES[${ARCH_ARM64}]} -eq 1 ]] && [[ ${ENABLED_ARCHITECTURES[${ARCH_ARM64_MAC_CATALYST}]} -eq 1 ]]; then + echo -e "INFO: Disabled arm64-mac-catalyst architecture which can not co-exist with arm64 in the same framework bundle.\n" 1>>"${BASEDIR}"/build.log 2>&1 + disable_arch "arm64-mac-catalyst" +fi + +# 2. DISABLE arm64-simulator WHEN arm64 IS ENABLED IN framework BUNDLES +if [[ -z ${FFMPEG_KIT_XCF_BUILD} ]] && [[ ${ENABLED_ARCHITECTURES[${ARCH_ARM64}]} -eq 1 ]] && [[ ${ENABLED_ARCHITECTURES[${ARCH_ARM64_SIMULATOR}]} -eq 1 ]]; then + echo -e "INFO: Disabled arm64-simulator architecture which can not co-exist with arm64 in the same framework bundle.\n" 1>>"${BASEDIR}"/build.log 2>&1 + disable_arch "arm64-simulator" +fi + +# 3. DISABLE x86-64-mac-catalyst WHEN x86-64 IS ENABLED IN framework BUNDLES +if [[ -z ${FFMPEG_KIT_XCF_BUILD} ]] && [[ ${ENABLED_ARCHITECTURES[${ARCH_X86_64}]} -eq 1 ]] && [[ ${ENABLED_ARCHITECTURES[${ARCH_X86_64_MAC_CATALYST}]} -eq 1 ]]; then + echo -e "INFO: Disabled x86-64-mac-catalyst architecture which can not co-exist with x86-64 in the same framework bundle.\n" 1>>"${BASEDIR}"/build.log 2>&1 + disable_arch "x86-64-mac-catalyst" +fi + echo -e "\nBuilding ffmpeg-kit ${BUILD_TYPE_ID}static library for iOS\n" echo -e -n "INFO: Building ffmpeg-kit ${BUILD_VERSION} ${BUILD_TYPE_ID}for iOS: " 1>>"${BASEDIR}"/build.log 2>&1 echo -e "$(date)\n" 1>>"${BASEDIR}"/build.log 2>&1 @@ -190,7 +200,7 @@ print_redownload_requested_libraries # VALIDATE GPL FLAGS for gpl_library in {$LIBRARY_X264,$LIBRARY_XVIDCORE,$LIBRARY_X265,$LIBRARY_LIBVIDSTAB,$LIBRARY_RUBBERBAND}; do if [[ ${ENABLED_LIBRARIES[$gpl_library]} -eq 1 ]]; then - library_name=$(get_library_name ${gpl_library}) + library_name=$(get_library_name "${gpl_library}") if [ ${GPL_ENABLED} != "yes" ]; then echo -e "\n(*) Invalid configuration detected. GPL library ${library_name} enabled without --enable-gpl flag.\n" @@ -203,6 +213,9 @@ done echo -n -e "\nDownloading sources: " echo -e "INFO: Downloading source code of ffmpeg and enabled external libraries.\n" 1>>"${BASEDIR}"/build.log 2>&1 +# DOWNLOAD GNU CONFIG +download_gnu_config + # DOWNLOAD LIBRARY SOURCES downloaded_enabled_library_sources "${ENABLED_LIBRARIES[@]}" @@ -210,421 +223,51 @@ downloaded_enabled_library_sources "${ENABLED_LIBRARIES[@]}" TARGET_ARCH_LIST=() # BUILD ENABLED LIBRARIES ON ENABLED ARCHITECTURES -for run_arch in {0..10}; do +for run_arch in {0..12}; do if [[ ${ENABLED_ARCHITECTURES[$run_arch]} -eq 1 ]]; then - export ARCH=$(get_arch_name $run_arch) - export TARGET_SDK=$(get_target_sdk) + export ARCH=$(get_arch_name "$run_arch") + export FULL_ARCH=$(get_full_arch_name "$run_arch") export SDK_PATH=$(get_sdk_path) export SDK_NAME=$(get_sdk_name) - export LIPO="$(xcrun --sdk "$(get_sdk_name)" -f lipo)" - # EXECUTE MAIN BUILD SCRIPT . "${BASEDIR}"/scripts/main-ios.sh "${ENABLED_LIBRARIES[@]}" - case ${ARCH} in - x86-64) - TARGET_ARCH="x86_64" - ;; - x86-64-mac-catalyst) - TARGET_ARCH="x86_64-mac-catalyst" - ;; - *) - TARGET_ARCH="${ARCH}" - ;; - esac - TARGET_ARCH_LIST+=("${TARGET_ARCH}") + + TARGET_ARCH_LIST+=("${FULL_ARCH}") # CLEAR FLAGS - for library in {0..57}; do - library_name=$(get_library_name ${library}) + for library in {0..58}; do + library_name=$(get_library_name "${library}") unset "$(echo "OK_${library_name}" | sed "s/\-/\_/g")" unset "$(echo "DEPENDENCY_REBUILT_${library_name}" | sed "s/\-/\_/g")" done fi done -FFMPEG_LIBS="libavcodec libavdevice libavfilter libavformat libavutil libswresample libswscale" - -# BUILD STATIC LIBRARIES -BUILD_LIBRARY_EXTENSION="a" - # BUILD FFMPEG-KIT if [[ -n ${TARGET_ARCH_LIST[0]} ]]; then # INITIALIZE TARGET FOLDERS + initialize_prebuilt_ios_folders + + # PREPARE PLATFORM ARCHITECTURE STRINGS + build_apple_architecture_variant_strings + if [[ -n ${FFMPEG_KIT_XCF_BUILD} ]]; then - echo -e -n "\n\nCreating xcframeworks under prebuilt: " + echo -e -n "\n\nCreating universal libraries and xcframeworks under prebuilt: " - rm -rf "${BASEDIR}/prebuilt/ios-xcframework" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - mkdir -p "${BASEDIR}/prebuilt/ios-xcframework" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 + create_universal_libraries_for_ios_xcframeworks + + create_frameworks_for_ios_xcframeworks + + create_ios_xcframeworks else - echo -e -n "\n\nCreating frameworks and universal libraries under prebuilt: " + echo -e -n "\n\nCreating universal libraries and frameworks under prebuilt: " - rm -rf "${BASEDIR}/prebuilt/ios-universal" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - mkdir -p "${BASEDIR}/prebuilt/ios-universal" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - rm -rf "${BASEDIR}/prebuilt/ios-framework" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - mkdir -p "${BASEDIR}/prebuilt/ios-framework" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 + create_universal_libraries_for_ios_default_frameworks + + create_ios_default_frameworks fi - # CREATE ENABLED LIBRARY PACKAGES. IT IS EITHER - # .framework and fat/universal library - # OR - # .xcframework - for library in {0..57}; do - if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then - library_name=$(get_library_name ${library}) - package_config_file_name=$(get_package_config_file_name ${library}) - - # EACH ENABLED LIBRARY HAS TO HAVE A .pc FILE AND A VERSION - library_version=$(get_external_library_version "${package_config_file_name}") - if [[ -z ${library_version} ]]; then - echo -e "Failed to detect version for ${library_name} from ${package_config_file_name}.pc\n" 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "failed\n" - exit 1 - fi - - echo -e "Creating external library package for ${library_name}\n" 1>>"${BASEDIR}"/build.log 2>&1 - - # SOME CUSTOM CODE TO HANDLE LIBRARIES THAT PRODUCE MULTIPLE LIBRARY FILES - if [[ ${LIBRARY_LIBTHEORA} == "$library" ]]; then - - LIBRARY_CREATED=$(create_external_library_package $library "libtheora" "libtheora.a" "${library_version}") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - LIBRARY_CREATED=$(create_external_library_package $library "libtheoraenc" "libtheoraenc.a" "${library_version}") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - LIBRARY_CREATED=$(create_external_library_package $library "libtheoradec" "libtheoradec.a" "${library_version}") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - elif [[ ${LIBRARY_LIBVORBIS} == "$library" ]]; then - - LIBRARY_CREATED=$(create_external_library_package $library "libvorbisfile" "libvorbisfile.a" "${library_version}") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - LIBRARY_CREATED=$(create_external_library_package $library "libvorbisenc" "libvorbisenc.a" "${library_version}") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - LIBRARY_CREATED=$(create_external_library_package $library "libvorbis" "libvorbis.a" "${library_version}") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - elif [[ ${LIBRARY_LIBWEBP} == "$library" ]]; then - - LIBRARY_CREATED=$(create_external_library_package $library "libwebpmux" "libwebpmux.a" "${library_version}") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - LIBRARY_CREATED=$(create_external_library_package $library "libwebpdemux" "libwebpdemux.a" "${library_version}") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - LIBRARY_CREATED=$(create_external_library_package $library "libwebp" "libwebp.a" "${library_version}") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - elif [[ ${LIBRARY_OPENCOREAMR} == "$library" ]]; then - - LIBRARY_CREATED=$(create_external_library_package $library "libopencore-amrnb" "libopencore-amrnb.a" "${library_version}") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - elif [[ ${LIBRARY_NETTLE} == "$library" ]]; then - - LIBRARY_CREATED=$(create_external_library_package $library "libnettle" "libnettle.a" "${library_version}") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - LIBRARY_CREATED=$(create_external_library_package $library "libhogweed" "libhogweed.a" "${library_version}") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - else - - # LIBRARIES WHICH HAVE ONLY ONE LIBRARY FILE ARE CREATED HERE - library_name=$(get_library_name $((library))) - static_archive_name=$(get_static_archive_name $((library))) - LIBRARY_CREATED=$(create_external_library_package $library "$library_name" "$static_archive_name" "${library_version}") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - fi - - fi - done - - # CREATE FFMPEG & FFMPEG KIT PACKAGES - if [[ -n ${FFMPEG_KIT_XCF_BUILD} ]]; then - - # CREATE .xcframework BUNDLE IF ENABLED - - # CREATE FFMPEG - for FFMPEG_LIB in ${FFMPEG_LIBS}; do - - # INITIALIZE FFMPEG FRAMEWORK DIRECTORY - XCFRAMEWORK_PATH=${BASEDIR}/prebuilt/ios-xcframework/${FFMPEG_LIB}.xcframework - mkdir -p "${XCFRAMEWORK_PATH}" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - - echo -e "Creating package for ${FFMPEG_LIB}\n" 1>>"${BASEDIR}"/build.log 2>&1 - - BUILD_COMMAND="xcodebuild -create-xcframework " - - for TARGET_ARCH in "${TARGET_ARCH_LIST[@]}"; do - - # arm64e NOT INCLUDED IN .xcframework BUNDLES - if [[ ${TARGET_ARCH} != "arm64e" ]]; then - - FFMPEG_LIB_UPPERCASE=$(echo "${FFMPEG_LIB}" | tr '[a-z]' '[A-Z]') - FFMPEG_LIB_CAPITALCASE=$(to_capital_case "${FFMPEG_LIB}") - - # EXTRACT FFMPEG VERSION - FFMPEG_LIB_MAJOR=$(grep "#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MAJOR" "${BASEDIR}/prebuilt/ios-${TARGET_ARCH}/ffmpeg/include/${FFMPEG_LIB}/version.h" | sed -e "s/#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MAJOR//g;s/\ //g") - FFMPEG_LIB_MINOR=$(grep "#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MINOR" "${BASEDIR}/prebuilt/ios-${TARGET_ARCH}/ffmpeg/include/${FFMPEG_LIB}/version.h" | sed -e "s/#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MINOR//g;s/\ //g") - FFMPEG_LIB_MICRO=$(grep "#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MICRO" "${BASEDIR}/prebuilt/ios-${TARGET_ARCH}/ffmpeg/include/${FFMPEG_LIB}/version.h" | sed "s/#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MICRO//g;s/\ //g") - FFMPEG_LIB_VERSION="${FFMPEG_LIB_MAJOR}.${FFMPEG_LIB_MINOR}.${FFMPEG_LIB_MICRO}" - - # INITIALIZE SUB-FRAMEWORK DIRECTORY - FFMPEG_LIB_FRAMEWORK_PATH=${BASEDIR}/prebuilt/ios-xcframework/.tmp/ios-${TARGET_ARCH}/${FFMPEG_LIB}.framework - rm -rf "${FFMPEG_LIB_FRAMEWORK_PATH}" 1>>"${BASEDIR}"/build.log 2>&1 - mkdir -p "${FFMPEG_LIB_FRAMEWORK_PATH}/Headers" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - - # COPY HEADER FILES - cp -r "${BASEDIR}"/prebuilt/ios-${TARGET_ARCH}/ffmpeg/include/${FFMPEG_LIB}/* ${FFMPEG_LIB_FRAMEWORK_PATH}/Headers 1>>"${BASEDIR}"/build.log 2>&1 - - # COPY LIBRARY FILE - cp "${BASEDIR}/prebuilt/ios-${TARGET_ARCH}/ffmpeg/lib/${FFMPEG_LIB}.${BUILD_LIBRARY_EXTENSION}" "${FFMPEG_LIB_FRAMEWORK_PATH}/${FFMPEG_LIB}" 1>>"${BASEDIR}"/build.log 2>&1 - - # COPY THE LICENSES - if [ ${GPL_ENABLED} == "yes" ]; then - cp "${BASEDIR}/LICENSE.GPLv3" "${FFMPEG_LIB_FRAMEWORK_PATH}/LICENSE" 1>>"${BASEDIR}"/build.log 2>&1 - else - cp "${BASEDIR}/LICENSE.LGPLv3" "${FFMPEG_LIB_FRAMEWORK_PATH}/LICENSE" 1>>"${BASEDIR}"/build.log 2>&1 - fi - - build_info_plist "${FFMPEG_LIB_FRAMEWORK_PATH}/Info.plist" "${FFMPEG_LIB}" "com.arthenica.ffmpegkit.${FFMPEG_LIB_CAPITALCASE}" "${FFMPEG_LIB_VERSION}" "${FFMPEG_LIB_VERSION}" - - BUILD_COMMAND+=" -framework ${FFMPEG_LIB_FRAMEWORK_PATH}" - fi - - done - - BUILD_COMMAND+=" -output ${XCFRAMEWORK_PATH}" - - # EXECUTE CREATE FRAMEWORK COMMAND - COMMAND_OUTPUT=$(${BUILD_COMMAND} 2>&1) - echo "${COMMAND_OUTPUT}" 1>>"${BASEDIR}"/build.log 2>&1 - echo "" 1>>"${BASEDIR}"/build.log 2>&1 - - # DO NOT ALLOW EMPTY FRAMEWORKS - if [[ ${COMMAND_OUTPUT} == *"is empty in library"* ]]; then - echo -e "failed\n" - exit 1 - fi - - echo -e "Created ${FFMPEG_LIB} xcframework successfully.\n" 1>>"${BASEDIR}"/build.log 2>&1 - - done - - # CREATE FFMPEG - - # INITIALIZE FFMPEG KIT FRAMEWORK DIRECTORY - XCFRAMEWORK_PATH=${BASEDIR}/prebuilt/ios-xcframework/ffmpegkit.xcframework - mkdir -p "${XCFRAMEWORK_PATH}" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - - BUILD_COMMAND="xcodebuild -create-xcframework " - - for TARGET_ARCH in "${TARGET_ARCH_LIST[@]}"; do - - # arm64e NOT INCLUDED IN .xcframework BUNDLES - if [[ ${TARGET_ARCH} != "arm64e" ]]; then - - # INITIALIZE SUB-FRAMEWORK DIRECTORY - FFMPEG_KIT_FRAMEWORK_PATH="${BASEDIR}/prebuilt/ios-xcframework/.tmp/ios-${TARGET_ARCH}/ffmpegkit.framework" - rm -rf "${FFMPEG_KIT_FRAMEWORK_PATH}" 1>>"${BASEDIR}"/build.log 2>&1 - mkdir -p "${FFMPEG_KIT_FRAMEWORK_PATH}/Headers" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - mkdir -p "${FFMPEG_KIT_FRAMEWORK_PATH}/Modules" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - - build_modulemap "${FFMPEG_KIT_FRAMEWORK_PATH}/Modules/module.modulemap" - - # COPY HEADER FILES - cp -r "${BASEDIR}"/prebuilt/ios-"${TARGET_ARCH}"/ffmpeg-kit/include/* "${FFMPEG_KIT_FRAMEWORK_PATH}"/Headers 1>>"${BASEDIR}"/build.log 2>&1 - - # COPY LIBRARY FILE - cp "${BASEDIR}/prebuilt/ios-${TARGET_ARCH}/ffmpeg-kit/lib/libffmpegkit.${BUILD_LIBRARY_EXTENSION}" "${FFMPEG_KIT_FRAMEWORK_PATH}/ffmpegkit" 1>>"${BASEDIR}"/build.log 2>&1 - - # COPY THE LICENSES - if [ ${GPL_ENABLED} == "yes" ]; then - cp "${BASEDIR}/LICENSE.GPLv3" "${FFMPEG_KIT_FRAMEWORK_PATH}/LICENSE" 1>>"${BASEDIR}"/build.log 2>&1 - else - cp "${BASEDIR}/LICENSE.LGPLv3" "${FFMPEG_KIT_FRAMEWORK_PATH}/LICENSE" 1>>"${BASEDIR}"/build.log 2>&1 - fi - - BUILD_COMMAND+=" -framework ${FFMPEG_KIT_FRAMEWORK_PATH}" - fi - done - - BUILD_COMMAND+=" -output ${XCFRAMEWORK_PATH}" - - # EXECUTE CREATE FRAMEWORK COMMAND - COMMAND_OUTPUT=$(${BUILD_COMMAND} 2>&1) - echo "${COMMAND_OUTPUT}" 1>>"${BASEDIR}"/build.log 2>&1 - echo "" 1>>"${BASEDIR}"/build.log 2>&1 - - # DO NOT ALLOW EMPTY FRAMEWORKS - if [[ ${COMMAND_OUTPUT} == *"is empty in library"* ]]; then - echo -e "failed\n" - exit 1 - fi - - echo -e "Created ffmpegkit xcframework successfully.\n" 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "ok\n" - - else - - # CREATE .framework AND FAT/UNIVERSAL LIBRARY IF ENABLED - - # CREATE FFMPEG - - # INITIALIZE UNIVERSAL LIBRARY DIRECTORY - FFMPEG_UNIVERSAL="${BASEDIR}/prebuilt/ios-universal/ffmpeg-universal" - mkdir -p "${FFMPEG_UNIVERSAL}/include" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - mkdir -p "${FFMPEG_UNIVERSAL}/lib" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - - # COPY HEADER FILES - cp -r "${BASEDIR}"/prebuilt/ios-"${TARGET_ARCH_LIST[0]}"/ffmpeg/include/* ${FFMPEG_UNIVERSAL}/include 1>>"${BASEDIR}"/build.log 2>&1 - cp "${BASEDIR}"/prebuilt/ios-"${TARGET_ARCH_LIST[0]}"/ffmpeg/include/config.h "${FFMPEG_UNIVERSAL}/include" 1>>"${BASEDIR}"/build.log 2>&1 - - for FFMPEG_LIB in ${FFMPEG_LIBS}; do - LIPO_COMMAND="${LIPO} -create" - - for TARGET_ARCH in "${TARGET_ARCH_LIST[@]}"; do - LIPO_COMMAND+=" "${BASEDIR}"/prebuilt/ios-${TARGET_ARCH}/ffmpeg/lib/${FFMPEG_LIB}.${BUILD_LIBRARY_EXTENSION}" - done - - LIPO_COMMAND+=" -output ${FFMPEG_UNIVERSAL}/lib/${FFMPEG_LIB}.${BUILD_LIBRARY_EXTENSION}" - - # EXECUTE CREATE UNIVERSAL LIBRARY COMMAND - ${LIPO_COMMAND} 1>>"${BASEDIR}"/build.log 2>&1 - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - FFMPEG_LIB_UPPERCASE=$(echo "${FFMPEG_LIB}" | tr '[a-z]' '[A-Z]') - FFMPEG_LIB_CAPITALCASE=$(to_capital_case "${FFMPEG_LIB}") - - # EXTRACT FFMPEG VERSION - FFMPEG_LIB_MAJOR=$(grep "#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MAJOR" "${FFMPEG_UNIVERSAL}/include/${FFMPEG_LIB}/version.h" | sed -e "s/#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MAJOR//g;s/\ //g") - FFMPEG_LIB_MINOR=$(grep "#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MINOR" "${FFMPEG_UNIVERSAL}/include/${FFMPEG_LIB}/version.h" | sed -e "s/#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MINOR//g;s/\ //g") - FFMPEG_LIB_MICRO=$(grep "#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MICRO" "${FFMPEG_UNIVERSAL}/include/${FFMPEG_LIB}/version.h" | sed "s/#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MICRO//g;s/\ //g") - FFMPEG_LIB_VERSION="${FFMPEG_LIB_MAJOR}.${FFMPEG_LIB_MINOR}.${FFMPEG_LIB_MICRO}" - - # INITIALIZE FRAMEWORK DIRECTORY - FFMPEG_LIB_FRAMEWORK_PATH="${BASEDIR}/prebuilt/ios-framework/${FFMPEG_LIB}.framework" - rm -rf "${FFMPEG_LIB_FRAMEWORK_PATH}" 1>>"${BASEDIR}"/build.log 2>&1 - mkdir -p "${FFMPEG_LIB_FRAMEWORK_PATH}/Headers" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - - # COPY HEADER FILES - cp -r ${FFMPEG_UNIVERSAL}/include/${FFMPEG_LIB}/* ${FFMPEG_LIB_FRAMEWORK_PATH}/Headers 1>>"${BASEDIR}"/build.log 2>&1 - - # COPY LIBRARY FILE - cp "${FFMPEG_UNIVERSAL}/lib/${FFMPEG_LIB}.${BUILD_LIBRARY_EXTENSION}" "${FFMPEG_LIB_FRAMEWORK_PATH}/${FFMPEG_LIB}" 1>>"${BASEDIR}"/build.log 2>&1 - - # COPY FRAMEWORK LICENSES - if [ ${GPL_ENABLED} == "yes" ]; then - cp "${BASEDIR}/LICENSE.GPLv3" "${FFMPEG_LIB_FRAMEWORK_PATH}/LICENSE" 1>>"${BASEDIR}"/build.log 2>&1 - else - cp "${BASEDIR}/LICENSE.LGPLv3" "${FFMPEG_LIB_FRAMEWORK_PATH}/LICENSE" 1>>"${BASEDIR}"/build.log 2>&1 - fi - - build_info_plist "${FFMPEG_LIB_FRAMEWORK_PATH}/Info.plist" "${FFMPEG_LIB}" "com.arthenica.ffmpegkit.${FFMPEG_LIB_CAPITALCASE}" "${FFMPEG_LIB_VERSION}" "${FFMPEG_LIB_VERSION}" - - echo -e "Created ${FFMPEG_LIB} framework successfully.\n" 1>>"${BASEDIR}"/build.log 2>&1 - done - - # COPY UNIVERSAL LIBRARY LICENSES - if [ ${GPL_ENABLED} == "yes" ]; then - cp "${BASEDIR}"/LICENSE.GPLv3 "${FFMPEG_UNIVERSAL}"/LICENSE 1>>"${BASEDIR}"/build.log 2>&1 - else - cp "${BASEDIR}"/LICENSE.LGPLv3 "${FFMPEG_UNIVERSAL}"/LICENSE 1>>"${BASEDIR}"/build.log 2>&1 - fi - - # FFMPEG KIT - - # INITIALIZE FRAMEWORK AND UNIVERSAL LIBRARY DIRECTORIES - FFMPEG_KIT_VERSION=$(get_ffmpeg_kit_version) - FFMPEG_KIT_UNIVERSAL="${BASEDIR}/prebuilt/ios-universal/ffmpeg-kit-universal" - FFMPEG_KIT_FRAMEWORK_PATH="${BASEDIR}/prebuilt/ios-framework/ffmpegkit.framework" - mkdir -p "${FFMPEG_KIT_UNIVERSAL}/include" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - mkdir -p "${FFMPEG_KIT_UNIVERSAL}/lib" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - rm -rf "${FFMPEG_KIT_FRAMEWORK_PATH}" 1>>"${BASEDIR}"/build.log 2>&1 - mkdir -p "${FFMPEG_KIT_FRAMEWORK_PATH}/Headers" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - mkdir -p "${FFMPEG_KIT_FRAMEWORK_PATH}/Modules" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - - LIPO_COMMAND="${LIPO} -create" - for TARGET_ARCH in "${TARGET_ARCH_LIST[@]}"; do - LIPO_COMMAND+=" ${BASEDIR}/prebuilt/ios-${TARGET_ARCH}/ffmpeg-kit/lib/libffmpegkit.${BUILD_LIBRARY_EXTENSION}" - done - LIPO_COMMAND+=" -output ${FFMPEG_KIT_UNIVERSAL}/lib/libffmpegkit.${BUILD_LIBRARY_EXTENSION}" - - # EXECUTE CREATE UNIVERSAL LIBRARY COMMAND - ${LIPO_COMMAND} 1>>"${BASEDIR}"/build.log 2>&1 - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - # COPY HEADER FILES - cp -r "${BASEDIR}"/prebuilt/ios-"${TARGET_ARCH_LIST[0]}"/ffmpeg-kit/include/* "${FFMPEG_KIT_UNIVERSAL}"/include 1>>"${BASEDIR}"/build.log 2>&1 - cp -r "${FFMPEG_KIT_UNIVERSAL}"/include/* "${FFMPEG_KIT_FRAMEWORK_PATH}"/Headers 1>>"${BASEDIR}"/build.log 2>&1 - - # COPY LIBRARY FILE - cp "${FFMPEG_KIT_UNIVERSAL}/lib/libffmpegkit.${BUILD_LIBRARY_EXTENSION}" "${FFMPEG_KIT_FRAMEWORK_PATH}/ffmpegkit" 1>>"${BASEDIR}"/build.log 2>&1 - - # COPY THE LICENSES - if [ ${GPL_ENABLED} == "yes" ]; then - cp "${BASEDIR}"/LICENSE.GPLv3 "${FFMPEG_KIT_UNIVERSAL}"/LICENSE 1>>"${BASEDIR}"/build.log 2>&1 - cp "${BASEDIR}"/LICENSE.GPLv3 "${FFMPEG_KIT_FRAMEWORK_PATH}"/LICENSE 1>>"${BASEDIR}"/build.log 2>&1 - else - cp "${BASEDIR}"/LICENSE.LGPLv3 "${FFMPEG_KIT_UNIVERSAL}"/LICENSE 1>>"${BASEDIR}"/build.log 2>&1 - cp "${BASEDIR}"/LICENSE.LGPLv3 "${FFMPEG_KIT_FRAMEWORK_PATH}"/LICENSE 1>>"${BASEDIR}"/build.log 2>&1 - fi - - build_info_plist "${FFMPEG_KIT_FRAMEWORK_PATH}/Info.plist" "ffmpegkit" "com.arthenica.ffmpegkit.FFmpegKit" "${FFMPEG_KIT_VERSION}" "${FFMPEG_KIT_VERSION}" - build_modulemap "${FFMPEG_KIT_FRAMEWORK_PATH}/Modules/module.modulemap" - - echo -e "Created ffmpegkit.framework and universal library successfully.\n" 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "ok\n" - fi + echo -e "ok\n" fi diff --git a/macos.sh b/macos.sh index 9bfbe56..94583c1 100755 --- a/macos.sh +++ b/macos.sh @@ -82,7 +82,7 @@ while [ ! $# -eq 0 ]; do FFMPEG_KIT_XCF_BUILD="1" ;; -f | --force) - BUILD_FORCE="1" + export BUILD_FORCE="1" ;; --reconf-*) CONF_LIBRARY=$(echo $1 | sed -e 's/^--[A-Za-z]*-//g') @@ -132,12 +132,12 @@ fi # PROCESS FULL OPTION AS LAST OPTION if [[ -n ${BUILD_FULL} ]]; then - for library in {0..57}; do + for library in {0..58}; do if [ ${GPL_ENABLED} == "yes" ]; then - enable_library "$(get_library_name $library)" 1 + enable_library "$(get_library_name "$library")" 1 else - if [[ $(is_gpl_licensed $library) -eq 1 ]]; then - enable_library "$(get_library_name $library)" 1 + if [[ $(is_gpl_licensed "$library") -eq 1 ]]; then + enable_library "$(get_library_name "$library")" 1 fi fi done @@ -149,6 +149,9 @@ if [[ -n ${DISPLAY_HELP} ]]; then exit 0 fi +# DISABLE NOT SUPPORTED ARCHITECTURES +disable_macos_architecture_not_supported_on_detected_sdk_version "${ARCH_ARM64}" "${DETECTED_MACOS_SDK_VERSION}" + # CHECK SOME RULES FOR .xcframework BUNDLES # 1. DO NOT ALLOW --lts AND --xcframework OPTIONS TOGETHER @@ -171,7 +174,7 @@ print_redownload_requested_libraries # VALIDATE GPL FLAGS for gpl_library in {$LIBRARY_X264,$LIBRARY_XVIDCORE,$LIBRARY_X265,$LIBRARY_LIBVIDSTAB,$LIBRARY_RUBBERBAND}; do if [[ ${ENABLED_LIBRARIES[$gpl_library]} -eq 1 ]]; then - library_name=$(get_library_name ${gpl_library}) + library_name=$(get_library_name "${gpl_library}") if [ ${GPL_ENABLED} != "yes" ]; then echo -e "\n(*) Invalid configuration detected. GPL library ${library_name} enabled without --enable-gpl flag.\n" @@ -184,6 +187,9 @@ done echo -n -e "\nDownloading sources: " echo -e "INFO: Downloading source code of ffmpeg and enabled external libraries.\n" 1>>"${BASEDIR}"/build.log 2>&1 +# DOWNLOAD GNU CONFIG +download_gnu_config + # DOWNLOAD LIBRARY SOURCES downloaded_enabled_library_sources "${ENABLED_LIBRARIES[@]}" @@ -191,410 +197,51 @@ downloaded_enabled_library_sources "${ENABLED_LIBRARIES[@]}" TARGET_ARCH_LIST=() # BUILD ENABLED LIBRARIES ON ENABLED ARCHITECTURES -for run_arch in {0..10}; do +for run_arch in {0..12}; do if [[ ${ENABLED_ARCHITECTURES[$run_arch]} -eq 1 ]]; then - export ARCH=$(get_arch_name $run_arch) - export TARGET_SDK=$(get_target_sdk) + export ARCH=$(get_arch_name "$run_arch") + export FULL_ARCH=$(get_full_arch_name "$run_arch") export SDK_PATH=$(get_sdk_path) export SDK_NAME=$(get_sdk_name) - export LIPO="$(xcrun --sdk "$(get_sdk_name)" -f lipo)" - # EXECUTE MAIN BUILD SCRIPT . "${BASEDIR}"/scripts/main-macos.sh "${ENABLED_LIBRARIES[@]}" - case ${ARCH} in - x86-64) - TARGET_ARCH="x86_64" - ;; - *) - TARGET_ARCH="${ARCH}" - ;; - esac - TARGET_ARCH_LIST+=("${TARGET_ARCH}") + + TARGET_ARCH_LIST+=("${FULL_ARCH}") # CLEAR FLAGS - for library in {0..57}; do - library_name=$(get_library_name ${library}) + for library in {0..58}; do + library_name=$(get_library_name "${library}") unset "$(echo "OK_${library_name}" | sed "s/\-/\_/g")" unset "$(echo "DEPENDENCY_REBUILT_${library_name}" | sed "s/\-/\_/g")" done fi done -FFMPEG_LIBS="libavcodec libavdevice libavfilter libavformat libavutil libswresample libswscale" - -# BUILD STATIC LIBRARIES -BUILD_LIBRARY_EXTENSION="a" - # BUILD FFMPEG-KIT if [[ -n ${TARGET_ARCH_LIST[0]} ]]; then # INITIALIZE TARGET FOLDERS + initialize_prebuilt_macos_folders + + # PREPARE PLATFORM ARCHITECTURE STRINGS + build_apple_architecture_variant_strings + if [[ -n ${FFMPEG_KIT_XCF_BUILD} ]]; then - echo -e -n "\n\nCreating xcframeworks under prebuilt: " + echo -e -n "\n\nCreating universal libraries and xcframeworks under prebuilt: " - rm -rf "${BASEDIR}/prebuilt/macos-xcframework" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - mkdir -p "${BASEDIR}/prebuilt/macos-xcframework" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 + create_universal_libraries_for_macos_xcframeworks + + create_frameworks_for_macos_xcframeworks + + create_macos_xcframeworks else - echo -e -n "\n\nCreating frameworks and universal libraries under prebuilt: " + echo -e -n "\n\nCreating universal libraries and frameworks under prebuilt: " - rm -rf "${BASEDIR}/prebuilt/macos-universal" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - mkdir -p "${BASEDIR}/prebuilt/macos-universal" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - rm -rf "${BASEDIR}/prebuilt/macos-framework" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - mkdir -p "${BASEDIR}/prebuilt/macos-framework" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 + create_universal_libraries_for_macos_default_frameworks + + create_macos_default_frameworks fi - # CREATE ENABLED LIBRARY PACKAGES. IT IS EITHER - # .framework and fat/universal library - # OR - # .xcframework - for library in {0..57}; do - if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then - library_name=$(get_library_name ${library}) - package_config_file_name=$(get_package_config_file_name ${library}) - - # EACH ENABLED LIBRARY HAS TO HAVE A .pc FILE AND A VERSION - library_version=$(get_external_library_version "${package_config_file_name}") - if [[ -z ${library_version} ]]; then - echo -e "Failed to detect version for ${library_name} from ${package_config_file_name}.pc\n" 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "failed\n" - exit 1 - fi - - echo -e "Creating external library package for ${library_name}\n" 1>>"${BASEDIR}"/build.log 2>&1 - - # SOME CUSTOM CODE TO HANDLE LIBRARIES THAT PRODUCE MULTIPLE LIBRARY FILES - if [[ ${LIBRARY_LIBTHEORA} == "$library" ]]; then - - LIBRARY_CREATED=$(create_external_library_package $library "libtheora" "libtheora.a" "${library_version}") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - LIBRARY_CREATED=$(create_external_library_package $library "libtheoraenc" "libtheoraenc.a" "${library_version}") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - LIBRARY_CREATED=$(create_external_library_package $library "libtheoradec" "libtheoradec.a" "${library_version}") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - elif [[ ${LIBRARY_LIBVORBIS} == "$library" ]]; then - - LIBRARY_CREATED=$(create_external_library_package $library "libvorbisfile" "libvorbisfile.a" "${library_version}") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - LIBRARY_CREATED=$(create_external_library_package $library "libvorbisenc" "libvorbisenc.a" "${library_version}") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - LIBRARY_CREATED=$(create_external_library_package $library "libvorbis" "libvorbis.a" "${library_version}") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - elif [[ ${LIBRARY_LIBWEBP} == "$library" ]]; then - - LIBRARY_CREATED=$(create_external_library_package $library "libwebpmux" "libwebpmux.a" "${library_version}") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - LIBRARY_CREATED=$(create_external_library_package $library "libwebpdemux" "libwebpdemux.a" "${library_version}") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - LIBRARY_CREATED=$(create_external_library_package $library "libwebp" "libwebp.a" "${library_version}") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - elif [[ ${LIBRARY_OPENCOREAMR} == "$library" ]]; then - - LIBRARY_CREATED=$(create_external_library_package $library "libopencore-amrnb" "libopencore-amrnb.a" "${library_version}") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - elif [[ ${LIBRARY_NETTLE} == "$library" ]]; then - - LIBRARY_CREATED=$(create_external_library_package $library "libnettle" "libnettle.a" "${library_version}") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - LIBRARY_CREATED=$(create_external_library_package $library "libhogweed" "libhogweed.a" "${library_version}") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - else - - # LIBRARIES WHICH HAVE ONLY ONE LIBRARY FILE ARE CREATED HERE - library_name=$(get_library_name $((library))) - static_archive_name=$(get_static_archive_name $((library))) - LIBRARY_CREATED=$(create_external_library_package $library "$library_name" "$static_archive_name" "${library_version}") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - fi - - fi - done - - # CREATE FFMPEG & FFMPEG KIT PACKAGES - if [[ -n ${FFMPEG_KIT_XCF_BUILD} ]]; then - - # CREATE .xcframework BUNDLE IF ENABLED - - # CREATE FFMPEG - for FFMPEG_LIB in ${FFMPEG_LIBS}; do - - # INITIALIZE FFMPEG FRAMEWORK DIRECTORY - XCFRAMEWORK_PATH=${BASEDIR}/prebuilt/macos-xcframework/${FFMPEG_LIB}.xcframework - mkdir -p "${XCFRAMEWORK_PATH}" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - - echo -e "Creating package for ${FFMPEG_LIB}\n" 1>>"${BASEDIR}"/build.log 2>&1 - - BUILD_COMMAND="xcodebuild -create-xcframework " - - for TARGET_ARCH in "${TARGET_ARCH_LIST[@]}"; do - - FFMPEG_LIB_UPPERCASE=$(echo "${FFMPEG_LIB}" | tr '[a-z]' '[A-Z]') - FFMPEG_LIB_CAPITALCASE=$(to_capital_case "${FFMPEG_LIB}") - - # EXTRACT FFMPEG VERSION - FFMPEG_LIB_MAJOR=$(grep "#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MAJOR" "${BASEDIR}/prebuilt/macos-${TARGET_ARCH}/ffmpeg/include/${FFMPEG_LIB}/version.h" | sed -e "s/#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MAJOR//g;s/\ //g") - FFMPEG_LIB_MINOR=$(grep "#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MINOR" "${BASEDIR}/prebuilt/macos-${TARGET_ARCH}/ffmpeg/include/${FFMPEG_LIB}/version.h" | sed -e "s/#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MINOR//g;s/\ //g") - FFMPEG_LIB_MICRO=$(grep "#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MICRO" "${BASEDIR}/prebuilt/macos-${TARGET_ARCH}/ffmpeg/include/${FFMPEG_LIB}/version.h" | sed "s/#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MICRO//g;s/\ //g") - FFMPEG_LIB_VERSION="${FFMPEG_LIB_MAJOR}.${FFMPEG_LIB_MINOR}.${FFMPEG_LIB_MICRO}" - - # INITIALIZE SUB-FRAMEWORK DIRECTORY - FFMPEG_LIB_FRAMEWORK_PATH=${BASEDIR}/prebuilt/macos-xcframework/.tmp/macos-${TARGET_ARCH}/${FFMPEG_LIB}.framework - rm -rf "${FFMPEG_LIB_FRAMEWORK_PATH}" 1>>"${BASEDIR}"/build.log 2>&1 - mkdir -p "${FFMPEG_LIB_FRAMEWORK_PATH}/Headers" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - - # COPY HEADER FILES - cp -r "${BASEDIR}"/prebuilt/macos-${TARGET_ARCH}/ffmpeg/include/${FFMPEG_LIB}/* ${FFMPEG_LIB_FRAMEWORK_PATH}/Headers 1>>"${BASEDIR}"/build.log 2>&1 - - # COPY LIBRARY FILE - cp "${BASEDIR}/prebuilt/macos-${TARGET_ARCH}/ffmpeg/lib/${FFMPEG_LIB}.${BUILD_LIBRARY_EXTENSION}" "${FFMPEG_LIB_FRAMEWORK_PATH}/${FFMPEG_LIB}" 1>>"${BASEDIR}"/build.log 2>&1 - - # COPY THE LICENSES - if [ ${GPL_ENABLED} == "yes" ]; then - cp "${BASEDIR}/LICENSE.GPLv3" "${FFMPEG_LIB_FRAMEWORK_PATH}/LICENSE" 1>>"${BASEDIR}"/build.log 2>&1 - else - cp "${BASEDIR}/LICENSE.LGPLv3" "${FFMPEG_LIB_FRAMEWORK_PATH}/LICENSE" 1>>"${BASEDIR}"/build.log 2>&1 - fi - - build_info_plist "${FFMPEG_LIB_FRAMEWORK_PATH}/Info.plist" "${FFMPEG_LIB}" "com.arthenica.ffmpegkit.${FFMPEG_LIB_CAPITALCASE}" "${FFMPEG_LIB_VERSION}" "${FFMPEG_LIB_VERSION}" - - BUILD_COMMAND+=" -framework ${FFMPEG_LIB_FRAMEWORK_PATH}" - - done - - BUILD_COMMAND+=" -output ${XCFRAMEWORK_PATH}" - - # EXECUTE CREATE FRAMEWORK COMMAND - COMMAND_OUTPUT=$(${BUILD_COMMAND} 2>&1) - echo "${COMMAND_OUTPUT}" 1>>"${BASEDIR}"/build.log 2>&1 - echo "" 1>>"${BASEDIR}"/build.log 2>&1 - - # DO NOT ALLOW EMPTY FRAMEWORKS - if [[ ${COMMAND_OUTPUT} == *"is empty in library"* ]]; then - echo -e "failed\n" - exit 1 - fi - - echo -e "Created ${FFMPEG_LIB} xcframework successfully.\n" 1>>"${BASEDIR}"/build.log 2>&1 - - done - - # CREATE FFMPEG - - # INITIALIZE FFMPEG KIT FRAMEWORK DIRECTORY - XCFRAMEWORK_PATH=${BASEDIR}/prebuilt/macos-xcframework/ffmpegkit.xcframework - mkdir -p "${XCFRAMEWORK_PATH}" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - - BUILD_COMMAND="xcodebuild -create-xcframework " - - for TARGET_ARCH in "${TARGET_ARCH_LIST[@]}"; do - - # INITIALIZE SUB-FRAMEWORK DIRECTORY - FFMPEG_KIT_FRAMEWORK_PATH="${BASEDIR}/prebuilt/macos-xcframework/.tmp/macos-${TARGET_ARCH}/ffmpegkit.framework" - rm -rf "${FFMPEG_KIT_FRAMEWORK_PATH}" 1>>"${BASEDIR}"/build.log 2>&1 - mkdir -p "${FFMPEG_KIT_FRAMEWORK_PATH}/Headers" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - mkdir -p "${FFMPEG_KIT_FRAMEWORK_PATH}/Modules" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - build_modulemap "${FFMPEG_KIT_FRAMEWORK_PATH}/Modules/module.modulemap" - - # COPY HEADER FILES - cp -r "${BASEDIR}"/prebuilt/macos-"${TARGET_ARCH}"/ffmpeg-kit/include/* "${FFMPEG_KIT_FRAMEWORK_PATH}"/Headers 1>>"${BASEDIR}"/build.log 2>&1 - - # COPY LIBRARY FILE - cp "${BASEDIR}/prebuilt/macos-${TARGET_ARCH}/ffmpeg-kit/lib/libffmpegkit.${BUILD_LIBRARY_EXTENSION}" "${FFMPEG_KIT_FRAMEWORK_PATH}/ffmpegkit" 1>>"${BASEDIR}"/build.log 2>&1 - - # COPY THE LICENSES - if [ ${GPL_ENABLED} == "yes" ]; then - cp "${BASEDIR}/LICENSE.GPLv3" "${FFMPEG_KIT_FRAMEWORK_PATH}/LICENSE" 1>>"${BASEDIR}"/build.log 2>&1 - else - cp "${BASEDIR}/LICENSE.LGPLv3" "${FFMPEG_KIT_FRAMEWORK_PATH}/LICENSE" 1>>"${BASEDIR}"/build.log 2>&1 - fi - - BUILD_COMMAND+=" -framework ${FFMPEG_KIT_FRAMEWORK_PATH}" - - done - - BUILD_COMMAND+=" -output ${XCFRAMEWORK_PATH}" - - # EXECUTE CREATE FRAMEWORK COMMAND - COMMAND_OUTPUT=$(${BUILD_COMMAND} 2>&1) - echo "${COMMAND_OUTPUT}" 1>>"${BASEDIR}"/build.log 2>&1 - echo "" 1>>"${BASEDIR}"/build.log 2>&1 - - # DO NOT ALLOW EMPTY FRAMEWORKS - if [[ ${COMMAND_OUTPUT} == *"is empty in library"* ]]; then - echo -e "failed\n" - exit 1 - fi - - echo -e "Created ffmpegkit xcframework successfully.\n" 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "ok\n" - - else - - # CREATE .framework AND FAT/UNIVERSAL LIBRARY IF ENABLED - - # CREATE FFMPEG - - # INITIALIZE UNIVERSAL LIBRARY DIRECTORY - FFMPEG_UNIVERSAL="${BASEDIR}/prebuilt/macos-universal/ffmpeg-universal" - mkdir -p "${FFMPEG_UNIVERSAL}/include" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - mkdir -p "${FFMPEG_UNIVERSAL}/lib" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - - # COPY HEADER FILES - cp -r "${BASEDIR}"/prebuilt/macos-"${TARGET_ARCH_LIST[0]}"/ffmpeg/include/* ${FFMPEG_UNIVERSAL}/include 1>>"${BASEDIR}"/build.log 2>&1 - cp "${BASEDIR}"/prebuilt/macos-"${TARGET_ARCH_LIST[0]}"/ffmpeg/include/config.h "${FFMPEG_UNIVERSAL}/include" 1>>"${BASEDIR}"/build.log 2>&1 - - for FFMPEG_LIB in ${FFMPEG_LIBS}; do - LIPO_COMMAND="${LIPO} -create" - - for TARGET_ARCH in "${TARGET_ARCH_LIST[@]}"; do - LIPO_COMMAND+=" "${BASEDIR}"/prebuilt/macos-${TARGET_ARCH}/ffmpeg/lib/${FFMPEG_LIB}.${BUILD_LIBRARY_EXTENSION}" - done - - LIPO_COMMAND+=" -output ${FFMPEG_UNIVERSAL}/lib/${FFMPEG_LIB}.${BUILD_LIBRARY_EXTENSION}" - - # EXECUTE CREATE UNIVERSAL LIBRARY COMMAND - ${LIPO_COMMAND} 1>>"${BASEDIR}"/build.log 2>&1 - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - FFMPEG_LIB_UPPERCASE=$(echo "${FFMPEG_LIB}" | tr '[a-z]' '[A-Z]') - FFMPEG_LIB_CAPITALCASE=$(to_capital_case "${FFMPEG_LIB}") - - # EXTRACT FFMPEG VERSION - FFMPEG_LIB_MAJOR=$(grep "#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MAJOR" "${FFMPEG_UNIVERSAL}/include/${FFMPEG_LIB}/version.h" | sed -e "s/#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MAJOR//g;s/\ //g") - FFMPEG_LIB_MINOR=$(grep "#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MINOR" "${FFMPEG_UNIVERSAL}/include/${FFMPEG_LIB}/version.h" | sed -e "s/#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MINOR//g;s/\ //g") - FFMPEG_LIB_MICRO=$(grep "#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MICRO" "${FFMPEG_UNIVERSAL}/include/${FFMPEG_LIB}/version.h" | sed "s/#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MICRO//g;s/\ //g") - FFMPEG_LIB_VERSION="${FFMPEG_LIB_MAJOR}.${FFMPEG_LIB_MINOR}.${FFMPEG_LIB_MICRO}" - - # INITIALIZE FRAMEWORK DIRECTORY - FFMPEG_LIB_FRAMEWORK_PATH="${BASEDIR}/prebuilt/macos-framework/${FFMPEG_LIB}.framework" - rm -rf "${FFMPEG_LIB_FRAMEWORK_PATH}" 1>>"${BASEDIR}"/build.log 2>&1 - mkdir -p "${FFMPEG_LIB_FRAMEWORK_PATH}/Headers" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - - # COPY HEADER FILES - cp -r ${FFMPEG_UNIVERSAL}/include/${FFMPEG_LIB}/* ${FFMPEG_LIB_FRAMEWORK_PATH}/Headers 1>>"${BASEDIR}"/build.log 2>&1 - - # COPY LIBRARY FILE - cp "${FFMPEG_UNIVERSAL}/lib/${FFMPEG_LIB}.${BUILD_LIBRARY_EXTENSION}" "${FFMPEG_LIB_FRAMEWORK_PATH}/${FFMPEG_LIB}" 1>>"${BASEDIR}"/build.log 2>&1 - - # COPY FRAMEWORK LICENSES - if [ ${GPL_ENABLED} == "yes" ]; then - cp "${BASEDIR}/LICENSE.GPLv3" "${FFMPEG_LIB_FRAMEWORK_PATH}/LICENSE" 1>>"${BASEDIR}"/build.log 2>&1 - else - cp "${BASEDIR}/LICENSE.LGPLv3" "${FFMPEG_LIB_FRAMEWORK_PATH}/LICENSE" 1>>"${BASEDIR}"/build.log 2>&1 - fi - - build_info_plist "${FFMPEG_LIB_FRAMEWORK_PATH}/Info.plist" "${FFMPEG_LIB}" "com.arthenica.ffmpegkit.${FFMPEG_LIB_CAPITALCASE}" "${FFMPEG_LIB_VERSION}" "${FFMPEG_LIB_VERSION}" - - echo -e "Created ${FFMPEG_LIB} framework successfully.\n" 1>>"${BASEDIR}"/build.log 2>&1 - done - - # COPY UNIVERSAL LIBRARY LICENSES - if [ ${GPL_ENABLED} == "yes" ]; then - cp "${BASEDIR}"/LICENSE.GPLv3 "${FFMPEG_UNIVERSAL}"/LICENSE 1>>"${BASEDIR}"/build.log 2>&1 - else - cp "${BASEDIR}"/LICENSE.LGPLv3 "${FFMPEG_UNIVERSAL}"/LICENSE 1>>"${BASEDIR}"/build.log 2>&1 - fi - - # FFMPEG KIT - - # INITIALIZE FRAMEWORK AND UNIVERSAL LIBRARY DIRECTORIES - FFMPEG_KIT_VERSION=$(get_ffmpeg_kit_version) - FFMPEG_KIT_UNIVERSAL="${BASEDIR}/prebuilt/macos-universal/ffmpeg-kit-universal" - FFMPEG_KIT_FRAMEWORK_PATH="${BASEDIR}/prebuilt/macos-framework/ffmpegkit.framework" - mkdir -p "${FFMPEG_KIT_UNIVERSAL}/include" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - mkdir -p "${FFMPEG_KIT_UNIVERSAL}/lib" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - rm -rf "${FFMPEG_KIT_FRAMEWORK_PATH}" 1>>"${BASEDIR}"/build.log 2>&1 - mkdir -p "${FFMPEG_KIT_FRAMEWORK_PATH}/Headers" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - mkdir -p "${FFMPEG_KIT_FRAMEWORK_PATH}/Modules" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - - LIPO_COMMAND="${LIPO} -create" - for TARGET_ARCH in "${TARGET_ARCH_LIST[@]}"; do - LIPO_COMMAND+=" ${BASEDIR}/prebuilt/macos-${TARGET_ARCH}/ffmpeg-kit/lib/libffmpegkit.${BUILD_LIBRARY_EXTENSION}" - done - LIPO_COMMAND+=" -output ${FFMPEG_KIT_UNIVERSAL}/lib/libffmpegkit.${BUILD_LIBRARY_EXTENSION}" - - # EXECUTE CREATE UNIVERSAL LIBRARY COMMAND - ${LIPO_COMMAND} 1>>"${BASEDIR}"/build.log 2>&1 - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - # COPY HEADER FILES - cp -r "${BASEDIR}"/prebuilt/macos-"${TARGET_ARCH_LIST[0]}"/ffmpeg-kit/include/* "${FFMPEG_KIT_UNIVERSAL}"/include 1>>"${BASEDIR}"/build.log 2>&1 - cp -r "${FFMPEG_KIT_UNIVERSAL}"/include/* "${FFMPEG_KIT_FRAMEWORK_PATH}"/Headers 1>>"${BASEDIR}"/build.log 2>&1 - - # COPY LIBRARY FILE - cp "${FFMPEG_KIT_UNIVERSAL}/lib/libffmpegkit.${BUILD_LIBRARY_EXTENSION}" "${FFMPEG_KIT_FRAMEWORK_PATH}/ffmpegkit" 1>>"${BASEDIR}"/build.log 2>&1 - - # COPY THE LICENSES - if [ ${GPL_ENABLED} == "yes" ]; then - cp "${BASEDIR}"/LICENSE.GPLv3 "${FFMPEG_KIT_UNIVERSAL}"/LICENSE 1>>"${BASEDIR}"/build.log 2>&1 - cp "${BASEDIR}"/LICENSE.GPLv3 "${FFMPEG_KIT_FRAMEWORK_PATH}"/LICENSE 1>>"${BASEDIR}"/build.log 2>&1 - else - cp "${BASEDIR}"/LICENSE.LGPLv3 "${FFMPEG_KIT_UNIVERSAL}"/LICENSE 1>>"${BASEDIR}"/build.log 2>&1 - cp "${BASEDIR}"/LICENSE.LGPLv3 "${FFMPEG_KIT_FRAMEWORK_PATH}"/LICENSE 1>>"${BASEDIR}"/build.log 2>&1 - fi - - build_info_plist "${FFMPEG_KIT_FRAMEWORK_PATH}/Info.plist" "ffmpegkit" "com.arthenica.ffmpegkit.FFmpegKit" "${FFMPEG_KIT_VERSION}" "${FFMPEG_KIT_VERSION}" - build_modulemap "${FFMPEG_KIT_FRAMEWORK_PATH}/Modules/module.modulemap" - - echo -e "Created ffmpegkit.framework and universal library successfully.\n" 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "ok\n" - fi + echo -e "ok\n" fi diff --git a/scripts/android/chromaprint.sh b/scripts/android/chromaprint.sh index f773763..52e0972 100755 --- a/scripts/android/chromaprint.sh +++ b/scripts/android/chromaprint.sh @@ -1,69 +1,30 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="chromaprint" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -CFLAGS=$(get_cflags ${LIB_NAME}) -CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -if [ -d "build" ]; then - rm -rf build -fi - -mkdir build; -cd build +mkdir -p "${BUILD_DIR}" || return 1 +cd "${BUILD_DIR}" || return 1 cmake -Wno-dev \ - -DCMAKE_VERBOSE_MAKEFILE=0 \ - -DCMAKE_C_FLAGS="${CFLAGS}" \ - -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ - -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ - -DCMAKE_SYSROOT="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot" \ - -DCMAKE_FIND_ROOT_PATH="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX="${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME}" \ - -DCMAKE_SYSTEM_NAME=Generic \ - -DCMAKE_C_COMPILER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$CC" \ - -DCMAKE_LINKER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$LD" \ - -DCMAKE_AR="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$AR" \ - -DCMAKE_AS="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$AS" \ - -DCMAKE_SYSTEM_PROCESSOR=$(get_cmake_target_processor) \ - -DCMAKE_POSITION_INDEPENDENT_CODE=1 \ - -DFFT_LIB=kissfft \ - -DBUILD_SHARED_LIBS=0 .. || exit 1 + -DCMAKE_VERBOSE_MAKEFILE=0 \ + -DCMAKE_C_FLAGS="${CFLAGS}" \ + -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ + -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ + -DCMAKE_SYSROOT="${ANDROID_SYSROOT}" \ + -DCMAKE_FIND_ROOT_PATH="${ANDROID_SYSROOT}" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="${LIB_INSTALL_PREFIX}" \ + -DCMAKE_SYSTEM_NAME=Generic \ + -DCMAKE_C_COMPILER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$CC" \ + -DCMAKE_LINKER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$LD" \ + -DCMAKE_AR="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$AR" \ + -DCMAKE_AS="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$AS" \ + -DCMAKE_SYSTEM_PROCESSOR=$(get_cmake_system_processor) \ + -DCMAKE_POSITION_INDEPENDENT_CODE=1 \ + -DFFT_LIB=kissfft \ + -DBUILD_SHARED_LIBS=0 "${BASEDIR}"/src/"${LIB_NAME}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # CREATE PACKAGE CONFIG MANUALLY -create_chromaprint_package_config "1.5.0" - -make install || exit 1 +create_chromaprint_package_config "1.5.0" || return 1 diff --git a/scripts/android/cpu-features.sh b/scripts/android/cpu-features.sh index 2f3f1a0..2ec940d 100755 --- a/scripts/android/cpu-features.sh +++ b/scripts/android/cpu-features.sh @@ -1,14 +1,10 @@ #!/bin/bash -# ENABLE COMMON FUNCTIONS -. "${BASEDIR}"/scripts/function-android.sh +$(android_ndk_cmake) -DBUILD_PIC=ON || return 1 -LIB_NAME="cpu-features" -set_toolchain_paths ${LIB_NAME} +make -C "$(get_cmake_build_directory)" || return 1 -cd "${BASEDIR}"/src/${LIB_NAME} || exit 1 +make -C "$(get_cmake_build_directory)" install || return 1 -$(android_ndk_cmake) -DBUILD_PIC=ON || exit 1 -make -C "$(get_android_build_dir)" install || exit 1 - -create_cpufeatures_package_config \ No newline at end of file +# CREATE PACKAGE CONFIG MANUALLY +create_cpufeatures_package_config "0.4.1.1" || return 1 diff --git a/scripts/android/expat.sh b/scripts/android/expat.sh index a4ab53e..71d1989 100755 --- a/scripts/android/expat.sh +++ b/scripts/android/expat.sh @@ -1,41 +1,29 @@ #!/bin/bash -# ENABLE COMMON FUNCTIONS -source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="expat" -set_toolchain_paths ${LIB_NAME} - -# SET BUILD FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 +cd "${LIB_NAME}" || return 1 +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_expat} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/"${LIB_NAME}"/configure ]] || [[ ${RECONF_expat} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" fi ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - --without-docbook \ - --without-xmlwf \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${ANDROID_SYSROOT}" \ + --without-docbook \ + --without-xmlwf \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --host="${HOST}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # MANUALLY COPY PKG-CONFIG FILES -cp ./expat.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 +cp ./expat.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/android/ffmpeg.sh b/scripts/android/ffmpeg.sh index 1e32b21..a8dff1e 100755 --- a/scripts/android/ffmpeg.sh +++ b/scripts/android/ffmpeg.sh @@ -1,277 +1,291 @@ #!/bin/bash -# ENABLE COMMON FUNCTIONS -source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh - -# FIND pkg-config PATH HOST_PKG_CONFIG_PATH=$(command -v pkg-config) if [ -z "${HOST_PKG_CONFIG_PATH}" ]; then echo -e "\n(*) pkg-config command not found\n" exit 1 fi -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="ffmpeg" -set_toolchain_paths ${LIB_NAME} +# ENABLE COMMON FUNCTIONS +source "${BASEDIR}"/scripts/function-"${FFMPEG_KIT_BUILD_TYPE}".sh 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 -# PREPARE BUILD FLAGS -BUILD_HOST=$(get_build_host) -CFLAGS=$(get_cflags ${LIB_NAME}) -CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -LDFLAGS=$(get_ldflags ${LIB_NAME}) +LIB_NAME="ffmpeg" + +echo -e "----------------------------------------------------------------" 1>>"${BASEDIR}"/build.log 2>&1 +echo -e "\nINFO: Building ${LIB_NAME} with the following environment variables\n" 1>>"${BASEDIR}"/build.log 2>&1 +env 1>>"${BASEDIR}"/build.log 2>&1 +echo -e "----------------------------------------------------------------\n" 1>>"${BASEDIR}"/build.log 2>&1 +echo -e "INFO: System information\n" 1>>"${BASEDIR}"/build.log 2>&1 +echo -e "INFO: $(uname -a)\n" 1>>"${BASEDIR}"/build.log 2>&1 +echo -e "----------------------------------------------------------------\n" 1>>"${BASEDIR}"/build.log 2>&1 + +FFMPEG_LIBRARY_PATH="${LIB_INSTALL_BASE}/${LIB_NAME}" +ANDROID_SYSROOT="${ANDROID_NDK_ROOT}"/toolchains/llvm/prebuilt/"${TOOLCHAIN}"/sysroot + +# SET PATHS +set_toolchain_paths "${LIB_NAME}" + +# SET BUILD FLAGS +HOST=$(get_host) +export CFLAGS=$(get_cflags "${LIB_NAME}") +export CXXFLAGS=$(get_cxxflags "${LIB_NAME}") +export LDFLAGS=$(get_ldflags "${LIB_NAME}") export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" -# PREPARE BUILD OPTIONS +cd "${BASEDIR}"/src/"${LIB_NAME}" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 + +# SET BUILD OPTIONS TARGET_CPU="" TARGET_ARCH="" -ARCH_OPTIONS="" +ASM_OPTIONS="" case ${ARCH} in arm-v7a) TARGET_CPU="armv7-a" TARGET_ARCH="armv7-a" - ARCH_OPTIONS=" --disable-neon --enable-asm --enable-inline-asm" + ASM_OPTIONS=" --disable-neon --enable-asm --enable-inline-asm" ;; arm-v7a-neon) TARGET_CPU="armv7-a" TARGET_ARCH="armv7-a" - ARCH_OPTIONS=" --enable-neon --enable-asm --enable-inline-asm --build-suffix=_neon" + ASM_OPTIONS=" --enable-neon --enable-asm --enable-inline-asm --build-suffix=_neon" ;; arm64-v8a) TARGET_CPU="armv8-a" TARGET_ARCH="aarch64" - ARCH_OPTIONS=" --enable-neon --enable-asm --enable-inline-asm" + ASM_OPTIONS=" --enable-neon --enable-asm --enable-inline-asm" ;; x86) TARGET_CPU="i686" TARGET_ARCH="i686" # asm disabled due to this ticket https://trac.ffmpeg.org/ticket/4928 - ARCH_OPTIONS=" --disable-neon --disable-asm --disable-inline-asm" + ASM_OPTIONS=" --disable-neon --disable-asm --disable-inline-asm" ;; x86-64) TARGET_CPU="x86_64" TARGET_ARCH="x86_64" - ARCH_OPTIONS=" --disable-neon --enable-asm --enable-inline-asm" + ASM_OPTIONS=" --disable-neon --enable-asm --enable-inline-asm" ;; esac CONFIGURE_POSTFIX="" HIGH_PRIORITY_INCLUDES="" -# PREPARE CONFIGURE OPTIONS +# SET CONFIGURE OPTIONS for library in {1..58}; do if [[ ${!library} -eq 1 ]]; then ENABLED_LIBRARY=$(get_library_name $((library - 1))) echo -e "INFO: Enabling library ${ENABLED_LIBRARY}\n" 1>>"${BASEDIR}"/build.log 2>&1 - case $ENABLED_LIBRARY in + case ${ENABLED_LIBRARY} in chromaprint) - CFLAGS+=" $(pkg-config --cflags libchromaprint 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static libchromaprint 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags libchromaprint 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static libchromaprint 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-chromaprint" ;; cpu-features) - pkg-config --libs --static cpu-features 1>>"${BASEDIR}"/build.log 2>&1 + pkg-config --libs --static cpu-features 2>>"${BASEDIR}"/build.log 1>/dev/null if [[ $? -eq 1 ]]; then - echo -e "\nffmpeg: failed\n" + echo -e "ERROR: cpu-features was not found in the pkg-config search path\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "\nffmpeg: failed\n\nSee build.log for details\n" exit 1 fi ;; fontconfig) - CFLAGS+=" $(pkg-config --cflags fontconfig 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static fontconfig 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags fontconfig 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static fontconfig 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-libfontconfig" ;; freetype) - CFLAGS+=" $(pkg-config --cflags freetype2 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static freetype2 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags freetype2 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static freetype2 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-libfreetype" ;; fribidi) - CFLAGS+=" $(pkg-config --cflags fribidi 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static fribidi 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags fribidi 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static fribidi 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-libfribidi" ;; gmp) - CFLAGS+=" $(pkg-config --cflags gmp 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static gmp 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags gmp 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static gmp 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-gmp" ;; gnutls) - CFLAGS+=" $(pkg-config --cflags gnutls 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static gnutls 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags gnutls 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static gnutls 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-gnutls" ;; kvazaar) - CFLAGS+=" $(pkg-config --cflags kvazaar 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static kvazaar 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags kvazaar 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static kvazaar 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-libkvazaar" ;; lame) - CFLAGS+=" $(pkg-config --cflags libmp3lame 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static libmp3lame 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags libmp3lame 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static libmp3lame 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-libmp3lame" ;; libaom) - CFLAGS+=" $(pkg-config --cflags aom 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static aom 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags aom 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static aom 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-libaom" ;; libass) - CFLAGS+=" $(pkg-config --cflags libass 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static libass 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags libass 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static libass 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-libass" ;; libiconv) - CFLAGS+=" $(pkg-config --cflags libiconv 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static libiconv 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags libiconv 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static libiconv 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-iconv" - HIGH_PRIORITY_INCLUDES+=" $(pkg-config --cflags libiconv 1>>"${BASEDIR}"/build.log 2>&1)" + HIGH_PRIORITY_INCLUDES+=" $(pkg-config --cflags libiconv 2>>"${BASEDIR}"/build.log)" ;; libilbc) - CFLAGS+=" $(pkg-config --cflags libilbc 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static libilbc 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags libilbc 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static libilbc 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-libilbc" ;; libtheora) - CFLAGS+=" $(pkg-config --cflags theora 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static theora 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags theora 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static theora 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-libtheora" ;; libvidstab) - CFLAGS+=" $(pkg-config --cflags vidstab 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static vidstab 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags vidstab 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static vidstab 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-libvidstab --enable-gpl" ;; libvorbis) - CFLAGS+=" $(pkg-config --cflags vorbis 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static vorbis 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags vorbis 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static vorbis 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-libvorbis" ;; libvpx) - CFLAGS+=" $(pkg-config --cflags vpx 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs vpx 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs cpu-features 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags vpx 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs vpx 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs cpu-features 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-libvpx" ;; libwebp) - CFLAGS+=" $(pkg-config --cflags libwebp 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static libwebp 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags libwebp 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static libwebp 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-libwebp" ;; libxml2) - CFLAGS+=" $(pkg-config --cflags libxml-2.0 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static libxml-2.0 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags libxml-2.0 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static libxml-2.0 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-libxml2" ;; opencore-amr) - CFLAGS+=" $(pkg-config --cflags opencore-amrnb 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static opencore-amrnb 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags opencore-amrnb 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static opencore-amrnb 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-libopencore-amrnb" ;; openh264) - FFMPEG_CFLAGS+=" $(pkg-config --cflags openh264 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static openh264 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags openh264 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static openh264 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-libopenh264" ;; opus) - CFLAGS+=" $(pkg-config --cflags opus 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static opus 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags opus 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static opus 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-libopus" ;; rubberband) - CFLAGS+=" $(pkg-config --cflags rubberband 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static rubberband 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags rubberband 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static rubberband 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-librubberband --enable-gpl" ;; - shine) - CFLAGS+=" $(pkg-config --cflags shine 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static shine 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-libshine" - ;; sdl) - CFLAGS+=" $(pkg-config --cflags sdl2 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static sdl2 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags sdl2 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static sdl2 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-sdl2" ;; + shine) + CFLAGS+=" $(pkg-config --cflags shine 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static shine 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-libshine" + ;; snappy) - CFLAGS+=" $(pkg-config --cflags snappy 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static snappy 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags snappy 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static snappy 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-libsnappy" ;; soxr) - CFLAGS+=" $(pkg-config --cflags soxr 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static soxr 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags soxr 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static soxr 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-libsoxr" ;; speex) - CFLAGS+=" $(pkg-config --cflags speex 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static speex 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags speex 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static speex 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-libspeex" ;; tesseract) - CFLAGS+=" $(pkg-config --cflags tesseract 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static tesseract 1>>"${BASEDIR}"/build.log 2>&1)" - CFLAGS+=" $(pkg-config --cflags giflib 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static giflib 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags tesseract 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static tesseract 2>>"${BASEDIR}"/build.log)" + CFLAGS+=" $(pkg-config --cflags giflib 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static giflib 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-libtesseract" ;; twolame) - CFLAGS+=" $(pkg-config --cflags twolame 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static twolame 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags twolame 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static twolame 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-libtwolame" ;; vo-amrwbenc) - CFLAGS+=" $(pkg-config --cflags vo-amrwbenc 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static vo-amrwbenc 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags vo-amrwbenc 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static vo-amrwbenc 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-libvo-amrwbenc" ;; wavpack) - CFLAGS+=" $(pkg-config --cflags wavpack 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static wavpack 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags wavpack 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static wavpack 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-libwavpack" ;; x264) - CFLAGS+=" $(pkg-config --cflags x264 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static x264 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags x264 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static x264 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-libx264 --enable-gpl" ;; x265) - CFLAGS+=" $(pkg-config --cflags x265 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static x265 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags x265 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static x265 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-libx265 --enable-gpl" ;; xvidcore) - CFLAGS+=" $(pkg-config --cflags xvidcore 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static xvidcore 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags xvidcore 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static xvidcore 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-libxvid --enable-gpl" ;; expat) - CFLAGS+=" $(pkg-config --cflags expat 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static expat 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags expat 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static expat 2>>"${BASEDIR}"/build.log)" ;; libogg) - CFLAGS+=" $(pkg-config --cflags ogg 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static ogg 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags ogg 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static ogg 2>>"${BASEDIR}"/build.log)" ;; libpng) - CFLAGS+=" $(pkg-config --cflags libpng 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static libpng 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags libpng 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static libpng 2>>"${BASEDIR}"/build.log)" ;; libuuid) - CFLAGS+=" $(pkg-config --cflags uuid 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static uuid 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags uuid 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static uuid 2>>"${BASEDIR}"/build.log)" ;; nettle) - CFLAGS+=" $(pkg-config --cflags nettle 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static nettle 1>>"${BASEDIR}"/build.log 2>&1)" - CFLAGS+=" $(pkg-config --cflags hogweed 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static hogweed 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags nettle 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static nettle 2>>"${BASEDIR}"/build.log)" + CFLAGS+=" $(pkg-config --cflags hogweed 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static hogweed 2>>"${BASEDIR}"/build.log)" ;; android-zlib) - CFLAGS+=" $(pkg-config --cflags zlib 1>>"${BASEDIR}"/build.log 2>&1)" - LDFLAGS+=" $(pkg-config --libs --static zlib 1>>"${BASEDIR}"/build.log 2>&1)" + CFLAGS+=" $(pkg-config --cflags zlib 2>>"${BASEDIR}"/build.log)" + LDFLAGS+=" $(pkg-config --libs --static zlib 2>>"${BASEDIR}"/build.log)" CONFIGURE_POSTFIX+=" --enable-zlib" ;; android-media-codec) @@ -292,11 +306,11 @@ for library in {1..58}; do fi done -LDFLAGS+=" -L${ANDROID_NDK_ROOT}/platforms/android-${API}/arch-${TOOLCHAIN_ARCH}/usr/lib" +export LDFLAGS+=" -L${ANDROID_NDK_ROOT}/platforms/android-${API}/arch-${TOOLCHAIN_ARCH}/usr/lib" # LINKING WITH ANDROID LTS SUPPORT LIBRARY IS NECESSARY FOR API < 18 if [[ -n ${FFMPEG_KIT_LTS_BUILD} ]] && [[ ${API} -lt 18 ]]; then - LDFLAGS+=" -Wl,--whole-archive ${BASEDIR}/android/app/src/main/cpp/libandroidltssupport.a -Wl,--no-whole-archive" + export LDFLAGS+=" -Wl,--whole-archive ${BASEDIR}/android/app/src/main/cpp/libandroidltssupport.a -Wl,--no-whole-archive" fi # ALWAYS BUILD SHARED LIBRARIES @@ -324,17 +338,13 @@ fi echo -n -e "\n${LIB_NAME}: " -cd "${BASEDIR}"/src/${LIB_NAME} || exit 1 - if [[ -z ${NO_WORKSPACE_CLEANUP_ffmpeg} ]]; then echo -e "INFO: Cleaning workspace for ${LIB_NAME}\n" 1>>"${BASEDIR}"/build.log 2>&1 make distclean 2>/dev/null 1>/dev/null fi -# SET BUILD FLAGS +# UPDATE BUILD FLAGS export CFLAGS="${HIGH_PRIORITY_INCLUDES} ${CFLAGS}" -export CXXFLAGS="${CXXFLAGS}" -export LDFLAGS="${LDFLAGS}" # USE HIGHER LIMITS FOR FFMPEG LINKING ulimit -n 2048 1>>"${BASEDIR}"/build.log 2>&1 @@ -342,23 +352,26 @@ ulimit -n 2048 1>>"${BASEDIR}"/build.log 2>&1 ########################### CUSTOMIZATIONS ####################### # 1. Use thread local log levels -${SED_INLINE} 's/static int av_log_level/__thread int av_log_level/g' "${BASEDIR}"/src/${LIB_NAME}/libavutil/log.c 1>>"${BASEDIR}"/build.log 2>&1 +${SED_INLINE} 's/static int av_log_level/__thread int av_log_level/g' "${BASEDIR}"/src/"${LIB_NAME}"/libavutil/log.c 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 ################################################################### ./configure \ - --cross-prefix="${BUILD_HOST}-" \ - --sysroot="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot" \ - --prefix="${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME}" \ + --cross-prefix="${HOST}-" \ + --sysroot="${ANDROID_SYSROOT}" \ + --prefix="${FFMPEG_LIBRARY_PATH}" \ --pkg-config="${HOST_PKG_CONFIG_PATH}" \ --enable-version3 \ --arch="${TARGET_ARCH}" \ --cpu="${TARGET_CPU}" \ --cc="${CC}" \ --cxx="${CXX}" \ - --extra-libs="$(pkg-config --libs --static cpu-features 1>>"${BASEDIR}"/build.log 2>&1)" \ + --ranlib="${RANLIB}" \ + --strip="${STRIP}" \ + --nm="${NM}" \ + --extra-libs="$(pkg-config --libs --static cpu-features)" \ --target-os=android \ - ${ARCH_OPTIONS} \ + ${ASM_OPTIONS} \ --enable-cross-compile \ --enable-pic \ --enable-jni \ @@ -400,65 +413,68 @@ ${SED_INLINE} 's/static int av_log_level/__thread int av_log_level/g' "${BASEDIR --disable-vdpau \ ${CONFIGURE_POSTFIX} 1>>"${BASEDIR}"/build.log 2>&1 -if [ $? -ne 0 ]; then - echo "failed" +if [[ $? -ne 0 ]]; then + echo -e "failed\n\nSee build.log for details\n" exit 1 fi if [[ -z ${NO_OUTPUT_REDIRECTION} ]]; then make -j$(get_cpu_count) 1>>"${BASEDIR}"/build.log 2>&1 - if [ $? -ne 0 ]; then - echo "failed" + if [[ $? -ne 0 ]]; then + echo -e "failed\n\nSee build.log for details\n" exit 1 fi else echo -e "started\n" - make -j$(get_cpu_count) 1>>"${BASEDIR}"/build.log 2>&1 + make -j$(get_cpu_count) - if [ $? -ne 0 ]; then - echo -n -e "\n${LIB_NAME}: failed\n" + if [[ $? -ne 0 ]]; then + echo -n -e "\n${LIB_NAME}: failed\n\nSee build.log for details\n" exit 1 else echo -n -e "\n${LIB_NAME}: " fi fi -rm -rf "${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME}" +# DELETE THE PREVIOUS BUILD OF THE LIBRARY BEFORE INSTALLING +if [ -d "${FFMPEG_LIBRARY_PATH}" ]; then + rm -rf "${FFMPEG_LIBRARY_PATH}" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 +fi make install 1>>"${BASEDIR}"/build.log 2>&1 -if [ $? -ne 0 ]; then - echo "failed" +if [[ $? -ne 0 ]]; then + echo -e "failed\n\nSee build.log for details\n" exit 1 fi # MANUALLY ADD REQUIRED HEADERS -mkdir -p "${BASEDIR}/prebuilt/android-$(get_target_build)"/ffmpeg/include/libavutil/x86 -mkdir -p "${BASEDIR}/prebuilt/android-$(get_target_build)"/ffmpeg/include/libavutil/arm -mkdir -p "${BASEDIR}/prebuilt/android-$(get_target_build)"/ffmpeg/include/libavutil/aarch64 -mkdir -p "${BASEDIR}/prebuilt/android-$(get_target_build)"/ffmpeg/include/libavcodec/x86 -mkdir -p "${BASEDIR}/prebuilt/android-$(get_target_build)"/ffmpeg/include/libavcodec/arm -cp -f "${BASEDIR}"/src/ffmpeg/config.h "${BASEDIR}/prebuilt/android-$(get_target_build)"/ffmpeg/include -cp -f "${BASEDIR}"/src/ffmpeg/libavcodec/mathops.h "${BASEDIR}/prebuilt/android-$(get_target_build)"/ffmpeg/include/libavcodec -cp -f "${BASEDIR}"/src/ffmpeg/libavcodec/x86/mathops.h "${BASEDIR}/prebuilt/android-$(get_target_build)"/ffmpeg/include/libavcodec/x86 -cp -f "${BASEDIR}"/src/ffmpeg/libavcodec/arm/mathops.h "${BASEDIR}/prebuilt/android-$(get_target_build)"/ffmpeg/include/libavcodec/arm -cp -f "${BASEDIR}"/src/ffmpeg/libavformat/network.h "${BASEDIR}/prebuilt/android-$(get_target_build)"/ffmpeg/include/libavformat -cp -f "${BASEDIR}"/src/ffmpeg/libavformat/os_support.h "${BASEDIR}/prebuilt/android-$(get_target_build)"/ffmpeg/include/libavformat -cp -f "${BASEDIR}"/src/ffmpeg/libavformat/url.h "${BASEDIR}/prebuilt/android-$(get_target_build)"/ffmpeg/include/libavformat -cp -f "${BASEDIR}"/src/ffmpeg/libavutil/internal.h "${BASEDIR}/prebuilt/android-$(get_target_build)"/ffmpeg/include/libavutil -cp -f "${BASEDIR}"/src/ffmpeg/libavutil/libm.h "${BASEDIR}/prebuilt/android-$(get_target_build)"/ffmpeg/include/libavutil -cp -f "${BASEDIR}"/src/ffmpeg/libavutil/reverse.h "${BASEDIR}/prebuilt/android-$(get_target_build)"/ffmpeg/include/libavutil -cp -f "${BASEDIR}"/src/ffmpeg/libavutil/thread.h "${BASEDIR}/prebuilt/android-$(get_target_build)"/ffmpeg/include/libavutil -cp -f "${BASEDIR}"/src/ffmpeg/libavutil/timer.h "${BASEDIR}/prebuilt/android-$(get_target_build)"/ffmpeg/include/libavutil -cp -f "${BASEDIR}"/src/ffmpeg/libavutil/x86/asm.h "${BASEDIR}/prebuilt/android-$(get_target_build)"/ffmpeg/include/libavutil/x86 -cp -f "${BASEDIR}"/src/ffmpeg/libavutil/x86/timer.h "${BASEDIR}/prebuilt/android-$(get_target_build)"/ffmpeg/include/libavutil/x86 -cp -f "${BASEDIR}"/src/ffmpeg/libavutil/arm/timer.h "${BASEDIR}/prebuilt/android-$(get_target_build)"/ffmpeg/include/libavutil/arm -cp -f "${BASEDIR}"/src/ffmpeg/libavutil/aarch64/timer.h "${BASEDIR}/prebuilt/android-$(get_target_build)"/ffmpeg/include/libavutil/aarch64 -cp -f "${BASEDIR}"/src/ffmpeg/libavutil/x86/emms.h "${BASEDIR}/prebuilt/android-$(get_target_build)"/ffmpeg/include/libavutil/x86 +mkdir -p "${FFMPEG_LIBRARY_PATH}"/include/libavutil/x86 1>>"${BASEDIR}"/build.log 2>&1 +mkdir -p "${FFMPEG_LIBRARY_PATH}"/include/libavutil/arm 1>>"${BASEDIR}"/build.log 2>&1 +mkdir -p "${FFMPEG_LIBRARY_PATH}"/include/libavutil/aarch64 1>>"${BASEDIR}"/build.log 2>&1 +mkdir -p "${FFMPEG_LIBRARY_PATH}"/include/libavcodec/x86 1>>"${BASEDIR}"/build.log 2>&1 +mkdir -p "${FFMPEG_LIBRARY_PATH}"/include/libavcodec/arm 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/config.h "${FFMPEG_LIBRARY_PATH}"/include/config.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavcodec/mathops.h "${FFMPEG_LIBRARY_PATH}"/include/libavcodec/mathops.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavcodec/x86/mathops.h "${FFMPEG_LIBRARY_PATH}"/include/libavcodec/x86/mathops.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavcodec/arm/mathops.h "${FFMPEG_LIBRARY_PATH}"/include/libavcodec/arm/mathops.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavformat/network.h "${FFMPEG_LIBRARY_PATH}"/include/libavformat/network.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavformat/os_support.h "${FFMPEG_LIBRARY_PATH}"/include/libavformat/os_support.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavformat/url.h "${FFMPEG_LIBRARY_PATH}"/include/libavformat/url.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavutil/internal.h "${FFMPEG_LIBRARY_PATH}"/include/libavutil/internal.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavutil/libm.h "${FFMPEG_LIBRARY_PATH}"/include/libavutil/libm.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavutil/reverse.h "${FFMPEG_LIBRARY_PATH}"/include/libavutil/reverse.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavutil/thread.h "${FFMPEG_LIBRARY_PATH}"/include/libavutil/thread.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavutil/timer.h "${FFMPEG_LIBRARY_PATH}"/include/libavutil/timer.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavutil/x86/asm.h "${FFMPEG_LIBRARY_PATH}"/include/libavutil/x86/asm.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavutil/x86/timer.h "${FFMPEG_LIBRARY_PATH}"/include/libavutil/x86/timer.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavutil/arm/timer.h "${FFMPEG_LIBRARY_PATH}"/include/libavutil/arm/timer.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavutil/aarch64/timer.h "${FFMPEG_LIBRARY_PATH}"/include/libavutil/aarch64/timer.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavutil/x86/emms.h "${FFMPEG_LIBRARY_PATH}"/include/libavutil/x86/emms.h 1>>"${BASEDIR}"/build.log 2>&1 if [ $? -eq 0 ]; then echo "ok" else - echo "failed" + echo -e "failed\n\nSee build.log for details\n" exit 1 fi diff --git a/scripts/android/fontconfig.sh b/scripts/android/fontconfig.sh index b3e8ac4..47fd90d 100755 --- a/scripts/android/fontconfig.sh +++ b/scripts/android/fontconfig.sh @@ -1,45 +1,30 @@ #!/bin/bash -# ENABLE COMMON FUNCTIONS -source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="fontconfig" -set_toolchain_paths ${LIB_NAME} - -# SET BUILD FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR=${INSTALL_PKG_CONFIG_DIR} - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_fontconfig} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_fontconfig} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" fi ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-libiconv-prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/libiconv \ - --with-expat=${BASEDIR}/prebuilt/android-$(get_target_build)/expat \ - --without-libintl-prefix \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --disable-rpath \ - --disable-libxml2 \ - --disable-docs \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-libiconv-prefix="${LIB_INSTALL_BASE}"/libiconv \ + --with-expat="${LIB_INSTALL_BASE}"/expat \ + --without-libintl-prefix \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --disable-rpath \ + --disable-libxml2 \ + --disable-docs \ + --host="${HOST}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # CREATE PACKAGE CONFIG MANUALLY -create_fontconfig_package_config "2.13.92" - -make install || exit 1 +create_fontconfig_package_config "2.13.92" || return 1 diff --git a/scripts/android/freetype.sh b/scripts/android/freetype.sh index 9b9e579..9049e08 100755 --- a/scripts/android/freetype.sh +++ b/scripts/android/freetype.sh @@ -1,48 +1,40 @@ #!/bin/bash -# ENABLE COMMON FUNCTIONS -source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="freetype" -set_toolchain_paths ${LIB_NAME} - -# SET BUILD FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 +# UPDATE BUILD FLAGS +export LIBPNG_CFLAGS="-I${LIB_INSTALL_BASE}/libpng/include" +export LIBPNG_LIBS="-L${LIB_INSTALL_BASE}/libpng/lib" +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# OVERRIDE PKG-CONFIG -export LIBPNG_CFLAGS="-I${BASEDIR}/prebuilt/android-$(get_target_build)/libpng/include" -export LIBPNG_LIBS="-L${BASEDIR}/prebuilt/android-$(get_target_build)/libpng/lib" +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/builds/unix/configure ]] || [[ ${RECONF_freetype} -eq 1 ]]; then + + # NOTE THAT FREETYPE DOES NOT SUPPORT AUTORECONF BUT IT COMES WITH AN autogen.sh + ./autogen.sh || return 1 +fi ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-zlib \ - --with-png \ - --with-sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - --without-harfbuzz \ - --without-bzip2 \ - --without-fsref \ - --without-quickdraw-toolbox \ - --without-quickdraw-carbon \ - --without-ats \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --disable-mmap \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-zlib \ + --with-png \ + --with-sysroot="${ANDROID_SYSROOT}" \ + --without-harfbuzz \ + --without-bzip2 \ + --without-fsref \ + --without-quickdraw-toolbox \ + --without-quickdraw-carbon \ + --without-ats \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --disable-mmap \ + --host="${HOST}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # CREATE PACKAGE CONFIG MANUALLY -create_freetype_package_config "23.2.17" - -make install || exit 1 +create_freetype_package_config "23.2.17" || return 1 diff --git a/scripts/android/fribidi.sh b/scripts/android/fribidi.sh index 801b9fe..eac38af 100755 --- a/scripts/android/fribidi.sh +++ b/scripts/android/fribidi.sh @@ -1,42 +1,30 @@ #!/bin/bash -# ENABLE COMMON FUNCTIONS -source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="fribidi" -set_toolchain_paths ${LIB_NAME} - -# SET BUILD FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_fribidi} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_fribidi} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" fi ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --disable-debug \ - --disable-deprecated \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${ANDROID_SYSROOT}" \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --disable-debug \ + --disable-deprecated \ + --host="${HOST}" || return 1 -make -j$(get_cpu_count) || exit 1 +# WORKAROUND TO DISABLE BUILDING OF doc FOLDER (doc depends on c2man which is not available on all platforms) +$SED_INLINE 's/ doc / /g' "${BASEDIR}"/src/"${LIB_NAME}"/Makefile || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 # MANUALLY COPY PKG-CONFIG FILES -cp ./*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 +cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/android/giflib.sh b/scripts/android/giflib.sh index 5a131d9..d7c47ba 100755 --- a/scripts/android/giflib.sh +++ b/scripts/android/giflib.sh @@ -1,60 +1,28 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="giflib" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -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}) -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 +# UPDATE BUILD FLAGS +export CFLAGS=$(get_cflags "${LIB_NAME}")" -DS_IREAD=S_IRUSR -DS_IWRITE=S_IWUSR" +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_giflib} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_giflib} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" fi ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${ANDROID_SYSROOT}" \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --host="${HOST}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # CREATE PACKAGE CONFIG MANUALLY -create_giflib_package_config "5.1.4" - -make install || exit 1 +create_giflib_package_config "5.1.4" || return 1 diff --git a/scripts/android/gmp.sh b/scripts/android/gmp.sh index 6dc3922..7967177 100755 --- a/scripts/android/gmp.sh +++ b/scripts/android/gmp.sh @@ -1,61 +1,27 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="gmp" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_gmp} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_gmp} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" fi ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - --enable-static \ - --disable-assembly \ - --disable-shared \ - --disable-fast-install \ - --disable-maintainer-mode \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${ANDROID_SYSROOT}" \ + --enable-static \ + --disable-assembly \ + --disable-shared \ + --disable-fast-install \ + --disable-maintainer-mode \ + --host="${HOST}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # CREATE PACKAGE CONFIG MANUALLY -create_gmp_package_config "6.2.0" - -make install || exit 1 +create_gmp_package_config "6.2.0" || return 1 diff --git a/scripts/android/gnutls.sh b/scripts/android/gnutls.sh index 8203867..ff937ef 100755 --- a/scripts/android/gnutls.sh +++ b/scripts/android/gnutls.sh @@ -1,93 +1,62 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi +# UPDATE BUILD FLAGS +export CFLAGS="$(get_cflags ${LIB_NAME}) -I${LIB_INSTALL_BASE}/libiconv/include" +export CXXFLAGS=$(get_cxxflags "${LIB_NAME}") +export LDFLAGS="$(get_ldflags ${LIB_NAME}) -L${LIB_INSTALL_BASE}/libiconv/lib" -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi +export NETTLE_CFLAGS="-I${LIB_INSTALL_BASE}/nettle/include" +export NETTLE_LIBS="-L${LIB_INSTALL_BASE}/nettle/lib -lnettle -L${LIB_INSTALL_BASE}/gmp/lib -lgmp" +export HOGWEED_CFLAGS="-I${LIB_INSTALL_BASE}/nettle/include" +export HOGWEED_LIBS="-L${LIB_INSTALL_BASE}/nettle/lib -lhogweed -L${LIB_INSTALL_BASE}/gmp/lib -lgmp" +export GMP_CFLAGS="-I${LIB_INSTALL_BASE}/gmp/include" +export GMP_LIBS="-L${LIB_INSTALL_BASE}/gmp/lib -lgmp" -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="gnutls" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -COMMON_CFLAGS=$(get_cflags ${LIB_NAME}) -COMMON_CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -COMMON_LDFLAGS=$(get_ldflags ${LIB_NAME}) - -export CFLAGS="${COMMON_CFLAGS} -I${BASEDIR}/prebuilt/android-$(get_target_build)/libiconv/include" -export CXXFLAGS="${COMMON_CXXFLAGS}" -export LDFLAGS="${COMMON_LDFLAGS} -L${BASEDIR}/prebuilt/android-$(get_target_build)/libiconv/lib" - -export NETTLE_CFLAGS="-I${BASEDIR}/prebuilt/android-$(get_target_build)/nettle/include" -export NETTLE_LIBS="-L${BASEDIR}/prebuilt/android-$(get_target_build)/nettle/lib -lnettle -L${BASEDIR}/prebuilt/android-$(get_target_build)/gmp/lib -lgmp" -export HOGWEED_CFLAGS="-I${BASEDIR}/prebuilt/android-$(get_target_build)/nettle/include" -export HOGWEED_LIBS="-L${BASEDIR}/prebuilt/android-$(get_target_build)/nettle/lib -lhogweed -L${BASEDIR}/prebuilt/android-$(get_target_build)/gmp/lib -lgmp" -export GMP_CFLAGS="-I${BASEDIR}/prebuilt/android-$(get_target_build)/gmp/include" -export GMP_LIBS="-L${BASEDIR}/prebuilt/android-$(get_target_build)/gmp/lib -lgmp" - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -HARDWARE_OPTIONS="" +# SET BUILD OPTIONS +ASM_OPTIONS="" case ${ARCH} in - x86) - HARDWARE_OPTIONS="--disable-hardware-acceleration" - ;; - *) - HARDWARE_OPTIONS="--enable-hardware-acceleration" - ;; +x86) + ASM_OPTIONS="--disable-hardware-acceleration" + ;; +*) + ASM_OPTIONS="--enable-hardware-acceleration" + ;; esac +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_gnutls} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_gnutls} -eq 1 ]]; then + ./bootstrap || return 1 fi ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - --with-included-libtasn1 \ - --with-included-unistring \ - --without-idn \ - --without-p11-kit \ - ${HARDWARE_OPTIONS} \ - --enable-static \ - --disable-openssl-compatibility \ - --disable-shared \ - --disable-fast-install \ - --disable-code-coverage \ - --disable-doc \ - --disable-manpages \ - --disable-guile \ - --disable-tests \ - --disable-tools \ - --disable-maintainer-mode \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${ANDROID_SYSROOT}" \ + --with-included-libtasn1 \ + --with-included-unistring \ + --without-idn \ + --without-p11-kit \ + ${ASM_OPTIONS} \ + --enable-static \ + --disable-openssl-compatibility \ + --disable-shared \ + --disable-fast-install \ + --disable-code-coverage \ + --disable-doc \ + --disable-manpages \ + --disable-guile \ + --disable-tests \ + --disable-tools \ + --disable-maintainer-mode \ + --disable-full-test-suite \ + --host="${HOST}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # CREATE PACKAGE CONFIG MANUALLY -create_gnutls_package_config "3.6.13" - -make install || exit 1 +create_gnutls_package_config "3.6.15.1" || return 1 diff --git a/scripts/android/harfbuzz.sh b/scripts/android/harfbuzz.sh new file mode 100755 index 0000000..aaf1bb1 --- /dev/null +++ b/scripts/android/harfbuzz.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_harfbuzz} -eq 1 ]]; then + NOCONFIGURE=1 ./autogen.sh || return 1 +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${ANDROID_SYSROOT}" \ + --with-glib=no \ + --with-fontconfig=yes \ + --with-freetype=yes \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp ./src/harfbuzz.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 + +# WORKAROUND TO REMOVE INSTALLED .la FILES +rm -f "${LIB_INSTALL_PREFIX}"/lib/*.la diff --git a/scripts/android/jpeg.sh b/scripts/android/jpeg.sh index 9bccc50..5914ab3 100755 --- a/scripts/android/jpeg.sh +++ b/scripts/android/jpeg.sh @@ -1,54 +1,36 @@ #!/bin/bash -# ENABLE COMMON FUNCTIONS -source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="jpeg" -set_toolchain_paths ${LIB_NAME} - -# SET BUILD FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -if [ -d "build" ]; then - rm -rf build -fi - -mkdir build || exit 1 -cd build || exit 1 +mkdir -p "${BUILD_DIR}" || return 1 +cd "${BUILD_DIR}" || return 1 cmake -Wno-dev \ - -DCMAKE_VERBOSE_MAKEFILE=0 \ - -DCMAKE_C_FLAGS="${CFLAGS}" \ - -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ - -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ - -DCMAKE_SYSROOT="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot" \ - -DCMAKE_FIND_ROOT_PATH="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX="${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME}" \ - -DCMAKE_SYSTEM_NAME=Generic \ - -DCMAKE_C_COMPILER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$CC" \ - -DCMAKE_CXX_COMPILER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$CXX" \ - -DCMAKE_LINKER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$LD" \ - -DCMAKE_AR="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$AR" \ - -DCMAKE_AS="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$AS" \ - -DCMAKE_POSITION_INDEPENDENT_CODE=1 \ - -DENABLE_STATIC=1 \ - -DENABLE_SHARED=0 \ - -DWITH_JPEG8=1 \ - -DWITH_SIMD=1 \ - -DWITH_TURBOJPEG=0 \ - -DWITH_JAVA=0 \ - -DCMAKE_SYSTEM_PROCESSOR=$(get_cmake_target_processor) .. || exit 1 + -DCMAKE_VERBOSE_MAKEFILE=0 \ + -DCMAKE_C_FLAGS="${CFLAGS}" \ + -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ + -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ + -DCMAKE_SYSROOT="${ANDROID_SYSROOT}" \ + -DCMAKE_FIND_ROOT_PATH="${ANDROID_SYSROOT}" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="${LIB_INSTALL_PREFIX}" \ + -DCMAKE_SYSTEM_NAME=Generic \ + -DCMAKE_C_COMPILER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$CC" \ + -DCMAKE_CXX_COMPILER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$CXX" \ + -DCMAKE_LINKER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$LD" \ + -DCMAKE_AR="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$AR" \ + -DCMAKE_AS="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$AS" \ + -DCMAKE_POSITION_INDEPENDENT_CODE=1 \ + -DENABLE_STATIC=1 \ + -DENABLE_SHARED=0 \ + -DWITH_JPEG8=1 \ + -DWITH_SIMD=1 \ + -DWITH_TURBOJPEG=0 \ + -DWITH_JAVA=0 \ + -DCMAKE_SYSTEM_PROCESSOR=$(get_cmake_system_processor) \ + "${BASEDIR}"/src/"${LIB_NAME}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # MANUALLY COPY PKG-CONFIG FILES -cp ${BASEDIR}/src/${LIB_NAME}/build/pkgscripts/libjpeg.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 +cp "${BUILD_DIR}"/pkgscripts/libjpeg.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/android/kvazaar.sh b/scripts/android/kvazaar.sh index d3f8a4e..110f772 100755 --- a/scripts/android/kvazaar.sh +++ b/scripts/android/kvazaar.sh @@ -1,68 +1,37 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="kvazaar" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# ALWAYS RECONFIGURE -autoreconf_library ${LIB_NAME} - -# LINKING WITH ANDROID LTS SUPPORT LIBRARY IS NECESSARY FOR API < 18 -if [[ ! -z ${FFMPEG_KIT_LTS_BUILD} ]] && [[ ${API} < 18 ]]; then - ARCH_SPECIFIC_LIBS=" -Wl,--no-whole-archive ${BASEDIR}/android/app/src/main/cpp/libandroidltssupport.a -Wl,--no-whole-archive" -else - ARCH_SPECIFIC_LIBS="" +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_kvazaar} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" fi -# DISABLE LINKING TO -lrt -${SED_INLINE} 's/\-lrt//g' ${BASEDIR}/src/${LIB_NAME}/configure +# UPDATE BUILD FLAGS +# LINKING WITH ANDROID LTS SUPPORT LIBRARY IS NECESSARY FOR API < 18 +if [[ -n ${FFMPEG_KIT_LTS_BUILD} ]] && [[ ${API} -lt 18 ]]; then + LTS_SUPPORT_LIBS=" -Wl,--no-whole-archive ${BASEDIR}/android/app/src/main/cpp/libandroidltssupport.a -Wl,--no-whole-archive" +else + LTS_SUPPORT_LIBS="" +fi -LIBS="${ARCH_SPECIFIC_LIBS}" ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --host=${BUILD_HOST} || exit 1 +# WORKAROUND TO DISABLE LINKING TO -lrt +${SED_INLINE} 's/\-lrt//g' "${BASEDIR}"/src/"${LIB_NAME}"/configure || return 1 -make || exit 1 +LIBS="${LTS_SUPPORT_LIBS}" ./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${ANDROID_SYSROOT}" \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --host="${HOST}" || return 1 + +# NOTE THAT kvazaar DOES NOT SUPPORT PARALLEL EXECUTION +make || return 1 + +make install || return 1 # MANUALLY COPY PKG-CONFIG FILES -cp ./src/kvazaar.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 +cp ./src/kvazaar.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/android/lame.sh b/scripts/android/lame.sh index b791cb0..f2b9b04 100755 --- a/scripts/android/lame.sh +++ b/scripts/android/lame.sh @@ -1,65 +1,32 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="lame" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 +cd "${LIB_NAME}" || return 1 +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_lame} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_lame} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" fi ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - --with-libiconv-prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/libiconv \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --disable-maintainer-mode \ - --disable-frontend \ - --disable-efence \ - --disable-gtktest \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${ANDROID_SYSROOT}" \ + --with-libiconv-prefix="${LIB_INSTALL_BASE}"/libiconv \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --disable-maintainer-mode \ + --disable-frontend \ + --disable-efence \ + --disable-gtktest \ + --host="${HOST}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # CREATE PACKAGE CONFIG MANUALLY -create_libmp3lame_package_config "3.100" - -make install || exit 1 +create_libmp3lame_package_config "3.100" || return 1 diff --git a/scripts/android/leptonica.sh b/scripts/android/leptonica.sh index 7e853bc..df10530 100755 --- a/scripts/android/leptonica.sh +++ b/scripts/android/leptonica.sh @@ -1,82 +1,49 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="leptonica" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -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" -export LDFLAGS="$(get_ldflags ${LIB_NAME}) -L${BASEDIR}/prebuilt/android-$(get_target_build)/giflib/lib -lgif" -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" +# UPDATE BUILD FLAGS +HOST=$(get_host) +export CFLAGS=$(get_cflags "${LIB_NAME}") +export CXXFLAGS=$(get_cxxflags "${LIB_NAME}") +export CPPFLAGS="-I${LIB_INSTALL_BASE}/giflib/include" +export LDFLAGS="$(get_ldflags "${LIB_NAME}") -L${LIB_INSTALL_BASE}/giflib/lib -lgif" export LIBPNG_CFLAGS="$(pkg-config --cflags libpng)" export LIBPNG_LIBS="$(pkg-config --libs --static libpng)" - export LIBWEBP_CFLAGS="$(pkg-config --cflags libwebp)" export LIBWEBP_LIBS="$(pkg-config --libs --static libwebp)" - export LIBTIFF_CFLAGS="$(pkg-config --cflags libtiff-4)" export LIBTIFF_LIBS="$(pkg-config --libs --static libtiff-4)" - export ZLIB_CFLAGS="$(pkg-config --cflags zlib)" export ZLIB_LIBS="$(pkg-config --libs --static zlib)" - export JPEG_CFLAGS="$(pkg-config --cflags libjpeg)" export JPEG_LIBS="$(pkg-config --libs --static libjpeg)" -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_leptonica} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_leptonica} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" fi ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-zlib \ - --with-libpng \ - --with-jpeg \ - --with-giflib \ - --with-libtiff \ - --with-libwebp \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --disable-programs \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-zlib \ + --with-libpng \ + --with-jpeg \ + --with-giflib \ + --with-libtiff \ + --with-libwebp \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --disable-programs \ + --host="${HOST}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # MANUALLY COPY PKG-CONFIG FILES -cp lept.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 +cp lept.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/android/libaom.sh b/scripts/android/libaom.sh index 47f09a3..1bdb44c 100755 --- a/scripts/android/libaom.sh +++ b/scripts/android/libaom.sh @@ -1,94 +1,56 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="libaom" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -CFLAGS=$(get_cflags ${LIB_NAME}) -CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -LDFLAGS=$(get_ldflags ${LIB_NAME}) - -ARCH_OPTIONS="" +# SET BUILD OPTIONS +ASM_OPTIONS="" case ${ARCH} in - arm-v7a) - ARCH_OPTIONS="-DARCH_ARM=1 -DENABLE_NEON=0 -DHAVE_NEON=0" - ;; - arm-v7a-neon) - ARCH_OPTIONS="-DARCH_ARM=1 -DENABLE_NEON=1 -DHAVE_NEON=1" - ;; - arm64-v8a) - ARCH_OPTIONS="-DARCH_ARM=1 -DENABLE_NEON=1 -DHAVE_NEON=1" - ;; - x86) - ARCH_OPTIONS="-DENABLE_SSE=1 -DHAVE_SSE=1 -DENABLE_SSE3=1 -DHAVE_SSE3=1" - ;; - x86-64) - ARCH_OPTIONS="-DENABLE_SSE4_2=1 -DHAVE_SSE4_2=1" - ;; +arm-v7a) + ASM_OPTIONS="-DARCH_ARM=1 -DENABLE_NEON=0 -DHAVE_NEON=0" + ;; +arm-v7a-neon) + ASM_OPTIONS="-DARCH_ARM=1 -DENABLE_NEON=1 -DHAVE_NEON=1" + ;; +arm64-v8a) + ASM_OPTIONS="-DARCH_ARM=1 -DENABLE_NEON=1 -DHAVE_NEON=1" + ;; +x86) + ASM_OPTIONS="-DENABLE_SSE=1 -DHAVE_SSE=1 -DENABLE_SSE3=1 -DHAVE_SSE3=1" + ;; +x86-64) + ASM_OPTIONS="-DENABLE_SSE4_2=1 -DHAVE_SSE4_2=1" + ;; esac -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -if [ -d "cmake-build" ]; then - rm -rf cmake-build -fi - -mkdir cmake-build; -cd cmake-build +mkdir -p "${BUILD_DIR}" || return 1 +cd "${BUILD_DIR}" || return 1 cmake -Wno-dev \ - -DCMAKE_VERBOSE_MAKEFILE=0 \ - -DCONFIG_PIC=1 \ - -DCMAKE_C_FLAGS="${CFLAGS}" \ - -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ - -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ - -DCMAKE_SYSROOT="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot" \ - -DCMAKE_FIND_ROOT_PATH="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_SYSTEM_NAME=Generic \ - -DCMAKE_INSTALL_PREFIX="${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME}" \ - -DCMAKE_CXX_COMPILER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$CXX" \ - -DCMAKE_C_COMPILER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$CC" \ - -DCMAKE_LINKER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$LD" \ - -DCMAKE_AR="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$AR" \ - -DCMAKE_AS="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$AS" \ - -DCMAKE_POSITION_INDEPENDENT_CODE=1 \ - ${ARCH_OPTIONS} \ - -DENABLE_TESTS=0 \ - -DENABLE_EXAMPLES=0 \ - -DENABLE_TOOLS=0 \ - -DCONFIG_UNIT_TESTS=0 \ - -DAOM_TARGET_CPU=generic \ - -DBUILD_SHARED_LIBS=0 .. || exit 1 + -DCMAKE_VERBOSE_MAKEFILE=0 \ + -DCONFIG_PIC=1 \ + -DCMAKE_C_FLAGS="${CFLAGS}" \ + -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ + -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ + -DCMAKE_SYSROOT="${ANDROID_SYSROOT}" \ + -DCMAKE_FIND_ROOT_PATH="${ANDROID_SYSROOT}" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_SYSTEM_NAME=Generic \ + -DCMAKE_INSTALL_PREFIX="${LIB_INSTALL_PREFIX}" \ + -DCMAKE_CXX_COMPILER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$CXX" \ + -DCMAKE_C_COMPILER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$CC" \ + -DCMAKE_LINKER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$LD" \ + -DCMAKE_AR="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$AR" \ + -DCMAKE_AS="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$AS" \ + -DCMAKE_POSITION_INDEPENDENT_CODE=1 \ + ${ASM_OPTIONS} \ + -DENABLE_TESTS=0 \ + -DENABLE_EXAMPLES=0 \ + -DENABLE_TOOLS=0 \ + -DCONFIG_UNIT_TESTS=0 \ + -DAOM_TARGET_CPU=generic \ + -DBUILD_SHARED_LIBS=0 "${BASEDIR}"/src/"${LIB_NAME}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # CREATE PACKAGE CONFIG MANUALLY -create_libaom_package_config "1.0.0" - -make install || exit 1 \ No newline at end of file +create_libaom_package_config "2.0.0" || return 1 diff --git a/scripts/android/libass.sh b/scripts/android/libass.sh index 4e2872e..c11b433 100755 --- a/scripts/android/libass.sh +++ b/scripts/android/libass.sh @@ -1,60 +1,45 @@ #!/bin/bash -# ENABLE COMMON FUNCTIONS -source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="libass" -set_toolchain_paths ${LIB_NAME} - -# SET BUILD FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_libass} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -# SET ARCH OPTIONS -ASM_FLAGS="" +# SET BUILD OPTIONS +ASM_OPTIONS="" case ${ARCH} in - x86) +x86) - # please note that asm is disabled - # because enabling asm for x86 causes text relocations in libavfilter.so - ASM_FLAGS=" --disable-asm" - ;; - *) - ASM_FLAGS=" --enable-asm" - ;; + # please note that asm is disabled + # enabling asm for x86 causes text relocations in libavfilter.so + ASM_OPTIONS=" --disable-asm" + ;; +*) + ASM_OPTIONS=" --enable-asm" + ;; esac -./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - --disable-libtool-lock \ - --enable-static \ - --disable-shared \ - --disable-harfbuzz \ - --disable-fast-install \ - --disable-test \ - --disable-profile \ - --disable-coretext \ - ${ASM_FLAGS} \ - --host=${BUILD_HOST} || exit 1 +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null -make -j$(get_cpu_count) || exit 1 +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_libass} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${ANDROID_SYSROOT}" \ + --disable-libtool-lock \ + --enable-static \ + --disable-shared \ + --disable-require-system-font-provider \ + --disable-fast-install \ + --disable-test \ + --disable-profile \ + --disable-coretext \ + ${ASM_OPTIONS} \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 # MANUALLY COPY PKG-CONFIG FILES -cp ./*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 +cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/android/libiconv.sh b/scripts/android/libiconv.sh index 561b682..a81cfc0 100755 --- a/scripts/android/libiconv.sh +++ b/scripts/android/libiconv.sh @@ -1,40 +1,29 @@ #!/bin/bash -# ENABLE COMMON FUNCTIONS -source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="libiconv" -set_toolchain_paths ${LIB_NAME} - -# SET BUILD FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 +# PULL SUBMODULES +./gitsub.sh pull || return 1 +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_libiconv} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_libiconv} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" fi ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --disable-rpath \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${ANDROID_SYSROOT}" \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --disable-rpath \ + --host="${HOST}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # CREATE PACKAGE CONFIG MANUALLY -create_libiconv_package_config "1.16" - -make install || exit 1 +create_libiconv_package_config "1.16.2" || return 1 diff --git a/scripts/android/libilbc.sh b/scripts/android/libilbc.sh index 1d15cd5..40e44a6 100755 --- a/scripts/android/libilbc.sh +++ b/scripts/android/libilbc.sh @@ -1,39 +1,25 @@ #!/bin/bash -# ENABLE COMMON FUNCTIONS -source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="libilbc" -set_toolchain_paths ${LIB_NAME} - -# SET BUILD FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_libilbc} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_libilbc} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" fi ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${ANDROID_SYSROOT}" \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --host="${HOST}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # MANUALLY COPY PKG-CONFIG FILES -cp ./libilbc.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 +cp ./libilbc.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/android/libogg.sh b/scripts/android/libogg.sh index b93b44b..f327ad0 100755 --- a/scripts/android/libogg.sh +++ b/scripts/android/libogg.sh @@ -1,59 +1,25 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="libogg" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_libogg} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_libogg} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" fi ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${ANDROID_SYSROOT}" \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --host="${HOST}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # MANUALLY COPY PKG-CONFIG FILES -cp ogg.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 +cp ogg.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/android/libpng.sh b/scripts/android/libpng.sh index d1acce8..8d20888 100755 --- a/scripts/android/libpng.sh +++ b/scripts/android/libpng.sh @@ -1,78 +1,45 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="libpng" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -ARCH_OPTIONS="" +# SET BUILD OPTIONS +ASM_OPTIONS="" case ${ARCH} in - x86 | x86-64) - ARCH_OPTIONS="--enable-hardware-optimizations --enable-intel-sse=yes" - ;; - arm-v7a-neon | arm64-v8a) - ARCH_OPTIONS="--enable-hardware-optimizations --enable-arm-neon=yes" - ;; - arm-v7a) - # hardware-optimizations not enabled because - # when --enable-hardware-optimizations is added - # make tries to build arm-neon specific instructions, which breaks compilation - ARCH_OPTIONS="--enable-arm-neon=no" - ;; +x86 | x86-64) + ASM_OPTIONS="--enable-hardware-optimizations --enable-intel-sse=yes" + ;; +arm-v7a-neon | arm64-v8a) + ASM_OPTIONS="--enable-hardware-optimizations --enable-arm-neon=yes" + ;; +arm-v7a) + # hardware-optimizations not enabled because + # when --enable-hardware-optimizations is added + # make tries to build arm-neon specific instructions, which breaks compilation + ASM_OPTIONS="--enable-arm-neon=no" + ;; esac -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_libpng} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_libpng} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" fi ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --disable-unversioned-libpng-pc \ - --disable-unversioned-libpng-config \ - ${ARCH_OPTIONS} \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${ANDROID_SYSROOT}" \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --disable-unversioned-libpng-pc \ + --disable-unversioned-libpng-config \ + ${ASM_OPTIONS} \ + --host="${HOST}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # MANUALLY COPY PKG-CONFIG FILES -cp ./*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 +cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/android/libsamplerate.sh b/scripts/android/libsamplerate.sh index 37abc3b..0cca682 100755 --- a/scripts/android/libsamplerate.sh +++ b/scripts/android/libsamplerate.sh @@ -1,64 +1,29 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="libsamplerate" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# DISABLE building of examples manually -${SED_INLINE} 's/examples tests//g' ${BASEDIR}/src/${LIB_NAME}/Makefile* - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_libsamplerate} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_libsamplerate} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" fi ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - --enable-static \ - --disable-fftw \ - --disable-shared \ - --disable-fast-install \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${ANDROID_SYSROOT}" \ + --enable-static \ + --disable-fftw \ + --disable-shared \ + --disable-fast-install \ + --host="${HOST}" || return 1 -make -j$(get_cpu_count) || exit 1 +# WORKAROUND TO DISABLE BUILDING OF EXAMPLES AND TESTS +${SED_INLINE} 's/examples tests//g' "${BASEDIR}"/src/"${LIB_NAME}"/Makefile* || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 # MANUALLY COPY PKG-CONFIG FILES -cp ./*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 +cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/android/libsndfile.sh b/scripts/android/libsndfile.sh index 0f607ba..573093c 100755 --- a/scripts/android/libsndfile.sh +++ b/scripts/android/libsndfile.sh @@ -1,63 +1,29 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="libsndfile" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -if [[ ! -f ${BASEDIR}/src/${LIB_NAME}/configure ]] || [[ ${RECONF_libsndfile} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_libsndfile} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" fi ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --disable-sqlite \ - --disable-alsa \ - --disable-full-suite \ - --disable-external-libs \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${ANDROID_SYSROOT}" \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --disable-sqlite \ + --disable-alsa \ + --disable-full-suite \ + --disable-external-libs \ + --host="${HOST}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # MANUALLY COPY PKG-CONFIG FILES -cp ./*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 +cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/android/libtheora.sh b/scripts/android/libtheora.sh index ec77417..60002c3 100755 --- a/scripts/android/libtheora.sh +++ b/scripts/android/libtheora.sh @@ -1,72 +1,42 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 +# SET BUILD OPTIONS +if [[ -z ${FFMPEG_KIT_LTS_BUILD} ]]; then + ASM_OPTIONS="--enable-asm" +else + ASM_OPTIONS="--disable-asm" fi -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="libtheora" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_libtheora} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_libtheora} -eq 1 ]]; then -if [[ -z ${FFMPEG_KIT_LTS_BUILD} ]]; then - ASM_FLAGS="--enable-asm" -else - ASM_FLAGS="--disable-asm" + # WORKAROUND NOT TO RUN CONFIGURE AT THE END OF autogen.sh + $SED_INLINE 's/$srcdir\/configure/#$srcdir\/configure/g' "${BASEDIR}"/src/"${LIB_NAME}"/autogen.sh || return 1 + + ./autogen.sh || return 1 fi ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --disable-examples \ - --disable-telemetry \ - --disable-sdltest \ - ${ASM_FLAGS} \ - --disable-valgrind-testing \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --disable-examples \ + --disable-telemetry \ + --disable-sdltest \ + ${ASM_OPTIONS} \ + --disable-valgrind-testing \ + --host="${HOST}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # MANUALLY COPY PKG-CONFIG FILES -cp theoradec.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 -cp theoraenc.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 -cp theora.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 +cp theoradec.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 +cp theoraenc.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 +cp theora.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/android/libuuid.sh b/scripts/android/libuuid.sh index 071d11d..b395818 100755 --- a/scripts/android/libuuid.sh +++ b/scripts/android/libuuid.sh @@ -1,59 +1,25 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="libuuid" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_libuuid} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_libuuid} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" fi ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${ANDROID_SYSROOT}" \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --host="${HOST}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 -# AUTO-GENERATED PKG-CONFIG FILE IS WRONG. CREATING IT MANUALLY -create_uuid_package_config "1.0.3" +make install || return 1 -make install || exit 1 +# CREATE PACKAGE CONFIG MANUALLY +create_uuid_package_config "1.0.3" || return 1 diff --git a/scripts/android/libvidstab.sh b/scripts/android/libvidstab.sh index f430968..7fd012b 100755 --- a/scripts/android/libvidstab.sh +++ b/scripts/android/libvidstab.sh @@ -1,80 +1,42 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="libvidstab" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -CFLAGS=$(get_cflags ${LIB_NAME}) -CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -if [ -d "build" ]; then - rm -rf build -fi - -mkdir build; -cd build - -ASM_FLAGS="" +# SET BUILD OPTIONS +ASM_OPTIONS="" case ${ARCH} in - arm-v7a | arm-v7a-neon | arm64-v8a) - ASM_FLAGS="-DSSE2_FOUND=0 -DSSE3_FOUND=0 -DSSSE3_FOUND=0 -DSSE4_1_FOUND=0" - ;; - *) - ASM_FLAGS="" - ;; +arm-v7a | arm-v7a-neon | arm64-v8a) + ASM_OPTIONS="-DSSE2_FOUND=0 -DSSE3_FOUND=0 -DSSSE3_FOUND=0 -DSSE4_1_FOUND=0" + ;; +*) + ASM_OPTIONS="" + ;; esac -cmake -Wno-dev \ - -DCMAKE_VERBOSE_MAKEFILE=0 \ - -DCMAKE_C_FLAGS="${CFLAGS}" \ - -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ - -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ - -DCMAKE_SYSROOT="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot" \ - -DCMAKE_FIND_ROOT_PATH="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX="${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME}" \ - -DCMAKE_SYSTEM_NAME=Generic \ - -DCMAKE_C_COMPILER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$CC" \ - -DCMAKE_LINKER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$LD" \ - -DCMAKE_AR="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$AR" \ - -DCMAKE_AS="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$AS" \ - -DCMAKE_POSITION_INDEPENDENT_CODE=1 \ - -DUSE_OMP=0 \ - ${ASM_FLAGS} \ - -DCMAKE_SYSTEM_PROCESSOR=$(get_cmake_target_processor) \ - -DBUILD_SHARED_LIBS=0 .. || exit 1 +mkdir -p "${BUILD_DIR}" || return 1 +cd "${BUILD_DIR}" || return 1 -make -j$(get_cpu_count) || exit 1 +cmake -Wno-dev \ + -DCMAKE_VERBOSE_MAKEFILE=0 \ + -DCMAKE_C_FLAGS="${CFLAGS}" \ + -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ + -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ + -DCMAKE_SYSROOT="${ANDROID_SYSROOT}" \ + -DCMAKE_FIND_ROOT_PATH="${ANDROID_SYSROOT}" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="${LIB_INSTALL_PREFIX}" \ + -DCMAKE_SYSTEM_NAME=Generic \ + -DCMAKE_C_COMPILER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$CC" \ + -DCMAKE_LINKER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$LD" \ + -DCMAKE_AR="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$AR" \ + -DCMAKE_AS="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$AS" \ + -DCMAKE_POSITION_INDEPENDENT_CODE=1 \ + -DUSE_OMP=0 \ + ${ASM_OPTIONS} \ + -DCMAKE_SYSTEM_PROCESSOR=$(get_cmake_system_processor) \ + -DBUILD_SHARED_LIBS=0 "${BASEDIR}"/src/"${LIB_NAME}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 # MANUALLY COPY PKG-CONFIG FILES -cp vidstab.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 +cp vidstab.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/android/libvorbis.sh b/scripts/android/libvorbis.sh index 6f624d6..1b31497 100755 --- a/scripts/android/libvorbis.sh +++ b/scripts/android/libvorbis.sh @@ -1,65 +1,34 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="libvorbis" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# -mno-ieee-fp option is not compatible with clang. removing it -${SED_INLINE} 's/\-mno-ieee-fp//g' ${BASEDIR}/src/${LIB_NAME}/configure.ac +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_libvorbis} -eq 1 ]]; then -# ALWAYS RECONFIGURE -autoreconf_library ${LIB_NAME} + # -mno-ieee-fp OPTION IS NOT COMPATIBLE WITH clang. REMOVING IT + ${SED_INLINE} 's/\-mno-ieee-fp//g' "${BASEDIR}"/src/"${LIB_NAME}"/configure.ac || return 1 + + autoreconf_library "${LIB_NAME}" +fi PKG_CONFIG= ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - --with-ogg-includes=${BASEDIR}/prebuilt/android-$(get_target_build)/libogg/include \ - --with-ogg-libraries=${BASEDIR}/prebuilt/android-$(get_target_build)/libogg/lib \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --disable-docs \ - --disable-examples \ - --disable-oggtest \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${ANDROID_SYSROOT}" \ + --with-ogg-includes="${LIB_INSTALL_BASE}"/libogg/include \ + --with-ogg-libraries="${LIB_INSTALL_BASE}"/libogg/lib \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --disable-docs \ + --disable-examples \ + --disable-oggtest \ + --host="${HOST}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # CREATE PACKAGE CONFIG MANUALLY -create_libvorbis_package_config "1.3.7" - -make install || exit 1 +create_libvorbis_package_config "1.3.7" || return 1 diff --git a/scripts/android/libvpx.sh b/scripts/android/libvpx.sh index 96f8f17..91f5378 100755 --- a/scripts/android/libvpx.sh +++ b/scripts/android/libvpx.sh @@ -1,115 +1,87 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="libvpx" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -export CFLAGS="$(get_cflags ${LIB_NAME}) -I${ANDROID_NDK_ROOT}/sources/android/cpufeatures" -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS="$(get_ldflags ${LIB_NAME})" - -# RECOVER configure.sh -rm -f ${BASEDIR}/src/${LIB_NAME}/build/make/configure.sh -cp ${BASEDIR}/tools/make/configure.libvpx.android.sh ${BASEDIR}/src/${LIB_NAME}/build/make/configure.sh +# UPDATE BUILD FLAGS +export CFLAGS="$(get_cflags "${LIB_NAME}") -I${LIB_INSTALL_BASE}/cpu-features/include/ndk_compat" +# SET BUILD OPTIONS TARGET_CPU="" -DISABLE_NEON_FLAG="" +ASM_OPTIONS="" case ${ARCH} in - arm-v7a) - TARGET_CPU="armv7" +arm-v7a) + TARGET_CPU="armv7" - # NEON disabled explicitly because - # --enable-runtime-cpu-detect enables NEON for armv7 cpu - DISABLE_NEON_FLAG="--disable-neon" - unset ASFLAGS - ;; - arm-v7a-neon) - # NEON IS ENABLED BY --enable-runtime-cpu-detect - TARGET_CPU="armv7" - unset ASFLAGS - ;; - arm64-v8a) - # NEON IS ENABLED BY --enable-runtime-cpu-detect - TARGET_CPU="arm64" - unset ASFLAGS - ;; - *) - # INTEL CPU EXTENSIONS ENABLED BY --enable-runtime-cpu-detect - TARGET_CPU="$(get_target_build)" - export ASFLAGS="-D__ANDROID__" - ;; + # NEON disabled explicitly because + # --enable-runtime-cpu-detect enables NEON for armv7 cpu + ASM_OPTIONS="--disable-neon" + unset ASFLAGS + ;; +arm-v7a-neon) + # NEON IS ENABLED BY --enable-runtime-cpu-detect + TARGET_CPU="armv7" + unset ASFLAGS + ;; +arm64-v8a) + # NEON IS ENABLED BY --enable-runtime-cpu-detect + TARGET_CPU="arm64" + unset ASFLAGS + ;; +*) + # INTEL CPU EXTENSIONS ENABLED BY --enable-runtime-cpu-detect + TARGET_CPU="$(get_target_cpu)" + export ASFLAGS="-D__ANDROID__" + ;; esac -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --target="${TARGET_CPU}-android-gcc" \ - --extra-cflags="${CFLAGS}" \ - --extra-cxxflags="${CXXFLAGS}" \ - --as=yasm \ - --log=yes \ - --enable-libs \ - --enable-install-libs \ - --enable-pic \ - --enable-optimizations \ - --enable-better-hw-compatibility \ - --enable-runtime-cpu-detect \ - ${DISABLE_NEON_FLAG} \ - --enable-vp8 \ - --enable-vp9 \ - --enable-multithread \ - --enable-spatial-resampling \ - --enable-small \ - --enable-static \ - --disable-realtime-only \ - --disable-shared \ - --disable-debug \ - --disable-gprof \ - --disable-gcov \ - --disable-ccache \ - --disable-install-bins \ - --disable-install-srcs \ - --disable-install-docs \ - --disable-docs \ - --disable-tools \ - --disable-examples \ - --disable-unit-tests \ - --disable-decode-perf-tests \ - --disable-encode-perf-tests \ - --disable-codec-srcs \ - --disable-debug-libs \ - --disable-internal-stats || exit 1 +# NOTE THAT RECONFIGURE IS NOT SUPPORTED -make -j$(get_cpu_count) || exit 1 +# WORKAROUND TO FIX BUILD OPTIONS DEFINED IN configure.sh +overwrite_file "${BASEDIR}"/tools/patch/make/libvpx/configure.sh "${BASEDIR}"/src/"${LIB_NAME}"/build/make/configure.sh || return 1 + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --target="${TARGET_CPU}-android-gcc" \ + --extra-cflags="${CFLAGS}" \ + --extra-cxxflags="${CXXFLAGS}" \ + --as=yasm \ + --log=yes \ + --enable-libs \ + --enable-install-libs \ + --enable-pic \ + --enable-optimizations \ + --enable-better-hw-compatibility \ + --enable-runtime-cpu-detect \ + ${ASM_OPTIONS} \ + --enable-vp8 \ + --enable-vp9 \ + --enable-multithread \ + --enable-spatial-resampling \ + --enable-small \ + --enable-static \ + --disable-realtime-only \ + --disable-shared \ + --disable-debug \ + --disable-gprof \ + --disable-gcov \ + --disable-ccache \ + --disable-install-bins \ + --disable-install-srcs \ + --disable-install-docs \ + --disable-docs \ + --disable-tools \ + --disable-examples \ + --disable-unit-tests \ + --disable-decode-perf-tests \ + --disable-encode-perf-tests \ + --disable-codec-srcs \ + --disable-debug-libs \ + --disable-internal-stats || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 # MANUALLY COPY PKG-CONFIG FILES -cp ./*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 +cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/android/libwebp.sh b/scripts/android/libwebp.sh index 1e2f73e..f4b5a24 100755 --- a/scripts/android/libwebp.sh +++ b/scripts/android/libwebp.sh @@ -1,83 +1,53 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="libwebp" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -ARCH_OPTIONS="" +# SET BUILD OPTIONS +ASM_OPTIONS="" case ${ARCH} in - arm-v7a) - ARCH_OPTIONS="--disable-neon --disable-neon-rtcd" - ;; - arm-v7a-neon | arm64-v8a) - ARCH_OPTIONS="--enable-neon --enable-neon-rtcd" - ;; - *) - ARCH_OPTIONS="--enable-sse2 --enable-sse4.1" - ;; +arm-v7a) + ASM_OPTIONS="--disable-neon --disable-neon-rtcd" + ;; +arm-v7a-neon | arm64-v8a) + ASM_OPTIONS="--enable-neon --enable-neon-rtcd" + ;; +*) + ASM_OPTIONS="--enable-sse2 --enable-sse4.1" + ;; esac -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# ALWAYS RECONFIGURE -autoreconf_library ${LIB_NAME} +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_libwebp} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" +fi ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - --enable-static \ - --disable-shared \ - --disable-dependency-tracking \ - --enable-libwebpmux \ - ${ARCH_OPTIONS} \ - --with-pngincludedir="${BASEDIR}/prebuilt/android-$(get_target_build)/libpng/include" \ - --with-pnglibdir="${BASEDIR}/prebuilt/android-$(get_target_build)/libpng/lib" \ - --with-jpegincludedir="${BASEDIR}/prebuilt/android-$(get_target_build)/jpeg/include" \ - --with-jpeglibdir="${BASEDIR}/prebuilt/android-$(get_target_build)/jpeg/lib" \ - --with-gifincludedir="${BASEDIR}/prebuilt/android-$(get_target_build)/giflib/include" \ - --with-giflibdir="${BASEDIR}/prebuilt/android-$(get_target_build)/giflib/lib" \ - --with-tiffincludedir="${BASEDIR}/prebuilt/android-$(get_target_build)/tiff/include" \ - --with-tifflibdir="${BASEDIR}/prebuilt/android-$(get_target_build)/tiff/lib" \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${ANDROID_SYSROOT}" \ + --enable-static \ + --disable-shared \ + --disable-dependency-tracking \ + --enable-libwebpmux \ + ${ASM_OPTIONS} \ + --with-pngincludedir="${LIB_INSTALL_BASE}/libpng/include" \ + --with-pnglibdir="${LIB_INSTALL_BASE}/libpng/lib" \ + --with-jpegincludedir="${LIB_INSTALL_BASE}/jpeg/include" \ + --with-jpeglibdir="${LIB_INSTALL_BASE}/jpeg/lib" \ + --with-gifincludedir="${LIB_INSTALL_BASE}/giflib/include" \ + --with-giflibdir="${LIB_INSTALL_BASE}/giflib/lib" \ + --with-tiffincludedir="${LIB_INSTALL_BASE}/tiff/include" \ + --with-tifflibdir="${LIB_INSTALL_BASE}/tiff/lib" \ + --host="${HOST}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # MANUALLY COPY PKG-CONFIG FILES -cp ${BASEDIR}/src/${LIB_NAME}/src/*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 -cp ${BASEDIR}/src/${LIB_NAME}/src/demux/*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 -cp ${BASEDIR}/src/${LIB_NAME}/src/mux/*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 +cp ${BASEDIR}/src/${LIB_NAME}/src/*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 +cp ${BASEDIR}/src/${LIB_NAME}/src/demux/*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 +cp ${BASEDIR}/src/${LIB_NAME}/src/mux/*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 -make install || exit 1 +make install || return 1 diff --git a/scripts/android/libxml2.sh b/scripts/android/libxml2.sh index c69cba2..5ada342 100755 --- a/scripts/android/libxml2.sh +++ b/scripts/android/libxml2.sh @@ -1,70 +1,37 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="libxml2" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - # NOTE THAT PYTHON IS DISABLED DUE TO THE FOLLOWING ERROR # # .../include/python2.7/pyport.h:1029:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)." # #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)." # -# ALWAYS RECONFIGURE -autoreconf_library ${LIB_NAME} +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_libxml2} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" +fi ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - --with-zlib \ - --with-iconv=${BASEDIR}/prebuilt/android-$(get_target_build)/libiconv/lib \ - --with-sax1 \ - --without-python \ - --without-debug \ - --without-lzma \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${ANDROID_SYSROOT}" \ + --with-zlib \ + --with-iconv="${LIB_INSTALL_BASE}/libiconv/lib" \ + --with-sax1 \ + --without-python \ + --without-debug \ + --without-lzma \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --host="${HOST}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # CREATE PACKAGE CONFIG MANUALLY -create_libxml2_package_config "2.9.10" - -make install || exit 1 +create_libxml2_package_config "2.9.10" || return 1 diff --git a/scripts/android/nettle.sh b/scripts/android/nettle.sh index 025eafd..a083552 100755 --- a/scripts/android/nettle.sh +++ b/scripts/android/nettle.sh @@ -1,75 +1,46 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="nettle" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -OPTIONAL_CPU_SUPPORT="" +# SET BUILD OPTIONS +ASM_OPTIONS="" case ${ARCH} in - arm-v7a-neon | arm64-v8a) - OPTIONAL_CPU_SUPPORT="--enable-arm-neon" - ;; - x86 | x86-64) - OPTIONAL_CPU_SUPPORT="--enable-x86-aesni" - ;; +arm-v7a-neon | arm64-v8a) + ASM_OPTIONS="--enable-arm-neon" + ;; +x86 | x86-64) + ASM_OPTIONS="--enable-x86-aesni" + ;; esac -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_nettle} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_nettle} -eq 1 ]]; then + + # WORKAROUND TO FIX BUILD SYSTEM COMPILER ON macOS + overwrite_file "${BASEDIR}"/tools/patch/make/nettle/aclocal.m4 "${BASEDIR}"/src/"${LIB_NAME}"/aclocal.m4 + + autoreconf_library "${LIB_NAME}" fi ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --enable-pic \ - --enable-static \ - --with-include-path=${BASEDIR}/prebuilt/android-$(get_target_build)/gmp/include \ - --with-lib-path=${BASEDIR}/prebuilt/android-$(get_target_build)/gmp/lib \ - --disable-shared \ - --disable-mini-gmp \ - --disable-assembler \ - --disable-openssl \ - --disable-gcov \ - --disable-documentation \ - ${OPTIONAL_CPU_SUPPORT} \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --enable-pic \ + --enable-static \ + --with-include-path="${LIB_INSTALL_BASE}"/gmp/include \ + --with-lib-path="${LIB_INSTALL_BASE}"/gmp/lib \ + --disable-shared \ + --disable-mini-gmp \ + --disable-assembler \ + --disable-openssl \ + --disable-gcov \ + --disable-documentation \ + ${ASM_OPTIONS} \ + --host="${HOST}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # MANUALLY COPY PKG-CONFIG FILES -cp ./*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 +cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/android/opencore-amr.sh b/scripts/android/opencore-amr.sh index aba69a3..8d1d55b 100755 --- a/scripts/android/opencore-amr.sh +++ b/scripts/android/opencore-amr.sh @@ -1,60 +1,26 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="opencore-amr" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_opencore_amr} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_opencore_amr} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" fi ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --disable-maintainer-mode \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${ANDROID_SYSROOT}" \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --disable-maintainer-mode \ + --host="${HOST}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # MANUALLY COPY PKG-CONFIG FILES -cp amrnb/*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 +cp amrnb/*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/android/openh264.sh b/scripts/android/openh264.sh index 6a529cc..084433a 100755 --- a/scripts/android/openh264.sh +++ b/scripts/android/openh264.sh @@ -1,62 +1,52 @@ #!/bin/bash -# ENABLE COMMON FUNCTIONS -source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh +# UPDATE BUILD FLAGS +export CFLAGS="$CFLAGS $(pkg-config --cflags libiconv) $(pkg-config --cflags cpu-features)" +export LDFLAGS="$LDFLAGS $(pkg-config --libs --static libiconv) $(pkg-config --libs --static cpu-features)" -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="openh264" -set_toolchain_paths ${LIB_NAME} - -# SET BUILD FLAGS -BUILD_HOST=$(get_build_host) -CFLAGS=$(get_cflags ${LIB_NAME}) -CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -LDFLAGS=$(get_ldflags ${LIB_NAME}) - -# SET ARCH OPTIONS +# SET BUILD OPTIONS case ${ARCH} in - arm-v7a-neon) - ARCH_OPTIONS=arm - CFLAGS+=" -DHAVE_NEON -DANDROID_NDK" - ;; - arm64-v8a) - ARCH_OPTIONS=arm64 - CFLAGS+=" -DHAVE_NEON_AARCH64 -DANDROID_NDK" - ;; - x86*) - ARCH_OPTIONS=x86 - CFLAGS+=" -DHAVE_AVX2 -DANDROID_NDK" - ;; +arm-v7a-neon) + ASM_OPTIONS=arm + CFLAGS+=" -DHAVE_NEON -DANDROID_NDK" + ;; +arm64-v8a) + ASM_OPTIONS=arm64 + CFLAGS+=" -DHAVE_NEON_AARCH64 -DANDROID_NDK" + ;; +x86*) + ASM_OPTIONS=x86 + CFLAGS+=" -DHAVE_AVX2 -DANDROID_NDK" + ;; esac -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - +# ALWAYS CLEAN THE PREVIOUS BUILD make clean 2>/dev/null 1>/dev/null -# revert ios changes -git checkout ${BASEDIR}/src/${LIB_NAME}/build 1>>"${BASEDIR}"/build.log 2>&1 -git checkout ${BASEDIR}/src/${LIB_NAME}/codec 1>>"${BASEDIR}"/build.log 2>&1 +# DISCARD APPLE WORKAROUNDS +git checkout "${BASEDIR}"/src/"${LIB_NAME}"/build || return 1 +git checkout "${BASEDIR}"/src/"${LIB_NAME}"/codec || return 1 -# comment out the piece that compiles cpu-features into libopenh264.a -${SED_INLINE} 's/^COMMON_OBJS +=/# COMMON_OBJS +=/' ${BASEDIR}/src/${LIB_NAME}/build/platform-android.mk -${SED_INLINE} 's/^COMMON_CFLAGS +=/# COMMON_CFLAGS +=/' ${BASEDIR}/src/${LIB_NAME}/build/platform-android.mk +# WORKAROUND TO DISABLE PARTS THAT COMPILE cpu-features INTO libopenh264.a +${SED_INLINE} 's/^COMMON_INCLUDES +=/# COMMON_INCLUDES +=/' "${BASEDIR}"/src/"${LIB_NAME}"/build/platform-android.mk +${SED_INLINE} 's/^COMMON_OBJS +=/# COMMON_OBJS +=/' "${BASEDIR}"/src/"${LIB_NAME}"/build/platform-android.mk +${SED_INLINE} 's/^COMMON_CFLAGS +=/# COMMON_CFLAGS +=/' "${BASEDIR}"/src/"${LIB_NAME}"/build/platform-android.mk make -j$(get_cpu_count) \ -ARCH="$(get_toolchain_arch)" \ -CC="$CC" \ -CFLAGS="$CFLAGS" \ -CXX="$CXX" \ -CXXFLAGS="${CXXFLAGS}" \ -LDFLAGS="$LDFLAGS" \ -OS=android \ -PREFIX="${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME}" \ -NDKLEVEL="${API}" \ -NDKROOT="${ANDROID_NDK_ROOT}" \ -NDK_TOOLCHAIN_VERSION=clang \ -AR="$AR" \ -ARCH_OPTIONS=${ARCH_OPTIONS} \ -TARGET="android-${API}" \ -install-static || exit 1 + ARCH="$(get_toolchain_arch)" \ + CC="$CC" \ + CFLAGS="$CFLAGS" \ + CXX="$CXX" \ + CXXFLAGS="${CXXFLAGS}" \ + LDFLAGS="${LDFLAGS}" \ + OS=android \ + PREFIX="${LIB_INSTALL_PREFIX}" \ + NDKLEVEL="${API}" \ + NDKROOT="${ANDROID_NDK_ROOT}" \ + NDK_TOOLCHAIN_VERSION=clang \ + AR="$AR" \ + ASM_OPTIONS=${ASM_OPTIONS} \ + TARGET="android-${API}" install-static || return 1 # MANUALLY COPY PKG-CONFIG FILES -cp ${BASEDIR}/src/${LIB_NAME}/openh264-static.pc ${INSTALL_PKG_CONFIG_DIR}/openh264.pc || exit 1 +cp "${BASEDIR}"/src/"${LIB_NAME}"/openh264-static.pc "${INSTALL_PKG_CONFIG_DIR}"/openh264.pc || return 1 diff --git a/scripts/android/opus.sh b/scripts/android/opus.sh index c7fd3c3..92720cd 100755 --- a/scripts/android/opus.sh +++ b/scripts/android/opus.sh @@ -1,66 +1,32 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="opus" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_opus} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_opus} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" fi ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - --enable-static \ - --enable-rtcd \ - --enable-asm \ - --enable-check-asm \ - --enable-custom-modes \ - --disable-shared \ - --disable-fast-install \ - --disable-maintainer-mode \ - --disable-doc \ - --disable-extra-programs \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${ANDROID_SYSROOT}" \ + --enable-static \ + --enable-rtcd \ + --enable-asm \ + --enable-check-asm \ + --enable-custom-modes \ + --disable-shared \ + --disable-fast-install \ + --disable-maintainer-mode \ + --disable-doc \ + --disable-extra-programs \ + --host="${HOST}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # MANUALLY COPY PKG-CONFIG FILES -cp ./opus.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 +cp ./opus.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/android/rubberband.sh b/scripts/android/rubberband.sh index e3016a8..b17ac13 100755 --- a/scripts/android/rubberband.sh +++ b/scripts/android/rubberband.sh @@ -1,67 +1,26 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="rubberband" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -CFLAGS=$(get_cflags ${LIB_NAME}) -CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR=${INSTALL_PKG_CONFIG_DIR} - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# DISABLE OPTIONAL FEATURES MANUALLY, SINCE ./configure DOES NOT PROVIDE OPTIONS FOR THEM -rm -f ${BASEDIR}/src/${LIB_NAME}/configure.ac -cp ${BASEDIR}/tools/make/rubberband/configure.ac ${BASEDIR}/src/${LIB_NAME}/configure.ac -rm -f ${BASEDIR}/src/${LIB_NAME}/Makefile.in -cp ${BASEDIR}/tools/make/rubberband/Makefile.android.in ${BASEDIR}/src/${LIB_NAME}/Makefile.in +# WORKAROUND TO DISABLE OPTIONAL FEATURES MANUALLY, SINCE ./configure DOES NOT PROVIDE OPTIONS FOR THEM +overwrite_file "${BASEDIR}"/tools/patch/make/rubberband/configure.ac "${BASEDIR}"/src/"${LIB_NAME}"/configure.ac || return 1 +overwrite_file "${BASEDIR}"/tools/patch/make/rubberband/Makefile.android.in "${BASEDIR}"/src/"${LIB_NAME}"/Makefile.in || return 1 -# FIX PACKAGE CONFIG FILE DEPENDENCIES -rm -f ${BASEDIR}/src/${LIB_NAME}/rubberband.pc.in -cp ${BASEDIR}/tools/make/rubberband/rubberband.pc.in ${BASEDIR}/src/${LIB_NAME}/rubberband.pc.in -${SED_INLINE} 's/%DEPENDENCIES%/sndfile, samplerate/g' ${BASEDIR}/src/${LIB_NAME}/rubberband.pc.in +# WORKAROUND TO FIX PACKAGE CONFIG FILE DEPENDENCIES +overwrite_file "${BASEDIR}"/tools/patch/make/rubberband/rubberband.pc.in "${BASEDIR}"/src/"${LIB_NAME}"/rubberband.pc.in || return 1 +${SED_INLINE} 's/%DEPENDENCIES%/sndfile, samplerate/g' "${BASEDIR}"/src/"${LIB_NAME}"/rubberband.pc.in || return 1 -# ALWAYS RECONFIGURE -autoreconf_library ${LIB_NAME} - -# MANUALLY CREATE LIB DIRECTORY -mkdir -p ${BASEDIR}/src/${LIB_NAME}/lib || exit 1 +# ALWAYS REGENERATE BUILD FILES - NECESSARY TO APPLY THE WORKAROUNDS +autoreconf_library "${LIB_NAME}" ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --host="${HOST}" || return 1 -make AR="$AR" -j$(get_cpu_count) || exit 1 +make AR="$AR" -j$(get_cpu_count) || return 1 -make install || exit 1 +make install || return 1 # MANUALLY COPY PKG-CONFIG FILES -cp ./*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 +cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/android/sdl.sh b/scripts/android/sdl.sh index 4510eab..c71bb1f 100755 --- a/scripts/android/sdl.sh +++ b/scripts/android/sdl.sh @@ -1,61 +1,26 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="sdl" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_sdl} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_sdl} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" fi ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --without-x \ - --with-sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --without-x \ + --with-sysroot="${ANDROID_SYSROOT}" \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --host="${HOST}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # MANUALLY COPY PKG-CONFIG FILES -cp ./*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 +cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/android/shine.sh b/scripts/android/shine.sh index 2b5dccc..33153f9 100755 --- a/scripts/android/shine.sh +++ b/scripts/android/shine.sh @@ -1,59 +1,25 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="shine" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_shine} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_shine} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" fi ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${ANDROID_SYSROOT}" \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --host="${HOST}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # MANUALLY COPY PKG-CONFIG FILES -cp ./*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 +cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/android/snappy.sh b/scripts/android/snappy.sh index 73c8189..c2a247f 100755 --- a/scripts/android/snappy.sh +++ b/scripts/android/snappy.sh @@ -1,72 +1,33 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="snappy" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -if [ -d "build" ]; then - rm -rf build -fi - -mkdir build; -cd build +mkdir -p "${BUILD_DIR}" || return 1 +cd "${BUILD_DIR}" || return 1 cmake -Wno-dev \ - -DCMAKE_VERBOSE_MAKEFILE=0 \ - -DCMAKE_C_FLAGS="${CFLAGS}" \ - -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ - -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ - -DCMAKE_SYSROOT="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot" \ - -DCMAKE_FIND_ROOT_PATH="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX="${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME}" \ - -DCMAKE_SYSTEM_NAME=Generic \ - -DCMAKE_CXX_COMPILER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$CXX" \ - -DCMAKE_C_COMPILER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$CC" \ - -DCMAKE_LINKER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$LD" \ - -DCMAKE_AR="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$AR" \ - -DCMAKE_AS="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$AS" \ - -DCMAKE_POSITION_INDEPENDENT_CODE=1 \ - -DSNAPPY_BUILD_TESTS=0 \ - -DHAVE_LIBLZO2=0 \ - -DHAVE_LIBZ=1 \ - -DCMAKE_SYSTEM_PROCESSOR=$(get_cmake_target_processor) \ - -DBUILD_SHARED_LIBS=0 .. || exit 1 + -DCMAKE_VERBOSE_MAKEFILE=0 \ + -DCMAKE_C_FLAGS="${CFLAGS}" \ + -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ + -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ + -DCMAKE_SYSROOT="${ANDROID_SYSROOT}" \ + -DCMAKE_FIND_ROOT_PATH="${ANDROID_SYSROOT}" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="${LIB_INSTALL_PREFIX}" \ + -DCMAKE_SYSTEM_NAME=Generic \ + -DCMAKE_CXX_COMPILER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$CXX" \ + -DCMAKE_C_COMPILER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$CC" \ + -DCMAKE_LINKER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$LD" \ + -DCMAKE_AR="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$AR" \ + -DCMAKE_AS="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$AS" \ + -DCMAKE_POSITION_INDEPENDENT_CODE=1 \ + -DSNAPPY_BUILD_TESTS=0 \ + -DHAVE_LIBLZO2=0 \ + -DHAVE_LIBZ=1 \ + -DCMAKE_SYSTEM_PROCESSOR=$(get_cmake_system_processor) \ + -DBUILD_SHARED_LIBS=0 "${BASEDIR}"/src/"${LIB_NAME}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # CREATE PACKAGE CONFIG MANUALLY -create_snappy_package_config "1.1.8" - -make install || exit 1 +create_snappy_package_config "1.1.8" || return 1 diff --git a/scripts/android/soxr.sh b/scripts/android/soxr.sh index 945249f..870e63b 100755 --- a/scripts/android/soxr.sh +++ b/scripts/android/soxr.sh @@ -1,74 +1,35 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="soxr" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -CFLAGS=$(get_cflags ${LIB_NAME}) -CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -if [ -d "build" ]; then - rm -rf build -fi - -mkdir build; -cd build +mkdir -p "${BUILD_DIR}" || return 1 +cd "${BUILD_DIR}" || return 1 cmake -Wno-dev \ - -DCMAKE_VERBOSE_MAKEFILE=0 \ - -DCMAKE_C_FLAGS="${CFLAGS}" \ - -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ - -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ - -DCMAKE_SYSROOT="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot" \ - -DCMAKE_FIND_ROOT_PATH="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX="${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME}" \ - -DCMAKE_SYSTEM_NAME=Generic \ - -DCMAKE_CXX_COMPILER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$CXX" \ - -DCMAKE_C_COMPILER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$CC" \ - -DCMAKE_LINKER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$LD" \ - -DCMAKE_AR="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$AR" \ - -DCMAKE_AS="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$AS" \ - -DCMAKE_POSITION_INDEPENDENT_CODE=1 \ - -DBUILD_TESTS=0 \ - -DWITH_DEV_TRACE=0 \ - -DWITH_LSR_BINDINGS=0 \ - -DWITH_OPENMP=0 \ - -DWITH_PFFFT=1 \ - -DCMAKE_SYSTEM_PROCESSOR=$(get_cmake_target_processor) \ - -DBUILD_SHARED_LIBS=0 .. || exit 1 + -DCMAKE_VERBOSE_MAKEFILE=0 \ + -DCMAKE_C_FLAGS="${CFLAGS}" \ + -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ + -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ + -DCMAKE_SYSROOT="${ANDROID_SYSROOT}" \ + -DCMAKE_FIND_ROOT_PATH="${ANDROID_SYSROOT}" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="${LIB_INSTALL_PREFIX}" \ + -DCMAKE_SYSTEM_NAME=Generic \ + -DCMAKE_CXX_COMPILER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$CXX" \ + -DCMAKE_C_COMPILER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$CC" \ + -DCMAKE_LINKER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$LD" \ + -DCMAKE_AR="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$AR" \ + -DCMAKE_AS="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$AS" \ + -DCMAKE_POSITION_INDEPENDENT_CODE=1 \ + -DBUILD_TESTS=0 \ + -DWITH_DEV_TRACE=0 \ + -DWITH_LSR_BINDINGS=0 \ + -DWITH_OPENMP=0 \ + -DWITH_PFFFT=1 \ + -DCMAKE_SYSTEM_PROCESSOR=$(get_cmake_system_processor) \ + -DBUILD_SHARED_LIBS=0 "${BASEDIR}"/src/"${LIB_NAME}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # CREATE PACKAGE CONFIG MANUALLY -create_soxr_package_config "0.1.3" - -make install || exit 1 +create_soxr_package_config "0.1.3" || return 1 diff --git a/scripts/android/speex.sh b/scripts/android/speex.sh index 1f2d96a..a90a17f 100755 --- a/scripts/android/speex.sh +++ b/scripts/android/speex.sh @@ -1,66 +1,35 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="speex" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -OPTIONAL_CPU_SUPPORT="" -if [ ${ARCH} == "x86" ] || [ ${ARCH} == "x86-64" ]; then - OPTIONAL_CPU_SUPPORT="--enable-sse" -fi - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 +# SET BUILD OPTIONS +ASM_OPTIONS="" +case ${ARCH} in +x86 | x86-64) + ASM_OPTIONS="--enable-sse" + ;; +esac +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_speex} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_soxr} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" fi ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - --enable-static ${OPTIONAL_CPU_SUPPORT} \ - --disable-shared \ - --disable-binaries \ - --disable-fast-install \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${ANDROID_SYSROOT}" \ + --enable-static \ + ${ASM_OPTIONS} \ + --disable-shared \ + --disable-binaries \ + --disable-fast-install \ + --host="${HOST}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # MANUALLY COPY PKG-CONFIG FILES -cp ./*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 +cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/android/tesseract.sh b/scripts/android/tesseract.sh index a7512a5..a491efd 100755 --- a/scripts/android/tesseract.sh +++ b/scripts/android/tesseract.sh @@ -1,72 +1,40 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="tesseract" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 +# UPDATE BUILD FLAGS +export LEPTONICA_CFLAGS="-I${LIB_INSTALL_BASE}/leptonica/include/leptonica" +export LEPTONICA_LIBS="-L${LIB_INSTALL_BASE}/leptonica/lib -llept" +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# RECONFIGURE IF REQUESTED -if [[ ! -f ${BASEDIR}/src/${LIB_NAME}/configure ]] || [[ ${RECONF_tesseract} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_tesseract} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" fi -export LEPTONICA_CFLAGS="-I${BASEDIR}/prebuilt/android-$(get_target_build)/leptonica/include/leptonica" -export LEPTONICA_LIBS="-L${BASEDIR}/prebuilt/android-$(get_target_build)/leptonica/lib -llept" - -# MANUALLY SET ENDIANNESS +# WORKAROUND TO MANUALLY SET ENDIANNESS export ac_cv_c_bigendian=no ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --disable-debug \ - --disable-graphics \ - --disable-cube \ - --disable-tessdata-prefix \ - --disable-largefile \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${ANDROID_SYSROOT}" \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --disable-debug \ + --disable-graphics \ + --disable-cube \ + --disable-tessdata-prefix \ + --disable-largefile \ + --host="${HOST}" || return 1 -${SED_INLINE} 's/\-lrt//g' ${BASEDIR}/src/${LIB_NAME}/api/Makefile +# WORKAROUND TO DISABLE LINKING TO rt +${SED_INLINE} 's/\-lrt//g' "${BASEDIR}"/src/"${LIB_NAME}"/api/Makefile || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # CREATE PACKAGE CONFIG MANUALLY -create_tesseract_package_config "3.05.02" - -make install || exit 1 +create_tesseract_package_config "3.05.02" || return 1 diff --git a/scripts/android/tiff.sh b/scripts/android/tiff.sh index 0da64ff..36d9390 100755 --- a/scripts/android/tiff.sh +++ b/scripts/android/tiff.sh @@ -1,65 +1,31 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="tiff" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_tiff} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_tiff} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" fi ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - --with-jpeg-include-dir=${BASEDIR}/prebuilt/android-$(get_target_build)/jpeg/include \ - --with-jpeg-lib-dir=${BASEDIR}/prebuilt/android-$(get_target_build)/jpeg/lib \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --disable-maintainer-mode \ - --disable-cxx \ - --disable-win32-io \ - --disable-lzma \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${ANDROID_SYSROOT}" \ + --with-jpeg-include-dir="${LIB_INSTALL_BASE}"/jpeg/include \ + --with-jpeg-lib-dir="${LIB_INSTALL_BASE}"/jpeg/lib \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --disable-maintainer-mode \ + --disable-cxx \ + --disable-win32-io \ + --disable-lzma \ + --host="${HOST}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # MANUALLY COPY PKG-CONFIG FILES -cp ./*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 +cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/android/twolame.sh b/scripts/android/twolame.sh index a7f167c..7d44d8d 100755 --- a/scripts/android/twolame.sh +++ b/scripts/android/twolame.sh @@ -1,63 +1,32 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="twolame" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_twolame} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - +# UPDATE BUILD FLAGS export SNDFILE_CFLAGS="$(pkg-config --cflags sndfile)" export SNDFILE_LIBS="$(pkg-config --libs --static sndfile)" -./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --host=${BUILD_HOST} || exit 1 +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null -make -j$(get_cpu_count) || exit 1 +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_twolame} -eq 1 ]]; then + NOCONFIGURE=1 ./autogen.sh || return 1 +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${ANDROID_SYSROOT}" \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --host="${HOST}" || return 1 + +# WORKAROUND TO DISABLE BUILDING OF DOCBOOK - BUILD SCRIPTS DO NOT GENERATE A TARGET FOR IT +$SED_INLINE 's/dist_man_MANS = .*/dist_man_MANS =/g' "${BASEDIR}"/src/"${LIB_NAME}"/doc/Makefile || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 # MANUALLY COPY PKG-CONFIG FILES -cp ./*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 +cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/android/vo-amrwbenc.sh b/scripts/android/vo-amrwbenc.sh index fe19368..763dea5 100755 --- a/scripts/android/vo-amrwbenc.sh +++ b/scripts/android/vo-amrwbenc.sh @@ -1,68 +1,35 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="vo-amrwbenc" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -ARCH_OPTIONS="" +# SET BUILD OPTIONS +ASM_OPTIONS="" case ${ARCH} in - arm-v7a-neon) - ARCH_OPTIONS="--enable-armv7neon" - ;; +arm-v7a-neon) + ASM_OPTIONS="--enable-armv7neon" + ;; esac -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_vo_amrwbenc} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_vo_amrwbenc} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" fi ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - ${ARCH_OPTIONS} \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --disable-maintainer-mode \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${ANDROID_SYSROOT}" \ + ${ASM_OPTIONS} \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --disable-maintainer-mode \ + --host="${HOST}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # MANUALLY COPY PKG-CONFIG FILES -cp ./*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 +cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/android/wavpack.sh b/scripts/android/wavpack.sh index 7a279f6..20af900 100755 --- a/scripts/android/wavpack.sh +++ b/scripts/android/wavpack.sh @@ -1,62 +1,28 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="wavpack" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - +# ALWAYS CLEAN THE PREVIOUS BUILD make distclean 2>/dev/null 1>/dev/null -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_wavpack} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_wavpack} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" fi ./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - --without-iconv \ - --enable-static \ - --disable-shared \ - --disable-apps \ - --disable-fast-install \ - --disable-tests \ - --host=${BUILD_HOST} || exit 1 + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${ANDROID_SYSROOT}" \ + --without-iconv \ + --enable-static \ + --disable-shared \ + --disable-apps \ + --disable-fast-install \ + --disable-tests \ + --host="${HOST}" || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # MANUALLY COPY PKG-CONFIG FILES -cp ./*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 +cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/android/x264.sh b/scripts/android/x264.sh index 560de17..0ae23a3 100755 --- a/scripts/android/x264.sh +++ b/scripts/android/x264.sh @@ -1,81 +1,48 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -if ! [ -x "$(command -v tar)" ]; then - echo -e "\n(*) tar command not found\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="x264" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -ASM_FLAGS="" +# SET BUILD OPTIONS +ASM_OPTIONS="" case ${ARCH} in - x86) +x86) - # please note that asm is disabled - # because enabling asm for x86 causes text relocations in libavfilter.so - ASM_FLAGS="--disable-asm" - ;; - x86-64) - if ! [ -x "$(command -v nasm)" ]; then - echo -e "\n(*) nasm command not found\n" - exit 1 - fi + # please note that asm is disabled + # enabling asm for x86 causes text relocations in libavfilter.so + ASM_OPTIONS="--disable-asm" + ;; +x86-64) + if ! [ -x "$(command -v nasm)" ]; then + echo -e "\n(*) nasm command not found\n" + return 1 + fi - export AS="$(command -v nasm)" + export AS="$(command -v nasm)" - # WORKAROUND APPLIED TO ENABLE X86 ASM - # https://github.com/android-ndk/ndk/issues/693 - export CFLAGS="${CFLAGS} -mno-stackrealign" - ;; + # WORKAROUND TO ENABLE X86 ASM + # https://github.com/android-ndk/ndk/issues/693 + export CFLAGS="${CFLAGS} -mno-stackrealign" + ;; esac -./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - --enable-pic \ - --sysroot=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot \ - --enable-static \ - --disable-cli \ - ${ASM_FLAGS} \ - --host=${BUILD_HOST} || exit 1 +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null -make -j$(get_cpu_count) || exit 1 +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_x264} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --enable-pic \ + --sysroot="${ANDROID_SYSROOT}" \ + --enable-static \ + --disable-cli \ + ${ASM_OPTIONS} \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 # MANUALLY COPY PKG-CONFIG FILES -cp x264.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 +cp x264.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/android/x265.sh b/scripts/android/x265.sh index 819b730..9c31ac8 100755 --- a/scripts/android/x265.sh +++ b/scripts/android/x265.sh @@ -1,99 +1,54 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="x265" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -CFLAGS=$(get_cflags ${LIB_NAME}) -CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -LDFLAGS=$(get_ldflags ${LIB_NAME}) - -# USE CLEAN SOURCE ON EACH BUILD -cd ${BASEDIR}/src || exit 1 -rm -rf ${LIB_NAME} || exit 1 -DOWNLOAD_RESULT=$(download_gpl_library_source ${LIB_NAME}) -if [[ ${DOWNLOAD_RESULT} -ne 0 ]]; then - exit 1 -fi -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -ARCH_OPTIONS="" +# SET BUILD OPTIONS +ASM_OPTIONS="" case ${ARCH} in - arm-v7a | arm-v7a-neon) - ARCH_OPTIONS="-DENABLE_ASSEMBLY=0 -DCROSS_COMPILE_ARM=1" - ;; - arm64-v8a) - ARCH_OPTIONS="-DENABLE_ASSEMBLY=0 -DCROSS_COMPILE_ARM=1" - ;; - x86) - ARCH_OPTIONS="-DENABLE_ASSEMBLY=0 -DCROSS_COMPILE_ARM=0" - ;; - x86-64) - ARCH_OPTIONS="-DENABLE_ASSEMBLY=0 -DCROSS_COMPILE_ARM=0" - ;; +arm-v7a | arm-v7a-neon) + ASM_OPTIONS="-DENABLE_ASSEMBLY=0 -DCROSS_COMPILE_ARM=1" + ;; +arm64-v8a) + ASM_OPTIONS="-DENABLE_ASSEMBLY=0 -DCROSS_COMPILE_ARM=1" + ;; +x86) + ASM_OPTIONS="-DENABLE_ASSEMBLY=0 -DCROSS_COMPILE_ARM=0" + ;; +x86-64) + ASM_OPTIONS="-DENABLE_ASSEMBLY=0 -DCROSS_COMPILE_ARM=0" + ;; esac -if [ -d "cmake-build" ]; then - rm -rf cmake-build -fi +mkdir -p "${BUILD_DIR}" || return 1 +cd "${BUILD_DIR}" || return 1 -mkdir cmake-build || exit 1 -cd cmake-build || exit 1 - -# FIX static_assert ERRORS -${SED_INLINE} 's/gnu++98/c++11/g' ${BASEDIR}/src/${LIB_NAME}/source/CMakeLists.txt +# WORKAROUND TO FIX static_assert ERRORS +${SED_INLINE} 's/gnu++98/c++11/g' "${BASEDIR}"/src/"${LIB_NAME}"/source/CMakeLists.txt || return 1 cmake -Wno-dev \ - -DCMAKE_VERBOSE_MAKEFILE=0 \ - -DCMAKE_C_FLAGS="${CFLAGS}" \ - -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ - -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ - -DCMAKE_SYSROOT="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot" \ - -DCMAKE_FIND_ROOT_PATH="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX="${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME}" \ - -DCMAKE_SYSTEM_NAME=Generic \ - -DCMAKE_C_COMPILER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$CC" \ - -DCMAKE_CXX_COMPILER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$CXX" \ - -DCMAKE_LINKER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$LD" \ - -DCMAKE_AR="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$AR" \ - -DCMAKE_AS="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$AS" \ - -DCMAKE_POSITION_INDEPENDENT_CODE=1 \ - -DSTATIC_LINK_CRT=1 \ - -DENABLE_PIC=1 \ - -DENABLE_CLI=0 \ - ${ARCH_OPTIONS} \ - -DCMAKE_SYSTEM_PROCESSOR="${ARCH}" \ - -DENABLE_SHARED=0 ../source || exit 1 + -DCMAKE_VERBOSE_MAKEFILE=0 \ + -DCMAKE_C_FLAGS="${CFLAGS}" \ + -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ + -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ + -DCMAKE_SYSROOT="${ANDROID_SYSROOT}" \ + -DCMAKE_FIND_ROOT_PATH="${ANDROID_SYSROOT}" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="${LIB_INSTALL_PREFIX}" \ + -DCMAKE_SYSTEM_NAME=Generic \ + -DCMAKE_C_COMPILER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$CC" \ + -DCMAKE_CXX_COMPILER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$CXX" \ + -DCMAKE_LINKER="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$LD" \ + -DCMAKE_AR="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$AR" \ + -DCMAKE_AS="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/$AS" \ + -DCMAKE_POSITION_INDEPENDENT_CODE=1 \ + -DSTATIC_LINK_CRT=1 \ + -DENABLE_PIC=1 \ + -DENABLE_CLI=0 \ + ${ASM_OPTIONS} \ + -DCMAKE_SYSTEM_PROCESSOR="${ARCH}" \ + -DENABLE_SHARED=0 "${BASEDIR}"/src/"${LIB_NAME}"/source || return 1 -make -j$(get_cpu_count) || exit 1 +make -j$(get_cpu_count) || return 1 + +make install || return 1 # CREATE PACKAGE CONFIG MANUALLY -create_x265_package_config "3.4" - -make install || exit 1 +create_x265_package_config "3.4" || return 1 diff --git a/scripts/android/xvidcore.sh b/scripts/android/xvidcore.sh index 790f920..abe9d30 100755 --- a/scripts/android/xvidcore.sh +++ b/scripts/android/xvidcore.sh @@ -1,68 +1,37 @@ #!/bin/bash -if [[ -z ${ANDROID_NDK_ROOT} ]]; then - echo -e "\n(*) ANDROID_NDK_ROOT not defined\n" - exit 1 -fi +cd "${BASEDIR}"/src/"${LIB_NAME}"/"${LIB_NAME}"/build/generic || return 1 -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${API} ]]; then - echo -e "\n(*) API not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -. ${BASEDIR}/build/android-common.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="xvidcore" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME}/build/generic || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_xvidcore} -eq 1 ]]; then - ./bootstrap.sh -fi - -ASM_FLAGS="" +# SET BUILD OPTIONS +ASM_OPTIONS="" case ${ARCH} in - x86) +x86) - # please note that asm is disabled - # because enabling asm for x86 causes text relocations in libavcodec.so - ASM_FLAGS="--disable-assembly" - ;; + # please note that asm is disabled + # enabling asm for x86 causes text relocations in libavcodec.so + ASM_OPTIONS="--disable-assembly" + ;; esac -./configure \ - --prefix=${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME} \ - ${ASM_FLAGS} \ - --host=${BUILD_HOST} || exit 1 +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null -make -j$(get_cpu_count) || exit 1 +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/"${LIB_NAME}"/build/generic/configure ]] || [[ ${RECONF_xvidcore} -eq 1 ]]; then + ./bootstrap.sh +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + ${ASM_OPTIONS} \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 # CREATE PACKAGE CONFIG MANUALLY -create_xvidcore_package_config "1.3.6" +create_xvidcore_package_config "1.3.7" || return 1 -make install || exit 1 - -# REMOVE DYNAMIC LIBS -rm -f ${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME}/lib/libxvidcore.so* +# WORKAROUND TO REMOVE DYNAMIC LIBS +rm -f "${LIB_INSTALL_PREFIX}"/lib/libxvidcore.so* diff --git a/scripts/apple/chromaprint.sh b/scripts/apple/chromaprint.sh new file mode 100755 index 0000000..808275d --- /dev/null +++ b/scripts/apple/chromaprint.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +mkdir -p "${BUILD_DIR}" || return 1 +cd "${BUILD_DIR}" || return 1 + +cmake -Wno-dev \ + -DCMAKE_VERBOSE_MAKEFILE=0 \ + -DCMAKE_C_FLAGS="${CFLAGS}" \ + -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ + -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ + -DCMAKE_SYSROOT="${SDK_PATH}" \ + -DCMAKE_FIND_ROOT_PATH="${SDK_PATH}" \ + -DCMAKE_OSX_SYSROOT="$(get_sdk_name)" \ + -DCMAKE_OSX_ARCHITECTURES="$(get_cmake_osx_architectures)" \ + -DCMAKE_SYSTEM_NAME="${CMAKE_SYSTEM_NAME}" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="${LIB_INSTALL_PREFIX}" \ + -DCMAKE_C_COMPILER="$CC" \ + -DCMAKE_LINKER="$LD" \ + -DCMAKE_AR="$(xcrun --sdk "$(get_sdk_name)" -f ar)" \ + -DCMAKE_AS="$AS" \ + -DFFT_LIB=kissfft \ + -DKISSFFT_SOURCE_DIR="${BASEDIR}"/src/"${LIB_NAME}"/vendor/kissfft \ + -DCMAKE_SYSTEM_PROCESSOR="$(get_target_cpu)" \ + -DBUILD_SHARED_LIBS=0 "${BASEDIR}"/src/"${LIB_NAME}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp libchromaprint.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/apple/expat.sh b/scripts/apple/expat.sh new file mode 100755 index 0000000..add98e4 --- /dev/null +++ b/scripts/apple/expat.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +cd "${LIB_NAME}" || return 1 + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/"${LIB_NAME}"/configure ]] || [[ ${RECONF_expat} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${SDK_PATH}" \ + --without-docbook \ + --without-xmlwf \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp ./expat.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/apple/ffmpeg-kit.sh b/scripts/apple/ffmpeg-kit.sh new file mode 100755 index 0000000..ed92115 --- /dev/null +++ b/scripts/apple/ffmpeg-kit.sh @@ -0,0 +1,85 @@ +#!/bin/bash + +# ENABLE COMMON FUNCTIONS +source "${BASEDIR}"/scripts/function-"${FFMPEG_KIT_BUILD_TYPE}".sh 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 + +LIB_NAME="ffmpeg-kit" + +echo -e "----------------------------------------------------------------" 1>>"${BASEDIR}"/build.log 2>&1 +echo -e "\nINFO: Building ${LIB_NAME} with the following environment variables\n" 1>>"${BASEDIR}"/build.log 2>&1 +env 1>>"${BASEDIR}"/build.log 2>&1 +echo -e "----------------------------------------------------------------\n" 1>>"${BASEDIR}"/build.log 2>&1 +echo -e "INFO: System information\n" 1>>"${BASEDIR}"/build.log 2>&1 +echo -e "INFO: $(uname -a)\n" 1>>"${BASEDIR}"/build.log 2>&1 +echo -e "----------------------------------------------------------------\n" 1>>"${BASEDIR}"/build.log 2>&1 + +FFMPEG_KIT_LIBRARY_PATH="${LIB_INSTALL_BASE}/${LIB_NAME}" + +# SET PATHS +set_toolchain_paths "${LIB_NAME}" + +# SET BUILD FLAGS +HOST=$(get_host) +export CFLAGS="$(get_cflags ${LIB_NAME}) -I${LIB_INSTALL_BASE}/ffmpeg/include" +export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) +export LDFLAGS="$(get_ldflags ${LIB_NAME}) -L${LIB_INSTALL_BASE}/ffmpeg/lib -framework Foundation -framework CoreVideo -lavdevice" +export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" + +cd "${BASEDIR}"/apple 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 + +# ALWAYS BUILD STATIC LIBRARIES +BUILD_LIBRARY_OPTIONS="--enable-static --disable-shared" + +echo -n -e "\n${LIB_NAME}: " + +make distclean 2>/dev/null 1>/dev/null + +rm -f "${BASEDIR}"/apple/src/libffmpegkit* 1>>"${BASEDIR}"/build.log 2>&1 + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/apple/configure ]] || [[ ${RECONF_ffmpeg_kit} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" || exit 1 +fi + +# CHECK IF VIDEOTOOLBOX IS ENABLED +VIDEOTOOLBOX_SUPPORT_FLAG="" +if [[ ${LIBRARY_APPLE_VIDEOTOOLBOX} -eq 1 ]]; then + VIDEOTOOLBOX_SUPPORT_FLAG="--enable-videotoolbox" +fi + +# REMOVE OPTIONS FROM CONFIGURE TO FIX THE FOLLOWING ERROR +# ld: -flat_namespace and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together +${SED_INLINE} 's/$wl-flat_namespace //g' configure 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 +${SED_INLINE} 's/$wl-undefined //g' configure 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 +${SED_INLINE} 's/${wl}suppress//g' configure 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 + +./configure \ + --prefix="${FFMPEG_KIT_LIBRARY_PATH}" \ + --with-pic \ + --with-sysroot="${SDK_PATH}" \ + ${BUILD_LIBRARY_OPTIONS} \ + ${VIDEOTOOLBOX_SUPPORT_FLAG} \ + --disable-fast-install \ + --disable-maintainer-mode \ + --host="${HOST}" 1>>"${BASEDIR}"/build.log 2>&1 + +if [ $? -ne 0 ]; then + echo -e "failed\n\nSee build.log for details\n" + exit 1 +fi + +# DELETE THE PREVIOUS BUILD OF THE LIBRARY +if [ -d "${FFMPEG_KIT_LIBRARY_PATH}" ]; then + rm -rf "${FFMPEG_KIT_LIBRARY_PATH}" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 +fi + +make -j$(get_cpu_count) 1>>"${BASEDIR}"/build.log 2>&1 + +make install 1>>"${BASEDIR}"/build.log 2>&1 + +if [ $? -eq 0 ]; then + echo "ok" +else + echo -e "failed\n\nSee build.log for details\n" + exit 1 +fi diff --git a/scripts/apple/ffmpeg.sh b/scripts/apple/ffmpeg.sh new file mode 100755 index 0000000..7e5969a --- /dev/null +++ b/scripts/apple/ffmpeg.sh @@ -0,0 +1,575 @@ +#!/bin/bash + +HOST_PKG_CONFIG_PATH=$(command -v pkg-config) +if [ -z "${HOST_PKG_CONFIG_PATH}" ]; then + echo -e "\n(*) pkg-config command not found\n" + exit 1 +fi + +# ENABLE COMMON FUNCTIONS +source "${BASEDIR}"/scripts/function-"${FFMPEG_KIT_BUILD_TYPE}".sh 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 + +LIB_NAME="ffmpeg" + +echo -e "----------------------------------------------------------------" 1>>"${BASEDIR}"/build.log 2>&1 +echo -e "\nINFO: Building ${LIB_NAME} with the following environment variables\n" 1>>"${BASEDIR}"/build.log 2>&1 +env 1>>"${BASEDIR}"/build.log 2>&1 +echo -e "----------------------------------------------------------------\n" 1>>"${BASEDIR}"/build.log 2>&1 +echo -e "INFO: System information\n" 1>>"${BASEDIR}"/build.log 2>&1 +echo -e "INFO: $(uname -a)\n" 1>>"${BASEDIR}"/build.log 2>&1 +echo -e "----------------------------------------------------------------\n" 1>>"${BASEDIR}"/build.log 2>&1 + +FFMPEG_LIBRARY_PATH="${LIB_INSTALL_BASE}/${LIB_NAME}" + +# SET PATHS +set_toolchain_paths "${LIB_NAME}" + +# SET BUILD FLAGS +HOST=$(get_host) +export CFLAGS=$(get_cflags "${LIB_NAME}") +export CXXFLAGS=$(get_cxxflags "${LIB_NAME}") +export LDFLAGS=$(get_ldflags "${LIB_NAME}") +export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" + +cd "${BASEDIR}"/src/"${LIB_NAME}" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 + +# SET EXTRA BUILD FLAGS +FFMPEG_CFLAGS="" +FFMPEG_LDFLAGS="" + +# SET BUILD OPTIONS +TARGET_CPU="" +TARGET_ARCH="" +ASM_OPTIONS="" +BITCODE_FLAGS="" +case ${ARCH} in +armv7) + TARGET_CPU="armv7" + TARGET_ARCH="armv7" + ASM_OPTIONS=" --enable-neon --enable-asm" + BITCODE_FLAGS="-fembed-bitcode -Wc,-fembed-bitcode" + ;; +armv7s) + TARGET_CPU="armv7s" + TARGET_ARCH="armv7s" + ASM_OPTIONS=" --enable-neon --enable-asm" + BITCODE_FLAGS="-fembed-bitcode -Wc,-fembed-bitcode" + ;; +arm64) + TARGET_CPU="armv8" + TARGET_ARCH="aarch64" + ASM_OPTIONS=" --enable-neon --enable-asm" + BITCODE_FLAGS="-fembed-bitcode -Wc,-fembed-bitcode" + ;; +arm64-mac-catalyst) + TARGET_CPU="armv8" + TARGET_ARCH="aarch64" + ASM_OPTIONS=" --enable-neon --enable-asm" + BITCODE_FLAGS="-fembed-bitcode -Wc,-fembed-bitcode" + ;; +arm64-simulator) + TARGET_CPU="armv8" + TARGET_ARCH="aarch64" + ASM_OPTIONS=" --enable-neon --enable-asm" + BITCODE_FLAGS="" + ;; +arm64e) + TARGET_CPU="armv8.3-a" + TARGET_ARCH="aarch64" + ASM_OPTIONS=" --enable-neon --enable-asm" + BITCODE_FLAGS="-fembed-bitcode -Wc,-fembed-bitcode" + ;; +i386) + TARGET_CPU="i386" + TARGET_ARCH="i386" + ASM_OPTIONS=" --disable-neon --enable-asm" + BITCODE_FLAGS="" + ;; +x86-64) + TARGET_CPU="x86_64" + TARGET_ARCH="x86_64" + ASM_OPTIONS=" --disable-neon --disable-asm" + case $FFMPEG_KIT_BUILD_TYPE in + macos) + BITCODE_FLAGS="-fembed-bitcode -Wc,-fembed-bitcode" + ;; + *) + BITCODE_FLAGS="" + ;; + esac + ;; +x86-64-mac-catalyst) + TARGET_CPU="x86_64" + TARGET_ARCH="x86_64" + ASM_OPTIONS=" --disable-neon --disable-asm" + BITCODE_FLAGS="-fembed-bitcode -Wc,-fembed-bitcode" + ;; +esac + +CONFIGURE_POSTFIX="" + +# SET CONFIGURE OPTIONS +for library in {1..58}; do + if [[ ${!library} -eq 1 ]]; then + ENABLED_LIBRARY=$(get_library_name $((library - 1))) + + echo -e "INFO: Enabling library ${ENABLED_LIBRARY}\n" 1>>"${BASEDIR}"/build.log 2>&1 + + case ${ENABLED_LIBRARY} in + chromaprint) + FFMPEG_CFLAGS+=" $(pkg-config --cflags libchromaprint 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static libchromaprint 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-chromaprint" + ;; + fontconfig) + FFMPEG_CFLAGS+=" $(pkg-config --cflags fontconfig 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static fontconfig 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-libfontconfig" + ;; + freetype) + FFMPEG_CFLAGS+=" $(pkg-config --cflags freetype2 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static freetype2 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-libfreetype" + ;; + fribidi) + FFMPEG_CFLAGS+=" $(pkg-config --cflags fribidi 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static fribidi 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-libfribidi" + ;; + gmp) + FFMPEG_CFLAGS+=" $(pkg-config --cflags gmp 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static gmp 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-gmp" + ;; + gnutls) + FFMPEG_CFLAGS+=" $(pkg-config --cflags gnutls 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static gnutls 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-gnutls" + ;; + kvazaar) + FFMPEG_CFLAGS+=" $(pkg-config --cflags kvazaar 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static kvazaar 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-libkvazaar" + ;; + lame) + FFMPEG_CFLAGS+=" $(pkg-config --cflags libmp3lame 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static libmp3lame 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-libmp3lame" + ;; + libaom) + FFMPEG_CFLAGS+=" $(pkg-config --cflags aom 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static aom 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-libaom" + ;; + libass) + FFMPEG_CFLAGS+=" $(pkg-config --cflags libass 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static libass 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-libass" + ;; + libilbc) + FFMPEG_CFLAGS+=" $(pkg-config --cflags libilbc 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static libilbc 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-libilbc" + ;; + libtheora) + FFMPEG_CFLAGS+=" $(pkg-config --cflags theora 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static theora 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-libtheora" + ;; + libvidstab) + FFMPEG_CFLAGS+=" $(pkg-config --cflags vidstab 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static vidstab 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-libvidstab --enable-gpl" + ;; + libvorbis) + FFMPEG_CFLAGS+=" $(pkg-config --cflags vorbis 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static vorbis 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-libvorbis" + ;; + libvpx) + FFMPEG_CFLAGS+=" $(pkg-config --cflags vpx 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static vpx 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-libvpx" + ;; + libwebp) + FFMPEG_CFLAGS+=" $(pkg-config --cflags libwebp 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static libwebp 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-libwebp" + ;; + libxml2) + FFMPEG_CFLAGS+=" $(pkg-config --cflags libxml-2.0 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static libxml-2.0 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-libxml2" + ;; + opencore-amr) + FFMPEG_CFLAGS+=" $(pkg-config --cflags opencore-amrnb 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static opencore-amrnb 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-libopencore-amrnb" + ;; + openh264) + FFMPEG_CFLAGS+=" $(pkg-config --cflags openh264 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static openh264 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-libopenh264" + ;; + opus) + FFMPEG_CFLAGS+=" $(pkg-config --cflags opus 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static opus 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-libopus" + ;; + rubberband) + FFMPEG_CFLAGS+=" $(pkg-config --cflags rubberband 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static rubberband 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" -framework Accelerate" + CONFIGURE_POSTFIX+=" --enable-librubberband --enable-gpl" + ;; + sdl) + FFMPEG_CFLAGS+=" $(pkg-config --cflags sdl2 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static sdl2 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-sdl2" + ;; + shine) + FFMPEG_CFLAGS+=" $(pkg-config --cflags shine 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static shine 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-libshine" + ;; + snappy) + FFMPEG_CFLAGS+=" $(pkg-config --cflags snappy 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static snappy 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-libsnappy" + ;; + soxr) + FFMPEG_CFLAGS+=" $(pkg-config --cflags soxr 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static soxr 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-libsoxr" + ;; + speex) + FFMPEG_CFLAGS+=" $(pkg-config --cflags speex 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static speex 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-libspeex" + ;; + tesseract) + FFMPEG_CFLAGS+=" $(pkg-config --cflags tesseract 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static tesseract 2>>"${BASEDIR}"/build.log)" + FFMPEG_CFLAGS+=" $(pkg-config --cflags giflib 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static giflib 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-libtesseract" + ;; + twolame) + FFMPEG_CFLAGS+=" $(pkg-config --cflags twolame 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static twolame 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-libtwolame" + ;; + vo-amrwbenc) + FFMPEG_CFLAGS+=" $(pkg-config --cflags vo-amrwbenc 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static vo-amrwbenc 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-libvo-amrwbenc" + ;; + wavpack) + FFMPEG_CFLAGS+=" $(pkg-config --cflags wavpack 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static wavpack 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-libwavpack" + ;; + x264) + FFMPEG_CFLAGS+=" $(pkg-config --cflags x264 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static x264 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-libx264 --enable-gpl" + ;; + x265) + FFMPEG_CFLAGS+=" $(pkg-config --cflags x265 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static x265 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-libx265 --enable-gpl" + ;; + xvidcore) + FFMPEG_CFLAGS+=" $(pkg-config --cflags xvidcore 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static xvidcore 2>>"${BASEDIR}"/build.log)" + CONFIGURE_POSTFIX+=" --enable-libxvid --enable-gpl" + ;; + expat) + FFMPEG_CFLAGS+=" $(pkg-config --cflags expat 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static expat 2>>"${BASEDIR}"/build.log)" + ;; + libogg) + FFMPEG_CFLAGS+=" $(pkg-config --cflags ogg 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static ogg 2>>"${BASEDIR}"/build.log)" + ;; + libpng) + FFMPEG_CFLAGS+=" $(pkg-config --cflags libpng 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static libpng 2>>"${BASEDIR}"/build.log)" + ;; + nettle) + FFMPEG_CFLAGS+=" $(pkg-config --cflags nettle 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static nettle 2>>"${BASEDIR}"/build.log)" + FFMPEG_CFLAGS+=" $(pkg-config --cflags hogweed 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static hogweed 2>>"${BASEDIR}"/build.log)" + ;; + ios-* | tvos-* | macos-*) + + # BUILT-IN LIBRARIES SHARE INCLUDE AND LIB DIRECTORIES + # INCLUDING ONLY ONE OF THEM IS ENOUGH + FFMPEG_CFLAGS+=" $(pkg-config --cflags zlib 2>>"${BASEDIR}"/build.log)" + FFMPEG_LDFLAGS+=" $(pkg-config --libs --static zlib 2>>"${BASEDIR}"/build.log)" + + case ${ENABLED_LIBRARY} in + *-audiotoolbox) + CONFIGURE_POSTFIX+=" --enable-audiotoolbox" + + if [[ ${FFMPEG_KIT_BUILD_TYPE} != "macos" ]]; then + + # NOT AVAILABLE ON IOS, TVOS + CONFIGURE_POSTFIX+=" --disable-outdev=audiotoolbox" + fi + ;; + *-avfoundation) + CONFIGURE_POSTFIX+=" --enable-avfoundation" + ;; + *-bzip2) + CONFIGURE_POSTFIX+=" --enable-bzlib" + ;; + *-coreimage) + CONFIGURE_POSTFIX+=" --enable-coreimage" + ;; + *-libiconv) + CONFIGURE_POSTFIX+=" --enable-iconv" + ;; + *-opencl) + CONFIGURE_POSTFIX+=" --enable-opencl" + ;; + *-opengl) + CONFIGURE_POSTFIX+=" --enable-opengl" + ;; + *-videotoolbox) + CONFIGURE_POSTFIX+=" --enable-videotoolbox" + ;; + *-zlib) + CONFIGURE_POSTFIX+=" --enable-zlib" + ;; + esac + ;; + esac + else + + # THE FOLLOWING LIBRARIES SHOULD BE EXPLICITLY DISABLED TO PREVENT AUTODETECT + # NOTE THAT IDS MUST BE +1 OF THE INDEX VALUE + if [[ ${library} -eq $((LIBRARY_SDL + 1)) ]]; then + CONFIGURE_POSTFIX+=" --disable-sdl2" + elif [[ ${library} -eq $((LIBRARY_APPLE_AUDIOTOOLBOX + 1)) ]]; then + CONFIGURE_POSTFIX+=" --disable-audiotoolbox" + elif [[ ${library} -eq $((LIBRARY_APPLE_AVFOUNDATION + 1)) ]]; then + CONFIGURE_POSTFIX+=" --disable-avfoundation" + elif [[ ${library} -eq $((LIBRARY_APPLE_BZIP2 + 1)) ]]; then + CONFIGURE_POSTFIX+=" --disable-bzlib" + elif [[ ${library} -eq $((LIBRARY_APPLE_COREIMAGE + 1)) ]]; then + CONFIGURE_POSTFIX+=" --disable-coreimage" + elif [[ ${library} -eq $((LIBRARY_APPLE_LIBICONV + 1)) ]]; then + CONFIGURE_POSTFIX+=" --disable-iconv" + elif [[ ${library} -eq $((LIBRARY_APPLE_OPENCL + 1)) ]]; then + CONFIGURE_POSTFIX+=" --disable-opencl" + elif [[ ${library} -eq $((LIBRARY_APPLE_OPENGL + 1)) ]]; then + CONFIGURE_POSTFIX+=" --disable-opengl" + elif [[ ${library} -eq $((LIBRARY_APPLE_VIDEOTOOLBOX + 1)) ]]; then + CONFIGURE_POSTFIX+=" --disable-videotoolbox" + elif [[ ${library} -eq $((LIBRARY_APPLE_ZLIB + 1)) ]]; then + CONFIGURE_POSTFIX+=" --disable-zlib" + fi + fi +done + +# ALWAYS BUILD STATIC LIBRARIES +BUILD_LIBRARY_OPTIONS="--enable-static --disable-shared" + +# OPTIMIZE FOR SPEED INSTEAD OF SIZE +if [[ -z ${FFMPEG_KIT_OPTIMIZED_FOR_SPEED} ]]; then + SIZE_OPTIONS="--enable-small" +else + SIZE_OPTIONS="" +fi + +# SET DEBUG OPTIONS +if [[ -z ${FFMPEG_KIT_DEBUG} ]]; then + DEBUG_OPTIONS="--disable-debug" +else + DEBUG_OPTIONS="--enable-debug --disable-stripping" +fi + +# PREPARE CFLAGS PARTS BEFORE COMBINING THEM +ARCH_CFLAGS=$(get_arch_specific_cflags) +APP_CFLAGS=$(get_app_specific_cflags ${LIB_NAME}) +COMMON_CFLAGS=$(get_common_cflags) +if [[ -z ${FFMPEG_KIT_DEBUG} ]]; then + OPTIMIZATION_CFLAGS="$(get_size_optimization_cflags ${LIB_NAME})" +else + OPTIMIZATION_CFLAGS="${FFMPEG_KIT_DEBUG}" +fi +MIN_VERSION_CFLAGS=$(get_min_version_cflags) +COMMON_INCLUDES=$(get_common_includes) + +# PREPARE CFLAGS LDFLAGS BEFORE COMBINING THEM +ARCH_LDFLAGS=$(get_arch_specific_ldflags) +if [[ -z ${FFMPEG_KIT_DEBUG} ]]; then + OPTIMIZATION_FLAGS="$(get_size_optimization_ldflags ${LIB_NAME})" +else + OPTIMIZATION_FLAGS="${FFMPEG_KIT_DEBUG}" +fi +LINKED_LIBRARIES=$(get_common_linked_libraries) +COMMON_LDFLAGS=$(get_common_ldflags) + +# UPDATE BUILD FLAGS +export CFLAGS="${ARCH_CFLAGS} ${APP_CFLAGS} ${COMMON_CFLAGS} ${OPTIMIZATION_CFLAGS} ${MIN_VERSION_CFLAGS}${FFMPEG_CFLAGS} ${COMMON_INCLUDES}" +export CXXFLAGS=$(get_cxxflags "${LIB_NAME}") +export LDFLAGS="${ARCH_LDFLAGS}${FFMPEG_LDFLAGS} ${LINKED_LIBRARIES} ${COMMON_LDFLAGS} ${BITCODE_FLAGS} ${OPTIMIZATION_FLAGS}" + +echo -n -e "\n${LIB_NAME}: " + +if [[ -z ${NO_WORKSPACE_CLEANUP_ffmpeg} ]]; then + echo -e "INFO: Cleaning workspace for ${LIB_NAME}\n" 1>>"${BASEDIR}"/build.log 2>&1 + make distclean 2>/dev/null 1>/dev/null + + # WORKAROUND TO MANUALLY DELETE UNCLEANED FILES + rm -f "${BASEDIR}"/src/"${LIB_NAME}"/libavfilter/opencl/*.o 1>>"${BASEDIR}"/build.log 2>&1 + rm -f "${BASEDIR}"/src/"${LIB_NAME}"/libavcodec/neon/*.o 1>>"${BASEDIR}"/build.log 2>&1 +fi + +########################### CUSTOMIZATIONS ####################### + +# 1. Workaround to prevent adding of -mdynamic-no-pic flag +${SED_INLINE} 's/check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic;/check_cflags -mdynamic-no-pic;/g' ./configure 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 + +# 2. Workaround for videotoolbox on mac catalyst +if [[ ${ARCH} == *-mac-catalyst ]]; then + ${SED_INLINE} 's/ CFDictionarySetValue(buffer_attributes\, kCVPixelBufferOpenGLESCompatibilityKey/ \/\/ CFDictionarySetValue(buffer_attributes\, kCVPixelBufferOpenGLESCompatibilityKey/g' "${BASEDIR}"/src/${LIB_NAME}/libavcodec/videotoolbox.c || exit 1 +else + ${SED_INLINE} 's/ \/\/ CFDictionarySetValue(buffer_attributes\, kCVPixelBufferOpenGLESCompatibilityKey/ CFDictionarySetValue(buffer_attributes\, kCVPixelBufferOpenGLESCompatibilityKey/g' "${BASEDIR}"/src/${LIB_NAME}/libavcodec/videotoolbox.c || exit 1 +fi + +# 3. Use thread local log levels +${SED_INLINE} 's/static int av_log_level/__thread int av_log_level/g' "${BASEDIR}"/src/${LIB_NAME}/libavutil/log.c 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 + +################################################################### + +./configure \ + --cross-prefix="${HOST}-" \ + --sysroot="${SDK_PATH}" \ + --prefix="${FFMPEG_LIBRARY_PATH}" \ + --pkg-config="${HOST_PKG_CONFIG_PATH}" \ + --enable-version3 \ + --arch="${TARGET_ARCH}" \ + --cpu="${TARGET_CPU}" \ + --target-os=darwin \ + ${ASM_OPTIONS} \ + --ar="${AR}" \ + --cc="${CC}" \ + --cxx="${CXX}" \ + --as="${AS}" \ + --ranlib="${RANLIB}" \ + --strip="${STRIP}" \ + --ranlib="${RANLIB}" \ + --strip="${STRIP}" \ + --nm="${NM}" \ + --disable-autodetect \ + --enable-cross-compile \ + --enable-pic \ + --enable-inline-asm \ + --enable-optimizations \ + --enable-swscale \ + ${BUILD_LIBRARY_OPTIONS} \ + --enable-pthreads \ + --disable-v4l2-m2m \ + --disable-outdev=v4l2 \ + --disable-outdev=fbdev \ + --disable-indev=v4l2 \ + --disable-indev=fbdev \ + ${SIZE_OPTIONS} \ + --disable-openssl \ + --disable-xmm-clobber-test \ + ${DEBUG_OPTIONS} \ + --disable-neon-clobber-test \ + --disable-programs \ + --disable-postproc \ + --disable-doc \ + --disable-htmlpages \ + --disable-manpages \ + --disable-podpages \ + --disable-txtpages \ + --disable-sndio \ + --disable-schannel \ + --disable-securetransport \ + --disable-xlib \ + --disable-cuda \ + --disable-cuvid \ + --disable-nvenc \ + --disable-vaapi \ + --disable-vdpau \ + --disable-appkit \ + --disable-alsa \ + --disable-cuda \ + --disable-cuvid \ + --disable-nvenc \ + --disable-vaapi \ + --disable-vdpau \ + ${CONFIGURE_POSTFIX} 1>>"${BASEDIR}"/build.log 2>&1 + +if [[ $? -ne 0 ]]; then + echo -e "failed\n\nSee build.log for details\n" + exit 1 +fi + +if [[ -z ${NO_OUTPUT_REDIRECTION} ]]; then + make -j$(get_cpu_count) 1>>"${BASEDIR}"/build.log 2>&1 + + if [[ $? -ne 0 ]]; then + echo -e "failed\n\nSee build.log for details\n" + exit 1 + fi +else + echo -e "started\n" + make -j$(get_cpu_count) + + if [[ $? -ne 0 ]]; then + echo -n -e "\n${LIB_NAME}: failed\n\nSee build.log for details\n" + exit 1 + else + echo -n -e "\n${LIB_NAME}: " + fi +fi + +# DELETE THE PREVIOUS BUILD OF THE LIBRARY BEFORE INSTALLING +if [ -d "${FFMPEG_LIBRARY_PATH}" ]; then + rm -rf "${FFMPEG_LIBRARY_PATH}" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 +fi +make install 1>>"${BASEDIR}"/build.log 2>&1 + +if [[ $? -ne 0 ]]; then + echo -e "failed\n\nSee build.log for details\n" + exit 1 +fi + +# MANUALLY ADD REQUIRED HEADERS +mkdir -p "${FFMPEG_LIBRARY_PATH}"/include/libavutil/x86 1>>"${BASEDIR}"/build.log 2>&1 +mkdir -p "${FFMPEG_LIBRARY_PATH}"/include/libavutil/arm 1>>"${BASEDIR}"/build.log 2>&1 +mkdir -p "${FFMPEG_LIBRARY_PATH}"/include/libavutil/aarch64 1>>"${BASEDIR}"/build.log 2>&1 +mkdir -p "${FFMPEG_LIBRARY_PATH}"/include/libavcodec/x86 1>>"${BASEDIR}"/build.log 2>&1 +mkdir -p "${FFMPEG_LIBRARY_PATH}"/include/libavcodec/arm 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/config.h "${FFMPEG_LIBRARY_PATH}"/include/config.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavcodec/mathops.h "${FFMPEG_LIBRARY_PATH}"/include/libavcodec/mathops.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavcodec/x86/mathops.h "${FFMPEG_LIBRARY_PATH}"/include/libavcodec/x86/mathops.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavcodec/arm/mathops.h "${FFMPEG_LIBRARY_PATH}"/include/libavcodec/arm/mathops.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavformat/network.h "${FFMPEG_LIBRARY_PATH}"/include/libavformat/network.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavformat/os_support.h "${FFMPEG_LIBRARY_PATH}"/include/libavformat/os_support.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavformat/url.h "${FFMPEG_LIBRARY_PATH}"/include/libavformat/url.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavutil/internal.h "${FFMPEG_LIBRARY_PATH}"/include/libavutil/internal.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavutil/libm.h "${FFMPEG_LIBRARY_PATH}"/include/libavutil/libm.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavutil/reverse.h "${FFMPEG_LIBRARY_PATH}"/include/libavutil/reverse.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavutil/thread.h "${FFMPEG_LIBRARY_PATH}"/include/libavutil/thread.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavutil/timer.h "${FFMPEG_LIBRARY_PATH}"/include/libavutil/timer.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavutil/x86/asm.h "${FFMPEG_LIBRARY_PATH}"/include/libavutil/x86/asm.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavutil/x86/timer.h "${FFMPEG_LIBRARY_PATH}"/include/libavutil/x86/timer.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavutil/arm/timer.h "${FFMPEG_LIBRARY_PATH}"/include/libavutil/arm/timer.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavutil/aarch64/timer.h "${FFMPEG_LIBRARY_PATH}"/include/libavutil/aarch64/timer.h 1>>"${BASEDIR}"/build.log 2>&1 +overwrite_file "${BASEDIR}"/src/ffmpeg/libavutil/x86/emms.h "${FFMPEG_LIBRARY_PATH}"/include/libavutil/x86/emms.h 1>>"${BASEDIR}"/build.log 2>&1 + +if [ $? -eq 0 ]; then + echo "ok" +else + echo -e "failed\n\nSee build.log for details\n" + exit 1 +fi diff --git a/scripts/apple/fontconfig.sh b/scripts/apple/fontconfig.sh new file mode 100755 index 0000000..8b036a9 --- /dev/null +++ b/scripts/apple/fontconfig.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_fontconfig} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-libiconv-prefix="${SDK_PATH}"/usr \ + --with-expat="${LIB_INSTALL_BASE}"/expat \ + --without-libintl-prefix \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --disable-rpath \ + --disable-libxml2 \ + --disable-docs \ + --host="${HOST}" || return 1 + +# DISABLE IOS TESTS with system() calls - system() is deprecated for IOS +# 1. test-bz106632.c +overwrite_file "${BASEDIR}"/src/"${LIB_NAME}"/test/test-bz106618.c "${BASEDIR}"/src/"${LIB_NAME}"/test/test-bz106632.c + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# CREATE PACKAGE CONFIG MANUALLY +create_fontconfig_package_config "2.13.92" || return 1 diff --git a/scripts/apple/freetype.sh b/scripts/apple/freetype.sh new file mode 100755 index 0000000..befaf85 --- /dev/null +++ b/scripts/apple/freetype.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# UPDATE BUILD FLAGS +export LIBPNG_CFLAGS="-I${LIB_INSTALL_BASE}/libpng/include" +export LIBPNG_LIBS="-L${LIB_INSTALL_BASE}/libpng/lib" + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/builds/unix/configure ]] || [[ ${RECONF_freetype} -eq 1 ]]; then + + # NOTE THAT FREETYPE DOES NOT SUPPORT AUTORECONF BUT IT COMES WITH AN autogen.sh + ./autogen.sh || return 1 +fi + +# UPDATE CONFIG FILES TO SUPPORT APPLE ARCHITECTURES +overwrite_file "${FFMPEG_KIT_TMPDIR}"/source/config/config.guess "${BASEDIR}"/src/"${LIB_NAME}"/builds/unix/config.guess || return 1 +overwrite_file "${FFMPEG_KIT_TMPDIR}"/source/config/config.sub "${BASEDIR}"/src/"${LIB_NAME}"/builds/unix/config.sub || return 1 + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-zlib \ + --with-png \ + --with-sysroot="${SDK_PATH}" \ + --without-harfbuzz \ + --without-bzip2 \ + --without-fsref \ + --without-quickdraw-toolbox \ + --without-quickdraw-carbon \ + --without-ats \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --disable-mmap \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# CREATE PACKAGE CONFIG MANUALLY +create_freetype_package_config "23.2.17" || return 1 diff --git a/scripts/apple/fribidi.sh b/scripts/apple/fribidi.sh new file mode 100755 index 0000000..bf30d90 --- /dev/null +++ b/scripts/apple/fribidi.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_fribidi} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${SDK_PATH}" \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --disable-debug \ + --disable-deprecated \ + --host="${HOST}" || return 1 + +# WORKAROUND TO DISABLE BUILDING OF doc FOLDER (doc depends on c2man which is not available on all platforms) +$SED_INLINE 's/ doc / /g' "${BASEDIR}"/src/"${LIB_NAME}"/Makefile || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/apple/giflib.sh b/scripts/apple/giflib.sh new file mode 100755 index 0000000..110af90 --- /dev/null +++ b/scripts/apple/giflib.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# UPDATE BUILD FLAGS +export CFLAGS=$(get_cflags "${LIB_NAME}")" -DS_IREAD=S_IRUSR -DS_IWRITE=S_IWUSR" + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_giflib} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${SDK_PATH}" \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# CREATE PACKAGE CONFIG MANUALLY +create_giflib_package_config "5.1.4" || return 1 diff --git a/scripts/apple/gmp.sh b/scripts/apple/gmp.sh new file mode 100755 index 0000000..00ddda4 --- /dev/null +++ b/scripts/apple/gmp.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +# SET BUILD OPTIONS +unset gmp_cv_asm_w32 +case ${ARCH} in +i386) + HOST="x86-ios-darwin" + ;; +x86-64-mac-catalyst) + # Workaround for 'cannot determine how to define a 32-bit word' error + export gmp_cv_asm_w32=".long" + ;; +esac + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_gmp} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" +fi + +# UPDATE CONFIG FILES TO SUPPORT APPLE ARCHITECTURES +overwrite_file "${FFMPEG_KIT_TMPDIR}"/source/config/config.guess "${BASEDIR}"/src/"${LIB_NAME}"/config.guess || return 1 +overwrite_file "${FFMPEG_KIT_TMPDIR}"/source/config/config.sub "${BASEDIR}"/src/"${LIB_NAME}"/config.sub || return 1 + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${SDK_PATH}" \ + --enable-static \ + --disable-assembly \ + --disable-shared \ + --disable-fast-install \ + --disable-maintainer-mode \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# CREATE PACKAGE CONFIG MANUALLY +create_gmp_package_config "6.2.0" || return 1 diff --git a/scripts/apple/gnutls.sh b/scripts/apple/gnutls.sh new file mode 100755 index 0000000..523f70d --- /dev/null +++ b/scripts/apple/gnutls.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +# UPDATE BUILD FLAGS +export CFLAGS="$(get_cflags ${LIB_NAME}) -I${SDK_PATH}/usr/include" +export CXXFLAGS=$(get_cxxflags "${LIB_NAME}") +export LDFLAGS="$(get_ldflags ${LIB_NAME}) -L${SDK_PATH}/usr/lib" + +export NETTLE_CFLAGS="-I${LIB_INSTALL_BASE}/nettle/include" +export NETTLE_LIBS="-L${LIB_INSTALL_BASE}/nettle/lib -lnettle -L${LIB_INSTALL_BASE}/gmp/lib -lgmp" +export HOGWEED_CFLAGS="-I${LIB_INSTALL_BASE}/nettle/include" +export HOGWEED_LIBS="-L${LIB_INSTALL_BASE}/nettle/lib -lhogweed -L${LIB_INSTALL_BASE}/gmp/lib -lgmp" +export GMP_CFLAGS="-I${LIB_INSTALL_BASE}/gmp/include" +export GMP_LIBS="-L${LIB_INSTALL_BASE}/gmp/lib -lgmp" + +# SET BUILD OPTIONS +case ${ARCH} in +i386) + # DISABLING thread_local WHICH IS NOT SUPPORTED ON i386 + export CFLAGS+=" -D__thread=" + ;; +esac + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_gnutls} -eq 1 ]]; then + ./bootstrap || return 1 +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${SDK_PATH}" \ + --with-included-libtasn1 \ + --with-included-unistring \ + --without-idn \ + --without-p11-kit \ + --enable-hardware-acceleration \ + --enable-static \ + --disable-openssl-compatibility \ + --disable-shared \ + --disable-fast-install \ + --disable-code-coverage \ + --disable-doc \ + --disable-manpages \ + --disable-guile \ + --disable-tests \ + --disable-tools \ + --disable-maintainer-mode \ + --disable-full-test-suite \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# CREATE PACKAGE CONFIG MANUALLY +create_gnutls_package_config "3.6.15.1" || return 1 diff --git a/scripts/apple/harfbuzz.sh b/scripts/apple/harfbuzz.sh new file mode 100755 index 0000000..89228c5 --- /dev/null +++ b/scripts/apple/harfbuzz.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_harfbuzz} -eq 1 ]]; then + NOCONFIGURE=1 ./autogen.sh || return 1 +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${SDK_PATH}" \ + --with-glib=no \ + --with-fontconfig=yes \ + --with-freetype=yes \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --host="${HOST}" || return 1 + +# WORKAROUND TO REMOVE -bind_at_load FLAG WHICH CAN NOT BE USED WHEN BITCODE IS ENABLED +${SED_INLINE} 's/$wl-bind_at_load//g' ${BASEDIR}/src/${LIB_NAME}/libtool + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp ./src/harfbuzz.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 + +# WORKAROUND TO REMOVE INSTALLED .la FILES +rm -f "${LIB_INSTALL_PREFIX}"/lib/*.la diff --git a/scripts/apple/jpeg.sh b/scripts/apple/jpeg.sh new file mode 100755 index 0000000..caec9aa --- /dev/null +++ b/scripts/apple/jpeg.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +# SET BUILD FLAGS +export CCAS=${AS} +export ASM_FLAGS=$(get_asmflags "${LIB_NAME}") + +# SET BUILD OPTIONS +ASM_OPTIONS="" +case ${ARCH} in +armv7 | armv7s | arm64*) + ASM_OPTIONS="-DWITH_SIMD=1" + ;; +*) + case ${FFMPEG_KIT_BUILD_TYPE} in + ios) + ASM_OPTIONS="-DWITH_SIMD=0" + ;; + *) + ASM_OPTIONS="-DWITH_SIMD=1" + ;; + esac + ;; +esac + +# WORKAROUND TO FIX ASM FLAGS +${SED_INLINE} 's/${CMAKE_C_FLAGS} ${CMAKE_ASM_FLAGS}/${CMAKE_ASM_FLAGS}/g' "${BASEDIR}"/src/"${LIB_NAME}"/simd/CMakeLists.txt + +mkdir -p "${BUILD_DIR}" || return 1 +cd "${BUILD_DIR}" || return 1 + +cmake -Wno-dev \ + -DCMAKE_VERBOSE_MAKEFILE=0 \ + -DCMAKE_C_FLAGS="${CFLAGS}" \ + -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ + -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ + -DCMAKE_SYSROOT="${SDK_PATH}" \ + -DCMAKE_FIND_ROOT_PATH="${SDK_PATH}" \ + -DCMAKE_OSX_SYSROOT="$(get_sdk_name)" \ + -DCMAKE_OSX_ARCHITECTURES="$(get_cmake_osx_architectures)" \ + -DCMAKE_SYSTEM_NAME=Darwin \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="${LIB_INSTALL_PREFIX}" \ + -DCMAKE_C_COMPILER="$CC" \ + -DCMAKE_LINKER="$LD" \ + -DCMAKE_AR="$(xcrun --sdk $(get_sdk_name) -f ar)" \ + -DCMAKE_ASM_FLAGS="$ASM_FLAGS" \ + -DENABLE_PIC=1 \ + -DENABLE_STATIC=1 \ + -DENABLE_SHARED=0 \ + -DWITH_JPEG8=1 \ + ${ASM_OPTIONS} \ + -DWITH_TURBOJPEG=0 \ + -DWITH_JAVA=0 \ + -DCMAKE_SYSTEM_PROCESSOR="$(get_target_cpu)" \ + -DBUILD_SHARED_LIBS=0 "${BASEDIR}"/src/"${LIB_NAME}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp "${BUILD_DIR}"/pkgscripts/libjpeg.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/apple/kvazaar.sh b/scripts/apple/kvazaar.sh new file mode 100755 index 0000000..e0d6bef --- /dev/null +++ b/scripts/apple/kvazaar.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# SET BUILD OPTIONS +ASM_OPTIONS="--enable-asm" +case ${ARCH} in +i386) + HOST="x86-ios-darwin" + ;; +x86-64 | x86-64-mac-catalyst) + ASM_OPTIONS="--disable-asm" + ;; +esac + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_kvazaar} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${SDK_PATH}" \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + ${ASM_OPTIONS} \ + --host="${HOST}" || return 1 + +# NOTE THAT kvazaar DOES NOT SUPPORT PARALLEL EXECUTION +make || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp ./src/kvazaar.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/apple/lame.sh b/scripts/apple/lame.sh new file mode 100755 index 0000000..a82704a --- /dev/null +++ b/scripts/apple/lame.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +cd "${LIB_NAME}" || return 1 + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_lame} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${SDK_PATH}" \ + --with-libiconv-prefix="${SDK_PATH}"/usr \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --disable-maintainer-mode \ + --disable-frontend \ + --disable-efence \ + --disable-gtktest \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# CREATE PACKAGE CONFIG MANUALLY +create_libmp3lame_package_config "3.100" || return 1 diff --git a/scripts/apple/leptonica.sh b/scripts/apple/leptonica.sh new file mode 100755 index 0000000..87832d9 --- /dev/null +++ b/scripts/apple/leptonica.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +# UPDATE BUILD FLAGS +HOST=$(get_host) +export CFLAGS=$(get_cflags "${LIB_NAME}") +export CXXFLAGS=$(get_cxxflags "${LIB_NAME}") +export CPPFLAGS="-I${LIB_INSTALL_BASE}/giflib/include" +export LDFLAGS="$(get_ldflags "${LIB_NAME}") -L${LIB_INSTALL_BASE}/giflib/lib -lgif" + +export LIBPNG_CFLAGS="$(pkg-config --cflags libpng)" +export LIBPNG_LIBS="$(pkg-config --libs --static libpng)" + +export LIBWEBP_CFLAGS="$(pkg-config --cflags libwebp)" +export LIBWEBP_LIBS="$(pkg-config --libs --static libwebp)" + +export LIBTIFF_CFLAGS="$(pkg-config --cflags libtiff-4)" +export LIBTIFF_LIBS="$(pkg-config --libs --static libtiff-4)" + +export ZLIB_CFLAGS="$(pkg-config --cflags zlib)" +export ZLIB_LIBS="$(pkg-config --libs --static zlib)" + +export JPEG_CFLAGS="$(pkg-config --cflags libjpeg)" +export JPEG_LIBS="$(pkg-config --libs --static libjpeg)" + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_leptonica} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-zlib \ + --with-libpng \ + --with-jpeg \ + --with-giflib \ + --with-libtiff \ + --with-libwebp \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --disable-programs \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp lept.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/apple/libaom.sh b/scripts/apple/libaom.sh new file mode 100755 index 0000000..d759462 --- /dev/null +++ b/scripts/apple/libaom.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +# DISABLE x86-64 ASM WORKAROUNDS BEFORE APPLYING THEM AGAIN +${SED_INLINE} 's/define aom_clear_system_state()/define aom_clear_system_state() aom_reset_mmx_state()/g' ${BASEDIR}/src/${LIB_NAME}/aom_ports/system_state.h +${SED_INLINE} 's/#add_asm_library("aom_ports/ add_asm_library("aom_ports/g' ${BASEDIR}/src/${LIB_NAME}/aom_ports/aom_ports.cmake +${SED_INLINE} 's/#target_sources(aom_ports/ target_sources(aom_ports/g' ${BASEDIR}/src/${LIB_NAME}/aom_ports/aom_ports.cmake + +# SET BUILD OPTIONS +ASM_OPTIONS="" +case ${ARCH} in +arm*) + ASM_OPTIONS="-DCONFIG_RUNTIME_CPU_DETECT=0 -DARCH_ARM=1 -DENABLE_NEON=1 -DHAVE_NEON=1" + ;; +i386) + ASM_OPTIONS="-DARCH_X86=1 -DENABLE_SSE=1 -DHAVE_SSE=1 -DENABLE_SSE3=1 -DHAVE_SSE3=1" + ;; +x86-64*) + ASM_OPTIONS="-DARCH_X86_64=0 -DENABLE_SSE=0 -DENABLE_SSE2=0 -DENABLE_SSE3=0 -DENABLE_SSE4_1=0 -DENABLE_SSE4_2=0 -DENABLE_MMX=0" + + # WORKAROUND TO DISABLE ASM + ${SED_INLINE} 's/define aom_clear_system_state() aom_reset_mmx_state()/define aom_clear_system_state()/g' ${BASEDIR}/src/${LIB_NAME}/aom_ports/system_state.h + ${SED_INLINE} 's/ add_asm_library("aom_ports/#add_asm_library("aom_ports/g' ${BASEDIR}/src/${LIB_NAME}/aom_ports/aom_ports.cmake + ${SED_INLINE} 's/ target_sources(aom_ports/#target_sources(aom_ports/g' ${BASEDIR}/src/${LIB_NAME}/aom_ports/aom_ports.cmake + ;; +esac + +mkdir -p "${BUILD_DIR}" || return 1 +cd "${BUILD_DIR}" || return 1 + +cmake -Wno-dev \ + -DCMAKE_VERBOSE_MAKEFILE=0 \ + -DCONFIG_PIC=1 \ + -DCMAKE_C_FLAGS="${CFLAGS}" \ + -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ + -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ + -DCMAKE_SYSROOT="${SDK_PATH}" \ + -DCMAKE_FIND_ROOT_PATH="${SDK_PATH}" \ + -DCMAKE_OSX_SYSROOT="$(get_sdk_name)" \ + -DCMAKE_OSX_ARCHITECTURES="$(get_cmake_osx_architectures)" \ + -DCMAKE_SYSTEM_NAME="${CMAKE_SYSTEM_NAME}" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="${LIB_INSTALL_PREFIX}" \ + -DCMAKE_CXX_COMPILER="$CXX" \ + -DCMAKE_C_COMPILER="$CC" \ + -DCMAKE_LINKER="$LD" \ + -DCMAKE_AR="$(xcrun --sdk $(get_sdk_name) -f ar)" \ + -DCMAKE_AS="$AS" \ + ${ASM_OPTIONS} \ + -DENABLE_TESTS=0 \ + -DENABLE_EXAMPLES=0 \ + -DENABLE_TOOLS=0 \ + -DCONFIG_UNIT_TESTS=0 \ + -DCMAKE_SYSTEM_PROCESSOR="$(get_target_cpu)" \ + -DBUILD_SHARED_LIBS=0 "${BASEDIR}"/src/"${LIB_NAME}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp "${BUILD_DIR}"/aom.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/apple/libass.sh b/scripts/apple/libass.sh new file mode 100755 index 0000000..68949a5 --- /dev/null +++ b/scripts/apple/libass.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# SET BUILD OPTIONS +ASM_OPTIONS="--enable-asm" +case ${ARCH} in +x86-64 | x86-64-mac-catalyst) + ASM_OPTIONS="--disable-asm" + ;; +esac + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_libass} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${SDK_PATH}" \ + --disable-libtool-lock \ + --enable-static \ + --disable-shared \ + --disable-require-system-font-provider \ + --disable-fast-install \ + --disable-test \ + --disable-profile \ + --disable-coretext \ + ${ASM_OPTIONS} \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/apple/libilbc.sh b/scripts/apple/libilbc.sh new file mode 100755 index 0000000..37c9b23 --- /dev/null +++ b/scripts/apple/libilbc.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_libilbc} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${SDK_PATH}" \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp ./libilbc.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/apple/libogg.sh b/scripts/apple/libogg.sh new file mode 100755 index 0000000..09e537c --- /dev/null +++ b/scripts/apple/libogg.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_libogg} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" +fi + +# FIX INCLUDE PATHS +${SED_INLINE} 's/sys\/types/stdint/g' ${BASEDIR}/src/libogg/include/ogg/os_types.h + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${SDK_PATH}" \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp ogg.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/apple/libpng.sh b/scripts/apple/libpng.sh new file mode 100755 index 0000000..b49df51 --- /dev/null +++ b/scripts/apple/libpng.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# SET BUILD OPTIONS +ASM_OPTIONS="" +case ${ARCH} in +x86*) + ASM_OPTIONS=" --enable-intel-sse=yes" + ;; +arm*) + ASM_OPTIONS=" --enable-arm-neon=yes" + ;; +esac + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_libpng} -eq 1 ]] || [[ $(is_gnu_config_files_up_to_date) == "0" ]]; then + + # UPDATE CONFIG FILES TO SUPPORT APPLE ARCHITECTURES + overwrite_file "${FFMPEG_KIT_TMPDIR}"/source/config/config.guess "${BASEDIR}"/src/"${LIB_NAME}"/config.guess || return 1 + overwrite_file "${FFMPEG_KIT_TMPDIR}"/source/config/config.sub "${BASEDIR}"/src/"${LIB_NAME}"/config.sub || return 1 + + autoreconf_library "${LIB_NAME}" +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${SDK_PATH}" \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --disable-unversioned-libpng-pc \ + --disable-unversioned-libpng-config \ + ${ASM_OPTIONS} \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# CREATE PACKAGE CONFIG MANUALLY +create_libpng_package_config "1.6.37" || return 1 diff --git a/scripts/apple/libsamplerate.sh b/scripts/apple/libsamplerate.sh new file mode 100755 index 0000000..cf3759a --- /dev/null +++ b/scripts/apple/libsamplerate.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_libsamplerate} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${SDK_PATH}" \ + --enable-static \ + --disable-fftw \ + --disable-shared \ + --disable-fast-install \ + --host="${HOST}" || return 1 + +# WORKAROUND TO DISABLE BUILDING OF EXAMPLES AND TESTS +${SED_INLINE} 's/examples tests//g' "${BASEDIR}"/src/"${LIB_NAME}"/Makefile* || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/apple/libsndfile.sh b/scripts/apple/libsndfile.sh new file mode 100755 index 0000000..a61a4c7 --- /dev/null +++ b/scripts/apple/libsndfile.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_libsndfile} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${SDK_PATH}" \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --disable-sqlite \ + --disable-alsa \ + --disable-full-suite \ + --disable-external-libs \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/apple/libtheora.sh b/scripts/apple/libtheora.sh new file mode 100755 index 0000000..ce8eb3c --- /dev/null +++ b/scripts/apple/libtheora.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_libtheora} -eq 1 ]]; then + + # WORKAROUND NOT TO RUN CONFIGURE AT THE END OF autogen.sh + $SED_INLINE 's/$srcdir\/configure/#$srcdir\/configure/g' "${BASEDIR}"/src/"${LIB_NAME}"/autogen.sh || return 1 + + ./autogen.sh || return 1 +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --disable-examples \ + --disable-telemetry \ + --disable-sdltest \ + --disable-valgrind-testing \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp theoradec.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 +cp theoraenc.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 +cp theora.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/apple/libvidstab.sh b/scripts/apple/libvidstab.sh new file mode 100755 index 0000000..9c01bae --- /dev/null +++ b/scripts/apple/libvidstab.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +# SET BUILD OPTIONS +ASM_OPTIONS="" +case ${ARCH} in +arm*) + ASM_OPTIONS="-DSSE2_FOUND=0 -DSSE3_FOUND=0 -DSSSE3_FOUND=0 -DSSE4_1_FOUND=0" + ;; +*) + ASM_OPTIONS="" + ;; +esac + +mkdir -p "${BUILD_DIR}" || return 1 +cd "${BUILD_DIR}" || return 1 + +cmake -Wno-dev \ + -DCMAKE_VERBOSE_MAKEFILE=0 \ + -DCMAKE_C_FLAGS="${CFLAGS}" \ + -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ + -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ + -DCMAKE_SYSROOT="${SDK_PATH}" \ + -DCMAKE_FIND_ROOT_PATH="${SDK_PATH}" \ + -DCMAKE_OSX_SYSROOT="$(get_sdk_name)" \ + -DCMAKE_OSX_ARCHITECTURES="$(get_cmake_osx_architectures)" \ + -DCMAKE_SYSTEM_NAME="${CMAKE_SYSTEM_NAME}" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="${LIB_INSTALL_PREFIX}" \ + -DCMAKE_C_COMPILER="$CC" \ + -DCMAKE_LINKER="$LD" \ + -DCMAKE_AR="$(xcrun --sdk $(get_sdk_name) -f ar)" \ + -DCMAKE_AS="$AS" \ + -DUSE_OMP=0 \ + ${ASM_OPTIONS} \ + -DCMAKE_SYSTEM_PROCESSOR="$(get_target_cpu)" \ + -DBUILD_SHARED_LIBS=0 "${BASEDIR}"/src/"${LIB_NAME}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp vidstab.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/apple/libvorbis.sh b/scripts/apple/libvorbis.sh new file mode 100755 index 0000000..d72ab69 --- /dev/null +++ b/scripts/apple/libvorbis.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_libvorbis} -eq 1 ]]; then + + # -mno-ieee-fp OPTION IS NOT COMPATIBLE WITH clang. REMOVING IT + ${SED_INLINE} 's/\-mno-ieee-fp//g' "${BASEDIR}"/src/"${LIB_NAME}"/configure.ac || return 1 + + autoreconf_library "${LIB_NAME}" +fi + +# WORKAROUND TO REMOVE -force_cpusubtype_ALL FLAG DUE TO THE FOLLOWING ERROR +# ld: -force_cpusubtype_ALL and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together +${SED_INLINE} 's/-force_cpusubtype_ALL//g' ${BASEDIR}/src/${LIB_NAME}/configure + +PKG_CONFIG= ./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${SDK_PATH}" \ + --with-ogg-includes="${LIB_INSTALL_BASE}"/libogg/include \ + --with-ogg-libraries="${LIB_INSTALL_BASE}"/libogg/lib \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --disable-docs \ + --disable-examples \ + --disable-oggtest \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# CREATE PACKAGE CONFIG MANUALLY +create_libvorbis_package_config "1.3.7" || return 1 diff --git a/scripts/apple/libvpx.sh b/scripts/apple/libvpx.sh new file mode 100755 index 0000000..18b79ea --- /dev/null +++ b/scripts/apple/libvpx.sh @@ -0,0 +1,100 @@ +#!/bin/bash + +# SET BUILD OPTIONS +TARGET="" +ASM_OPTIONS="" +case ${ARCH} in +armv7 | armv7s) + + # note that --disable-runtime-cpu-detect is used for arm + # using --enable-runtime-cpu-detect cause the following error + # vpx_ports/arm_cpudetect.c:151:2: error: "--enable-runtime-cpu-detect selected, but no CPU detection method " "available for your platform. Reconfigure with --disable-runtime-cpu-detect." + + TARGET="$(get_target_cpu)-darwin-gcc" + ASM_OPTIONS="--disable-runtime-cpu-detect --enable-neon --enable-neon-asm" + ;; +arm64*) + TARGET="arm64-darwin-gcc" + + # --enable-neon-asm option not added because it causes the following error + # vpx_dsp/arm/intrapred_neon_asm.asm.S:653:26: error: vector register expected + # vst1.64 + ASM_OPTIONS="--disable-runtime-cpu-detect --enable-neon" + ;; +i386) + TARGET="x86-iphonesimulator-gcc" + ASM_OPTIONS="--enable-runtime-cpu-detect --disable-avx512" + ;; +x86-64*) + if [[ ${ARCH} == "x86-64-mac-catalyst" ]]; then + TARGET="x86_64-macosx-gcc" + else + + # WORKAROUND TO USE A VALID TARGET FOR LIBVPX BUILD SCRIPTS + # HAS NO EFFECT ON THE OUTPUT + # CUSTOMIZED LIBVPX BUILD SCRIPTS (FOR tvOS, macOS) USE BUILD FLAGS SET BY FFMPEG KIT + TARGET="x86_64-iphonesimulator-gcc" + fi + ASM_OPTIONS="--enable-runtime-cpu-detect --disable-avx512 --disable-sse --disable-sse2 --disable-mmx" + ;; +esac + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# NOTE THAT RECONFIGURE IS NOT SUPPORTED + +# WORKAROUND TO FIX BUILD OPTIONS DEFINED IN configure.sh +case ${ARCH} in +x86-64-mac-catalyst) + overwrite_file "${BASEDIR}"/tools/patch/make/libvpx/configure.x86_64_mac_catalyst.sh "${BASEDIR}"/src/"${LIB_NAME}"/build/make/configure.sh || return 1 + ;; +*) + overwrite_file "${BASEDIR}"/tools/patch/make/libvpx/configure.sh "${BASEDIR}"/src/"${LIB_NAME}"/build/make/configure.sh || return 1 + ;; +esac + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --target="${TARGET}" \ + --extra-cflags="${CFLAGS}" \ + --extra-cxxflags="${CXXFLAGS}" \ + --as=yasm \ + --log=yes \ + --enable-libs \ + --enable-install-libs \ + --enable-pic \ + --enable-optimizations \ + --enable-better-hw-compatibility \ + ${ASM_OPTIONS} \ + --enable-vp8 \ + --enable-vp9 \ + --enable-multithread \ + --enable-spatial-resampling \ + --enable-small \ + --enable-static \ + --disable-realtime-only \ + --disable-shared \ + --disable-debug \ + --disable-gprof \ + --disable-gcov \ + --disable-ccache \ + --disable-install-bins \ + --disable-install-srcs \ + --disable-install-docs \ + --disable-docs \ + --disable-tools \ + --disable-examples \ + --disable-unit-tests \ + --disable-decode-perf-tests \ + --disable-encode-perf-tests \ + --disable-codec-srcs \ + --disable-debug-libs \ + --disable-internal-stats || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/apple/libwebp.sh b/scripts/apple/libwebp.sh new file mode 100755 index 0000000..de0013f --- /dev/null +++ b/scripts/apple/libwebp.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +# SET BUILD OPTIONS +ASM_OPTIONS="" +case ${ARCH} in +arm*) + ASM_OPTIONS="--enable-neon --enable-neon-rtcd" + ;; +x86-64-mac-catalyst) + ASM_OPTIONS="--disable-sse2 --disable-sse4.1" + ;; +*) + ASM_OPTIONS="--enable-sse2 --enable-sse4.1" + ;; +esac + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_libwebp} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${SDK_PATH}" \ + --enable-static \ + --disable-shared \ + --disable-dependency-tracking \ + --enable-libwebpmux \ + ${ASM_OPTIONS} \ + --with-pngincludedir="${LIB_INSTALL_BASE}/libpng/include" \ + --with-pnglibdir="${LIB_INSTALL_BASE}/libpng/lib" \ + --with-jpegincludedir="${LIB_INSTALL_BASE}/jpeg/include" \ + --with-jpeglibdir="${LIB_INSTALL_BASE}/jpeg/lib" \ + --with-gifincludedir="${LIB_INSTALL_BASE}/giflib/include" \ + --with-giflibdir="${LIB_INSTALL_BASE}/giflib/lib" \ + --with-tiffincludedir="${LIB_INSTALL_BASE}/tiff/include" \ + --with-tifflibdir="${LIB_INSTALL_BASE}/tiff/lib" \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp ${BASEDIR}/src/${LIB_NAME}/src/*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 +cp ${BASEDIR}/src/${LIB_NAME}/src/demux/*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 +cp ${BASEDIR}/src/${LIB_NAME}/src/mux/*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 + +make install || return 1 diff --git a/scripts/apple/libxml2.sh b/scripts/apple/libxml2.sh new file mode 100755 index 0000000..9822972 --- /dev/null +++ b/scripts/apple/libxml2.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_libxml2} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${SDK_PATH}" \ + --with-zlib \ + --with-iconv="${SDK_PATH}"/usr \ + --with-sax1 \ + --without-python \ + --without-debug \ + --without-lzma \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# CREATE PACKAGE CONFIG MANUALLY +create_libxml2_package_config "2.9.10" || return 1 diff --git a/scripts/apple/nettle.sh b/scripts/apple/nettle.sh new file mode 100755 index 0000000..126ac36 --- /dev/null +++ b/scripts/apple/nettle.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +# SET BUILD OPTIONS +ASM_OPTIONS="" +case ${ARCH} in +arm*) + ASM_OPTIONS="--enable-arm-neon" + ;; +i386 | x86-64*) + ASM_OPTIONS="--enable-x86-aesni" + ;; +esac + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_nettle} -eq 1 ]]; then + + # WORKAROUND TO FIX BUILD SYSTEM COMPILER ON macOS + overwrite_file "${BASEDIR}"/tools/patch/make/nettle/aclocal.m4 "${BASEDIR}"/src/"${LIB_NAME}"/aclocal.m4 + + autoreconf_library "${LIB_NAME}" +fi + +# UPDATE CONFIG FILES TO SUPPORT APPLE ARCHITECTURES +overwrite_file "${FFMPEG_KIT_TMPDIR}"/source/config/config.guess "${BASEDIR}"/src/"${LIB_NAME}"/config.guess || return 1 +overwrite_file "${FFMPEG_KIT_TMPDIR}"/source/config/config.sub "${BASEDIR}"/src/"${LIB_NAME}"/config.sub || return 1 + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --enable-pic \ + --enable-static \ + --with-include-path="${LIB_INSTALL_BASE}"/gmp/include \ + --with-lib-path="${LIB_INSTALL_BASE}"/gmp/lib \ + --disable-shared \ + --disable-mini-gmp \ + --disable-assembler \ + --disable-openssl \ + --disable-gcov \ + --disable-documentation \ + ${ASM_OPTIONS} \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/apple/opencore-amr.sh b/scripts/apple/opencore-amr.sh new file mode 100755 index 0000000..02fbb99 --- /dev/null +++ b/scripts/apple/opencore-amr.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# UPDATE BUILD FLAGS +case ${ARCH} in +x86-64 | x86-64-mac-catalyst) + export CXX="xcrun --sdk $(get_sdk_name) clang++ -arch x86_64" + ;; +arm64-simulator | arm64-mac-catalyst) + export CXX="xcrun --sdk $(get_sdk_name) clang++ -arch arm64" + ;; +*) + export CXX="xcrun --sdk $(get_sdk_name) clang++ -arch ${ARCH}" + ;; +esac + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_opencore_amr} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${SDK_PATH}" \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --disable-maintainer-mode \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp amrnb/*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/apple/openh264.sh b/scripts/apple/openh264.sh new file mode 100755 index 0000000..77721f9 --- /dev/null +++ b/scripts/apple/openh264.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# UPDATE BUILD FLAGS AND SET BUILD OPTIONS +ASM_OPTIONS="OS=darwin" +case ${ARCH} in +armv7 | armv7s) + CFLAGS+=" -DHAVE_NEON" + ;; +arm64*) + CFLAGS+=" -DHAVE_NEON_AARCH64" + ;; +*) + CFLAGS+=" -DHAVE_AVX2" + ;; +esac + +# MAKE SURE THAT ASM IS ENABLED FOR ALL IOS ARCHITECTURES - EXCEPT x86-64 +${SED_INLINE} 's/arm64 aarch64/arm64% aarch64/g' ${BASEDIR}/src/${LIB_NAME}/build/arch.mk +${SED_INLINE} 's/%86 x86_64,/%86 x86_64 x86-64%,/g' ${BASEDIR}/src/${LIB_NAME}/build/arch.mk +${SED_INLINE} 's/filter-out arm64,/filter-out arm64%,/g' ${BASEDIR}/src/${LIB_NAME}/build/arch.mk +${SED_INLINE} 's/CFLAGS += -DHAVE_NEON/#CFLAGS += -DHAVE_NEON/g' ${BASEDIR}/src/${LIB_NAME}/build/arch.mk +${SED_INLINE} 's/ifeq (\$(ASM_ARCH), arm64)/ifneq (\$(filter arm64%, \$(ASM_ARCH)),)/g' ${BASEDIR}/src/${LIB_NAME}/codec/common/targets.mk +${SED_INLINE} 's/ifeq (\$(ASM_ARCH), arm)/ifneq (\$(filter armv%, \$(ASM_ARCH)),)/g' ${BASEDIR}/src/${LIB_NAME}/codec/common/targets.mk + +# ALWAYS CLEAN THE PREVIOUS BUILD +make clean 2>/dev/null 1>/dev/null + +make -j$(get_cpu_count) \ + ASM_ARCH="$(get_target_cpu)" \ + ARCH="${ARCH}" \ + CC="${CC}" \ + CFLAGS="$CFLAGS" \ + CXX="${CXX}" \ + CXXFLAGS="${CXXFLAGS}" \ + LDFLAGS="$LDFLAGS" \ + ${ASM_OPTIONS} \ + PREFIX="${LIB_INSTALL_PREFIX}" \ + SDK_MIN="${IOS_MIN_VERSION}" \ + SDKROOT="${SDK_PATH}" \ + STATIC_LDFLAGS="-lc++" \ + install-static || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp ${BASEDIR}/src/${LIB_NAME}/openh264-static.pc ${INSTALL_PKG_CONFIG_DIR}/openh264.pc || return 1 diff --git a/scripts/apple/opus.sh b/scripts/apple/opus.sh new file mode 100755 index 0000000..25710f1 --- /dev/null +++ b/scripts/apple/opus.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_opus} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${SDK_PATH}" \ + --enable-static \ + --enable-rtcd \ + --enable-asm \ + --enable-check-asm \ + --enable-custom-modes \ + --disable-shared \ + --disable-fast-install \ + --disable-maintainer-mode \ + --disable-doc \ + --disable-extra-programs \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp ./opus.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/apple/rubberband.sh b/scripts/apple/rubberband.sh new file mode 100755 index 0000000..2849944 --- /dev/null +++ b/scripts/apple/rubberband.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# WORKAROUND TO DISABLE OPTIONAL FEATURES MANUALLY, SINCE ./configure DOES NOT PROVIDE OPTIONS FOR THEM +overwrite_file "${BASEDIR}"/tools/patch/make/rubberband/configure.ac "${BASEDIR}"/src/"${LIB_NAME}"/configure.ac || return 1 +overwrite_file "${BASEDIR}"/tools/patch/make/rubberband/Makefile.ios.in "${BASEDIR}"/src/"${LIB_NAME}"/Makefile.in || return 1 + +# WORKAROUND TO FIX PACKAGE CONFIG FILE DEPENDENCIES +overwrite_file "${BASEDIR}"/tools/patch/make/rubberband/rubberband.pc.in "${BASEDIR}"/src/"${LIB_NAME}"/rubberband.pc.in || return 1 +${SED_INLINE} 's/%DEPENDENCIES%/sndfile, samplerate/g' "${BASEDIR}"/src/"${LIB_NAME}"/rubberband.pc.in || return 1 + +# ALWAYS REGENERATE BUILD FILES - NECESSARY TO APPLY THE WORKAROUNDS +autoreconf_library "${LIB_NAME}" + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --host="${HOST}" || return 1 + +make AR="$AR" -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/apple/sdl.sh b/scripts/apple/sdl.sh new file mode 100755 index 0000000..08033aa --- /dev/null +++ b/scripts/apple/sdl.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# SET BUILD OPTIONS +ASM_OPTIONS="" +case ${ARCH} in +*-mac-catalyst) + ASM_OPTIONS="--disable-video-cocoa --disable-render-metal --disable-haptic --disable-diskaudio --disable-joystick" + ;; +esac + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# WORKAROUND TO FIX AUTOMATICALLY ENABLED LIBRARIES IN CONFIGURE +overwrite_file "${BASEDIR}/tools/patch/make/sdl/configure.in" "${BASEDIR}/src/${LIB_NAME}/configure.in" + +# ALWAYS REGENERATE BUILD FILES - NECESSARY TO APPLY THE WORKAROUNDS +./autogen.sh || return 1 + +# WORKAROUND TO EXCLUDE libunwind.h ON LTS BUILDS +if [[ -n ${FFMPEG_KIT_LTS_BUILD} ]]; then + export ac_cv_header_libunwind_h=no +fi + +# UPDATE CONFIG FILES TO SUPPORT APPLE ARCHITECTURES +overwrite_file "${FFMPEG_KIT_TMPDIR}"/source/config/config.guess "${BASEDIR}"/src/"${LIB_NAME}"/build-scripts/config.guess || return 1 +overwrite_file "${FFMPEG_KIT_TMPDIR}"/source/config/config.sub "${BASEDIR}"/src/"${LIB_NAME}"/build-scripts/config.sub || return 1 + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${SDK_PATH}" \ + --enable-static \ + --disable-shared \ + --disable-video-opengl \ + ${ASM_OPTIONS} \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/apple/shine.sh b/scripts/apple/shine.sh new file mode 100755 index 0000000..b2b176d --- /dev/null +++ b/scripts/apple/shine.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_shine} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${SDK_PATH}" \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/apple/snappy.sh b/scripts/apple/snappy.sh new file mode 100755 index 0000000..fb3f1d4 --- /dev/null +++ b/scripts/apple/snappy.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# UPDATE BUILD FLAGS +export CFLAGS="$(get_cflags "${LIB_NAME}") -I${SDK_PATH}/usr/include" +export LDFLAGS="$(get_ldflags ${LIB_NAME}) -L${SDK_PATH}/usr/lib" + +mkdir -p "${BUILD_DIR}" || return 1 +cd "${BUILD_DIR}" || return 1 + +cmake -Wno-dev \ + -DCMAKE_VERBOSE_MAKEFILE=0 \ + -DCMAKE_C_FLAGS="${CFLAGS}" \ + -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ + -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ + -DCMAKE_SYSROOT="${SDK_PATH}" \ + -DCMAKE_FIND_ROOT_PATH="${SDK_PATH}" \ + -DCMAKE_OSX_SYSROOT="$(get_sdk_name)" \ + -DCMAKE_OSX_ARCHITECTURES="$(get_cmake_osx_architectures)" \ + -DCMAKE_SYSTEM_NAME="${CMAKE_SYSTEM_NAME}" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="${LIB_INSTALL_PREFIX}" \ + -DCMAKE_CXX_COMPILER="$CXX" \ + -DCMAKE_C_COMPILER="$CC" \ + -DCMAKE_LINKER="$LD" \ + -DCMAKE_AR="$(xcrun --sdk $(get_sdk_name) -f ar)" \ + -DCMAKE_AS="$AS" \ + -DSNAPPY_BUILD_TESTS=0 \ + -DHAVE_LIBLZO2=0 \ + -DHAVE_LIBZ=1 \ + -DCMAKE_SYSTEM_PROCESSOR="$(get_target_cpu)" \ + -DBUILD_SHARED_LIBS=0 "${BASEDIR}"/src/"${LIB_NAME}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# CREATE PACKAGE CONFIG MANUALLY +create_snappy_package_config "1.1.8" || return 1 diff --git a/scripts/apple/soxr.sh b/scripts/apple/soxr.sh new file mode 100755 index 0000000..a10e24b --- /dev/null +++ b/scripts/apple/soxr.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +# SET BUILD OPTIONS +ASM_OPTIONS="" +case ${ARCH} in +arm64*) + ASM_OPTIONS="-DWITH_CR32S=0 -DWITH_CR64S=0" + ;; +esac + +mkdir -p "${BUILD_DIR}" || return 1 +cd "${BUILD_DIR}" || return 1 + +cmake -Wno-dev \ + -DCMAKE_VERBOSE_MAKEFILE=0 \ + -DCMAKE_C_FLAGS="${CFLAGS}" \ + -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ + -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ + -DCMAKE_SYSROOT="${SDK_PATH}" \ + -DCMAKE_FIND_ROOT_PATH="${SDK_PATH}" \ + -DCMAKE_OSX_SYSROOT="$(get_sdk_name)" \ + -DCMAKE_OSX_ARCHITECTURES="$(get_cmake_osx_architectures)" \ + -DCMAKE_SYSTEM_NAME="${CMAKE_SYSTEM_NAME}" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="${LIB_INSTALL_PREFIX}" \ + -DCMAKE_C_COMPILER="$CC" \ + -DCMAKE_LINKER="$LD" \ + -DCMAKE_AR="$(xcrun --sdk $(get_sdk_name) -f ar)" \ + -DCMAKE_AS="$AS" \ + -DBUILD_TESTS=0 \ + -DWITH_DEV_TRACE=0 \ + -DWITH_LSR_BINDINGS=0 \ + -DWITH_OPENMP=0 \ + ${ASM_OPTIONS} \ + -DCMAKE_SYSTEM_PROCESSOR="$(get_target_cpu)" \ + -DBUILD_SHARED_LIBS=0 "${BASEDIR}"/src/"${LIB_NAME}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# CREATE PACKAGE CONFIG MANUALLY +create_soxr_package_config "0.1.3" || return 1 diff --git a/scripts/apple/speex.sh b/scripts/apple/speex.sh new file mode 100755 index 0000000..b67c065 --- /dev/null +++ b/scripts/apple/speex.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# SET BUILD OPTIONS +ASM_OPTIONS="" +case ${ARCH} in +x86*) + ASM_OPTIONS="--enable-sse" + ;; +esac + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_soxr} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${SDK_PATH}" \ + --enable-static \ + ${ASM_OPTIONS} \ + --disable-shared \ + --disable-binaries \ + --disable-fast-install \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/apple/tesseract.sh b/scripts/apple/tesseract.sh new file mode 100755 index 0000000..caa75c9 --- /dev/null +++ b/scripts/apple/tesseract.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# UPDATE BUILD FLAGS +export LEPTONICA_CFLAGS="-I${LIB_INSTALL_BASE}/leptonica/include/leptonica" +export LEPTONICA_LIBS="-L${LIB_INSTALL_BASE}/leptonica/lib -llept" + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_tesseract} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${SDK_PATH}" \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --disable-debug \ + --disable-graphics \ + --disable-cube \ + --disable-tessdata-prefix \ + --disable-largefile \ + --host="${HOST}" || return 1 + +# WORKAROUND TO REMOVE -bind_at_load FLAG WHICH CAN NOT BE USED WHEN BITCODE IS ENABLED +${SED_INLINE} 's/$wl-bind_at_load//g' ${BASEDIR}/src/${LIB_NAME}/libtool + +# WORKAROUND TO DISABLE LINKING TO rt +${SED_INLINE} 's/-lrt//g' ${BASEDIR}/src/${LIB_NAME}/api/Makefile + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# CREATE PACKAGE CONFIG MANUALLY +create_tesseract_package_config "3.05.02" || return 1 diff --git a/scripts/apple/tiff.sh b/scripts/apple/tiff.sh new file mode 100755 index 0000000..46fe9ce --- /dev/null +++ b/scripts/apple/tiff.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_tiff} -eq 1 ]] || [[ $(is_gnu_config_files_up_to_date) == "0" ]]; then + + # UPDATE CONFIG FILES TO SUPPORT APPLE ARCHITECTURES + overwrite_file "${FFMPEG_KIT_TMPDIR}"/source/config/config.guess "${BASEDIR}"/src/"${LIB_NAME}"/config.guess || return 1 + overwrite_file "${FFMPEG_KIT_TMPDIR}"/source/config/config.sub "${BASEDIR}"/src/"${LIB_NAME}"/config.sub || return 1 + + autoreconf_library "${LIB_NAME}" +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${SDK_PATH}" \ + --with-jpeg-include-dir="${LIB_INSTALL_BASE}"/jpeg/include \ + --with-jpeg-lib-dir="${LIB_INSTALL_BASE}"/jpeg/lib \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --disable-maintainer-mode \ + --disable-cxx \ + --disable-win32-io \ + --disable-lzma \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/apple/twolame.sh b/scripts/apple/twolame.sh new file mode 100755 index 0000000..056f508 --- /dev/null +++ b/scripts/apple/twolame.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# UPDATE BUILD FLAGS +export SNDFILE_CFLAGS="$(pkg-config --cflags sndfile)" +export SNDFILE_LIBS="$(pkg-config --libs --static sndfile)" + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_twolame} -eq 1 ]]; then + NOCONFIGURE=1 ./autogen.sh || return 1 +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${SDK_PATH}" \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --host="${HOST}" || return 1 + +# WORKAROUND TO DISABLE BUILDING OF DOCBOOK - BUILD SCRIPTS DO NOT GENERATE A TARGET FOR IT +$SED_INLINE 's/dist_man_MANS = .*/dist_man_MANS =/g' "${BASEDIR}"/src/"${LIB_NAME}"/doc/Makefile || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/apple/vo-amrwbenc.sh b/scripts/apple/vo-amrwbenc.sh new file mode 100755 index 0000000..d95f6a4 --- /dev/null +++ b/scripts/apple/vo-amrwbenc.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# UPDATE BUILD FLAGS +case ${ARCH} in +x86-64 | x86-64-mac-catalyst) + export CXX="xcrun --sdk $(get_sdk_name) clang++ -arch x86_64" + ;; +*) + export CXX="xcrun --sdk $(get_sdk_name) clang++ -arch ${ARCH}" + ;; +esac + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_vo_amrwbenc} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${SDK_PATH}" \ + --enable-static \ + --disable-shared \ + --disable-fast-install \ + --disable-maintainer-mode \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/apple/wavpack.sh b/scripts/apple/wavpack.sh new file mode 100755 index 0000000..8130a15 --- /dev/null +++ b/scripts/apple/wavpack.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# SET BUILD OPTIONS +ASM_OPTIONS="" +case ${ARCH} in +armv7 | armv7s | arm64*) + ASM_OPTIONS="--disable-asm" + ;; +*) + ASM_OPTIONS="--enable-asm" + ;; +esac + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_wavpack} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --with-pic \ + --with-sysroot="${SDK_PATH}" \ + --without-iconv \ + ${ASM_OPTIONS} \ + --enable-static \ + --disable-shared \ + --disable-apps \ + --disable-fast-install \ + --disable-tests \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/apple/x264.sh b/scripts/apple/x264.sh new file mode 100755 index 0000000..fb66d06 --- /dev/null +++ b/scripts/apple/x264.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +# SET BUILD OPTIONS +ASM_OPTIONS="" +case ${ARCH} in +i386 | x86-64*) + ASM_OPTIONS="--disable-asm" + + if ! [ -x "$(command -v nasm)" ]; then + echo -e "\n(*) nasm command not found\n" + return 1 + fi + + export AS="$(command -v nasm)" + ;; +esac + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_x264} -eq 1 ]]; then + autoreconf_library "${LIB_NAME}" +fi + +# UPDATE CONFIG FILES TO SUPPORT APPLE ARCHITECTURES +overwrite_file "${FFMPEG_KIT_TMPDIR}"/source/config/config.guess "${BASEDIR}"/src/"${LIB_NAME}"/config.guess || return 1 +overwrite_file "${FFMPEG_KIT_TMPDIR}"/source/config/config.sub "${BASEDIR}"/src/"${LIB_NAME}"/config.sub || return 1 + +# WORKAROUND DISABLE INLINE -arch DEFINITIONS +# @TODO TEST THESE +# ${SED_INLINE} 's/CFLAGS=\"\$CFLAGS \-arch x86_64/CFLAGS=\"\$CFLAGS/g' configure +# ${SED_INLINE} 's/LDFLAGS=\"\$LDFLAGS \-arch x86_64/LDFLAGS=\"\$CFLAGS/g' configure + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + --enable-pic \ + --sysroot=${SDK_PATH} \ + --enable-static \ + --disable-cli \ + ${ASM_OPTIONS} \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp x264.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/apple/x265.sh b/scripts/apple/x265.sh new file mode 100755 index 0000000..d4d8812 --- /dev/null +++ b/scripts/apple/x265.sh @@ -0,0 +1,78 @@ +#!/bin/bash + +# SET BUILD OPTIONS +case ${ARCH} in +armv7 | armv7s) + ASM_OPTIONS="-DENABLE_ASSEMBLY=1 -DCROSS_COMPILE_ARM=1" + ;; +arm64*) + ASM_OPTIONS="-DENABLE_ASSEMBLY=0 -DCROSS_COMPILE_ARM=1" + ;; +x86-64-mac-catalyst) + ASM_OPTIONS="-DENABLE_ASSEMBLY=0 -DCROSS_COMPILE_ARM=0" + ;; +*) + ASM_OPTIONS="-DENABLE_ASSEMBLY=1 -DCROSS_COMPILE_ARM=0" + ;; +esac + +mkdir -p "${BUILD_DIR}" || return 1 +cd "${BUILD_DIR}" || return 1 + +# @TODO TEST THESE +# fix x86 and x86_64 assembly +${SED_INLINE} 's/win64/macho64 -DPREFIX/g' ${BASEDIR}/src/x265/source/cmake/CMakeASM_NASMInformation.cmake +${SED_INLINE} 's/win/macho/g' ${BASEDIR}/src/x265/source/cmake/CMakeASM_NASMInformation.cmake + +# fixing constant shift +${SED_INLINE} 's/lsr 16/lsr #16/g' ${BASEDIR}/src/x265/source/common/arm/blockcopy8.S + +# fixing leading underscores +${SED_INLINE} 's/function x265_/function _x265_/g' ${BASEDIR}/src/x265/source/common/arm/*.S +${SED_INLINE} 's/ x265_/ _x265_/g' ${BASEDIR}/src/x265/source/common/arm/pixel-util.S + +# fixing relocation errors +# ${SED_INLINE} 's/sad12_mask:/sad12_mask_bytes:/g' ${BASEDIR}/src/x265/source/common/arm/sad-a.S +# ${SED_INLINE} 's/g_lumaFilter:/g_lumaFilter_bytes:/g' ${BASEDIR}/src/x265/source/common/arm/ipfilter8.S +# ${SED_INLINE} 's/g_chromaFilter:/g_chromaFilter_bytes:/g' ${BASEDIR}/src/x265/source/common/arm/ipfilter8.S +# ${SED_INLINE} 's/\.text/.equ sad12_mask, .-sad12_mask_bytes\ +# \ +# .text/g' ${BASEDIR}/src/x265/source/common/arm/sad-a.S +# ${SED_INLINE} 's/\.text/.equ g_lumaFilter, .-g_lumaFilter_bytes\ +# .equ g_chromaFilter, .-g_chromaFilter_bytes\ +# \ +# .text/g' ${BASEDIR}/src/x265/source/common/arm/ipfilter8.S + +# WORKAROUND TO USE A CUSTOM BUILD FILE +overwrite_file "${BASEDIR}"/tools/patch/cmake/x265/CMakeLists.txt "${BASEDIR}"/src/"${LIB_NAME}"/source/CMakeLists.txt || return 1 + +cmake -Wno-dev \ + -DCMAKE_VERBOSE_MAKEFILE=0 \ + -DCMAKE_C_FLAGS="${CFLAGS}" \ + -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ + -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ + -DCMAKE_SYSROOT="${SDK_PATH}" \ + -DCMAKE_FIND_ROOT_PATH="${SDK_PATH}" \ + -DCMAKE_OSX_SYSROOT="$(get_sdk_name)" \ + -DCMAKE_OSX_ARCHITECTURES="$(get_cmake_osx_architectures)" \ + -DCMAKE_SYSTEM_NAME="${CMAKE_SYSTEM_NAME}" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="${LIB_INSTALL_PREFIX}" \ + -DCMAKE_C_COMPILER="$CC" \ + -DCMAKE_CXX_COMPILER="$CXX" \ + -DCMAKE_LINKER="$LD" \ + -DCMAKE_AR="$(xcrun --sdk $(get_sdk_name) -f ar)" \ + -DCMAKE_AS="$AS" \ + -DSTATIC_LINK_CRT=1 \ + -DENABLE_PIC=1 \ + -DENABLE_CLI=0 \ + ${ASM_OPTIONS} \ + -DCMAKE_SYSTEM_PROCESSOR="$(get_target_cpu)" \ + -DENABLE_SHARED=0 "${BASEDIR}"/src/"${LIB_NAME}"/source || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# MANUALLY COPY PKG-CONFIG FILES +cp x265.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1 diff --git a/scripts/apple/xvidcore.sh b/scripts/apple/xvidcore.sh new file mode 100755 index 0000000..2b89b44 --- /dev/null +++ b/scripts/apple/xvidcore.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +cd "${BASEDIR}"/src/"${LIB_NAME}"/"${LIB_NAME}"/build/generic || return 1 + +# SET BUILD OPTIONS +ASM_OPTIONS="" +case ${ARCH} in +i386 | x86-64*) + ASM_OPTIONS="--disable-assembly" + ;; +esac + +# ALWAYS CLEAN THE PREVIOUS BUILD +make distclean 2>/dev/null 1>/dev/null + +# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED +if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/"${LIB_NAME}"/build/generic/configure ]] || [[ ${RECONF_xvidcore} -eq 1 ]]; then + + # WORKAROUND TO FIX THE FOLLOWING ERROR + # ld: -flat_namespace and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together + ${SED_INLINE} 's/ -flat_namespace//g' configure.in + + # WORKAROUND TO FIX THE FOLLOWING ERROR + # ld: -read_only_relocs and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together + ${SED_INLINE} 's/-Wl,-read_only_relocs,suppress//g' configure.in + + ./bootstrap.sh +fi + +./configure \ + --prefix="${LIB_INSTALL_PREFIX}" \ + ${ASM_OPTIONS} \ + --host="${HOST}" || return 1 + +make -j$(get_cpu_count) || return 1 + +make install || return 1 + +# CREATE PACKAGE CONFIG MANUALLY +create_xvidcore_package_config "1.3.7" || return 1 + +# WORKAROUND TO REMOVE DYNAMIC LIBS +rm -f "${LIB_INSTALL_PREFIX}"/lib/libxvidcore.dylib* diff --git a/scripts/function-android.sh b/scripts/function-android.sh index 11e43fe..1370c41 100755 --- a/scripts/function-android.sh +++ b/scripts/function-android.sh @@ -23,15 +23,15 @@ get_ffmpeg_kit_version() { display_help() { local COMMAND=$(echo "$0" | sed -e 's/\.\///g') - echo -e "\n'$COMMAND' builds FFmpegKit for Android platform. By default five Android ABIs (armeabi-v7a, \ + echo -e "\n'$COMMAND' builds FFmpegKit for Android platform. By default five Android architectures (armeabi-v7a, \ armeabi-v7a-neon, arm64-v8a, x86 and x86_64) are built without any external libraries enabled. Options can be used to \ -disable ABIs and/or enable external libraries. Please note that GPL libraries (external libraries with GPL license) \ -need --enable-gpl flag to be set explicitly. When compilation ends an Android Archive (AAR) file is created under the \ -prebuilt folder.\n" +disable architectures and/or enable external libraries. Please note that GPL libraries (external libraries with GPL \ +license) need --enable-gpl flag to be set explicitly. When compilation ends an Android Archive (AAR) file is created \ +under the prebuilt folder.\n" echo -e "Usage: ./$COMMAND [OPTION]... [VAR=VALUE]...\n" echo -e "Specify environment variables as VARIABLE=VALUE to override default build options.\n" - display_help_options " --api-level=api\t\tset Android api level [${API}]" + display_help_options " -l, --lts\t\t\tbuild lts packages to support API 16+ devices" " --api-level=api\t\toverride Android api level [${API}]" display_help_licensing echo -e "Architectures:" @@ -92,7 +92,7 @@ APP_LDFLAGS := -Wl,--hash-style=both EOF } -get_clang_target_host() { +get_clang_host() { case ${ARCH} in arm-v7a | arm-v7a-neon) echo "armv7a-linux-androideabi${API}" @@ -127,7 +127,7 @@ get_toolchain() { echo "${HOST_OS}-${HOST_ARCH}" } -get_cmake_target_processor() { +get_cmake_system_processor() { case ${ARCH} in arm-v7a | arm-v7a-neon) echo "arm" @@ -144,7 +144,7 @@ get_cmake_target_processor() { esac } -get_target_build() { +get_target_cpu() { case ${ARCH} in arm-v7a) echo "arm" @@ -207,7 +207,7 @@ get_common_cflags() { local LTS_BUILD__FLAG="-DFFMPEG_KIT_LTS " fi - echo "-fno-integrated-as -fstrict-aliasing -fPIC -DANDROID ${LTS_BUILD__FLAG}-D__ANDROID__ -D__ANDROID_API__=${API}" + echo "-fno-integrated-as -fstrict-aliasing -DANDROID_NDK -fPIC -DANDROID ${LTS_BUILD__FLAG}-D__ANDROID__ -D__ANDROID_API__=${API}" } get_arch_specific_cflags() { @@ -288,6 +288,9 @@ get_app_specific_cflags() { kvazaar) APP_FLAGS="-std=gnu99 -Wno-unused-function" ;; + openh264) + APP_FLAGS="-std=gnu99 -Wno-unused-function -fstack-protector-all" + ;; rubberband) APP_FLAGS="-std=c99 -Wno-unused-function" ;; @@ -359,7 +362,7 @@ get_cxxflags() { } get_common_linked_libraries() { - 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" + local COMMON_LIBRARY_PATHS="-L${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/${HOST}/lib -L${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot/usr/lib/${HOST}/${API} -L${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/lib" case $1 in ffmpeg) @@ -448,7 +451,7 @@ create_chromaprint_package_config() { local CHROMAPRINT_VERSION="$1" cat >"${INSTALL_PKG_CONFIG_DIR}/libchromaprint.pc" <"${INSTALL_PKG_CONFIG_DIR}/fontconfig.pc" <"${INSTALL_PKG_CONFIG_DIR}/freetype2.pc" <"${INSTALL_PKG_CONFIG_DIR}/giflib.pc" <"${INSTALL_PKG_CONFIG_DIR}/gmp.pc" <"${INSTALL_PKG_CONFIG_DIR}/gnutls.pc" <"${INSTALL_PKG_CONFIG_DIR}/aom.pc" <"${INSTALL_PKG_CONFIG_DIR}/libiconv.pc" <"${INSTALL_PKG_CONFIG_DIR}/libmp3lame.pc" <"${INSTALL_PKG_CONFIG_DIR}/vorbis.pc" <"${INSTALL_PKG_CONFIG_DIR}/vorbisenc.pc" <"${INSTALL_PKG_CONFIG_DIR}/vorbisfile.pc" <"${INSTALL_PKG_CONFIG_DIR}/libxml-2.0.pc" <"${INSTALL_PKG_CONFIG_DIR}/snappy.pc" <"${INSTALL_PKG_CONFIG_DIR}/soxr.pc" <"${INSTALL_PKG_CONFIG_DIR}/tesseract.pc" <"${INSTALL_PKG_CONFIG_DIR}/uuid.pc" <"${INSTALL_PKG_CONFIG_DIR}/x265.pc" <"${INSTALL_PKG_CONFIG_DIR}/xvidcore.pc" <"${INSTALL_PKG_CONFIG_DIR}/zlib.pc" <"${INSTALL_PKG_CONFIG_DIR}/cpu-features.pc" <>"${BASEDIR}"/build.log 2>&1 fi if [ ! -f "${ZLIB_PACKAGE_CONFIG_PATH}" ]; then - create_zlib_system_package_config + create_zlib_system_package_config 1>>"${BASEDIR}"/build.log 2>&1 fi prepare_inline_sed @@ -940,11 +978,11 @@ build_android_lts_support() { set_toolchain_paths ${LIB_NAME} # PREPARE FLAGS - BUILD_HOST=$(get_build_host) - CFLAGS=$(get_cflags ${LIB_NAME}) + HOST=$(get_host) + CFLAGS=$(get_cflags "${LIB_NAME}") LDFLAGS=$(get_ldflags ${LIB_NAME}) # BUILD - "$(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 - "${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 + "$(get_clang_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 + "${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 } diff --git a/scripts/function-apple.sh b/scripts/function-apple.sh new file mode 100644 index 0000000..16b2833 --- /dev/null +++ b/scripts/function-apple.sh @@ -0,0 +1,1563 @@ +#!/bin/bash + +source "${BASEDIR}/scripts/function.sh" + +export FFMPEG_LIBS=("libavcodec" "libavdevice" "libavfilter" "libavformat" "libavutil" "libswresample" "libswscale") + +get_ffmpeg_kit_version() { + local FFMPEG_KIT_VERSION=$(grep 'const FFMPEG_KIT_VERSION' "${BASEDIR}"/apple/src/FFmpegKit.m | grep -Eo '\".*\"' | sed -e 's/\"//g') + + if [[ -z ${FFMPEG_KIT_LTS_BUILD} ]]; then + echo "${FFMPEG_KIT_VERSION}" + else + echo "${FFMPEG_KIT_VERSION}.LTS" + fi +} + +# 1 - library index +# 2 - output path +copy_external_library_license() { + output_path_array=("$2") + for output_path in "${output_path_array[@]}"; do + $(cp $(get_external_library_license_path "$1") "${output_path}/LICENSE" 1>>"${BASEDIR}"/build.log 2>&1) + if [[ $? -ne 0 ]]; then + echo 1 + return + fi + done + echo 0 +} + +get_external_library_version() { + local library_version=$(grep Version "${BASEDIR}"/prebuilt/"$(get_build_directory)"/pkgconfig/"$1".pc 2>>"${BASEDIR}"/build.log | sed 's/Version://g;s/\ //g') + + echo "${library_version}" +} + +# +# 1. architecture index +# 2. detected sdk version +# +disable_ios_architecture_not_supported_on_detected_sdk_version() { + local ARCH_NAME=$(get_arch_name $1) + + case ${ARCH_NAME} in + armv7 | armv7s | i386) + + # SUPPORTED UNTIL IOS SDK 10 + if [[ $2 == 11* ]] || [[ $2 == 12* ]] || [[ $2 == 13* ]] || [[ $2 == 14* ]]; then + local SUPPORTED=0 + else + local SUPPORTED=1 + fi + ;; + arm64e) + + # INTRODUCED IN IOS SDK 10 + if [[ $2 == 10* ]] || [[ $2 == 11* ]] || [[ $2 == 12* ]] || [[ $2 == 13* ]] || [[ $2 == 14* ]]; then + local SUPPORTED=1 + else + local SUPPORTED=0 + fi + ;; + x86-64-mac-catalyst) + + # INTRODUCED IN IOS SDK 13 + if [[ $2 == 13* ]] || [[ $2 == 14* ]]; then + local SUPPORTED=1 + else + local SUPPORTED=0 + fi + ;; + arm64-*) + + # INTRODUCED IN IOS SDK 14 + if [[ $2 == 14* ]]; then + local SUPPORTED=1 + else + local SUPPORTED=0 + fi + ;; + *) + local SUPPORTED=1 + ;; + esac + + if [[ ${SUPPORTED} -ne 1 ]]; then + if [[ -z ${BUILD_FORCE} ]]; then + echo -e "INFO: Disabled ${ARCH_NAME} architecture which is not supported on SDK $2\n" 1>>"${BASEDIR}"/build.log 2>&1 + disable_arch "${ARCH_NAME}" + fi + fi +} + +# +# 1. architecture index +# 2. detected sdk version +# +disable_macos_architecture_not_supported_on_detected_sdk_version() { + local ARCH_NAME=$(get_arch_name $1) + + case ${ARCH_NAME} in + arm64) + + # INTRODUCED IN MACOS SDK 11 + if [[ $2 == 11* ]]; then + local SUPPORTED=1 + else + local SUPPORTED=0 + fi + ;; + *) + local SUPPORTED=1 + ;; + esac + + if [[ ${SUPPORTED} -ne 1 ]]; then + if [[ -z ${BUILD_FORCE} ]]; then + echo -e "INFO: Disabled ${ARCH_NAME} architecture which is not supported on SDK $2\n" 1>>"${BASEDIR}"/build.log 2>&1 + disable_arch "${ARCH_NAME}" + fi + fi +} + +build_apple_architecture_variant_strings() { + export ALL_IOS_ARCHITECTURES="$(get_apple_architectures_for_variant 1)" + export IPHONEOS_ARCHITECTURES="$(get_apple_architectures_for_variant 2)" + export IPHONE_SIMULATOR_ARCHITECTURES="$(get_apple_architectures_for_variant 3)" + export MAC_CATALYST_ARCHITECTURES="$(get_apple_architectures_for_variant 4)" + export ALL_TVOS_ARCHITECTURES="$(get_apple_architectures_for_variant 5)" + export APPLETVOS_ARCHITECTURES="$(get_apple_architectures_for_variant 6)" + export APPLETV_SIMULATOR_ARCHITECTURES="$(get_apple_architectures_for_variant 7)" + export MACOSX_ARCHITECTURES="$(get_apple_architectures_for_variant 8)" +} + +# +# 1. architecture variant +# +# DEPENDS TARGET_ARCH_LIST VARIABLE +# +is_apple_architecture_variant_supported() { + local ARCHITECTURE_VARIANT="$1" + local TARGET_ARCHITECTURES=("$(get_apple_architectures_for_variant "${ARCHITECTURE_VARIANT}")") + local SUPPORTED="0" + + for ARCH in "${TARGET_ARCH_LIST[@]}"; do + if [[ " ${TARGET_ARCHITECTURES[*]} " == *" ${ARCH} "* ]]; then + SUPPORTED="1" + fi + done + + echo "${SUPPORTED}" +} + +# +# 1. folder path +# +initialize_folder() { + rm -rf "$1" 1>>"${BASEDIR}"/build.log 2>&1 + if [[ $? -ne 0 ]]; then + return 1 + fi + + mkdir -p "$1" 1>>"${BASEDIR}"/build.log 2>&1 + if [[ $? -ne 0 ]]; then + return 1 + fi + + return 0 +} + +# +# 1. library index +# 2. static library name +# 3. universal library directory +# 4. target architectures array +# +# DEPENDS TARGET_ARCH_LIST VARIABLE +# +create_single_universal_library() { + local LIBRARY_INDEX="$1" + local STATIC_LIBRARY_NAME="$2" + local UNIVERSAL_DIRECTORY_PATH="$3" + local TARGET_ARCHITECTURES=("$4") + local LIBRARY_NAME=$(get_library_name "${LIBRARY_INDEX}") + local LIPO="$(xcrun --sdk "$(get_default_sdk_name)" -f lipo)" + + local LIPO_COMMAND="${LIPO} -create" + + for ARCH in "${TARGET_ARCH_LIST[@]}"; do + if [[ " ${TARGET_ARCHITECTURES[*]} " == *" ${ARCH} "* ]]; then + local FULL_LIBRARY_PATH="${BASEDIR}/prebuilt/$(get_build_directory)/${LIBRARY_NAME}/lib/${STATIC_LIBRARY_NAME}" + LIPO_COMMAND+=" ${FULL_LIBRARY_PATH}" + fi + done + + LIPO_COMMAND+=" -output ${UNIVERSAL_DIRECTORY_PATH}/lib/${STATIC_LIBRARY_NAME}" + + mkdir -p "${UNIVERSAL_DIRECTORY_PATH}/lib" 1>>"${BASEDIR}"/build.log 2>&1 + + ${LIPO_COMMAND} 1>>"${BASEDIR}"/build.log 2>&1 + + if [[ $? -ne 0 ]]; then + echo -e "\nINFO: Failed to build universal ${LIBRARY_NAME} library\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "failed\n\nSee build.log for details\n" + exit 1 + fi + + RC=$(copy_external_library_license "$LIBRARY_INDEX" "${UNIVERSAL_DIRECTORY_PATH}") + + if [[ ${RC} -ne 0 ]]; then + echo -e "\nINFO: Failed to build universal ${LIBRARY_NAME} library\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "failed\n\nSee build.log for details\n" + exit 1 + fi +} + +# +# 1. library index +# 2. architecture variant +# +# DEPENDS TARGET_ARCH_LIST VARIABLE +# +create_universal_library() { + local LIBRARY_INDEX="$1" + local ARCHITECTURE_VARIANT="$2" + local TARGET_ARCHITECTURES=("$(get_apple_architectures_for_variant "${ARCHITECTURE_VARIANT}")") + local LIBRARY_NAME=$(get_library_name "${LIBRARY_INDEX}") + local UNIVERSAL_LIBRARY_PATH="${BASEDIR}/prebuilt/$(get_universal_library_directory "${ARCHITECTURE_VARIANT}")" + + if [[ $(is_apple_architecture_variant_supported "${ARCHITECTURE_VARIANT}") -eq 0 ]]; then + + # THERE ARE NO ARCHITECTURES ENABLED FOR THIS LIBRARY TYPE + return + fi + + initialize_folder "${UNIVERSAL_LIBRARY_PATH}/${LIBRARY_NAME}" + + if [[ ${LIBRARY_LIBTHEORA} == "${LIBRARY_INDEX}" ]]; then + + create_single_universal_library "${LIBRARY_INDEX}" "libtheora.a" "${UNIVERSAL_LIBRARY_PATH}/${LIBRARY_NAME}" "${TARGET_ARCHITECTURES[@]}" + create_single_universal_library "${LIBRARY_INDEX}" "libtheoraenc.a" "${UNIVERSAL_LIBRARY_PATH}/${LIBRARY_NAME}" "${TARGET_ARCHITECTURES[@]}" + create_single_universal_library "${LIBRARY_INDEX}" "libtheoradec.a" "${UNIVERSAL_LIBRARY_PATH}/${LIBRARY_NAME}" "${TARGET_ARCHITECTURES[@]}" + + elif [[ ${LIBRARY_LIBVORBIS} == "${LIBRARY_INDEX}" ]]; then + + create_single_universal_library "${LIBRARY_INDEX}" "libvorbisfile.a" "${UNIVERSAL_LIBRARY_PATH}/${LIBRARY_NAME}" "${TARGET_ARCHITECTURES[@]}" + create_single_universal_library "${LIBRARY_INDEX}" "libvorbisenc.a" "${UNIVERSAL_LIBRARY_PATH}/${LIBRARY_NAME}" "${TARGET_ARCHITECTURES[@]}" + create_single_universal_library "${LIBRARY_INDEX}" "libvorbis.a" "${UNIVERSAL_LIBRARY_PATH}/${LIBRARY_NAME}" "${TARGET_ARCHITECTURES[@]}" + + elif [[ ${LIBRARY_LIBWEBP} == "${LIBRARY_INDEX}" ]]; then + + create_single_universal_library "${LIBRARY_INDEX}" "libwebpmux.a" "${UNIVERSAL_LIBRARY_PATH}/${LIBRARY_NAME}" "${TARGET_ARCHITECTURES[@]}" + create_single_universal_library "${LIBRARY_INDEX}" "libwebpdemux.a" "${UNIVERSAL_LIBRARY_PATH}/${LIBRARY_NAME}" "${TARGET_ARCHITECTURES[@]}" + create_single_universal_library "${LIBRARY_INDEX}" "libwebp.a" "${UNIVERSAL_LIBRARY_PATH}/${LIBRARY_NAME}" "${TARGET_ARCHITECTURES[@]}" + + elif [[ ${LIBRARY_OPENCOREAMR} == "${LIBRARY_INDEX}" ]]; then + + create_single_universal_library "${LIBRARY_INDEX}" "libopencore-amrnb.a" "${UNIVERSAL_LIBRARY_PATH}/${LIBRARY_NAME}" "${TARGET_ARCHITECTURES[@]}" + + elif [[ ${LIBRARY_NETTLE} == "${LIBRARY_INDEX}" ]]; then + + create_single_universal_library "${LIBRARY_INDEX}" "libnettle.a" "${UNIVERSAL_LIBRARY_PATH}/${LIBRARY_NAME}" "${TARGET_ARCHITECTURES[@]}" + create_single_universal_library "${LIBRARY_INDEX}" "libhogweed.a" "${UNIVERSAL_LIBRARY_PATH}/${LIBRARY_NAME}" "${TARGET_ARCHITECTURES[@]}" + + else + + create_single_universal_library "${LIBRARY_INDEX}" "$(get_static_archive_name "${LIBRARY_INDEX}").a" "${UNIVERSAL_LIBRARY_PATH}/${LIBRARY_NAME}" "${TARGET_ARCHITECTURES[@]}" + + fi + + echo -e "DEBUG: ${LIBRARY_NAME} universal library built for $(get_apple_architecture_variant "${ARCHITECTURE_VARIANT}") platform successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 +} + +# +# 1. architecture variant +# +# DEPENDS TARGET_ARCH_LIST VARIABLE +# +create_ffmpeg_universal_library() { + local ARCHITECTURE_VARIANT="$1" + local TARGET_ARCHITECTURES=("$(get_apple_architectures_for_variant "${ARCHITECTURE_VARIANT}")") + local LIBRARY_NAME="ffmpeg" + local UNIVERSAL_LIBRARY_PATH="${BASEDIR}/prebuilt/$(get_universal_library_directory "${ARCHITECTURE_VARIANT}")" + local FFMPEG_UNIVERSAL_LIBRARY_PATH="${UNIVERSAL_LIBRARY_PATH}/${LIBRARY_NAME}" + local LIPO="$(xcrun --sdk "$(get_default_sdk_name)" -f lipo)" + + if [[ $(is_apple_architecture_variant_supported "${ARCHITECTURE_VARIANT}") -eq 0 ]]; then + + # THERE ARE NO ARCHITECTURES ENABLED FOR THIS LIBRARY TYPE + return + fi + + # INITIALIZE UNIVERSAL LIBRARY DIRECTORY + initialize_folder "${FFMPEG_UNIVERSAL_LIBRARY_PATH}" + initialize_folder "${FFMPEG_UNIVERSAL_LIBRARY_PATH}/include" + initialize_folder "${FFMPEG_UNIVERSAL_LIBRARY_PATH}/lib" + + local FFMPEG_DEFAULT_BUILD_PATH="${BASEDIR}/prebuilt/$(get_default_build_directory)/ffmpeg" + + # COPY HEADER FILES + cp -r "${FFMPEG_DEFAULT_BUILD_PATH}"/include/* "${FFMPEG_UNIVERSAL_LIBRARY_PATH}"/include 1>>"${BASEDIR}"/build.log 2>&1 + cp "${FFMPEG_DEFAULT_BUILD_PATH}"/include/config.h "${FFMPEG_UNIVERSAL_LIBRARY_PATH}"/include 1>>"${BASEDIR}"/build.log 2>&1 + + for FFMPEG_LIB in "${FFMPEG_LIBS[@]}"; do + LIPO_COMMAND="${LIPO} -create" + + for ARCH in "${TARGET_ARCH_LIST[@]}"; do + if [[ " ${TARGET_ARCHITECTURES[*]} " == *" ${ARCH} "* ]]; then + local FULL_LIBRARY_PATH="${BASEDIR}/prebuilt/$(get_build_directory)/${LIBRARY_NAME}/lib/${FFMPEG_LIB}.a" + LIPO_COMMAND+=" ${FULL_LIBRARY_PATH}" + fi + done + + LIPO_COMMAND+=" -output ${FFMPEG_UNIVERSAL_LIBRARY_PATH}/lib/${FFMPEG_LIB}.a" + + ${LIPO_COMMAND} 1>>"${BASEDIR}"/build.log 2>&1 + + if [[ $? -ne 0 ]]; then + echo -e "\nINFO: Failed to build universal ${LIBRARY_NAME} library\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "failed\n\nSee build.log for details\n" + exit 1 + fi + done + + # COPY UNIVERSAL LIBRARY LICENSES + if [[ ${GPL_ENABLED} == "yes" ]]; then + cp "${BASEDIR}"/LICENSE.GPLv3 "${FFMPEG_UNIVERSAL_LIBRARY_PATH}"/LICENSE 1>>"${BASEDIR}"/build.log 2>&1 + else + cp "${BASEDIR}"/LICENSE.LGPLv3 "${FFMPEG_UNIVERSAL_LIBRARY_PATH}"/LICENSE 1>>"${BASEDIR}"/build.log 2>&1 + fi + + echo -e "DEBUG: ${LIBRARY_NAME} universal library built for $(get_apple_architecture_variant "${ARCHITECTURE_VARIANT}") platform successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 +} + +# +# 1. architecture variant +# +# DEPENDS TARGET_ARCH_LIST VARIABLE +# +create_ffmpeg_kit_universal_library() { + local ARCHITECTURE_VARIANT="$1" + local TARGET_ARCHITECTURES=("$(get_apple_architectures_for_variant "${ARCHITECTURE_VARIANT}")") + local LIBRARY_NAME="ffmpeg-kit" + local UNIVERSAL_LIBRARY_PATH="${BASEDIR}/prebuilt/$(get_universal_library_directory "${ARCHITECTURE_VARIANT}")" + local FFMPEG_KIT_UNIVERSAL_LIBRARY_PATH="${UNIVERSAL_LIBRARY_PATH}/${LIBRARY_NAME}" + local LIPO="$(xcrun --sdk "$(get_default_sdk_name)" -f lipo)" + + if [[ $(is_apple_architecture_variant_supported "${ARCHITECTURE_VARIANT}") -eq 0 ]]; then + + # THERE ARE NO ARCHITECTURES ENABLED FOR THIS LIBRARY TYPE + return + fi + + # INITIALIZE UNIVERSAL LIBRARY DIRECTORY + initialize_folder "${FFMPEG_KIT_UNIVERSAL_LIBRARY_PATH}" + initialize_folder "${FFMPEG_KIT_UNIVERSAL_LIBRARY_PATH}/include" + initialize_folder "${FFMPEG_KIT_UNIVERSAL_LIBRARY_PATH}/lib" + + local FFMPEG_KIT_DEFAULT_BUILD_PATH="${BASEDIR}/prebuilt/$(get_default_build_directory)/ffmpeg-kit" + + # COPY HEADER FILES + cp -r "${FFMPEG_KIT_DEFAULT_BUILD_PATH}"/include/* "${FFMPEG_KIT_UNIVERSAL_LIBRARY_PATH}"/include 1>>"${BASEDIR}"/build.log 2>&1 + + LIPO_COMMAND="${LIPO} -create" + + for ARCH in "${TARGET_ARCH_LIST[@]}"; do + if [[ " ${TARGET_ARCHITECTURES[*]} " == *" ${ARCH} "* ]]; then + local FULL_LIBRARY_PATH="${BASEDIR}/prebuilt/$(get_build_directory)/${LIBRARY_NAME}/lib/libffmpegkit.a" + LIPO_COMMAND+=" ${FULL_LIBRARY_PATH}" + fi + done + + LIPO_COMMAND+=" -output ${FFMPEG_KIT_UNIVERSAL_LIBRARY_PATH}/lib/libffmpegkit.a" + + ${LIPO_COMMAND} 1>>"${BASEDIR}"/build.log 2>&1 + + if [[ $? -ne 0 ]]; then + echo -e "\nINFO: Failed to build universal ${LIBRARY_NAME} library\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "failed\n\nSee build.log for details\n" + exit 1 + fi + + # COPY UNIVERSAL LIBRARY LICENSES + if [[ ${GPL_ENABLED} == "yes" ]]; then + cp "${BASEDIR}"/LICENSE.GPLv3 "${FFMPEG_KIT_UNIVERSAL_LIBRARY_PATH}"/LICENSE 1>>"${BASEDIR}"/build.log 2>&1 + else + cp "${BASEDIR}"/LICENSE.LGPLv3 "${FFMPEG_KIT_UNIVERSAL_LIBRARY_PATH}"/LICENSE 1>>"${BASEDIR}"/build.log 2>&1 + fi + + echo -e "DEBUG: ${LIBRARY_NAME} universal library built for $(get_apple_architecture_variant "${ARCHITECTURE_VARIANT}") platform successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 +} + +# +# 1. library index +# 2. library version +# 3. static library name +# 4. architecture variant +# +create_single_framework() { + local LIBRARY_INDEX="$1" + local LIBRARY_VERSION="$2" + local STATIC_LIBRARY_NAME="$3" + local ARCHITECTURE_VARIANT="$4" + local LIBRARY_NAME=$(get_library_name "${LIBRARY_INDEX}") + local FRAMEWORK_NAME="$3" + local FRAMEWORK_PATH=${BASEDIR}/prebuilt/$(get_framework_directory "${ARCHITECTURE_VARIANT}")/${FRAMEWORK_NAME}.framework + + initialize_folder "${FRAMEWORK_PATH}" + + local CAPITAL_CASE_LIBRARY_NAME=$(to_capital_case "${LIBRARY_NAME}") + + build_info_plist "${FRAMEWORK_PATH}/Info.plist" "${LIBRARY_NAME}" "com.arthenica.ffmpegkit.${CAPITAL_CASE_LIBRARY_NAME}" "${LIBRARY_VERSION}" "${LIBRARY_VERSION}" + + cp "${BASEDIR}/prebuilt/$(get_universal_library_directory "${ARCHITECTURE_VARIANT}")/${LIBRARY_NAME}/lib/${STATIC_LIBRARY_NAME}.a" "${FRAMEWORK_PATH}/${FRAMEWORK_NAME}" 1>>"${BASEDIR}/build.log" 2>&1 + + if [[ $? -ne 0 ]]; then + echo -e "\nINFO: Failed to build ${LIBRARY_NAME} framework\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "failed\n\nSee build.log for details\n" + exit 1 + fi + + RC=$(copy_external_library_license "$LIBRARY_INDEX" "${FRAMEWORK_PATH}") + + if [[ ${RC} -ne 0 ]]; then + echo -e "\nINFO: Failed to build ${LIBRARY_NAME} framework\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "failed\n\nSee build.log for details\n" + exit 1 + fi +} + +# +# 1. library index +# 2. architecture variant +# +create_framework() { + local LIBRARY_INDEX="$1" + local ARCHITECTURE_VARIANT="$2" + local LIBRARY_NAME=$(get_library_name "${LIBRARY_INDEX}") + local PACKAGE_CONFIG_FILE_NAME=$(get_package_config_file_name "${LIBRARY_INDEX}") + + # EACH ENABLED LIBRARY HAS TO HAVE A .pc FILE AND A VERSION + local LIBRARY_VERSION=$(get_external_library_version "${PACKAGE_CONFIG_FILE_NAME}") + if [[ -z ${LIBRARY_VERSION} ]]; then + echo -e "Failed to detect the version off ${LIBRARY_NAME} from ${PACKAGE_CONFIG_FILE_NAME}.pc\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "failed\n\nSee build.log for details\n" + exit 1 + fi + + if [[ ${LIBRARY_LIBTHEORA} == "${LIBRARY_INDEX}" ]]; then + + create_single_framework "${LIBRARY_INDEX}" "${LIBRARY_VERSION}" "libtheora" "${ARCHITECTURE_VARIANT}" + create_single_framework "${LIBRARY_INDEX}" "${LIBRARY_VERSION}" "libtheoraenc" "${ARCHITECTURE_VARIANT}" + create_single_framework "${LIBRARY_INDEX}" "${LIBRARY_VERSION}" "libtheoradec" "${ARCHITECTURE_VARIANT}" + + elif [[ ${LIBRARY_LIBVORBIS} == "${LIBRARY_INDEX}" ]]; then + + create_single_framework "${LIBRARY_INDEX}" "${LIBRARY_VERSION}" "libvorbisfile" "${ARCHITECTURE_VARIANT}" + create_single_framework "${LIBRARY_INDEX}" "${LIBRARY_VERSION}" "libvorbisenc" "${ARCHITECTURE_VARIANT}" + create_single_framework "${LIBRARY_INDEX}" "${LIBRARY_VERSION}" "libvorbis" "${ARCHITECTURE_VARIANT}" + + elif [[ ${LIBRARY_LIBWEBP} == "${LIBRARY_INDEX}" ]]; then + + create_single_framework "${LIBRARY_INDEX}" "${LIBRARY_VERSION}" "libwebpmux" "${ARCHITECTURE_VARIANT}" + create_single_framework "${LIBRARY_INDEX}" "${LIBRARY_VERSION}" "libwebpdemux" "${ARCHITECTURE_VARIANT}" + create_single_framework "${LIBRARY_INDEX}" "${LIBRARY_VERSION}" "libwebp" "${ARCHITECTURE_VARIANT}" + + elif [[ ${LIBRARY_OPENCOREAMR} == "${LIBRARY_INDEX}" ]]; then + + create_single_framework "${LIBRARY_INDEX}" "${LIBRARY_VERSION}" "libopencore-amrnb" "${ARCHITECTURE_VARIANT}" + + elif [[ ${LIBRARY_NETTLE} == "${LIBRARY_INDEX}" ]]; then + + create_single_framework "${LIBRARY_INDEX}" "${LIBRARY_VERSION}" "libnettle" "${ARCHITECTURE_VARIANT}" + create_single_framework "${LIBRARY_INDEX}" "${LIBRARY_VERSION}" "libhogweed" "${ARCHITECTURE_VARIANT}" + + else + + create_single_framework "${LIBRARY_INDEX}" "${LIBRARY_VERSION}" "$(get_static_archive_name "${LIBRARY_INDEX}")" "${ARCHITECTURE_VARIANT}" + + fi + + echo -e "DEBUG: ${LIBRARY_NAME} framework built for $(get_apple_architecture_variant "${ARCHITECTURE_VARIANT}") platform successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 +} + +# +# 1. architecture variant +# +create_ffmpeg_framework() { + local ARCHITECTURE_VARIANT="$1" + local LIBRARY_NAME="ffmpeg" + local UNIVERSAL_LIBRARY_PATH="${BASEDIR}/prebuilt/$(get_universal_library_directory "${ARCHITECTURE_VARIANT}")" + local FFMPEG_UNIVERSAL_LIBRARY_PATH="${UNIVERSAL_LIBRARY_PATH}/${LIBRARY_NAME}" + + if [[ $(is_apple_architecture_variant_supported "${ARCHITECTURE_VARIANT}") -eq 0 ]]; then + + # THERE ARE NO ARCHITECTURES ENABLED FOR THIS LIBRARY TYPE + return + fi + + for FFMPEG_LIB in "${FFMPEG_LIBS[@]}"; do + local FFMPEG_LIB_UPPERCASE=$(echo "${FFMPEG_LIB}" | tr '[a-z]' '[A-Z]') + local CAPITAL_CASE_FFMPEG_LIB_NAME=$(to_capital_case "${FFMPEG_LIB}") + + # EXTRACT FFMPEG VERSION + local FFMPEG_LIB_MAJOR=$(grep "#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MAJOR" "${FFMPEG_UNIVERSAL_LIBRARY_PATH}/include/${FFMPEG_LIB}/version.h" | sed -e "s/#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MAJOR//g;s/\ //g") + local FFMPEG_LIB_MINOR=$(grep "#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MINOR" "${FFMPEG_UNIVERSAL_LIBRARY_PATH}/include/${FFMPEG_LIB}/version.h" | sed -e "s/#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MINOR//g;s/\ //g") + local FFMPEG_LIB_MICRO=$(grep "#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MICRO" "${FFMPEG_UNIVERSAL_LIBRARY_PATH}/include/${FFMPEG_LIB}/version.h" | sed "s/#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MICRO//g;s/\ //g") + local FFMPEG_LIB_VERSION="${FFMPEG_LIB_MAJOR}.${FFMPEG_LIB_MINOR}.${FFMPEG_LIB_MICRO}" + + # INITIALIZE FRAMEWORK DIRECTORY + local FFMPEG_LIB_FRAMEWORK_PATH="${BASEDIR}/prebuilt/$(get_framework_directory "${ARCHITECTURE_VARIANT}")/${FFMPEG_LIB}.framework" + initialize_folder "${FFMPEG_LIB_FRAMEWORK_PATH}" + initialize_folder "${FFMPEG_LIB_FRAMEWORK_PATH}/Headers" + + # COPY HEADER FILES + cp -r "${FFMPEG_UNIVERSAL_LIBRARY_PATH}/include/${FFMPEG_LIB}"/* "${FFMPEG_LIB_FRAMEWORK_PATH}"/Headers 1>>"${BASEDIR}"/build.log 2>&1 + + # COPY LIBRARY FILE + cp "${FFMPEG_UNIVERSAL_LIBRARY_PATH}/lib/${FFMPEG_LIB}.a" "${FFMPEG_LIB_FRAMEWORK_PATH}/${FFMPEG_LIB}" 1>>"${BASEDIR}"/build.log 2>&1 + + # COPY FRAMEWORK LICENSES + if [[ "${GPL_ENABLED}" == "yes" ]]; then + cp "${BASEDIR}/LICENSE.GPLv3" "${FFMPEG_LIB_FRAMEWORK_PATH}/LICENSE" 1>>"${BASEDIR}"/build.log 2>&1 + else + cp "${BASEDIR}/LICENSE.LGPLv3" "${FFMPEG_LIB_FRAMEWORK_PATH}/LICENSE" 1>>"${BASEDIR}"/build.log 2>&1 + fi + + build_info_plist "${FFMPEG_LIB_FRAMEWORK_PATH}/Info.plist" "${FFMPEG_LIB}" "com.arthenica.ffmpegkit.${CAPITAL_CASE_FFMPEG_LIB_NAME}" "${FFMPEG_LIB_VERSION}" "${FFMPEG_LIB_VERSION}" + + echo -e "DEBUG: ${FFMPEG_LIB} framework built for $(get_apple_architecture_variant "${ARCHITECTURE_VARIANT}") platform successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 + done +} + +# +# 1. architecture variant +# +create_ffmpeg_kit_framework() { + local ARCHITECTURE_VARIANT="$1" + local LIBRARY_NAME="ffmpeg-kit" + local UNIVERSAL_LIBRARY_PATH="${BASEDIR}/prebuilt/$(get_universal_library_directory "${ARCHITECTURE_VARIANT}")" + local FFMPEG_KIT_UNIVERSAL_LIBRARY_PATH="${UNIVERSAL_LIBRARY_PATH}/${LIBRARY_NAME}" + + if [[ $(is_apple_architecture_variant_supported "${ARCHITECTURE_VARIANT}") -eq 0 ]]; then + + # THERE ARE NO ARCHITECTURES ENABLED FOR THIS LIBRARY TYPE + return + fi + + local FFMPEG_KIT_VERSION=$(get_ffmpeg_kit_version) + + # INITIALIZE FRAMEWORK DIRECTORY + local FFMPEG_KIT_FRAMEWORK_PATH="${BASEDIR}/prebuilt/$(get_framework_directory "${ARCHITECTURE_VARIANT}")/ffmpegkit.framework" + initialize_folder "${FFMPEG_KIT_FRAMEWORK_PATH}" + initialize_folder "${FFMPEG_KIT_FRAMEWORK_PATH}/Headers" + initialize_folder "${FFMPEG_KIT_FRAMEWORK_PATH}/Modules" + + # COPY HEADER FILES + cp -r "${FFMPEG_KIT_UNIVERSAL_LIBRARY_PATH}"/include/* "${FFMPEG_KIT_FRAMEWORK_PATH}"/Headers 1>>"${BASEDIR}"/build.log 2>&1 + + # COPY LIBRARY FILE + cp "${FFMPEG_KIT_UNIVERSAL_LIBRARY_PATH}/lib/libffmpegkit.a" "${FFMPEG_KIT_FRAMEWORK_PATH}"/ffmpegkit 1>>"${BASEDIR}"/build.log 2>&1 + + # COPY FRAMEWORK LICENSES + if [[ "${GPL_ENABLED}" == "yes" ]]; then + cp "${BASEDIR}/LICENSE.GPLv3" "${FFMPEG_KIT_FRAMEWORK_PATH}/LICENSE" 1>>"${BASEDIR}"/build.log 2>&1 + else + cp "${BASEDIR}/LICENSE.LGPLv3" "${FFMPEG_KIT_FRAMEWORK_PATH}/LICENSE" 1>>"${BASEDIR}"/build.log 2>&1 + fi + + build_info_plist "${FFMPEG_KIT_FRAMEWORK_PATH}/Info.plist" "ffmpegkit" "com.arthenica.ffmpegkit.FFmpegKit" "${FFMPEG_KIT_VERSION}" "${FFMPEG_KIT_VERSION}" + build_modulemap "${FFMPEG_KIT_FRAMEWORK_PATH}/Modules/module.modulemap" + + echo -e "DEBUG: ffmpeg-kit framework built for $(get_apple_architecture_variant "${ARCHITECTURE_VARIANT}") platform successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 +} + +# +# 1. framework name +# +create_single_xcframework() { + local FRAMEWORK_NAME="$1" + local XCFRAMEWORK_PATH=${BASEDIR}/prebuilt/$(get_xcframework_directory)/${FRAMEWORK_NAME}.xcframework + + initialize_folder "${XCFRAMEWORK_PATH}" + + local BUILD_COMMAND="xcodebuild -create-xcframework " + + for ARCHITECTURE_VARIANT in "${ARCHITECTURE_VARIANT_ARRAY[@]}"; do + if [[ $(is_apple_architecture_variant_supported "${ARCHITECTURE_VARIANT}") -eq 1 ]]; then + local FRAMEWORK_PATH=${BASEDIR}/prebuilt/$(get_framework_directory "${ARCHITECTURE_VARIANT}")/${FRAMEWORK_NAME}.framework + BUILD_COMMAND+=" -framework ${FRAMEWORK_PATH}" + fi + done + + BUILD_COMMAND+=" -output ${XCFRAMEWORK_PATH}" + + # EXECUTE CREATE FRAMEWORK COMMAND + COMMAND_OUTPUT=$(${BUILD_COMMAND} 2>&1) + RC=$? + echo -e "DEBUG: ${COMMAND_OUTPUT}\n" 1>>"${BASEDIR}"/build.log 2>&1 + + if [[ ${RC} -ne 0 ]]; then + echo -e "INFO: Building ${FRAMEWORK_NAME} xcframework failed\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "failed\n\nSee build.log for details\n" + exit 1 + fi + + # DO NOT ALLOW EMPTY FRAMEWORKS + if [[ ${COMMAND_OUTPUT} == *"is empty in library"* ]]; then + echo -e "INFO: Building ${FRAMEWORK_NAME} xcframework failed\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "failed\n\nSee build.log for details\n" + exit 1 + fi +} + +# +# 1. library index +# +create_xcframework() { + local LIBRARY_INDEX="$1" + local LIBRARY_NAME=$(get_library_name "${LIBRARY_INDEX}") + + if [[ ${LIBRARY_LIBTHEORA} == "${LIBRARY_INDEX}" ]]; then + + create_single_xcframework "libtheora" + create_single_xcframework "libtheoraenc" + create_single_xcframework "libtheoradec" + + elif [[ ${LIBRARY_LIBVORBIS} == "${LIBRARY_INDEX}" ]]; then + + create_single_xcframework "libvorbisfile" + create_single_xcframework "libvorbisenc" + create_single_xcframework "libvorbis" + + elif [[ ${LIBRARY_LIBWEBP} == "${LIBRARY_INDEX}" ]]; then + + create_single_xcframework "libwebpmux" + create_single_xcframework "libwebpdemux" + create_single_xcframework "libwebp" + + elif [[ ${LIBRARY_OPENCOREAMR} == "${LIBRARY_INDEX}" ]]; then + + create_single_xcframework "libopencore-amrnb" + + elif [[ ${LIBRARY_NETTLE} == "${LIBRARY_INDEX}" ]]; then + + create_single_xcframework "libnettle" + create_single_xcframework "libhogweed" + + else + + create_single_xcframework "$(get_static_archive_name "${LIBRARY_INDEX}")" + + fi + + echo -e "DEBUG: xcframework for ${LIBRARY_NAME} built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 +} + +create_ffmpeg_xcframework() { + for FFMPEG_LIB in "${FFMPEG_LIBS[@]}"; do + + # INITIALIZE FRAMEWORK DIRECTORY + local FRAMEWORK_NAME="${FFMPEG_LIB}" + local XCFRAMEWORK_PATH=${BASEDIR}/prebuilt/$(get_xcframework_directory)/${FRAMEWORK_NAME}.xcframework + + initialize_folder "${XCFRAMEWORK_PATH}" + + local BUILD_COMMAND="xcodebuild -create-xcframework " + + for ARCHITECTURE_VARIANT in "${ARCHITECTURE_VARIANT_ARRAY[@]}"; do + if [[ $(is_apple_architecture_variant_supported "${ARCHITECTURE_VARIANT}") -eq 1 ]]; then + local FRAMEWORK_PATH=${BASEDIR}/prebuilt/$(get_framework_directory "${ARCHITECTURE_VARIANT}")/${FRAMEWORK_NAME}.framework + BUILD_COMMAND+=" -framework ${FRAMEWORK_PATH}" + fi + done + + BUILD_COMMAND+=" -output ${XCFRAMEWORK_PATH}" + + # EXECUTE CREATE FRAMEWORK COMMAND + COMMAND_OUTPUT=$(${BUILD_COMMAND} 2>&1) + RC=$? + echo -e "DEBUG: ${COMMAND_OUTPUT}\n" 1>>"${BASEDIR}"/build.log 2>&1 + + if [[ ${RC} -ne 0 ]]; then + echo -e "INFO: Building ${FRAMEWORK_NAME} xcframework failed\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "failed\n\nSee build.log for details\n" + exit 1 + fi + + # DO NOT ALLOW EMPTY FRAMEWORKS + if [[ ${COMMAND_OUTPUT} == *"is empty in library"* ]]; then + echo -e "INFO: Building ${FRAMEWORK_NAME} xcframework failed\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "failed\n\nSee build.log for details\n" + exit 1 + fi + + echo -e "DEBUG: xcframework for ${FFMPEG_LIB} built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 + done +} + +create_ffmpeg_kit_xcframework() { + local FRAMEWORK_NAME="ffmpegkit" + + # INITIALIZE FRAMEWORK DIRECTORY + local XCFRAMEWORK_PATH=${BASEDIR}/prebuilt/$(get_xcframework_directory)/${FRAMEWORK_NAME}.xcframework + + initialize_folder "${XCFRAMEWORK_PATH}" + local BUILD_COMMAND="xcodebuild -create-xcframework " + + for ARCHITECTURE_VARIANT in "${ARCHITECTURE_VARIANT_ARRAY[@]}"; do + if [[ $(is_apple_architecture_variant_supported "${ARCHITECTURE_VARIANT}") -eq 1 ]]; then + local FRAMEWORK_PATH=${BASEDIR}/prebuilt/$(get_framework_directory "${ARCHITECTURE_VARIANT}")/${FRAMEWORK_NAME}.framework + BUILD_COMMAND+=" -framework ${FRAMEWORK_PATH}" + fi + done + + BUILD_COMMAND+=" -output ${XCFRAMEWORK_PATH}" + + # EXECUTE CREATE FRAMEWORK COMMAND + COMMAND_OUTPUT=$(${BUILD_COMMAND} 2>&1) + RC=$? + echo -e "DEBUG: ${COMMAND_OUTPUT}\n" 1>>"${BASEDIR}"/build.log 2>&1 + + if [[ ${RC} -ne 0 ]]; then + echo -e "INFO: Building ${FRAMEWORK_NAME} xcframework failed\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "failed\n\nSee build.log for details\n" + exit 1 + fi + + # DO NOT ALLOW EMPTY FRAMEWORKS + if [[ ${COMMAND_OUTPUT} == *"is empty in library"* ]]; then + echo -e "INFO: Building ${FRAMEWORK_NAME} xcframework failed\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "failed\n\nSee build.log for details\n" + exit 1 + fi + + echo -e "DEBUG: xcframework for ffmpeg-kit built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 +} + +# +# DEPENDS TARGET_ARCH_LIST VARIABLE +# +get_default_build_directory() { + ARCH=${TARGET_ARCH_LIST[0]} + get_build_directory +} + +get_build_directory() { + local LTS_POSTFIX="" + if [[ -n ${FFMPEG_KIT_LTS_BUILD} ]]; then + LTS_POSTFIX="-lts" + fi + + case ${ARCH} in + x86-64) + echo "apple-${FFMPEG_KIT_BUILD_TYPE}-x86_64${LTS_POSTFIX}" + ;; + x86-64-mac-catalyst) + echo "apple-${FFMPEG_KIT_BUILD_TYPE}-x86_64-mac-catalyst${LTS_POSTFIX}" + ;; + *) + echo "apple-${FFMPEG_KIT_BUILD_TYPE}-${ARCH}${LTS_POSTFIX}" + ;; + esac +} + +# +# 1. framework type +# +get_framework_directory() { + local FRAMEWORK_TYPE="$1" + local LTS_POSTFIX="" + if [[ -n ${FFMPEG_KIT_LTS_BUILD} ]]; then + LTS_POSTFIX="-lts" + fi + + case $FRAMEWORK_TYPE in + 1) + echo "bundle-apple-framework-ios${LTS_POSTFIX}" + ;; + 2) + echo "bundle-apple-framework-iphoneos${LTS_POSTFIX}" + ;; + 3) + echo "bundle-apple-framework-iphonesimulator${LTS_POSTFIX}" + ;; + 4) + echo "bundle-apple-framework-mac-catalyst${LTS_POSTFIX}" + ;; + 5) + echo "bundle-apple-framework-tvos${LTS_POSTFIX}" + ;; + 6) + echo "bundle-apple-framework-appletvos${LTS_POSTFIX}" + ;; + 7) + echo "bundle-apple-framework-appletvsimulator${LTS_POSTFIX}" + ;; + 8) + echo "bundle-apple-framework-macos${LTS_POSTFIX}" + ;; + esac +} + +get_xcframework_directory() { + local LTS_POSTFIX="" + if [[ -n ${FFMPEG_KIT_LTS_BUILD} ]]; then + LTS_POSTFIX="-lts" + fi + + echo "bundle-apple-xcframework-${FFMPEG_KIT_BUILD_TYPE}${LTS_POSTFIX}" +} + +# +# 1. architecture variant +# +get_universal_library_directory() { + local ARCHITECTURE_VARIANT="$1" + local LTS_POSTFIX="" + if [[ -n ${FFMPEG_KIT_LTS_BUILD} ]]; then + LTS_POSTFIX="-lts" + fi + + case ${ARCHITECTURE_VARIANT} in + 1) + echo "bundle-apple-universal-ios${LTS_POSTFIX}" + ;; + 2) + echo "bundle-apple-universal-iphoneos${LTS_POSTFIX}" + ;; + 3) + echo "bundle-apple-universal-iphonesimulator${LTS_POSTFIX}" + ;; + 4) + echo "bundle-apple-universal-mac-catalyst${LTS_POSTFIX}" + ;; + 5) + echo "bundle-apple-universal-tvos${LTS_POSTFIX}" + ;; + 6) + echo "bundle-apple-universal-appletvos${LTS_POSTFIX}" + ;; + 7) + echo "bundle-apple-universal-appletvsimulator${LTS_POSTFIX}" + ;; + 8) + echo "bundle-apple-universal-macos${LTS_POSTFIX}" + ;; + esac +} + +# +# 1. architecture variant +# +get_apple_architecture_variant() { + local ARCHITECTURE_VARIANT="$1" + local LTS_POSTFIX="" + if [[ -n ${FFMPEG_KIT_LTS_BUILD} ]]; then + LTS_POSTFIX="-lts" + fi + + case ${ARCHITECTURE_VARIANT} in + 2) + echo "iphoneos${LTS_POSTFIX}" + ;; + 3) + echo "iphonesimulator${LTS_POSTFIX}" + ;; + 4) + echo "mac-catalyst${LTS_POSTFIX}" + ;; + 5) + echo "tvos${LTS_POSTFIX}" + ;; + 6) + echo "appletvos${LTS_POSTFIX}" + ;; + 7) + echo "appletvsimulator${LTS_POSTFIX}" + ;; + 8) + echo "macosx${LTS_POSTFIX}" + ;; + *) + echo "ios${LTS_POSTFIX}" + ;; + esac +} + +# +# 1. architecture variant +# +get_apple_architectures_for_variant() { + local ARCHITECTURE_VARIANT="$1" + + local ARCHITECTURES="" + + case ${ARCHITECTURE_VARIANT} in + 2) + for index in 2 3 5 6; do + ARCHITECTURES+=" $(get_full_arch_name "${index}") " + done + ;; + 3) + for index in 7 9 12; do + ARCHITECTURES+=" $(get_full_arch_name "${index}") " + done + ;; + 4) + for index in 10 11; do + ARCHITECTURES+=" $(get_full_arch_name "${index}") " + done + ;; + 5) + for index in 5 9; do + ARCHITECTURES+=" $(get_full_arch_name "${index}") " + done + ;; + 6) + for index in 5; do + ARCHITECTURES+=" $(get_full_arch_name "${index}") " + done + ;; + 7) + for index in 9; do + ARCHITECTURES+=" $(get_full_arch_name "${index}") " + done + ;; + 8) + for index in 5 9; do + ARCHITECTURES+=" $(get_full_arch_name "${index}") " + done + ;; + *) + for index in 2 3 5 6 7 9 10 11 12; do + ARCHITECTURES+=" $(get_full_arch_name "${index}") " + done + ;; + esac + + echo "${ARCHITECTURES}" +} + +get_cmake_osx_architectures() { + case ${ARCH} in + arm64 | arm64-*) + echo "arm64" + ;; + arm64e) + echo "arm64e" + ;; + x86-64*) + echo "x86_64" + ;; + *) + echo "${ARCH}" + ;; + esac +} + +get_target_cpu() { + case ${ARCH} in + arm64*) + echo "arm64" + ;; + x86-64*) + echo "x86_64" + ;; + *) + echo "${ARCH}" + ;; + esac +} + +get_static_archive_name() { + case $1 in + 5) echo "libmp3lame" ;; + 6) echo "libass" ;; + 10) echo "libvpx" ;; + 12) echo "libxml2" ;; + 21) echo "libvidstab" ;; + 23) echo "libilbc" ;; + 27) echo "libaom" ;; + 29) echo "libtwolame" ;; + 30) echo "libSDL2" ;; + 31) echo "libtesseract" ;; + 34) echo "libgif" ;; + 36) echo "libogg" ;; + 37) echo "libpng" ;; + 42) echo "libsndfile" ;; + 43) echo "liblept" ;; + 44) echo "libsamplerate" ;; + *) echo lib"$(get_library_name "$1")" ;; + esac +} + +build_modulemap() { + local FILE_PATH="$1" + + cat >"${FILE_PATH}" <${FILE_PATH} < + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${FRAMEWORK_NAME} + CFBundleIdentifier + ${FRAMEWORK_ID} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${FRAMEWORK_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + ${FRAMEWORK_SHORT_VERSION} + CFBundleVersion + ${FRAMEWORK_VERSION} + CFBundleSignature + ???? + MinimumOSVersion + ${MINIMUM_OS_VERSION} + CFBundleSupportedPlatforms + + ${SUPPORTED_PLATFORMS} + + NSPrincipalClass + + + +EOF +} + +get_default_sdk_name() { + case ${FFMPEG_KIT_BUILD_TYPE} in + ios) + echo "iphoneos" + ;; + tvos) + echo "appletvos" + ;; + macos) + echo "macosx" + ;; + esac +} + +get_sdk_name() { + case ${ARCH} in + armv7 | armv7s | arm64e) + echo "iphoneos" + ;; + arm64) + case ${FFMPEG_KIT_BUILD_TYPE} in + ios) + echo "iphoneos" + ;; + tvos) + echo "appletvos" + ;; + macos) + echo "macosx" + ;; + esac + ;; + x86-64) + case ${FFMPEG_KIT_BUILD_TYPE} in + ios) + echo "iphonesimulator" + ;; + tvos) + echo "appletvsimulator" + ;; + macos) + echo "macosx" + ;; + esac + ;; + i386 | arm64-simulator) + echo "iphonesimulator" + ;; + *-mac-catalyst) + echo "macosx" + ;; + esac +} + +get_min_version_cflags() { + case ${ARCH} in + armv7 | armv7s | arm64e) + echo "-miphoneos-version-min=$(get_min_sdk_version)" + ;; + arm64) + case ${FFMPEG_KIT_BUILD_TYPE} in + ios) + echo "-miphoneos-version-min=$(get_min_sdk_version)" + ;; + tvos) + echo "-mappletvos-version-min=$(get_min_sdk_version)" + ;; + macos) + echo "-mmacosx-version-min=$(get_min_sdk_version)" + ;; + esac + ;; + x86-64) + case ${FFMPEG_KIT_BUILD_TYPE} in + ios) + echo "-mios-simulator-version-min=$(get_min_sdk_version)" + ;; + tvos) + echo "-mappletvsimulator-version-min=$(get_min_sdk_version)" + ;; + macos) + echo "-mmacosx-version-min=$(get_min_sdk_version)" + ;; + esac + ;; + i386 | arm64-simulator) + echo "-mios-simulator-version-min=$(get_min_sdk_version)" + ;; + *-mac-catalyst) + echo "-miphoneos-version-min=$(get_min_sdk_version)" + ;; + esac +} + +get_min_sdk_version() { + case ${ARCH} in + *-mac-catalyst) + echo "13.0" + ;; + *) + case ${FFMPEG_KIT_BUILD_TYPE} in + ios) + echo "${IOS_MIN_VERSION}" + ;; + tvos) + echo "${TVOS_MIN_VERSION}" + ;; + macos) + echo "${MACOS_MIN_VERSION}" + ;; + esac + ;; + esac +} + +get_sdk_path() { + echo "$(xcrun --sdk "$(get_sdk_name)" --show-sdk-path)" +} + +create_fontconfig_package_config() { + local FONTCONFIG_VERSION="$1" + + cat >"${INSTALL_PKG_CONFIG_DIR}/fontconfig.pc" <= 21.0.15, uuid, expat >= 2.2.0, libiconv +Requires.private: +Libs: -L\${libdir} -lfontconfig +Libs.private: +Cflags: -I\${includedir} +EOF +} + +create_freetype_package_config() { + local FREETYPE_VERSION="$1" + + cat >"${INSTALL_PKG_CONFIG_DIR}/freetype2.pc" <"${INSTALL_PKG_CONFIG_DIR}/giflib.pc" <"${INSTALL_PKG_CONFIG_DIR}/gmp.pc" <"${INSTALL_PKG_CONFIG_DIR}/gnutls.pc" <"${INSTALL_PKG_CONFIG_DIR}/libmp3lame.pc" <"${INSTALL_PKG_CONFIG_DIR}/libiconv.pc" <"${INSTALL_PKG_CONFIG_DIR}/libpng.pc" <"${INSTALL_PKG_CONFIG_DIR}/vorbis.pc" <"${INSTALL_PKG_CONFIG_DIR}/vorbisenc.pc" <"${INSTALL_PKG_CONFIG_DIR}/vorbisfile.pc" <"${INSTALL_PKG_CONFIG_DIR}/libxml-2.0.pc" <"${INSTALL_PKG_CONFIG_DIR}/snappy.pc" <"${INSTALL_PKG_CONFIG_DIR}/soxr.pc" <"${INSTALL_PKG_CONFIG_DIR}/tesseract.pc" <"${INSTALL_PKG_CONFIG_DIR}/uuid.pc" <"${INSTALL_PKG_CONFIG_DIR}/xvidcore.pc" <"${INSTALL_PKG_CONFIG_DIR}/zlib.pc" <"${INSTALL_PKG_CONFIG_DIR}/bzip2.pc" <>"${BASEDIR}"/build.log 2>&1 || exit 1 - local STATIC_LIBRARY_PATH=$(find "${BASEDIR}"/prebuilt/ios-${TARGET_ARCH} -name $3) - local CAPITAL_CASE_LIBRARY_NAME=$(to_capital_case "$2") - - build_info_plist "${FRAMEWORK_PATH}/Info.plist" "$2" "com.arthenica.ffmpegkit.${CAPITAL_CASE_LIBRARY_NAME}" "$4" "$4" - cp "${STATIC_LIBRARY_PATH}" "${FRAMEWORK_PATH}/$2" 1>>"${BASEDIR}"/build.log 2>&1 - fi - done - - # 2. CREATE XCFRAMEWORKS - local XCFRAMEWORK_PATH=${BASEDIR}/prebuilt/ios-xcframework/$2.xcframework - mkdir -p "${XCFRAMEWORK_PATH}" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - - BUILD_COMMAND="xcodebuild -create-xcframework " - - for TARGET_ARCH in "${TARGET_ARCH_LIST[@]}"; do - if [[ ${TARGET_ARCH} != "arm64e" ]]; then - local FRAMEWORK_PATH=${BASEDIR}/prebuilt/ios-xcframework/.tmp/ios-${TARGET_ARCH}/$2.framework - BUILD_COMMAND+=" -framework ${FRAMEWORK_PATH}" - fi - done - - BUILD_COMMAND+=" -output ${XCFRAMEWORK_PATH}" - - COMMAND_OUTPUT=$(${BUILD_COMMAND} 2>&1) - - echo "${COMMAND_OUTPUT}" 1>>"${BASEDIR}"/build.log 2>&1 - - echo "" 1>>"${BASEDIR}"/build.log 2>&1 - - if [[ ${COMMAND_OUTPUT} == *"is empty in library"* ]]; then - RC=1 - else - RC=0 - fi - - else - - # 1. CREATE FAT LIBRARY - local FAT_LIBRARY_PATH=${BASEDIR}/prebuilt/ios-universal/$2-universal - - mkdir -p "${FAT_LIBRARY_PATH}/lib" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - - LIPO_COMMAND="${LIPO} -create" - - for TARGET_ARCH in "${TARGET_ARCH_LIST[@]}"; do - LIPO_COMMAND+=" $(find "${BASEDIR}"/prebuilt/ios-"${TARGET_ARCH}" -name $3)" - done - - LIPO_COMMAND+=" -output ${FAT_LIBRARY_PATH}/lib/$3" - - RC=$(${LIPO_COMMAND} 1>>"${BASEDIR}"/build.log 2>&1) - - if [[ ${RC} -eq 0 ]]; then - - # 2. CREATE FRAMEWORK - RC=$(create_static_framework "$2" "$3" "$4") - - if [[ ${RC} -eq 0 ]]; then - - # 3. COPY LICENSES - if [[ ${LIBRARY_LIBTHEORA} == "$1" ]]; then - license_directories=("${BASEDIR}/prebuilt/ios-universal/libtheora-universal" "${BASEDIR}/prebuilt/ios-universal/libtheoraenc-universal" "${BASEDIR}/prebuilt/ios-universal/libtheoradec-universal" "${BASEDIR}/prebuilt/ios-framework/libtheora.framework" "${BASEDIR}/prebuilt/ios-framework/libtheoraenc.framework" "${BASEDIR}/prebuilt/ios-framework/libtheoradec.framework") - elif [[ ${LIBRARY_LIBVORBIS} == "$1" ]]; then - license_directories=("${BASEDIR}/prebuilt/ios-universal/libvorbisfile-universal" "${BASEDIR}/prebuilt/ios-universal/libvorbisenc-universal" "${BASEDIR}/prebuilt/ios-universal/libvorbis-universal" "${BASEDIR}/prebuilt/ios-framework/libvorbisfile.framework" "${BASEDIR}/prebuilt/ios-framework/libvorbisenc.framework" "${BASEDIR}/prebuilt/ios-framework/libvorbis.framework") - elif [[ ${LIBRARY_LIBWEBP} == "$1" ]]; then - license_directories=("${BASEDIR}/prebuilt/ios-universal/libwebpmux-universal" "${BASEDIR}/prebuilt/ios-universal/libwebpdemux-universal" "${BASEDIR}/prebuilt/ios-universal/libwebp-universal" "${BASEDIR}/prebuilt/ios-framework/libwebpmux.framework" "${BASEDIR}/prebuilt/ios-framework/libwebpdemux.framework" "${BASEDIR}/prebuilt/ios-framework/libwebp.framework") - elif [[ ${LIBRARY_OPENCOREAMR} == "$1" ]]; then - license_directories=("${BASEDIR}/prebuilt/ios-universal/libopencore-amrnb-universal" "${BASEDIR}/prebuilt/ios-framework/libopencore-amrnb.framework") - elif [[ ${LIBRARY_NETTLE} == "$1" ]]; then - license_directories=("${BASEDIR}/prebuilt/ios-universal/libnettle-universal" "${BASEDIR}/prebuilt/ios-universal/libhogweed-universal" "${BASEDIR}/prebuilt/ios-framework/libnettle.framework" "${BASEDIR}/prebuilt/ios-framework/libhogweed.framework") - else - license_directories=("${BASEDIR}/prebuilt/ios-universal/$2-universal" "${BASEDIR}/prebuilt/ios-framework/$2.framework") - fi - - RC=$(copy_external_library_license "$1" "${license_directories[@]}") - fi - - fi - - fi - - echo "${RC}" -} - -# 1 - library index -# 2 - output path -copy_external_library_license() { - output_path_array="$2" - for output_path in "${output_path_array[@]}"; do - $(cp $(get_external_library_license_path "$1") "${output_path}/LICENSE" 1>>"${BASEDIR}"/build.log 2>&1) - if [ $? -ne 0 ]; then - echo 1 - return - fi - done - echo 0 -} - -get_external_library_version() { - local library_version=$(grep Version "${BASEDIR}"/prebuilt/ios-"${TARGET_ARCH_LIST[0]}"/pkgconfig/"$1".pc 2>>"${BASEDIR}"/build.log | sed 's/Version://g;s/\ //g') - - echo "${library_version}" -} - -# -# 1. architecture index -# 2. detected sdk version -# -disable_architecture_not_supported_on_detected_sdk_version() { - local ARCH_NAME=$(get_arch_name $1) - - case ${ARCH_NAME} in - armv7 | armv7s | i386) - - # SUPPORTED UNTIL IOS SDK 10 - if [[ $2 == 11* ]] || [[ $2 == 12* ]] || [[ $2 == 13* ]] || [[ $2 == 14* ]]; then - local SUPPORTED=0 - else - local SUPPORTED=1 - fi - ;; - arm64e) - - # INTRODUCED IN IOS SDK 10 - if [[ $2 == 10* ]] || [[ $2 == 11* ]] || [[ $2 == 12* ]] || [[ $2 == 13* ]] || [[ $2 == 14* ]]; then - local SUPPORTED=1 - else - local SUPPORTED=0 - fi - ;; - x86-64-mac-catalyst) - - # INTRODUCED IN IOS SDK 13 - if [[ $2 == 13* ]] || [[ $2 == 14* ]]; then - local SUPPORTED=1 - else - local SUPPORTED=0 - fi - ;; - *) - local SUPPORTED=1 - ;; - esac - - if [[ ${SUPPORTED} -ne 1 ]]; then - if [[ -z ${BUILD_FORCE} ]]; then - echo -e "INFO: Disabled ${ARCH_NAME} architecture which is not supported on SDK $2\n" 1>>"${BASEDIR}"/build.log 2>&1 - disable_arch "${ARCH_NAME}" - fi - fi -} - -get_target_host() { - case ${ARCH} in - x86-64-mac-catalyst) - echo "x86_64-apple-ios13.0-macabi" - ;; - *) - echo "$(get_target_arch)-ios-darwin" - ;; - esac -} - -get_target_build_directory() { - case ${ARCH} in - x86-64) - echo "ios-x86_64" - ;; - x86-64-mac-catalyst) - echo "ios-x86_64-mac-catalyst" - ;; - *) - echo "ios-${ARCH}" - ;; - esac -} - -get_target_arch() { - case ${ARCH} in - arm64 | arm64e) - echo "aarch64" - ;; - x86-64 | x86-64-mac-catalyst) - echo "x86_64" - ;; - *) - echo "${ARCH}" - ;; - esac -} - -get_target_sdk() { - echo "$(get_target_arch)-apple-ios${IOS_MIN_VERSION}" -} - -get_sdk_name() { - case ${ARCH} in - armv7 | armv7s | arm64 | arm64e) - echo "iphoneos" - ;; - i386 | x86-64) - echo "iphonesimulator" - ;; - x86-64-mac-catalyst) - echo "macosx" - ;; - esac -} - -get_sdk_path() { - echo "$(xcrun --sdk "$(get_sdk_name)" --show-sdk-path)" -} - -get_min_version_cflags() { - case ${ARCH} in - armv7 | armv7s | arm64 | arm64e) - echo "-miphoneos-version-min=${IOS_MIN_VERSION}" - ;; - i386 | x86-64) - echo "-mios-simulator-version-min=${IOS_MIN_VERSION}" - ;; - x86-64-mac-catalyst) - echo "-miphoneos-version-min=13.0" - ;; - esac -} - get_common_includes() { echo "-I${SDK_PATH}/usr/include" } @@ -325,11 +77,11 @@ get_common_cflags() { local BUILD_DATE="-DFFMPEG_KIT_BUILD_DATE=$(date +%Y%m%d 2>>"${BASEDIR}"/build.log)" case ${ARCH} in - i386 | x86-64) + i386 | x86-64 | arm64-simulator) echo "-fstrict-aliasing -DIOS ${LTS_BUILD_FLAG}${BUILD_DATE} -isysroot ${SDK_PATH}" ;; - x86-64-mac-catalyst) - echo "-fstrict-aliasing -fembed-bitcode ${LTS_BUILD_FLAG}${BUILD_DATE} -isysroot ${SDK_PATH}" + *-mac-catalyst) + echo "-fstrict-aliasing -fembed-bitcode -DMACOSX ${LTS_BUILD_FLAG}${BUILD_DATE} -isysroot ${SDK_PATH}" ;; *) echo "-fstrict-aliasing -fembed-bitcode -DIOS ${LTS_BUILD_FLAG}${BUILD_DATE} -isysroot ${SDK_PATH}" @@ -340,25 +92,31 @@ get_common_cflags() { get_arch_specific_cflags() { case ${ARCH} in armv7) - echo "-arch armv7 -target $(get_target_host) -march=armv7 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -DFFMPEG_KIT_ARMV7" + echo "-arch armv7 -target $(get_target) -march=armv7 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -DFFMPEG_KIT_ARMV7" ;; armv7s) - echo "-arch armv7s -target $(get_target_host) -march=armv7s -mcpu=generic -mfpu=neon -mfloat-abi=softfp -DFFMPEG_KIT_ARMV7S" + echo "-arch armv7s -target $(get_target) -march=armv7s -mcpu=generic -mfpu=neon -mfloat-abi=softfp -DFFMPEG_KIT_ARMV7S" ;; arm64) - echo "-arch arm64 -target $(get_target_host) -march=armv8-a+crc+crypto -mcpu=generic -DFFMPEG_KIT_ARM64" + echo "-arch arm64 -target $(get_target) -march=armv8-a+crc+crypto -mcpu=generic -DFFMPEG_KIT_ARM64" + ;; + arm64-mac-catalyst) + echo "-arch arm64 -target $(get_target) -march=armv8-a+crc+crypto -mcpu=generic -DFFMPEG_KIT_ARM64_MAC_CATALYST -isysroot ${SDK_PATH} -isystem ${SDK_PATH}/System/iOSSupport/usr/include -iframework ${SDK_PATH}/System/iOSSupport/System/Library/Frameworks" + ;; + arm64-simulator) + echo "-arch arm64 -target $(get_target) -march=armv8-a+crc+crypto -mcpu=generic -DFFMPEG_KIT_ARM64_SIMULATOR" ;; arm64e) - echo "-arch arm64e -target $(get_target_host) -march=armv8.3-a+crc+crypto -mcpu=generic -DFFMPEG_KIT_ARM64E" + echo "-arch arm64e -target $(get_target) -march=armv8.3-a+crc+crypto -mcpu=generic -DFFMPEG_KIT_ARM64E" ;; i386) - echo "-arch i386 -target $(get_target_host) -march=i386 -mtune=intel -mssse3 -mfpmath=sse -m32 -DFFMPEG_KIT_I386" + echo "-arch i386 -target $(get_target) -march=i386 -mtune=intel -mssse3 -mfpmath=sse -m32 -DFFMPEG_KIT_I386" ;; x86-64) - echo "-arch x86_64 -target $(get_target_host) -march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel -DFFMPEG_KIT_X86_64" + echo "-arch x86_64 -target $(get_target) -march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel -DFFMPEG_KIT_X86_64" ;; x86-64-mac-catalyst) - echo "-arch x86_64 -target $(get_target_host) -march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel -DFFMPEG_KIT_X86_64_MAC_CATALYST -isysroot ${SDK_PATH} -isystem ${SDK_PATH}/System/iOSSupport/usr/include -iframework ${SDK_PATH}/System/iOSSupport/System/Library/Frameworks" + echo "-arch x86_64 -target $(get_target) -march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel -DFFMPEG_KIT_X86_64_MAC_CATALYST -isysroot ${SDK_PATH} -isystem ${SDK_PATH}/System/iOSSupport/usr/include -iframework ${SDK_PATH}/System/iOSSupport/System/Library/Frameworks" ;; esac } @@ -367,10 +125,10 @@ get_size_optimization_cflags() { local ARCH_OPTIMIZATION="" case ${ARCH} in - armv7 | armv7s | arm64 | arm64e | x86-64-mac-catalyst) + armv7 | armv7s | arm64 | arm64e | *-mac-catalyst) ARCH_OPTIMIZATION="-Oz -Wno-ignored-optimization-argument" ;; - i386 | x86-64) + i386 | x86-64 | arm64-simulator) ARCH_OPTIMIZATION="-O2 -Wno-ignored-optimization-argument" ;; esac @@ -384,10 +142,10 @@ get_size_optimization_asm_cflags() { case $1 in jpeg | ffmpeg) case ${ARCH} in - armv7 | armv7s | arm64 | arm64e | x86-64-mac-catalyst) + armv7 | armv7s | arm64 | arm64e | *-mac-catalyst) ARCH_OPTIMIZATION="-Oz" ;; - i386 | x86-64) + i386 | x86-64 | arm64-simulator) ARCH_OPTIMIZATION="-O2" ;; esac @@ -432,7 +190,7 @@ get_app_specific_cflags() { libwebp | xvidcore) APP_FLAGS="-fno-common -DPIC" ;; - sdl2) + sdl) APP_FLAGS="-DPIC -Wno-unused-function -D__IPHONEOS__" ;; shine) @@ -492,7 +250,7 @@ get_cxxflags() { local BITCODE_FLAGS="" case ${ARCH} in - armv7 | armv7s | arm64 | arm64e | x86-64-mac-catalyst) + armv7 | armv7s | arm64 | arm64e | *-mac-catalyst) local BITCODE_FLAGS="-fembed-bitcode" ;; esac @@ -532,7 +290,7 @@ get_common_ldflags() { get_size_optimization_ldflags() { case ${ARCH} in - armv7 | armv7s | arm64 | arm64e | x86-64-mac-catalyst) + armv7 | armv7s | arm64 | arm64e | *-mac-catalyst) case $1 in ffmpeg | ffmpeg-kit) echo "-Oz -dead_strip" @@ -558,25 +316,31 @@ get_size_optimization_ldflags() { get_arch_specific_ldflags() { case ${ARCH} in armv7) - echo "-arch armv7 -march=armv7 -mfpu=neon -mfloat-abi=softfp -fembed-bitcode -target $(get_target_host)" + echo "-arch armv7 -march=armv7 -mfpu=neon -mfloat-abi=softfp -fembed-bitcode -target $(get_target)" ;; armv7s) - echo "-arch armv7s -march=armv7s -mfpu=neon -mfloat-abi=softfp -fembed-bitcode -target $(get_target_host)" + echo "-arch armv7s -march=armv7s -mfpu=neon -mfloat-abi=softfp -fembed-bitcode -target $(get_target)" ;; arm64) - echo "-arch arm64 -march=armv8-a+crc+crypto -fembed-bitcode -target $(get_target_host)" + echo "-arch arm64 -march=armv8-a+crc+crypto -fembed-bitcode -target $(get_target)" + ;; + arm64-mac-catalyst) + echo "-arch arm64 -march=armv8-a+crc+crypto -fembed-bitcode -target $(get_target) -isysroot ${SDK_PATH} -L${SDK_PATH}/System/iOSSupport/usr/lib -iframework ${SDK_PATH}/System/iOSSupport/System/Library/Frameworks" + ;; + arm64-simulator) + echo "-arch arm64 -march=armv8-a+crc+crypto -target $(get_target)" ;; arm64e) - echo "-arch arm64e -march=armv8.3-a+crc+crypto -fembed-bitcode -target $(get_target_host)" + echo "-arch arm64e -march=armv8.3-a+crc+crypto -fembed-bitcode -target $(get_target)" ;; i386) - echo "-arch i386 -march=i386 -target $(get_target_host)" + echo "-arch i386 -march=i386 -target $(get_target)" ;; x86-64) - echo "-arch x86_64 -march=x86-64 -target $(get_target_host)" + echo "-arch x86_64 -march=x86-64 -target $(get_target)" ;; x86-64-mac-catalyst) - echo "-arch x86_64 -march=x86-64 -target $(get_target_host) -isysroot ${SDK_PATH} -L${SDK_PATH}/System/iOSSupport/usr/lib -iframework ${SDK_PATH}/System/iOSSupport/System/Library/Frameworks" + echo "-arch x86_64 -march=x86-64 -target $(get_target) -isysroot ${SDK_PATH} -L${SDK_PATH}/System/iOSSupport/usr/lib -iframework ${SDK_PATH}/System/iOSSupport/System/Library/Frameworks" ;; esac } @@ -594,7 +358,7 @@ get_ldflags() { case $1 in ffmpeg-kit) case ${ARCH} in - armv7 | armv7s | arm64 | arm64e | x86-64-mac-catalyst) + armv7 | armv7s | arm64 | arm64e | *-mac-catalyst) echo "${ARCH_FLAGS} ${LINKED_LIBRARIES} ${COMMON_FLAGS} -fembed-bitcode -Wc,-fembed-bitcode ${OPTIMIZATION_FLAGS}" ;; *) @@ -608,373 +372,6 @@ get_ldflags() { esac } -create_fontconfig_package_config() { - local FONTCONFIG_VERSION="$1" - - cat >"${INSTALL_PKG_CONFIG_DIR}/fontconfig.pc" <= 21.0.15, uuid, expat >= 2.2.0, libiconv -Requires.private: -Libs: -L\${libdir} -lfontconfig -Libs.private: -Cflags: -I\${includedir} -EOF -} - -create_freetype_package_config() { - local FREETYPE_VERSION="$1" - - cat >"${INSTALL_PKG_CONFIG_DIR}/freetype2.pc" <"${INSTALL_PKG_CONFIG_DIR}/giflib.pc" <"${INSTALL_PKG_CONFIG_DIR}/gmp.pc" <"${INSTALL_PKG_CONFIG_DIR}/gnutls.pc" <"${INSTALL_PKG_CONFIG_DIR}/libmp3lame.pc" <"${INSTALL_PKG_CONFIG_DIR}/libiconv.pc" <"${INSTALL_PKG_CONFIG_DIR}/libpng.pc" <"${INSTALL_PKG_CONFIG_DIR}/vorbis.pc" <"${INSTALL_PKG_CONFIG_DIR}/vorbisenc.pc" <"${INSTALL_PKG_CONFIG_DIR}/vorbisfile.pc" <"${INSTALL_PKG_CONFIG_DIR}/libxml-2.0.pc" <"${INSTALL_PKG_CONFIG_DIR}/snappy.pc" <"${INSTALL_PKG_CONFIG_DIR}/soxr.pc" <"${INSTALL_PKG_CONFIG_DIR}/tesseract.pc" <"${INSTALL_PKG_CONFIG_DIR}/uuid.pc" <"${INSTALL_PKG_CONFIG_DIR}/xvidcore.pc" <"${INSTALL_PKG_CONFIG_DIR}/zlib.pc" <"${INSTALL_PKG_CONFIG_DIR}/bzip2.pc" <>"${BASEDIR}"/build.log 2>&1 + + if [[ $(is_apple_architecture_variant_supported 2) -eq 1 ]]; then + mkdir -p "${BASEDIR}/prebuilt/$(get_universal_library_directory 2)" 1>>"${BASEDIR}"/build.log 2>&1 + mkdir -p "${BASEDIR}/prebuilt/$(get_framework_directory 2)" 1>>"${BASEDIR}"/build.log 2>&1 + fi + if [[ $(is_apple_architecture_variant_supported 3) -eq 1 ]]; then + mkdir -p "${BASEDIR}/prebuilt/$(get_universal_library_directory 3)" 1>>"${BASEDIR}"/build.log 2>&1 + mkdir -p "${BASEDIR}/prebuilt/$(get_framework_directory 3)" 1>>"${BASEDIR}"/build.log 2>&1 + fi + if [[ $(is_apple_architecture_variant_supported 4) -eq 1 ]]; then + mkdir -p "${BASEDIR}/prebuilt/$(get_universal_library_directory 4)" 1>>"${BASEDIR}"/build.log 2>&1 + mkdir -p "${BASEDIR}/prebuilt/$(get_framework_directory 4)" 1>>"${BASEDIR}"/build.log 2>&1 + fi + + echo -e "DEBUG: Initializing xcframework directory at ${BASEDIR}/prebuilt/$(get_xcframework_directory)\n" 1>>"${BASEDIR}"/build.log 2>&1 + + # XCF BUILDS GENERATE XCFFRAMEWORKS + mkdir -p "${BASEDIR}/prebuilt/$(get_xcframework_directory)" 1>>"${BASEDIR}"/build.log 2>&1 + else + + echo -e "DEBUG: Initializing default universal directory at ${BASEDIR}/prebuilt/$(get_universal_library_directory 1)\n" 1>>"${BASEDIR}"/build.log 2>&1 + + # DEFAULT BUILDS GENERATE UNIVERSAL LIBRARIES AND FRAMEWORKS + mkdir -p "${BASEDIR}/prebuilt/$(get_universal_library_directory 1)" 1>>"${BASEDIR}"/build.log 2>&1 + + echo -e "DEBUG: Initializing framework directory at ${BASEDIR}/prebuilt/$(get_framework_directory 1)\n" 1>>"${BASEDIR}"/build.log 2>&1 + + mkdir -p "${BASEDIR}/prebuilt/$(get_framework_directory 1)" 1>>"${BASEDIR}"/build.log 2>&1 + fi +} + +# +# DEPENDS TARGET_ARCH_LIST VARIABLE +# +create_universal_libraries_for_ios_default_frameworks() { + local ROOT_UNIVERSAL_DIRECTORY_PATH="${BASEDIR}/prebuilt/$(get_universal_library_directory 1)" + + echo -e "INFO: Building universal libraries in ${ROOT_UNIVERSAL_DIRECTORY_PATH} for default frameworks using ${TARGET_ARCH_LIST[@]}\n" 1>>"${BASEDIR}"/build.log 2>&1 + + for library in {0..46}; do + if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then + create_universal_library "${library}" 1 + fi + done + + create_ffmpeg_universal_library 1 + + create_ffmpeg_kit_universal_library 1 + + echo -e "INFO: Universal libraries for default frameworks built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 +} + +create_ios_default_frameworks() { + echo -e "INFO: Building default frameworks\n" 1>>"${BASEDIR}"/build.log 2>&1 + + for library in {0..46}; do + if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then + create_framework "${library}" 1 + fi + done + + create_ffmpeg_framework 1 + + create_ffmpeg_kit_framework 1 + + echo -e "INFO: Default frameworks built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 +} + +create_universal_libraries_for_ios_xcframeworks() { + echo -e "INFO: Building universal libraries for xcframeworks using ${TARGET_ARCH_LIST[@]}\n" 1>>"${BASEDIR}"/build.log 2>&1 + + for library in {0..46}; do + if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then + create_universal_library "${library}" 2 + create_universal_library "${library}" 3 + create_universal_library "${library}" 4 + fi + done + + create_ffmpeg_universal_library 2 + create_ffmpeg_universal_library 3 + create_ffmpeg_universal_library 4 + + create_ffmpeg_kit_universal_library 2 + create_ffmpeg_kit_universal_library 3 + create_ffmpeg_kit_universal_library 4 + + echo -e "INFO: Universal libraries for xcframeworks built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 +} + +create_frameworks_for_ios_xcframeworks() { + echo -e "INFO: Building frameworks for xcframeworks\n" 1>>"${BASEDIR}"/build.log 2>&1 + + for library in {0..46}; do + if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then + create_framework "${library}" 2 + create_framework "${library}" 3 + create_framework "${library}" 4 + fi + done + + create_ffmpeg_framework 2 + create_ffmpeg_framework 3 + create_ffmpeg_framework 4 + + create_ffmpeg_kit_framework 2 + create_ffmpeg_kit_framework 3 + create_ffmpeg_kit_framework 4 + + echo -e "INFO: Frameworks for xcframeworks built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 +} + +create_ios_xcframeworks() { + export ARCHITECTURE_VARIANT_ARRAY=(2 3 4) + echo -e "INFO: Building xcframeworks\n" 1>>"${BASEDIR}"/build.log 2>&1 + + for library in {0..46}; do + if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then + create_xcframework "${library}" + fi + done + + create_ffmpeg_xcframework + + create_ffmpeg_kit_xcframework + + echo -e "INFO: xcframeworks built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 +} diff --git a/scripts/function-macos.sh b/scripts/function-macos.sh index beb3fa1..afd68be 100755 --- a/scripts/function-macos.sh +++ b/scripts/function-macos.sh @@ -1,36 +1,27 @@ #!/bin/bash -source "${BASEDIR}/scripts/function.sh" +source "${BASEDIR}/scripts/function-apple.sh" enable_default_macos_architectures() { + ENABLED_ARCHITECTURES[ARCH_ARM64]=1 ENABLED_ARCHITECTURES[ARCH_X86_64]=1 } -get_ffmpeg_kit_version() { - local FFMPEG_KIT_VERSION=$(grep 'const FFMPEG_KIT_VERSION' "${BASEDIR}"/objc/src/FFmpegKit.m | grep -Eo '\".*\"' | sed -e 's/\"//g') - - if [[ -z ${FFMPEG_KIT_LTS_BUILD} ]]; then - echo "${FFMPEG_KIT_VERSION}" - else - echo "${FFMPEG_KIT_VERSION}.LTS" - fi -} - display_help() { COMMAND=$(echo "$0" | sed -e 's/\.\///g') - echo -e "\n'$COMMAND' builds FFmpegKit for macOS platform. By default only one architecture (x86-64) is built \ + echo -e "\n'$COMMAND' builds FFmpegKit for macOS platform. By default two architectures (arm64 and x86-64) are built \ without any external libraries enabled. Options can be used to disable architectures and/or enable external libraries. \ Please note that GPL libraries (external libraries with GPL license) need --enable-gpl flag to be set explicitly. \ -When compilation ends, library bundles are created under the prebuilt folder. By default framework bundles and \ -universal fat binaries are created. If --xcframework option is provided then xcframework bundles are created.\n" +When compilation ends, libraries are created under the prebuilt folder.\n" echo -e "Usage: ./$COMMAND [OPTION]...\n" echo -e "Specify environment variables as VARIABLE=VALUE to override default build options.\n" - display_help_options " -x, --xcframework\t\tbuild xcframework bundles instead of framework bundles and universal libraries" + display_help_options " -x, --xcframework\t\tbuild xcframework bundles instead of framework bundles and universal libraries" " -l, --lts build lts packages to support sdk 10.11+ devices" display_help_licensing echo -e "Architectures:" + echo -e " --disable-arm64\t\tdo not build arm64 architecture [yes]" echo -e " --disable-x86-64\t\tdo not build x86-64 architecture [yes]\n" echo -e "Libraries:" @@ -62,172 +53,6 @@ enable_lts_build() { export MACOS_MIN_VERSION=10.11 } -# 1 - library index -# 2 - library name -# 3 - static library name -# 4 - library version -create_external_library_package() { - if [[ -n ${FFMPEG_KIT_XCF_BUILD} ]]; then - - # 1. CREATE INDIVIDUAL FRAMEWORKS - for TARGET_ARCH in "${TARGET_ARCH_LIST[@]}"; do - local FRAMEWORK_PATH=${BASEDIR}/prebuilt/macos-xcframework/.tmp/macos-${TARGET_ARCH}/$2.framework - mkdir -p "${FRAMEWORK_PATH}" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - local STATIC_LIBRARY_PATH=$(find "${BASEDIR}"/prebuilt/macos-${TARGET_ARCH} -name $3) - local CAPITAL_CASE_LIBRARY_NAME=$(to_capital_case "$2") - - build_info_plist "${FRAMEWORK_PATH}/Info.plist" "$2" "com.arthenica.ffmpegkit.${CAPITAL_CASE_LIBRARY_NAME}" "$4" "$4" - cp "${STATIC_LIBRARY_PATH}" "${FRAMEWORK_PATH}/$2" 1>>"${BASEDIR}"/build.log 2>&1 - done - - # 2. CREATE XCFRAMEWORKS - local XCFRAMEWORK_PATH=${BASEDIR}/prebuilt/macos-xcframework/$2.xcframework - mkdir -p "${XCFRAMEWORK_PATH}" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - - BUILD_COMMAND="xcodebuild -create-xcframework " - - for TARGET_ARCH in "${TARGET_ARCH_LIST[@]}"; do - local FRAMEWORK_PATH=${BASEDIR}/prebuilt/macos-xcframework/.tmp/macos-${TARGET_ARCH}/$2.framework - BUILD_COMMAND+=" -framework ${FRAMEWORK_PATH}" - done - - BUILD_COMMAND+=" -output ${XCFRAMEWORK_PATH}" - - COMMAND_OUTPUT=$(${BUILD_COMMAND} 2>&1) - - echo "${COMMAND_OUTPUT}" 1>>"${BASEDIR}"/build.log 2>&1 - - echo "" 1>>"${BASEDIR}"/build.log 2>&1 - - if [[ ${COMMAND_OUTPUT} == *"is empty in library"* ]]; then - RC=1 - else - RC=0 - fi - - else - - # 1. CREATE FAT LIBRARY - local FAT_LIBRARY_PATH=${BASEDIR}/prebuilt/macos-universal/$2-universal - - mkdir -p "${FAT_LIBRARY_PATH}/lib" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 - - LIPO_COMMAND="${LIPO} -create" - - for TARGET_ARCH in "${TARGET_ARCH_LIST[@]}"; do - LIPO_COMMAND+=" $(find "${BASEDIR}"/prebuilt/macos-"${TARGET_ARCH}" -name $3)" - done - - LIPO_COMMAND+=" -output ${FAT_LIBRARY_PATH}/lib/$3" - - RC=$(${LIPO_COMMAND} 1>>"${BASEDIR}"/build.log 2>&1) - - if [[ ${RC} -eq 0 ]]; then - - # 2. CREATE FRAMEWORK - RC=$(create_static_framework "$2" "$3" "$4") - - if [[ ${RC} -eq 0 ]]; then - - # 3. COPY LICENSES - if [[ ${LIBRARY_LIBTHEORA} == "$1" ]]; then - license_directories=("${BASEDIR}/prebuilt/macos-universal/libtheora-universal" "${BASEDIR}/prebuilt/macos-universal/libtheoraenc-universal" "${BASEDIR}/prebuilt/macos-universal/libtheoradec-universal" "${BASEDIR}/prebuilt/macos-framework/libtheora.framework" "${BASEDIR}/prebuilt/macos-framework/libtheoraenc.framework" "${BASEDIR}/prebuilt/macos-framework/libtheoradec.framework") - elif [[ ${LIBRARY_LIBVORBIS} == "$1" ]]; then - license_directories=("${BASEDIR}/prebuilt/macos-universal/libvorbisfile-universal" "${BASEDIR}/prebuilt/macos-universal/libvorbisenc-universal" "${BASEDIR}/prebuilt/macos-universal/libvorbis-universal" "${BASEDIR}/prebuilt/macos-framework/libvorbisfile.framework" "${BASEDIR}/prebuilt/macos-framework/libvorbisenc.framework" "${BASEDIR}/prebuilt/macos-framework/libvorbis.framework") - elif [[ ${LIBRARY_LIBWEBP} == "$1" ]]; then - license_directories=("${BASEDIR}/prebuilt/macos-universal/libwebpmux-universal" "${BASEDIR}/prebuilt/macos-universal/libwebpdemux-universal" "${BASEDIR}/prebuilt/macos-universal/libwebp-universal" "${BASEDIR}/prebuilt/macos-framework/libwebpmux.framework" "${BASEDIR}/prebuilt/macos-framework/libwebpdemux.framework" "${BASEDIR}/prebuilt/macos-framework/libwebp.framework") - elif [[ ${LIBRARY_OPENCOREAMR} == "$1" ]]; then - license_directories=("${BASEDIR}/prebuilt/macos-universal/libopencore-amrnb-universal" "${BASEDIR}/prebuilt/macos-framework/libopencore-amrnb.framework") - elif [[ ${LIBRARY_NETTLE} == "$1" ]]; then - license_directories=("${BASEDIR}/prebuilt/macos-universal/libnettle-universal" "${BASEDIR}/prebuilt/macos-universal/libhogweed-universal" "${BASEDIR}/prebuilt/macos-framework/libnettle.framework" "${BASEDIR}/prebuilt/macos-framework/libhogweed.framework") - else - license_directories=("${BASEDIR}/prebuilt/macos-universal/$2-universal" "${BASEDIR}/prebuilt/macos-framework/$2.framework") - fi - - RC=$(copy_external_library_license "$1" "${license_directories[@]}") - fi - - fi - - fi - - echo "${RC}" -} - -# 1 - library index -# 2 - output path -copy_external_library_license() { - output_path_array="$2" - for output_path in "${output_path_array[@]}"; do - $(cp $(get_external_library_license_path "$1") "${output_path}/LICENSE" 1>>"${BASEDIR}"/build.log 2>&1) - if [ $? -ne 0 ]; then - echo 1 - return - fi - done - echo 0 -} - -get_external_library_version() { - local library_version=$(grep Version "${BASEDIR}"/prebuilt/macos-"${TARGET_ARCH_LIST[0]}"/pkgconfig/"$1".pc 2>>"${BASEDIR}"/build.log | sed 's/Version://g;s/\ //g') - - echo "${library_version}" -} - -get_target_host() { - case ${ARCH} in - *) - echo "$(get_target_arch)-macos-darwin" - ;; - esac -} - -get_target_build_directory() { - case ${ARCH} in - x86-64) - echo "macos-x86_64" - ;; - *) - echo "macos-${ARCH}" - ;; - esac -} - -get_target_arch() { - case ${ARCH} in - arm64) - echo "aarch64" - ;; - x86-64) - echo "x86_64" - ;; - esac -} - -get_target_sdk() { - echo "$(get_target_arch)-apple-macos${TVOS_MIN_VERSION}" -} - -get_sdk_name() { - case ${ARCH} in - arm64 | x86-64) - echo "macosx" - ;; - esac -} - -get_sdk_path() { - echo "$(xcrun --sdk "$(get_sdk_name)" --show-sdk-path)" -} - -get_min_version_cflags() { - case ${ARCH} in - arm64 | x86-64) - echo "-mmacosx-version-min=${MACOS_MIN_VERSION}" - ;; - esac -} - get_common_includes() { echo "-I${SDK_PATH}/usr/include" } @@ -239,16 +64,23 @@ get_common_cflags() { local BUILD_DATE="-DFFMPEG_KIT_BUILD_DATE=$(date +%Y%m%d 2>>"${BASEDIR}"/build.log)" - echo "-fstrict-aliasing -fembed-bitcode -DMACOSX ${LTS_BUILD_FLAG}${BUILD_DATE} -isysroot ${SDK_PATH}" + case ${ARCH} in + arm64) + echo "-fstrict-aliasing -fembed-bitcode -DMACOSX ${LTS_BUILD_FLAG}${BUILD_DATE} -isysroot ${SDK_PATH}" + ;; + *) + echo "-fstrict-aliasing -DMACOSX ${LTS_BUILD_FLAG}${BUILD_DATE} -isysroot ${SDK_PATH}" + ;; + esac } get_arch_specific_cflags() { case ${ARCH} in arm64) - echo "-arch arm64 -target $(get_target_host) -march=armv8-a+crc+crypto -mcpu=generic -DFFMPEG_KIT_ARM64" + echo "-arch arm64 -target $(get_target) -march=armv8-a+crc+crypto -mcpu=generic -DFFMPEG_KIT_ARM64" ;; x86-64) - echo "-arch x86_64 -target $(get_target_host) -march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel -DFFMPEG_KIT_X86_64" + echo "-arch x86_64 -target $(get_target) -march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel -DFFMPEG_KIT_X86_64" ;; esac } @@ -257,9 +89,12 @@ get_size_optimization_cflags() { local ARCH_OPTIMIZATION="" case ${ARCH} in - arm64 | x86-64) + arm64) ARCH_OPTIMIZATION="-Oz -Wno-ignored-optimization-argument" ;; + x86-64) + ARCH_OPTIMIZATION="-O2 -Wno-ignored-optimization-argument" + ;; esac echo "${ARCH_OPTIMIZATION}" @@ -271,9 +106,12 @@ get_size_optimization_asm_cflags() { case $1 in jpeg | ffmpeg) case ${ARCH} in - arm64 | x86-64) + arm64) ARCH_OPTIMIZATION="-Oz" ;; + x86-64) + ARCH_OPTIMIZATION="-O2" + ;; esac ;; *) @@ -309,8 +147,8 @@ get_app_specific_cflags() { libwebp | xvidcore) APP_FLAGS="-fno-common -DPIC" ;; - sdl2) - APP_FLAGS="-DPIC -Wno-unused-function -D__IPHONEOS__" + sdl) + APP_FLAGS="-DPIC -Wno-unused-function -D__MACOSX__" ;; shine) APP_FLAGS="-Wno-unused-function" @@ -420,10 +258,10 @@ get_size_optimization_ldflags() { get_arch_specific_ldflags() { case ${ARCH} in arm64) - echo "-arch arm64 -march=armv8-a+crc+crypto -fembed-bitcode -target $(get_target_host)" + echo "-arch arm64 -march=armv8-a+crc+crypto -fembed-bitcode -target $(get_target)" ;; x86-64) - echo "-arch x86_64 -march=x86-64 -fembed-bitcode -target $(get_target_host)" + echo "-arch x86_64 -march=x86-64 -target $(get_target)" ;; esac } @@ -441,9 +279,12 @@ get_ldflags() { case $1 in ffmpeg-kit) case ${ARCH} in - arm64 | x86-64) + arm64) echo "${ARCH_FLAGS} ${LINKED_LIBRARIES} ${COMMON_FLAGS} -fembed-bitcode -Wc,-fembed-bitcode ${OPTIMIZATION_FLAGS}" ;; + x86-64) + echo "${ARCH_FLAGS} ${LINKED_LIBRARIES} ${COMMON_FLAGS} ${OPTIMIZATION_FLAGS}" + ;; esac ;; *) @@ -452,373 +293,6 @@ get_ldflags() { esac } -create_fontconfig_package_config() { - local FONTCONFIG_VERSION="$1" - - cat >"${INSTALL_PKG_CONFIG_DIR}/fontconfig.pc" <= 21.0.15, uuid, expat >= 2.2.0, libiconv -Requires.private: -Libs: -L\${libdir} -lfontconfig -Libs.private: -Cflags: -I\${includedir} -EOF -} - -create_freetype_package_config() { - local FREETYPE_VERSION="$1" - - cat >"${INSTALL_PKG_CONFIG_DIR}/freetype2.pc" <"${INSTALL_PKG_CONFIG_DIR}/giflib.pc" <"${INSTALL_PKG_CONFIG_DIR}/gmp.pc" <"${INSTALL_PKG_CONFIG_DIR}/gnutls.pc" <"${INSTALL_PKG_CONFIG_DIR}/libmp3lame.pc" <"${INSTALL_PKG_CONFIG_DIR}/libiconv.pc" <"${INSTALL_PKG_CONFIG_DIR}/libpng.pc" <"${INSTALL_PKG_CONFIG_DIR}/vorbis.pc" <"${INSTALL_PKG_CONFIG_DIR}/vorbisenc.pc" <"${INSTALL_PKG_CONFIG_DIR}/vorbisfile.pc" <"${INSTALL_PKG_CONFIG_DIR}/libxml-2.0.pc" <"${INSTALL_PKG_CONFIG_DIR}/snappy.pc" <"${INSTALL_PKG_CONFIG_DIR}/soxr.pc" <"${INSTALL_PKG_CONFIG_DIR}/tesseract.pc" <"${INSTALL_PKG_CONFIG_DIR}/uuid.pc" <"${INSTALL_PKG_CONFIG_DIR}/xvidcore.pc" <"${INSTALL_PKG_CONFIG_DIR}/zlib.pc" <"${INSTALL_PKG_CONFIG_DIR}/bzip2.pc" <>"${BASEDIR}"/build.log 2>&1 + + if [[ $(is_apple_architecture_variant_supported 8) -eq 1 ]]; then + mkdir -p "${BASEDIR}/prebuilt/$(get_universal_library_directory 8)" 1>>"${BASEDIR}"/build.log 2>&1 + mkdir -p "${BASEDIR}/prebuilt/$(get_framework_directory 8)" 1>>"${BASEDIR}"/build.log 2>&1 + fi + + echo -e "DEBUG: Initializing xcframework directory at ${BASEDIR}/prebuilt/$(get_xcframework_directory)\n" 1>>"${BASEDIR}"/build.log 2>&1 + + # XCF BUILDS GENERATE XCFFRAMEWORKS + mkdir -p "${BASEDIR}/prebuilt/$(get_xcframework_directory)" 1>>"${BASEDIR}"/build.log 2>&1 + else + + echo -e "DEBUG: Initializing default universal directory at ${BASEDIR}/prebuilt/$(get_universal_library_directory 1)\n" 1>>"${BASEDIR}"/build.log 2>&1 + + # DEFAULT BUILDS GENERATE UNIVERSAL LIBRARIES AND FRAMEWORKS + mkdir -p "${BASEDIR}/prebuilt/$(get_universal_library_directory 8)" 1>>"${BASEDIR}"/build.log 2>&1 + + echo -e "DEBUG: Initializing framework directory at ${BASEDIR}/prebuilt/$(get_framework_directory 1)\n" 1>>"${BASEDIR}"/build.log 2>&1 + + mkdir -p "${BASEDIR}/prebuilt/$(get_framework_directory 8)" 1>>"${BASEDIR}"/build.log 2>&1 + fi +} + +# +# DEPENDS TARGET_ARCH_LIST VARIABLE +# +create_universal_libraries_for_macos_default_frameworks() { + local ROOT_UNIVERSAL_DIRECTORY_PATH="${BASEDIR}/prebuilt/$(get_universal_library_directory 1)" + + echo -e "INFO: Building universal libraries in ${ROOT_UNIVERSAL_DIRECTORY_PATH} for default frameworks using ${TARGET_ARCH_LIST[@]}\n" 1>>"${BASEDIR}"/build.log 2>&1 + + for library in {0..46}; do + if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then + create_universal_library "${library}" 8 + fi + done + + create_ffmpeg_universal_library 8 + + create_ffmpeg_kit_universal_library 8 + + echo -e "INFO: Universal libraries for default frameworks built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 +} + +create_macos_default_frameworks() { + echo -e "INFO: Building default frameworks\n" 1>>"${BASEDIR}"/build.log 2>&1 + + for library in {0..46}; do + if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then + create_framework "${library}" 8 + fi + done + + create_ffmpeg_framework 8 + + create_ffmpeg_kit_framework 8 + + echo -e "INFO: Default frameworks built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 +} + +create_universal_libraries_for_macos_xcframeworks() { + echo -e "INFO: Building universal libraries for xcframeworks using ${TARGET_ARCH_LIST[@]}\n" 1>>"${BASEDIR}"/build.log 2>&1 + + for library in {0..46}; do + if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then + create_universal_library "${library}" 8 + fi + done + + create_ffmpeg_universal_library 8 + + create_ffmpeg_kit_universal_library 8 + + echo -e "INFO: Universal libraries for xcframeworks built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 +} + +create_frameworks_for_macos_xcframeworks() { + echo -e "INFO: Building frameworks for xcframeworks\n" 1>>"${BASEDIR}"/build.log 2>&1 + + for library in {0..46}; do + if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then + create_framework "${library}" 8 + fi + done + + create_ffmpeg_framework 8 + + create_ffmpeg_kit_framework 8 + + echo -e "INFO: Frameworks for xcframeworks built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 +} + +create_macos_xcframeworks() { + export ARCHITECTURE_VARIANT_ARRAY=(8) + echo -e "INFO: Building xcframeworks\n" 1>>"${BASEDIR}"/build.log 2>&1 + + for library in {0..46}; do + if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then + create_xcframework "${library}" + fi + done + + create_ffmpeg_xcframework + + create_ffmpeg_kit_xcframework + + echo -e "INFO: xcframeworks built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 +} diff --git a/scripts/function-tvos.sh b/scripts/function-tvos.sh index e7f433f..f99bf79 100755 --- a/scripts/function-tvos.sh +++ b/scripts/function-tvos.sh @@ -1,33 +1,23 @@ #!/bin/bash -source "${BASEDIR}/scripts/function.sh" +source "${BASEDIR}/scripts/function-apple.sh" enable_default_tvos_architectures() { ENABLED_ARCHITECTURES[ARCH_ARM64]=1 ENABLED_ARCHITECTURES[ARCH_X86_64]=1 } -get_ffmpeg_kit_version() { - local FFMPEG_KIT_VERSION=$(grep 'const FFMPEG_KIT_VERSION' "${BASEDIR}"/objc/src/FFmpegKit.m | grep -Eo '\".*\"' | sed -e 's/\"//g') - - if [[ -z ${FFMPEG_KIT_LTS_BUILD} ]]; then - echo "${FFMPEG_KIT_VERSION}" - else - echo "${FFMPEG_KIT_VERSION}.LTS" - fi -} - display_help() { COMMAND=$(echo "$0" | sed -e 's/\.\///g') echo -e "\n'$COMMAND' builds FFmpegKit for tvOS platform. By default two architectures (arm64 and x86-64) are built \ without any external libraries enabled. Options can be used to disable architectures and/or enable external libraries. \ Please note that GPL libraries (external libraries with GPL license) need --enable-gpl flag to be set explicitly. \ -When compilation ends, framework bundles and universal fat binaries are created under the prebuilt folder.\n" +When compilation ends, libraries are created under the prebuilt folder.\n" echo -e "Usage: ./$COMMAND [OPTION]...\n" echo -e "Specify environment variables as VARIABLE=VALUE to override default build options.\n" - display_help_options + display_help_options " -x, --xcframework\t\tbuild xcframework bundles instead of framework bundles and universal libraries" " -l, --lts build lts packages to support sdk 9.2+ devices" display_help_licensing echo -e "Architectures:" @@ -64,85 +54,6 @@ enable_lts_build() { ENABLED_LIBRARIES[LIBRARY_VIDEOTOOLBOX]=0 } -create_static_fat_library() { - local FAT_LIBRARY_PATH="${BASEDIR}"/prebuilt/tvos-universal/"$2"-universal - - mkdir -p "${FAT_LIBRARY_PATH}"/lib 1>>"${BASEDIR}"/build.log 2>&1 - - LIPO_COMMAND="${LIPO} -create" - - for TARGET_ARCH in "${TARGET_ARCH_LIST[@]}"; do - LIPO_COMMAND+=" $(find "${BASEDIR}"/prebuilt/tvos-"${TARGET_ARCH}"-apple-darwin -name $1)" - done - - LIPO_COMMAND+=" -output ${FAT_LIBRARY_PATH}/lib/$1" - - RC=$(${LIPO_COMMAND} 1>>"${BASEDIR}"/build.log 2>&1) - - echo ${RC} -} - -get_external_library_version() { - local library_version=$(grep Version "${BASEDIR}"/prebuilt/tvos-"${TARGET_ARCH_LIST[0]}"-apple-darwin/pkgconfig/"$1".pc 2>>"${BASEDIR}"/build.log | sed 's/Version://g;s/\ //g') - - echo "${library_version}" -} - -get_target_build_directory() { - case ${ARCH} in - x86-64) - echo "tvos-x86_64-apple-darwin" - ;; - *) - echo "tvos-${ARCH}-apple-darwin" - ;; - esac -} - -get_target_arch() { - case ${ARCH} in - arm64) - echo "aarch64" - ;; - x86-64) - echo "x86_64" - ;; - *) - echo "${ARCH}" - ;; - esac -} - -get_target_sdk() { - echo "$(get_target_arch)-apple-tvos${TVOS_MIN_VERSION}" -} - -get_sdk_name() { - case ${ARCH} in - arm64) - echo "appletvos" - ;; - x86-64) - echo "appletvsimulator" - ;; - esac -} - -get_sdk_path() { - echo "$(xcrun --sdk "$(get_sdk_name)" --show-sdk-path)" -} - -get_min_version_cflags() { - case ${ARCH} in - arm64) - echo "-mappletvos-version-min=${TVOS_MIN_VERSION}" - ;; - x86-64) - echo "-mappletvsimulator-version-min=${TVOS_MIN_VERSION}" - ;; - esac -} - get_common_includes() { echo "-I${SDK_PATH}/usr/include" } @@ -155,22 +66,22 @@ get_common_cflags() { local BUILD_DATE="-DFFMPEG_KIT_BUILD_DATE=$(date +%Y%m%d 2>>"${BASEDIR}"/build.log)" case ${ARCH} in - i386 | x86-64) - echo "-fstrict-aliasing -DTVOS ${LTS_BUILD_FLAG}${BUILD_DATE} -isysroot ${SDK_PATH}" - ;; - *) + arm64) echo "-fstrict-aliasing -fembed-bitcode -DTVOS ${LTS_BUILD_FLAG}${BUILD_DATE} -isysroot ${SDK_PATH}" ;; + x86-64) + echo "-fstrict-aliasing -DTVOS ${LTS_BUILD_FLAG}${BUILD_DATE} -isysroot ${SDK_PATH}" + ;; esac } get_arch_specific_cflags() { case ${ARCH} in arm64) - echo "-arch arm64 -target $(get_build_host) -march=armv8-a+crc+crypto -mcpu=generic -DFFMPEG_KIT_ARM64" + echo "-arch arm64 -target $(get_target) -march=armv8-a+crc+crypto -mcpu=generic -DFFMPEG_KIT_ARM64" ;; x86-64) - echo "-arch x86_64 -target $(get_build_host) -march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel -DFFMPEG_KIT_X86_64" + echo "-arch x86_64 -target $(get_target) -march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel -DFFMPEG_KIT_X86_64" ;; esac } @@ -264,7 +175,7 @@ get_app_specific_cflags() { ffmpeg-kit) APP_FLAGS="-std=c99 -Wno-unused-function -Wall -Wno-deprecated-declarations -Wno-pointer-sign -Wno-switch -Wno-unused-result -Wno-unused-variable -DPIC -fobjc-arc" ;; - sdl2) + sdl) APP_FLAGS="-DPIC -Wno-unused-function -D__TVOS__" ;; shine) @@ -425,373 +336,6 @@ get_ldflags() { esac } -create_fontconfig_package_config() { - local FONTCONFIG_VERSION="$1" - - cat >"${INSTALL_PKG_CONFIG_DIR}/fontconfig.pc" <= 21.0.15, uuid, expat >= 2.2.0, libiconv -Requires.private: -Libs: -L\${libdir} -lfontconfig -Libs.private: -Cflags: -I\${includedir} -EOF -} - -create_freetype_package_config() { - local FREETYPE_VERSION="$1" - - cat >"${INSTALL_PKG_CONFIG_DIR}/freetype2.pc" <"${INSTALL_PKG_CONFIG_DIR}/giflib.pc" <"${INSTALL_PKG_CONFIG_DIR}/gmp.pc" <"${INSTALL_PKG_CONFIG_DIR}/gnutls.pc" <"${INSTALL_PKG_CONFIG_DIR}/libmp3lame.pc" <"${INSTALL_PKG_CONFIG_DIR}/libiconv.pc" <"${INSTALL_PKG_CONFIG_DIR}/libpng.pc" <"${INSTALL_PKG_CONFIG_DIR}/vorbis.pc" <"${INSTALL_PKG_CONFIG_DIR}/vorbisenc.pc" <"${INSTALL_PKG_CONFIG_DIR}/vorbisfile.pc" <"${INSTALL_PKG_CONFIG_DIR}/libxml-2.0.pc" <"${INSTALL_PKG_CONFIG_DIR}/snappy.pc" <"${INSTALL_PKG_CONFIG_DIR}/soxr.pc" <"${INSTALL_PKG_CONFIG_DIR}/tesseract.pc" <"${INSTALL_PKG_CONFIG_DIR}/uuid.pc" <"${INSTALL_PKG_CONFIG_DIR}/xvidcore.pc" <"${INSTALL_PKG_CONFIG_DIR}/zlib.pc" <"${INSTALL_PKG_CONFIG_DIR}/bzip2.pc" <>"${BASEDIR}"/build.log 2>&1 + + if [[ $(is_apple_architecture_variant_supported 6) -eq 1 ]]; then + mkdir -p "${BASEDIR}/prebuilt/$(get_universal_library_directory 6)" 1>>"${BASEDIR}"/build.log 2>&1 + mkdir -p "${BASEDIR}/prebuilt/$(get_framework_directory 6)" 1>>"${BASEDIR}"/build.log 2>&1 + fi + if [[ $(is_apple_architecture_variant_supported 7) -eq 1 ]]; then + mkdir -p "${BASEDIR}/prebuilt/$(get_universal_library_directory 7)" 1>>"${BASEDIR}"/build.log 2>&1 + mkdir -p "${BASEDIR}/prebuilt/$(get_framework_directory 7)" 1>>"${BASEDIR}"/build.log 2>&1 + fi + + echo -e "DEBUG: Initializing xcframework directory at ${BASEDIR}/prebuilt/$(get_xcframework_directory)\n" 1>>"${BASEDIR}"/build.log 2>&1 + + # XCF BUILDS GENERATE XCFFRAMEWORKS + mkdir -p "${BASEDIR}/prebuilt/$(get_xcframework_directory)" 1>>"${BASEDIR}"/build.log 2>&1 + else + + echo -e "DEBUG: Initializing default universal directory at ${BASEDIR}/prebuilt/$(get_universal_library_directory 1)\n" 1>>"${BASEDIR}"/build.log 2>&1 + + # DEFAULT BUILDS GENERATE UNIVERSAL LIBRARIES AND FRAMEWORKS + mkdir -p "${BASEDIR}/prebuilt/$(get_universal_library_directory 5)" 1>>"${BASEDIR}"/build.log 2>&1 + + echo -e "DEBUG: Initializing framework directory at ${BASEDIR}/prebuilt/$(get_framework_directory 1)\n" 1>>"${BASEDIR}"/build.log 2>&1 + + mkdir -p "${BASEDIR}/prebuilt/$(get_framework_directory 5)" 1>>"${BASEDIR}"/build.log 2>&1 + fi +} + +# +# DEPENDS TARGET_ARCH_LIST VARIABLE +# +create_universal_libraries_for_tvos_default_frameworks() { + local ROOT_UNIVERSAL_DIRECTORY_PATH="${BASEDIR}/prebuilt/$(get_universal_library_directory 1)" + + echo -e "INFO: Building universal libraries in ${ROOT_UNIVERSAL_DIRECTORY_PATH} for default frameworks using ${TARGET_ARCH_LIST[@]}\n" 1>>"${BASEDIR}"/build.log 2>&1 + + for library in {0..46}; do + if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then + create_universal_library "${library}" 5 + fi + done + + create_ffmpeg_universal_library 5 + + create_ffmpeg_kit_universal_library 5 + + echo -e "INFO: Universal libraries for default frameworks built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 +} + +create_tvos_default_frameworks() { + echo -e "INFO: Building default frameworks\n" 1>>"${BASEDIR}"/build.log 2>&1 + + for library in {0..46}; do + if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then + create_framework "${library}" 5 + fi + done + + create_ffmpeg_framework 5 + + create_ffmpeg_kit_framework 5 + + echo -e "INFO: Default frameworks built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 +} + +create_universal_libraries_for_tvos_xcframeworks() { + echo -e "INFO: Building universal libraries for xcframeworks using ${TARGET_ARCH_LIST[@]}\n" 1>>"${BASEDIR}"/build.log 2>&1 + + for library in {0..46}; do + if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then + create_universal_library "${library}" 6 + create_universal_library "${library}" 7 + fi + done + + create_ffmpeg_universal_library 6 + create_ffmpeg_universal_library 7 + + create_ffmpeg_kit_universal_library 6 + create_ffmpeg_kit_universal_library 7 + + echo -e "INFO: Universal libraries for xcframeworks built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 +} + +create_frameworks_for_tvos_xcframeworks() { + echo -e "INFO: Building frameworks for xcframeworks\n" 1>>"${BASEDIR}"/build.log 2>&1 + + for library in {0..46}; do + if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then + create_framework "${library}" 6 + create_framework "${library}" 7 + fi + done + + create_ffmpeg_framework 6 + create_ffmpeg_framework 7 + + create_ffmpeg_kit_framework 6 + create_ffmpeg_kit_framework 7 + + echo -e "INFO: Frameworks for xcframeworks built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 +} + +create_tvos_xcframeworks() { + export ARCHITECTURE_VARIANT_ARRAY=(6 7) + echo -e "INFO: Building xcframeworks\n" 1>>"${BASEDIR}"/build.log 2>&1 + + for library in {0..46}; do + if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then + create_xcframework "${library}" + fi + done + + create_ffmpeg_xcframework + + create_ffmpeg_kit_xcframework + + echo -e "INFO: xcframeworks built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 +} diff --git a/scripts/function.sh b/scripts/function.sh index 0e46a19..2ca5004 100755 --- a/scripts/function.sh +++ b/scripts/function.sh @@ -9,12 +9,22 @@ get_arch_name() { 2) echo "armv7" ;; # ios 3) echo "armv7s" ;; # ios 4) echo "arm64-v8a" ;; # android - 5) echo "arm64" ;; # ios, tvos + 5) echo "arm64" ;; # ios, tvos, macos 6) echo "arm64e" ;; # ios 7) echo "i386" ;; # ios 8) echo "x86" ;; # android 9) echo "x86-64" ;; # android, ios, macos, tvos 10) echo "x86-64-mac-catalyst" ;; # ios + 11) echo "arm64-mac-catalyst" ;; # ios + 12) echo "arm64-simulator" ;; # ios + esac +} + +get_full_arch_name() { + case $1 in + 9) echo "x86_64" ;; + 10) echo "x86_64-mac-catalyst" ;; + *) get_arch_name "$1" ;; esac } @@ -25,12 +35,14 @@ from_arch_name() { armv7) echo 2 ;; # ios armv7s) echo 3 ;; # ios arm64-v8a) echo 4 ;; # android - arm64) echo 5 ;; # ios, tvos + arm64) echo 5 ;; # ios, tvos, macos arm64e) echo 6 ;; # ios i386) echo 7 ;; # ios x86) echo 8 ;; # android x86-64) echo 9 ;; # android, ios, macos, tvos x86-64-mac-catalyst) echo 10 ;; # ios + arm64-mac-catalyst) echo 11 ;; # ios + arm64-simulator) echo 12 ;; # ios esac } @@ -81,10 +93,11 @@ get_library_name() { 42) echo "libsndfile" ;; 43) echo "leptonica" ;; 44) echo "libsamplerate" ;; - 45) echo "cpu-features" ;; - 46) echo "android-zlib" ;; - 47) echo "android-media-codec" ;; - 48) + 45) echo "harfbuzz" ;; + 46) echo "cpu-features" ;; + 47) echo "android-zlib" ;; + 48) echo "android-media-codec" ;; + 49) if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]]; then echo "ios-zlib" elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]]; then @@ -93,7 +106,7 @@ get_library_name() { echo "tvos-zlib" fi ;; - 49) + 50) if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]]; then echo "ios-audiotoolbox" elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]]; then @@ -102,7 +115,7 @@ get_library_name() { echo "tvos-audiotoolbox" fi ;; - 50) + 51) if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]]; then echo "ios-bzip2" elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]]; then @@ -111,7 +124,7 @@ get_library_name() { echo "tvos-bzip2" fi ;; - 51) + 52) if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]]; then echo "ios-videotoolbox" elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]]; then @@ -120,14 +133,14 @@ get_library_name() { echo "tvos-videotoolbox" fi ;; - 52) + 53) if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]]; then echo "ios-avfoundation" elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]]; then echo "macos-avfoundation" fi ;; - 53) + 54) if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]]; then echo "ios-libiconv" elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]]; then @@ -136,7 +149,7 @@ get_library_name() { echo "tvos-libiconv" fi ;; - 54) + 55) if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]]; then echo "ios-libuuid" elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]]; then @@ -145,17 +158,17 @@ get_library_name() { echo "tvos-libuuid" fi ;; - 55) + 56) if [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]]; then echo "macos-coreimage" fi ;; - 56) + 57) if [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]]; then echo "macos-opencl" fi ;; - 57) + 58) if [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]]; then echo "macos-opengl" fi @@ -210,19 +223,20 @@ from_library_name() { libsndfile) echo 42 ;; leptonica) echo 43 ;; libsamplerate) echo 44 ;; - cpu-features) echo 45 ;; - android-zlib) echo 46 ;; - android-media-codec) echo 47 ;; - ios-zlib | macos-zlib | tvos-zlib) echo 48 ;; - ios-audiotoolbox | macos-audiotoolbox | tvos-audiotoolbox) echo 49 ;; - ios-bzip2 | macos-bzip2 | tvos-bzip2) echo 50 ;; - ios-videotoolbox | macos-videotoolbox | tvos-videotoolbox) echo 51 ;; - ios-avfoundation | macos-avfoundation) echo 52 ;; - ios-libiconv | macos-libiconv | tvos-libiconv) echo 53 ;; - ios-libuuid | macos-libuuid | tvos-libuuid) echo 54 ;; - macos-coreimage) echo 55 ;; - macos-opencl) echo 56 ;; - macos-opengl) echo 57 ;; + harfbuzz) echo 45 ;; + cpu-features) echo 46 ;; + android-zlib) echo 47 ;; + android-media-codec) echo 48 ;; + ios-zlib | macos-zlib | tvos-zlib) echo 49 ;; + ios-audiotoolbox | macos-audiotoolbox | tvos-audiotoolbox) echo 50 ;; + ios-bzip2 | macos-bzip2 | tvos-bzip2) echo 51 ;; + ios-videotoolbox | macos-videotoolbox | tvos-videotoolbox) echo 52 ;; + ios-avfoundation | macos-avfoundation) echo 53 ;; + ios-libiconv | macos-libiconv | tvos-libiconv) echo 54 ;; + ios-libuuid | macos-libuuid | tvos-libuuid) echo 55 ;; + macos-coreimage) echo 56 ;; + macos-opencl) echo 57 ;; + macos-opengl) echo 58 ;; esac } @@ -238,12 +252,12 @@ is_library_supported_on_platform() { 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 39 | 40) echo "0" ;; - 41 | 42 | 43 | 44) + 41 | 42 | 43 | 44 | 45) echo "0" ;; # ANDROID - 7 | 38 | 45 | 46 | 47) + 7 | 38 | 46 | 47 | 48) if [[ ${FFMPEG_KIT_BUILD_TYPE} == "android" ]]; then echo "0" else @@ -252,7 +266,7 @@ is_library_supported_on_platform() { ;; # ONLY IOS, MACOS AND TVOS MAIN - 51) + 52) if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]] && [[ $1 == "ios-videotoolbox" ]]; then echo "0" elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]] && [[ $1 == "macos-videotoolbox" ]]; then @@ -265,7 +279,7 @@ is_library_supported_on_platform() { ;; # ONLY IOS AND MACOS - 52) + 53) if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]] && [[ $1 == "ios-avfoundation" ]]; then echo "0" elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]] && [[ $1 == "macos-avfoundation" ]]; then @@ -276,7 +290,7 @@ is_library_supported_on_platform() { ;; # IOS, MACOS AND TVOS - 48 | 49 | 50 | 53 | 54) + 49 | 50 | 51 | 54 | 55) if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then echo "0" else @@ -285,7 +299,7 @@ is_library_supported_on_platform() { ;; # ONLY MACOS - 55 | 56 | 57) + 56 | 57 | 58) if [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]]; then echo "0" else @@ -318,7 +332,7 @@ is_arch_supported_on_platform() { ;; # IOS - $ARCH_ARMV7 | $ARCH_ARMV7S | $ARCH_ARM64E | $ARCH_I386 | $ARCH_X86_64_MAC_CATALYST) + $ARCH_ARMV7 | $ARCH_ARMV7S | $ARCH_ARM64E | $ARCH_I386 | $ARCH_X86_64_MAC_CATALYST | $ARCH_ARM64_MAC_CATALYST | $ARCH_ARM64_SIMULATOR) if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]]; then echo 1 else @@ -359,49 +373,69 @@ get_package_config_file_name() { 42) echo "sndfile" ;; 43) echo "lept" ;; 44) echo "samplerate" ;; - 54) echo "uuid" ;; + 55) echo "uuid" ;; *) echo "$(get_library_name "$1")" ;; esac } -get_static_archive_name() { - case $1 in - 5) echo "libmp3lame.a" ;; - 6) echo "libass.a" ;; - 10) echo "libvpx.a" ;; - 12) echo "libxml2.a" ;; - 21) echo "libvidstab.a" ;; - 23) echo "libilbc.a" ;; - 27) echo "libaom.a" ;; - 29) echo "libtwolame.a" ;; - 30) echo "libSDL2.a" ;; - 31) echo "libtesseract.a" ;; - 34) echo "libgif.a" ;; - 36) echo "libogg.a" ;; - 37) echo "libpng.a" ;; - 42) echo "libsndfile.a" ;; - 43) echo "liblept.a" ;; - 44) echo "libsamplerate.a" ;; - *) echo lib"$(get_library_name "$1")".a ;; +get_target() { + case ${ARCH} in + *-mac-catalyst) + echo "$(get_target_cpu)-apple-ios$(get_min_sdk_version)-macabi" + ;; + armv7 | armv7s | arm64e) + echo "$(get_target_cpu)-apple-ios$(get_min_sdk_version)" + ;; + i386) + echo "$(get_target_cpu)-apple-ios$(get_min_sdk_version)-simulator" + ;; + arm64) + if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]]; then + echo "$(get_target_cpu)-apple-ios$(get_min_sdk_version)" + elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]]; then + echo "$(get_target_cpu)-apple-macos$(get_min_sdk_version)" + elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then + echo "$(get_target_cpu)-apple-tvos$(get_min_sdk_version)" + fi + ;; + arm64-simulator) + echo "$(get_target_cpu)-apple-ios$(get_min_sdk_version)-simulator" + ;; + x86-64) + if [[ ${FFMPEG_KIT_BUILD_TYPE} == "android" ]]; then + echo "x86_64-linux-android" + elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]]; then + echo "$(get_target_cpu)-apple-ios$(get_min_sdk_version)-simulator" + elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]]; then + echo "$(get_target_cpu)-apple-darwin$(get_min_sdk_version)" + elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then + echo "$(get_target_cpu)-apple-tvos$(get_min_sdk_version)-simulator" + fi + ;; + *) + get_host + ;; esac } -get_build_host() { +get_host() { case ${ARCH} in arm-v7a | arm-v7a-neon) echo "arm-linux-androideabi" ;; - armv7 | armv7s | arm64e | i386 | x86-64-mac-catalyst) - echo "$(get_target_arch)-ios-darwin" + armv7 | armv7s | arm64e | i386 | *-mac-catalyst | arm64-simulator) + echo "$(get_target_cpu)-ios-darwin" ;; arm64-v8a) echo "aarch64-linux-android" ;; arm64) if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]]; then - echo "$(get_target_arch)-ios-darwin" + echo "$(get_target_cpu)-ios-darwin" + elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]]; then + echo "$(get_target_cpu)-apple-darwin" elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - echo "$(get_target_arch)-tvos-darwin" + echo "$(get_target_cpu)-tvos-darwin" fi ;; x86) @@ -411,11 +445,11 @@ get_build_host() { if [[ ${FFMPEG_KIT_BUILD_TYPE} == "android" ]]; then echo "x86_64-linux-android" elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]]; then - echo "$(get_target_arch)-ios-darwin" + echo "$(get_target_cpu)-ios-darwin" elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]]; then - echo "$(get_target_arch)-macos-darwin" + echo "$(get_target_cpu)-apple-darwin" elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - echo "$(get_target_arch)-tvos-darwin" + echo "$(get_target_cpu)-tvos-darwin" fi ;; esac @@ -452,17 +486,22 @@ optimize_for_speed() { } print_unknown_option() { - echo -e "\n(*) Unknown option \"$1\".\n\nSee $0 --help for available options." + echo -e "\n(*) Unknown option \"$1\".\n\nSee $0 --help for available options.\n" exit 1 } print_unknown_library() { - echo -e "\n(*) Unknown library \"$1\".\n\nSee $0 --help for available libraries." + echo -e "\n(*) Unknown library \"$1\".\n\nSee $0 --help for available libraries.\n" + exit 1 +} + +print_unknown_virtual_library() { + echo -e "\n(*) Unknown virtual library \"$1\".\n\nThis is a bug and must be reported to project developers.\n" exit 1 } print_unknown_arch() { - echo -e "\n(*) Unknown architecture \"$1\".\n\nSee $0 --help for available architectures." + echo -e "\n(*) Unknown architecture \"$1\".\n\nSee $0 --help for available architectures.\n" exit 1 } @@ -471,7 +510,7 @@ display_version() { echo -e "\ $COMMAND v$(get_ffmpeg_kit_version)\n -Copyright (c) 2018-2020 Taner Sener\n +Copyright (c) 2018-2021 Taner Sener\n License LGPLv3.0: GNU LGPL version 3 or later\n\ \n\ This is free software: you can redistribute it and/or modify it under the terms of the \ @@ -485,11 +524,13 @@ display_help_options() { echo -e " -v, --version\t\t\tdisplay version information and exit" echo -e " -d, --debug\t\t\tbuild with debug information" echo -e " -s, --speed\t\t\toptimize for speed instead of size" - echo -e " -l, --lts\t\t\tbuild lts packages to support API 16+ devices" echo -e " -f, --force\t\t\tignore warnings" if [ -n "$1" ]; then echo -e "$1" fi + if [ -n "$2" ]; then + echo -e "$2" + fi echo -e "" } @@ -509,7 +550,13 @@ display_help_common_libraries() { echo -e " --enable-lame\t\t\tbuild with lame [no]" echo -e " --enable-libaom\t\tbuild with libaom [no]" echo -e " --enable-libass\t\tbuild with libass [no]" - echo -e " --enable-libiconv\t\tbuild with libiconv [no]" + + case ${FFMPEG_KIT_BUILD_TYPE} in + ios | tvos | macos) + echo -e " --enable-libiconv\t\tbuild with libiconv [no]" + ;; + esac + echo -e " --enable-libilbc\t\tbuild with libilbc [no]" echo -e " --enable-libtheora\t\tbuild with libtheora [no]" echo -e " --enable-libvorbis\t\tbuild with libvorbis [no]" @@ -553,9 +600,9 @@ reconf_library() { local RECONF_VARIABLE=$(echo "RECONF_$1" | sed "s/\-/\_/g") local library_supported=0 - for library in {0..45}; do + for library in {0..46}; do library_name=$(get_library_name ${library}) - local library_supported_on_platform=$(is_library_supported_on_platform ${library_name}) + local library_supported_on_platform=$(is_library_supported_on_platform "${library_name}") if [[ $1 != "ffmpeg" ]] && [[ ${library_name} == "$1" ]] && [[ ${library_supported_on_platform} -eq 0 ]]; then export ${RECONF_VARIABLE}=1 @@ -564,7 +611,7 @@ reconf_library() { fi done - if [[ ${library_supported} -eq 1 ]]; then + if [[ ${library_supported} -ne 1 ]]; then echo -e "INFO: --reconf flag detected for library $1 is not supported.\n" 1>>"${BASEDIR}"/build.log 2>&1 fi } @@ -576,9 +623,9 @@ rebuild_library() { local REBUILD_VARIABLE=$(echo "REBUILD_$1" | sed "s/\-/\_/g") local library_supported=0 - for library in {0..45}; do + for library in {0..46}; do library_name=$(get_library_name ${library}) - local library_supported_on_platform=$(is_library_supported_on_platform ${library_name}) + local library_supported_on_platform=$(is_library_supported_on_platform "${library_name}") if [[ $1 != "ffmpeg" ]] && [[ ${library_name} == "$1" ]] && [[ ${library_supported_on_platform} -eq 0 ]]; then export ${REBUILD_VARIABLE}=1 @@ -587,7 +634,7 @@ rebuild_library() { fi done - if [[ ${library_supported} -eq 1 ]]; then + if [[ ${library_supported} -ne 1 ]]; then echo -e "INFO: --rebuild flag detected for library $1 is not supported.\n" 1>>"${BASEDIR}"/build.log 2>&1 fi } @@ -599,9 +646,9 @@ redownload_library() { local REDOWNLOAD_VARIABLE=$(echo "REDOWNLOAD_$1" | sed "s/\-/\_/g") local library_supported=0 - for library in {0..45}; do + for library in {0..46}; do library_name=$(get_library_name ${library}) - local library_supported_on_platform=$(is_library_supported_on_platform ${library_name}) + local library_supported_on_platform=$(is_library_supported_on_platform "${library_name}") if [[ ${library_name} == "$1" ]] && [[ ${library_supported_on_platform} -eq 0 ]]; then export ${REDOWNLOAD_VARIABLE}=1 @@ -616,13 +663,13 @@ redownload_library() { library_supported=1 fi - if [[ ${library_supported} -eq 1 ]]; then + if [[ ${library_supported} -ne 1 ]]; then echo -e "INFO: --redownload flag detected for library $1 is not supported.\n" 1>>"${BASEDIR}"/build.log 2>&1 fi } # -# 1. library index +# 1. library name # 2. ignore unknown libraries # enable_library() { @@ -634,7 +681,16 @@ enable_library() { fi } +# +# 1. library name +# 2. enable/disable +# set_library() { + local library_supported_on_platform=$(is_library_supported_on_platform "$1") + if [[ $library_supported_on_platform -ne 0 ]]; then + return + fi + case $1 in android-zlib) ENABLED_LIBRARIES[LIBRARY_ANDROID_ZLIB]=$2 @@ -643,31 +699,34 @@ set_library() { ENABLED_LIBRARIES[LIBRARY_ANDROID_MEDIA_CODEC]=$2 ;; ios-zlib | macos-zlib | tvos-zlib) - ENABLED_LIBRARIES[LIBRARY_OBJC_ZLIB]=$2 + ENABLED_LIBRARIES[LIBRARY_APPLE_ZLIB]=$2 ;; ios-audiotoolbox | macos-audiotoolbox | tvos-audiotoolbox) - ENABLED_LIBRARIES[LIBRARY_OBJC_AUDIOTOOLBOX]=$2 + ENABLED_LIBRARIES[LIBRARY_APPLE_AUDIOTOOLBOX]=$2 ;; ios-bzip2 | macos-bzip2 | tvos-bzip2) - ENABLED_LIBRARIES[LIBRARY_OBJC_BZIP2]=$2 + ENABLED_LIBRARIES[LIBRARY_APPLE_BZIP2]=$2 ;; ios-videotoolbox | macos-videotoolbox | tvos-videotoolbox) - ENABLED_LIBRARIES[LIBRARY_OBJC_VIDEOTOOLBOX]=$2 + ENABLED_LIBRARIES[LIBRARY_APPLE_VIDEOTOOLBOX]=$2 ;; ios-avfoundation | macos-avfoundation) - ENABLED_LIBRARIES[LIBRARY_OBJC_AVFOUNDATION]=$2 + ENABLED_LIBRARIES[LIBRARY_APPLE_AVFOUNDATION]=$2 ;; ios-libiconv | macos-libiconv | tvos-libiconv) - ENABLED_LIBRARIES[LIBRARY_OBJC_LIBICONV]=$2 + ENABLED_LIBRARIES[LIBRARY_APPLE_LIBICONV]=$2 + ;; + ios-libuuid | macos-libuuid | tvos-libuuid) + ENABLED_LIBRARIES[LIBRARY_APPLE_LIBUUID]=$2 ;; macos-coreimage) - ENABLED_LIBRARIES[LIBRARY_OBJC_COREIMAGE]=$2 + ENABLED_LIBRARIES[LIBRARY_APPLE_COREIMAGE]=$2 ;; macos-opencl) - ENABLED_LIBRARIES[LIBRARY_OBJC_OPENCL]=$2 + ENABLED_LIBRARIES[LIBRARY_APPLE_OPENCL]=$2 ;; macos-opengl) - ENABLED_LIBRARIES[LIBRARY_OBJC_OPENGL]=$2 + ENABLED_LIBRARIES[LIBRARY_APPLE_OPENGL]=$2 ;; chromaprint) ENABLED_LIBRARIES[LIBRARY_CHROMAPRINT]=$2 @@ -678,18 +737,14 @@ set_library() { ;; fontconfig) ENABLED_LIBRARIES[LIBRARY_FONTCONFIG]=$2 - if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - ENABLED_LIBRARIES[LIBRARY_OBJC_LIBUUID]=$2 - else - ENABLED_LIBRARIES[LIBRARY_LIBUUID]=$2 - fi ENABLED_LIBRARIES[LIBRARY_EXPAT]=$2 - ENABLED_LIBRARIES[LIBRARY_LIBICONV]=$2 + set_virtual_library "libiconv" $2 + set_virtual_library "libuuid" $2 set_library "freetype" $2 ;; freetype) ENABLED_LIBRARIES[LIBRARY_FREETYPE]=$2 - ENABLED_LIBRARIES[LIBRARY_ZLIB]=$2 + set_virtual_library "zlib" $2 set_library "libpng" $2 ;; fribidi) @@ -700,33 +755,35 @@ set_library() { ;; gnutls) ENABLED_LIBRARIES[LIBRARY_GNUTLS]=$2 - ENABLED_LIBRARIES[LIBRARY_ZLIB]=$2 + set_virtual_library "zlib" $2 set_library "nettle" $2 set_library "gmp" $2 - set_library "libiconv" $2 + set_virtual_library "libiconv" $2 + ;; + harfbuzz) + ENABLED_LIBRARIES[LIBRARY_HARFBUZZ]=$2 + set_library "fontconfig" $2 + set_library "freetype" $2 ;; kvazaar) ENABLED_LIBRARIES[LIBRARY_KVAZAAR]=$2 ;; lame) ENABLED_LIBRARIES[LIBRARY_LAME]=$2 - set_library "libiconv" $2 + set_virtual_library "libiconv" $2 ;; libaom) ENABLED_LIBRARIES[LIBRARY_LIBAOM]=$2 ;; libass) ENABLED_LIBRARIES[LIBRARY_LIBASS]=$2 - if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - ENABLED_LIBRARIES[LIBRARY_OBJC_LIBUUID]=$2 - else - ENABLED_LIBRARIES[LIBRARY_LIBUUID]=$2 - fi ENABLED_LIBRARIES[LIBRARY_EXPAT]=$2 + set_virtual_library "libuuid" $2 set_library "freetype" $2 set_library "fribidi" $2 set_library "fontconfig" $2 - set_library "libiconv" $2 + set_library "harfbuzz" $2 + set_virtual_library "libiconv" $2 ;; libiconv) ENABLED_LIBRARIES[LIBRARY_LIBICONV]=$2 @@ -736,13 +793,16 @@ set_library() { ;; libpng) ENABLED_LIBRARIES[LIBRARY_LIBPNG]=$2 - ENABLED_LIBRARIES[LIBRARY_ZLIB]=$2 + set_virtual_library "zlib" $2 ;; libtheora) ENABLED_LIBRARIES[LIBRARY_LIBTHEORA]=$2 ENABLED_LIBRARIES[LIBRARY_LIBOGG]=$2 set_library "libvorbis" $2 ;; + libuuid) + ENABLED_LIBRARIES[LIBRARY_LIBUUID]=$2 + ;; libvidstab) ENABLED_LIBRARIES[LIBRARY_LIBVIDSTAB]=$2 ;; @@ -762,7 +822,7 @@ set_library() { ;; libxml2) ENABLED_LIBRARIES[LIBRARY_LIBXML2]=$2 - set_library "libiconv" $2 + set_virtual_library "libiconv" $2 ;; opencore-amr) ENABLED_LIBRARIES[LIBRARY_OPENCOREAMR]=$2 @@ -786,7 +846,7 @@ set_library() { ;; snappy) ENABLED_LIBRARIES[LIBRARY_SNAPPY]=$2 - ENABLED_LIBRARIES[LIBRARY_ZLIB]=$2 + set_virtual_library "zlib" $2 ;; soxr) ENABLED_LIBRARIES[LIBRARY_SOXR]=$2 @@ -800,7 +860,7 @@ set_library() { ENABLED_LIBRARIES[LIBRARY_LIBWEBP]=$2 ENABLED_LIBRARIES[LIBRARY_GIFLIB]=$2 ENABLED_LIBRARIES[LIBRARY_JPEG]=$2 - ENABLED_LIBRARIES[LIBRARY_ZLIB]=$2 + set_virtual_library "zlib" $2 set_library "tiff" $2 set_library "libpng" $2 ;; @@ -823,7 +883,7 @@ set_library() { xvidcore) ENABLED_LIBRARIES[LIBRARY_XVIDCORE]=$2 ;; - expat | giflib | jpeg | leptonica | libogg | libsamplerate | libsndfile | libuuid | ios-libuuid | tvos-libuuid) + expat | giflib | jpeg | leptonica | libogg | libsamplerate | libsndfile) # THESE LIBRARIES ARE NOT ENABLED DIRECTLY ;; nettle) @@ -840,6 +900,41 @@ set_library() { esac } +# +# 1. library name +# 2. enable/disable +# +# These libraries are supported by all platforms. +# +set_virtual_library() { + case $1 in + libiconv) + if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then + ENABLED_LIBRARIES[LIBRARY_APPLE_LIBICONV]=$2 + else + ENABLED_LIBRARIES[LIBRARY_LIBICONV]=$2 + fi + ;; + libuuid) + if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then + ENABLED_LIBRARIES[LIBRARY_APPLE_LIBUUID]=$2 + else + ENABLED_LIBRARIES[LIBRARY_LIBUUID]=$2 + fi + ;; + zlib) + if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then + ENABLED_LIBRARIES[LIBRARY_APPLE_ZLIB]=$2 + else + ENABLED_LIBRARIES[LIBRARY_ANDROID_ZLIB]=$2 + fi + ;; + *) + print_unknown_virtual_library $1 + ;; + esac +} + disable_arch() { local arch_supported_on_platform=$(is_arch_supported_on_platform "$1") if [[ $arch_supported_on_platform == 1 ]]; then @@ -869,6 +964,12 @@ set_arch() { arm64) ENABLED_ARCHITECTURES[ARCH_ARM64]=$2 ;; + arm64-mac-catalyst) + ENABLED_ARCHITECTURES[ARCH_ARM64_MAC_CATALYST]=$2 + ;; + arm64-simulator) + ENABLED_ARCHITECTURES[ARCH_ARM64_SIMULATOR]=$2 + ;; arm64e) ENABLED_ARCHITECTURES[ARCH_ARM64E]=$2 ;; @@ -892,16 +993,22 @@ set_arch() { check_if_dependency_rebuilt() { case $1 in + cpu-features) + set_dependency_rebuilt_flag "libvpx" + set_dependency_rebuilt_flag "openh264" + ;; expat) set_dependency_rebuilt_flag "fontconfig" set_dependency_rebuilt_flag "libass" ;; fontconfig) set_dependency_rebuilt_flag "libass" + set_dependency_rebuilt_flag "harfbuzz" ;; freetype) set_dependency_rebuilt_flag "fontconfig" set_dependency_rebuilt_flag "libass" + set_dependency_rebuilt_flag "harfbuzz" ;; fribidi) set_dependency_rebuilt_flag "libass" @@ -915,6 +1022,9 @@ check_if_dependency_rebuilt() { set_dependency_rebuilt_flag "gnutls" set_dependency_rebuilt_flag "nettle" ;; + harfbuzz) + set_dependency_rebuilt_flag "libass" + ;; jpeg) set_dependency_rebuilt_flag "tiff" set_dependency_rebuilt_flag "libwebp" @@ -980,7 +1090,7 @@ print_enabled_architectures() { echo -n "Architectures: " let enabled=0 - for print_arch in {0..10}; do + for print_arch in {0..12}; do if [[ ${ENABLED_ARCHITECTURES[$print_arch]} -eq 1 ]]; then if [[ ${enabled} -ge 1 ]]; then echo -n ", " @@ -1002,7 +1112,8 @@ print_enabled_libraries() { let enabled=0 - for library in {46..53} {55..57} {0..33}; do + # SUPPLEMENTARY LIBRARIES NOT PRINTED + for library in {47..54} {56..58} {0..33}; do if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then if [[ ${enabled} -ge 1 ]]; then echo -n ", " @@ -1079,109 +1190,48 @@ print_redownload_requested_libraries() { fi } -build_modulemap() { - local FILE_PATH="$1" - - cat >"${FILE_PATH}" <${FILE_PATH} < - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - ${FRAMEWORK_NAME} - CFBundleIdentifier - ${FRAMEWORK_ID} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${FRAMEWORK_NAME} - CFBundlePackageType - FMWK - CFBundleShortVersionString - ${FRAMEWORK_SHORT_VERSION} - CFBundleVersion - ${FRAMEWORK_VERSION} - CFBundleSignature - ???? - MinimumOSVersion - $6 - CFBundleSupportedPlatforms - - $7 - - NSPrincipalClass - - - -EOF -} - -# 1 - library name -# 2 - static library name -# 3 - library version -create_static_framework() { - local FRAMEWORK_PATH=${BASEDIR}/prebuilt/ios-framework/$1.framework - - mkdir -p "${FRAMEWORK_PATH}" 1>>"${BASEDIR}/build.log" 2>&1 || exit 1 - - local CAPITAL_CASE_LIBRARY_NAME=$(to_capital_case "$1") - - build_info_plist "${FRAMEWORK_PATH}/Info.plist" "${FFMPEG_LIB}" "com.arthenica.ffmpegkit.${CAPITAL_CASE_LIBRARY_NAME}" "$3" "$3" - - cp "${BASEDIR}/prebuilt/ios-universal/$1-universal/lib/$2" "${FRAMEWORK_PATH}/$1" 1>>"${BASEDIR}/build.log" 2>&1 - - echo "$?" -} - # 1 - library index get_external_library_license_path() { case $1 in 1) echo "${BASEDIR}/src/$(get_library_name "$1")/docs/LICENSE.TXT" ;; - 3) echo "${BASEDIR}/src/$(get_library_name "$1")/COPYING.LESSERv3" ;; - 25) echo "${BASEDIR}/src/$(get_library_name "$1")/COPYING.LGPL" ;; - 27) echo "${BASEDIR}/src/$(get_library_name "$1")/LICENSE.md" ;; - 29) echo "${BASEDIR}/src/$(get_library_name "$1")/COPYING.txt" ;; - 34) echo "${BASEDIR}/src/$(get_library_name "$1")/LICENSE.md " ;; - 37) echo "${BASEDIR}/src/$(get_library_name "$1")/COPYING.LESSERv3" ;; - 38) echo "${BASEDIR}/src/$(get_library_name "$1")/COPYRIGHT" ;; - 41) echo "${BASEDIR}/src/$(get_library_name "$1")/leptonica-license.txt" ;; - 4 | 9 | 12 | 18 | 20 | 26 | 31 | 36) echo "${BASEDIR}/src/$(get_library_name "$1")/LICENSE" ;; + 3 | 39) echo "${BASEDIR}/src/$(get_library_name "$1")/COPYING.LESSERv3" ;; + 5 | 41) echo "${BASEDIR}/src/$(get_library_name "$1")/$(get_library_name "$1")/COPYING" ;; + 19) echo "${BASEDIR}/src/$(get_library_name "$1")/$(get_library_name "$1")/LICENSE" ;; + 26) echo "${BASEDIR}/src/$(get_library_name "$1")/COPYING.LGPL" ;; + 28 | 35) echo "${BASEDIR}/src/$(get_library_name "$1")/LICENSE.md " ;; + 30) echo "${BASEDIR}/src/$(get_library_name "$1")/COPYING.txt" ;; + 38 | 40) echo "${BASEDIR}/src/$(get_library_name "$1")/COPYRIGHT" ;; + 43) echo "${BASEDIR}/src/$(get_library_name "$1")/leptonica-license.txt" ;; + 4 | 10 | 13 | 21 | 27 | 31 | 32 | 37) echo "${BASEDIR}/src/$(get_library_name "$1")/LICENSE" ;; *) echo "${BASEDIR}/src/$(get_library_name "$1")/COPYING" ;; esac } +get_cmake_build_directory() { + echo "${FFMPEG_KIT_TMPDIR}/cmake/build/$(get_build_directory)/${LIB_NAME}" +} + +get_apple_cmake_system_name() { + case ${FFMPEG_KIT_BUILD_TYPE} in + macos) + echo "Darwin" + ;; + tvos) + echo "tvOS" + ;; + *) + case ${ARCH} in + *-mac-catalyst) + echo "Darwin" + ;; + *) + echo "iOS" + ;; + esac + ;; + esac +} + # # 1. # @@ -1193,6 +1243,7 @@ autoreconf_library() { local EXTRACT_RC=$? if [ ${EXTRACT_RC} -eq 0 ]; then + echo -e "\nDEBUG: autoreconf completed successfully for $1\n" 1>>"${BASEDIR}"/build.log 2>&1 return fi @@ -1203,6 +1254,7 @@ autoreconf_library() { EXTRACT_RC=$? if [ ${EXTRACT_RC} -eq 0 ]; then + echo -e "\nDEBUG: autoreconf completed successfully for $1\n" 1>>"${BASEDIR}"/build.log 2>&1 return fi @@ -1213,6 +1265,7 @@ autoreconf_library() { EXTRACT_RC=$? if [ ${EXTRACT_RC} -eq 0 ]; then + echo -e "\nDEBUG: autoreconf completed successfully for $1\n" 1>>"${BASEDIR}"/build.log 2>&1 return fi @@ -1223,6 +1276,7 @@ autoreconf_library() { EXTRACT_RC=$? if [ ${EXTRACT_RC} -eq 0 ]; then + echo -e "\nDEBUG: autoreconf completed successfully for $1\n" 1>>"${BASEDIR}"/build.log 2>&1 return fi @@ -1233,6 +1287,7 @@ autoreconf_library() { EXTRACT_RC=$? if [ ${EXTRACT_RC} -eq 0 ]; then + echo -e "\nDEBUG: autoreconf completed successfully for $1\n" 1>>"${BASEDIR}"/build.log 2>&1 return fi @@ -1243,7 +1298,9 @@ autoreconf_library() { EXTRACT_RC=$? if [ ${EXTRACT_RC} -eq 0 ]; then - return + echo -e "\nDEBUG: autoreconf completed successfully for $1\n" 1>>"${BASEDIR}"/build.log 2>&1 + else + echo -e "\nDEBUG: Default autoreconf with include for $1 failed\n" 1>>"${BASEDIR}"/build.log 2>&1 fi } @@ -1372,7 +1429,7 @@ downloaded_enabled_library_sources() { exit 1 fi - for library in {1..46}; do + for library in {1..47}; do if [[ ${!library} -eq 1 ]]; then library_name=$(get_library_name $((library - 1))) @@ -1458,120 +1515,53 @@ download_library_source() { echo ${DOWNLOAD_RC} else echo -e "\nINFO: $1 library downloaded" 1>>"${BASEDIR}"/build.log 2>&1 + echo 0 fi } -#//@TODO CHECK IF NECESSARY -download_gpl_library_source() { - local GPL_LIB_URL="" - local GPL_LIB_FILE="" - local GPL_LIB_ORIG_DIR="" - local GPL_LIB_DEST_DIR="$1" - local GPL_LIB_SOURCE_PATH="${BASEDIR}/src/${GPL_LIB_DEST_DIR}" - local LIBRARY_RC="" +download_gnu_config() { + local SOURCE_REPO_URL="" + local LIB_NAME="config" + local LIB_LOCAL_PATH="${FFMPEG_KIT_TMPDIR}/source/${LIB_NAME}" + local SOURCE_ID="" local DOWNLOAD_RC="" + local SOURCE_TYPE="" + REDOWNLOAD_VARIABLE=$(echo "REDOWNLOAD_$LIB_NAME") - echo -e "\nDEBUG: Downloading GPL library source: $1\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "DEBUG: Downloading gnu config source.\n" 1>>"${BASEDIR}"/build.log 2>&1 - case $1 in - libvidstab) - GPL_LIB_URL="https://github.com/georgmartius/vid.stab/archive/v1.1.0.tar.gz" - GPL_LIB_FILE="v1.1.0.tar.gz" - GPL_LIB_ORIG_DIR="vid.stab-1.1.0" - ;; - x264) - GPL_LIB_URL="https://code.videolan.org/videolan/x264/-/archive/cde9a93319bea766a92e306d69059c76de970190/x264-cde9a93319bea766a92e306d69059c76de970190.tar.bz2" - GPL_LIB_FILE="x264-cde9a93319bea766a92e306d69059c76de970190.tar.bz2" - GPL_LIB_ORIG_DIR="x264-cde9a93319bea766a92e306d69059c76de970190" - ;; - x265) - GPL_LIB_URL="https://bitbucket.org/multicoreware/x265/downloads/x265_3.4.tar.gz" - GPL_LIB_FILE="x265_3.4.tar.gz" - GPL_LIB_ORIG_DIR="x265_3.4" - ;; - xvidcore) - GPL_LIB_URL="https://downloads.xvid.com/downloads/xvidcore-1.3.7.tar.gz" - GPL_LIB_FILE="xvidcore-1.3.7.tar.gz" - GPL_LIB_ORIG_DIR="xvidcore" - ;; - rubberband) - GPL_LIB_URL="https://breakfastquay.com/files/releases/rubberband-1.8.2.tar.bz2" - GPL_LIB_FILE="rubberband-1.8.2.tar.bz2" - GPL_LIB_ORIG_DIR="rubberband-1.8.2" - ;; - esac + SOURCE_REPO_URL=$(get_library_source "${LIB_NAME}" 1) + SOURCE_ID=$(get_library_source "${LIB_NAME}" 2) + SOURCE_TYPE=$(get_library_source "${LIB_NAME}" 3) - LIBRARY_RC=$(library_is_downloaded "${GPL_LIB_DEST_DIR}") - - if [ ${LIBRARY_RC} -eq 0 ]; then - echo -e "INFO: $1 already downloaded. Source folder found at ${GPL_LIB_SOURCE_PATH}\n" 1>>"${BASEDIR}"/build.log 2>&1 - echo 0 - return - fi - - local GPL_LIB_PACKAGE_PATH="${FFMPEG_KIT_TMPDIR}/${GPL_LIB_FILE}" - - echo -e "INFO: $1 source not found. Checking if library package ${GPL_LIB_FILE} is downloaded at ${GPL_LIB_PACKAGE_PATH} \n" 1>>"${BASEDIR}"/build.log 2>&1 - - if [ ! -f "${GPL_LIB_PACKAGE_PATH}" ]; then - echo -e "DEBUG: $1 library package not found. Downloading from ${GPL_LIB_URL}\n" 1>>"${BASEDIR}"/build.log 2>&1 - - DOWNLOAD_RC=$(download "${GPL_LIB_URL}" "${GPL_LIB_FILE}") - - if [ ${DOWNLOAD_RC} -ne 0 ]; then - echo -e "INFO: Downloading GPL library $1 failed. Can not get library package from ${GPL_LIB_URL}\n" 1>>"${BASEDIR}"/build.log 2>&1 - echo ${DOWNLOAD_RC} - return + if [[ -d "${LIB_LOCAL_PATH}" ]]; then + if [[ ${REDOWNLOAD_VARIABLE} -eq 1 ]]; then + echo -e "INFO: gnu config already downloaded but re-download requested\n" 1>>"${BASEDIR}"/build.log 2>&1 + rm -rf "${LIB_LOCAL_PATH}" 1>>"${BASEDIR}"/build.log 2>&1 else - echo -e "DEBUG: $1 library package downloaded\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "INFO: gnu config already downloaded. Source folder found at ${LIB_LOCAL_PATH}\n" 1>>"${BASEDIR}"/build.log 2>&1 + return fi + fi + + DOWNLOAD_RC=$(clone_git_repository_with_tag "${SOURCE_REPO_URL}" "${SOURCE_ID}" "${LIB_LOCAL_PATH}") + + if [[ ${DOWNLOAD_RC} -ne 0 ]]; then + echo -e "INFO: Downloading gnu config failed. Can not get source from ${SOURCE_REPO_URL}\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "failed\n" + exit 1 else - echo -e "DEBUG: $1 library package already downloaded\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "\nINFO: gnu config downloaded successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 fi +} - local EXTRACT_COMMAND="" - - if [[ ${GPL_LIB_FILE} == *bz2 ]]; then - EXTRACT_COMMAND="tar jxf ${GPL_LIB_PACKAGE_PATH} --directory ${FFMPEG_KIT_TMPDIR}" - else - EXTRACT_COMMAND="tar zxf ${GPL_LIB_PACKAGE_PATH} --directory ${FFMPEG_KIT_TMPDIR}" - fi - - echo -e "DEBUG: Extracting library package ${GPL_LIB_FILE} inside ${FFMPEG_KIT_TMPDIR}\n" 1>>"${BASEDIR}"/build.log 2>&1 - - ${EXTRACT_COMMAND} 1>>"${BASEDIR}"/build.log 2>&1 - - local EXTRACT_RC=$? - - if [ ${EXTRACT_RC} -ne 0 ]; then - echo -e "\nINFO: Downloading GPL library $1 failed. Extract for library package ${GPL_LIB_FILE} completed with rc=${EXTRACT_RC}. Deleting failed files.\n" 1>>"${BASEDIR}"/build.log 2>&1 - rm -f ${GPL_LIB_PACKAGE_PATH} 1>>"${BASEDIR}"/build.log 2>&1 - rm -rf "${FFMPEG_KIT_TMPDIR}"/"${GPL_LIB_ORIG_DIR}" 1>>"${BASEDIR}"/build.log 2>&1 - echo ${EXTRACT_RC} - return - fi - - echo -e "DEBUG: Extract completed. Copying library source to ${GPL_LIB_SOURCE_PATH}\n" 1>>"${BASEDIR}"/build.log 2>&1 - - COPY_COMMAND="cp -r ${FFMPEG_KIT_TMPDIR}/${GPL_LIB_ORIG_DIR} ${GPL_LIB_SOURCE_PATH}" - - ${COPY_COMMAND} 1>>"${BASEDIR}"/build.log 2>&1 - - local COPY_RC=$? - - if [ ${COPY_RC} -eq 0 ]; then - echo -e "INFO: Downloading GPL library source $1 completed successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 - else - echo -e "\nINFO: Downloading GPL library $1 failed. Copying library source to ${GPL_LIB_SOURCE_PATH} completed with rc=${COPY_RC}\n" 1>>"${BASEDIR}"/build.log 2>&1 - rm -rf "${GPL_LIB_SOURCE_PATH}" 1>>"${BASEDIR}"/build.log 2>&1 - echo ${COPY_RC} - return - fi +is_gnu_config_files_up_to_date() { + echo $(grep aarch64-apple-darwin config.guess | wc -l 2>>"${BASEDIR}"/build.log) } get_cpu_count() { if [ "$(uname)" == "Darwin" ]; then - echo $(sysctl -n hw.physicalcpu) + echo $(sysctl -n hw.logicalcpu) else echo $(nproc) fi @@ -1625,19 +1615,19 @@ library_is_installed() { if [ ! -d "${INSTALL_PATH}"/"${LIB_NAME}" ]; then echo -e "INFO: ${INSTALL_PATH}/${LIB_NAME} directory not found\n" 1>>"${BASEDIR}"/build.log 2>&1 - echo 1 + echo 0 return fi if [ ! -d "${INSTALL_PATH}"/"${LIB_NAME}"/lib ]; then echo -e "INFO: ${INSTALL_PATH}/${LIB_NAME}/lib directory not found\n" 1>>"${BASEDIR}"/build.log 2>&1 - echo 1 + echo 0 return fi if [ ! -d "${INSTALL_PATH}"/"${LIB_NAME}"/include ]; then echo -e "INFO: ${INSTALL_PATH}/${LIB_NAME}/include directory not found\n" 1>>"${BASEDIR}"/build.log 2>&1 - echo 1 + echo 0 return fi @@ -1646,18 +1636,18 @@ library_is_installed() { if [[ ${HEADER_COUNT} -eq 0 ]]; then echo -e "INFO: No headers found under ${INSTALL_PATH}/${LIB_NAME}/include\n" 1>>"${BASEDIR}"/build.log 2>&1 - echo 1 + echo 0 return fi if [[ ${LIB_COUNT} -eq 0 ]]; then echo -e "INFO: No libraries found under ${INSTALL_PATH}/${LIB_NAME}/lib\n" 1>>"${BASEDIR}"/build.log 2>&1 - echo 1 + echo 0 return fi echo -e "INFO: ${LIB_NAME} library is already built and installed\n" 1>>"${BASEDIR}"/build.log 2>&1 - echo 0 + echo 1 } prepare_inline_sed() { @@ -1671,3 +1661,12 @@ prepare_inline_sed() { to_capital_case() { echo "$(echo ${1:0:1} | tr '[a-z]' '[A-Z]')${1:1}" } + +# +# 1. source file +# 2. destination file +# +overwrite_file() { + rm -f "$2" + cp "$1" "$2" +} diff --git a/scripts/main-android.sh b/scripts/main-android.sh index 08ab409..180a187 100755 --- a/scripts/main-android.sh +++ b/scripts/main-android.sh @@ -26,16 +26,16 @@ if [[ -z ${TOOLCHAIN_ARCH} ]]; then fi # ENABLE COMMON FUNCTIONS -. "${BASEDIR}"/scripts/function-android.sh +source "${BASEDIR}"/scripts/function-"${FFMPEG_KIT_BUILD_TYPE}".sh 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 echo -e "\nBuilding ${ARCH} platform on API level ${API}\n" echo -e "\nINFO: Starting new build for ${ARCH} on API level ${API} at $(date)\n" 1>>"${BASEDIR}"/build.log 2>&1 # SET BASE INSTALLATION DIRECTORY FOR THIS ARCHITECTURE -INSTALL_BASE="${BASEDIR}/prebuilt/android-$(get_target_build)" +export LIB_INSTALL_BASE="${BASEDIR}/prebuilt/$(get_build_directory)" # CREATE PACKAGE CONFIG DIRECTORY FOR THIS ARCHITECTURE -PKG_CONFIG_DIRECTORY="${INSTALL_BASE}/pkgconfig" +PKG_CONFIG_DIRECTORY="${LIB_INSTALL_BASE}/pkgconfig" if [ ! -d "${PKG_CONFIG_DIRECTORY}" ]; then mkdir -p "${PKG_CONFIG_DIRECTORY}" || exit 1 fi @@ -43,7 +43,7 @@ fi # FILTER WHICH EXTERNAL LIBRARIES WILL BE BUILT # NOTE THAT BUILT-IN LIBRARIES ARE FORWARDED TO FFMPEG SCRIPT WITHOUT ANY PROCESSING enabled_library_list=() -for library in {1..46}; do +for library in {1..47}; do if [[ ${!library} -eq 1 ]]; then ENABLED_LIBRARY=$(get_library_name $((library - 1))) enabled_library_list+=(${ENABLED_LIBRARY}) @@ -64,77 +64,92 @@ while [ ${#enabled_library_list[@]} -gt $completed ]; do let run=0 case $library in fontconfig) - if [[ -n $OK_libuuid ]] && [[ -n $OK_expat ]] && [[ -n $OK_libiconv ]] && [[ -n $OK_freetype ]]; then + if [[ $OK_libuuid -eq 1 ]] && [[ $OK_expat -eq 1 ]] && [[ $OK_libiconv -eq 1 ]] && [[ $OK_freetype -eq 1 ]]; then run=1 fi ;; freetype) - if [[ -n $OK_libpng ]]; then + if [[ $OK_libpng -eq 1 ]]; then run=1 fi ;; gnutls) - if [[ -n $OK_nettle ]] && [[ -n $OK_gmp ]] && [[ -n $OK_libiconv ]]; then + if [[ $OK_nettle -eq 1 ]] && [[ $OK_gmp -eq 1 ]] && [[ $OK_libiconv -eq 1 ]]; then + run=1 + fi + ;; + harfbuzz) + if [[ $OK_fontconfig -eq 1 ]] && [[ $OK_freetype -eq 1 ]]; then run=1 fi ;; lame) - if [[ -n $OK_libiconv ]]; then + if [[ $OK_libiconv -eq 1 ]]; then run=1 fi ;; leptonica) - if [[ -n $OK_giflib ]] && [[ -n $OK_jpeg ]] && [[ -n $OK_libpng ]] && [[ -n $OK_tiff ]] && [[ -n $OK_libwebp ]]; then + if [[ $OK_giflib -eq 1 ]] && [[ $OK_jpeg -eq 1 ]] && [[ $OK_libpng -eq 1 ]] && [[ $OK_tiff -eq 1 ]] && [[ $OK_libwebp -eq 1 ]]; then run=1 fi ;; libass) - if [[ -n $OK_libuuid ]] && [[ -n $OK_expat ]] && [[ -n $OK_libiconv ]] && [[ -n $OK_freetype ]] && [[ -n $OK_fribidi ]] && [[ -n $OK_fontconfig ]] && [[ -n $OK_libpng ]]; then + if [[ $OK_libuuid -eq 1 ]] && [[ $OK_expat -eq 1 ]] && [[ $OK_libiconv -eq 1 ]] && [[ $OK_freetype -eq 1 ]] && [[ $OK_fribidi -eq 1 ]] && [[ $OK_fontconfig -eq 1 ]] && [[ $OK_libpng -eq 1 ]] && [[ $OK_harfbuzz -eq 1 ]]; then run=1 fi ;; libtheora) - if [[ -n $OK_libvorbis ]] && [[ -n $OK_libogg ]]; then + if [[ $OK_libvorbis -eq 1 ]] && [[ $OK_libogg -eq 1 ]]; then run=1 fi ;; libvorbis) - if [[ -n $OK_libogg ]]; then + if [[ $OK_libogg -eq 1 ]]; then + run=1 + fi + ;; + libvpx) + if [[ $OK_cpu_features -eq 1 ]]; then run=1 fi ;; libwebp) - if [[ -n $OK_giflib ]] && [[ -n $OK_jpeg ]] && [[ -n $OK_libpng ]] && [[ -n $OK_tiff ]]; then + if [[ $OK_giflib -eq 1 ]] && [[ $OK_jpeg -eq 1 ]] && [[ $OK_libpng -eq 1 ]] && [[ $OK_tiff -eq 1 ]]; then run=1 fi ;; libxml2) - if [[ -n $OK_libiconv ]]; then + if [[ $OK_libiconv -eq 1 ]]; then run=1 fi ;; nettle) - if [[ -n $OK_gmp ]]; then + if [[ $OK_gmp -eq 1 ]]; then + run=1 + fi + ;; + openh264) + if [[ $OK_cpu_features -eq 1 ]]; then run=1 fi ;; rubberband) - if [[ -n $OK_libsndfile ]] && [[ -n $OK_libsamplerate ]]; then + if [[ $OK_libsndfile -eq 1 ]] && [[ $OK_libsamplerate -eq 1 ]]; then run=1 fi ;; tesseract) - if [[ -n $OK_leptonica ]]; then + if [[ $OK_leptonica -eq 1 ]]; then run=1 fi ;; tiff) - if [[ -n $OK_jpeg ]]; then + if [[ $OK_jpeg -eq 1 ]]; then run=1 fi ;; twolame) - if [[ -n $OK_libsndfile ]]; then + if [[ $OK_libsndfile -eq 1 ]]; then run=1 fi ;; @@ -148,37 +163,17 @@ while [ ${#enabled_library_list[@]} -gt $completed ]; do REBUILD_FLAG=$(echo "REBUILD_${library}" | sed "s/\-/\_/g") DEPENDENCY_REBUILT_FLAG=$(echo "DEPENDENCY_REBUILT_${library}" | sed "s/\-/\_/g") - if [ $run -eq 1 ] && [[ -z ${!BUILD_COMPLETED_FLAG} ]]; then - ENABLED_LIBRARY_PATH="${INSTALL_BASE}/${library}" + if [[ $run -eq 1 ]] && [[ "${!BUILD_COMPLETED_FLAG}" != "1" ]]; then + LIBRARY_IS_INSTALLED=$(library_is_installed "${LIB_INSTALL_BASE}" "${library}") - LIBRARY_IS_INSTALLED=$(library_is_installed "${INSTALL_BASE}" "${library}") - - echo -e "INFO: Flags detected for ${library}: already installed=${LIBRARY_IS_INSTALLED}, rebuild=${!REBUILD_FLAG}, dependency rebuilt=${!DEPENDENCY_REBUILT_FLAG}\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "INFO: Flags detected for ${library}: already installed=${LIBRARY_IS_INSTALLED}, rebuild requested by user=${!REBUILD_FLAG}, will be rebuilt due to dependency update=${!DEPENDENCY_REBUILT_FLAG}\n" 1>>"${BASEDIR}"/build.log 2>&1 # CHECK IF BUILD IS NECESSARY OR NOT - if [[ ${LIBRARY_IS_INSTALLED} -ne 0 ]] || [[ ${!REBUILD_FLAG} -eq 1 ]] || [[ ${!DEPENDENCY_REBUILT_FLAG} -eq 1 ]]; then - - echo -e "----------------------------------------------------------------" 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "\nINFO: Building $library with the following environment variables\n" 1>>"${BASEDIR}"/build.log 2>&1 - env 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "----------------------------------------------------------------\n" 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "INFO: System information\n" 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "INFO: $(uname -a)\n" 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "----------------------------------------------------------------\n" 1>>"${BASEDIR}"/build.log 2>&1 + if [[ ${LIBRARY_IS_INSTALLED} -ne 1 ]] || [[ ${!REBUILD_FLAG} -eq 1 ]] || [[ ${!DEPENDENCY_REBUILT_FLAG} -eq 1 ]]; then echo -n "${library}: " - # DELETE THE PREVIOUS BUILD OF THE LIBRARY - if [ -d "${ENABLED_LIBRARY_PATH}" ]; then - rm -rf "${INSTALL_BASE}"/"${library}" || exit 1 - fi - - SCRIPT_PATH="${BASEDIR}/scripts/android/${library}.sh" - - cd "${BASEDIR}" - - # EXECUTE BUILD SCRIPT OF EACH ENABLED LIBRARY - ${SCRIPT_PATH} 1>>"${BASEDIR}"/build.log 2>&1 + "${BASEDIR}"/scripts/run-android.sh "${library}" 1>>"${BASEDIR}"/build.log 2>&1 # SET SOME FLAGS AFTER THE BUILD if [ $? -eq 0 ]; then @@ -187,7 +182,7 @@ while [ ${#enabled_library_list[@]} -gt $completed ]; do check_if_dependency_rebuilt "${library}" echo "ok" else - echo "failed" + echo -e "failed\n\nSee build.log for details\n" exit 1 fi else @@ -196,7 +191,7 @@ while [ ${#enabled_library_list[@]} -gt $completed ]; do echo "${library}: already built" fi else - echo -e "INFO: Skipping $library, run=$run, completed=${!BUILD_COMPLETED_FLAG}\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "INFO: Skipping $library, dependencies built=$run, already built=${!BUILD_COMPLETED_FLAG}\n" 1>>"${BASEDIR}"/build.log 2>&1 fi done done @@ -205,7 +200,11 @@ done if [[ ${SKIP_ffmpeg} -ne 1 ]]; then # BUILD FFMPEG - . "${BASEDIR}"/scripts/android/ffmpeg.sh "$@" + "${BASEDIR}"/scripts/android/ffmpeg.sh "$@" + + if [[ $? -ne 0 ]]; then + exit 1 + fi else echo -e "\nffmpeg: skipped" fi diff --git a/scripts/main-ios.sh b/scripts/main-ios.sh index c64435e..f978ad0 100755 --- a/scripts/main-ios.sh +++ b/scripts/main-ios.sh @@ -15,27 +15,22 @@ if [[ -z ${BASEDIR} ]]; then exit 1 fi -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - if [[ -z ${SDK_PATH} ]]; then echo -e "\n(*) SDK_PATH not defined\n" exit 1 fi # ENABLE COMMON FUNCTIONS -. "${BASEDIR}"/scripts/function-ios.sh +source "${BASEDIR}"/scripts/function-"${FFMPEG_KIT_BUILD_TYPE}".sh 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 echo -e "\nBuilding ${ARCH} platform\n" echo -e "\nINFO: Starting new build for ${ARCH} at $(date)\n" 1>>"${BASEDIR}"/build.log 2>&1 # SET BASE INSTALLATION DIRECTORY FOR THIS ARCHITECTURE -INSTALL_BASE="${BASEDIR}/prebuilt/$(get_target_build_directory)" +export LIB_INSTALL_BASE="${BASEDIR}/prebuilt/$(get_build_directory)" # CREATE PACKAGE CONFIG DIRECTORY FOR THIS ARCHITECTURE -PKG_CONFIG_DIRECTORY="${INSTALL_BASE}/pkgconfig" +PKG_CONFIG_DIRECTORY="${LIB_INSTALL_BASE}/pkgconfig" if [ ! -d "${PKG_CONFIG_DIRECTORY}" ]; then mkdir -p "${PKG_CONFIG_DIRECTORY}" || exit 1 fi @@ -43,7 +38,7 @@ fi # FILTER WHICH EXTERNAL LIBRARIES WILL BE BUILT # NOTE THAT BUILT-IN LIBRARIES ARE FORWARDED TO FFMPEG SCRIPT WITHOUT ANY PROCESSING enabled_library_list=() -for library in {1..46}; do +for library in {1..47}; do if [[ ${!library} -eq 1 ]]; then ENABLED_LIBRARY=$(get_library_name $((library - 1))) enabled_library_list+=(${ENABLED_LIBRARY}) @@ -59,67 +54,72 @@ while [ ${#enabled_library_list[@]} -gt $completed ]; do let run=0 case $library in fontconfig) - if [[ -n $OK_expat ]] && [[ -n $OK_freetype ]]; then + if [[ $OK_expat -eq 1 ]] && [[ $OK_freetype -eq 1 ]]; then run=1 fi ;; freetype) - if [[ -n $OK_libpng ]]; then + if [[ $OK_libpng -eq 1 ]]; then run=1 fi ;; gnutls) - if [[ -n $OK_nettle ]] && [[ -n $OK_gmp ]]; then + if [[ $OK_nettle -eq 1 ]] && [[ $OK_gmp -eq 1 ]]; then + run=1 + fi + ;; + harfbuzz) + if [[ $OK_fontconfig -eq 1 ]] && [[ $OK_freetype -eq 1 ]]; then run=1 fi ;; leptonica) - if [[ -n $OK_giflib ]] && [[ -n $OK_jpeg ]] && [[ -n $OK_libpng ]] && [[ -n $OK_tiff ]] && [[ -n $OK_libwebp ]]; then + if [[ $OK_giflib -eq 1 ]] && [[ $OK_jpeg -eq 1 ]] && [[ $OK_libpng -eq 1 ]] && [[ $OK_tiff -eq 1 ]] && [[ $OK_libwebp -eq 1 ]]; then run=1 fi ;; libass) - if [[ -n $OK_expat ]] && [[ -n $OK_freetype ]] && [[ -n $OK_fribidi ]] && [[ -n $OK_fontconfig ]] && [[ -n $OK_libpng ]]; then + if [[ $OK_expat -eq 1 ]] && [[ $OK_freetype -eq 1 ]] && [[ $OK_fribidi -eq 1 ]] && [[ $OK_fontconfig -eq 1 ]] && [[ $OK_libpng -eq 1 ]] && [[ $OK_harfbuzz -eq 1 ]]; then run=1 fi ;; libtheora) - if [[ -n $OK_libvorbis ]] && [[ -n $OK_libogg ]]; then + if [[ $OK_libvorbis -eq 1 ]] && [[ $OK_libogg -eq 1 ]]; then run=1 fi ;; libvorbis) - if [[ -n $OK_libogg ]]; then + if [[ $OK_libogg -eq 1 ]]; then run=1 fi ;; libwebp) - if [[ -n $OK_giflib ]] && [[ -n $OK_jpeg ]] && [[ -n $OK_libpng ]] && [[ -n $OK_tiff ]]; then + if [[ $OK_giflib -eq 1 ]] && [[ $OK_jpeg -eq 1 ]] && [[ $OK_libpng -eq 1 ]] && [[ $OK_tiff -eq 1 ]]; then run=1 fi ;; nettle) - if [[ -n $OK_gmp ]]; then + if [[ $OK_gmp -eq 1 ]]; then run=1 fi ;; rubberband) - if [[ -n $OK_libsndfile ]] && [[ -n $OK_libsamplerate ]]; then + if [[ $OK_libsndfile -eq 1 ]] && [[ $OK_libsamplerate -eq 1 ]]; then run=1 fi ;; tesseract) - if [[ -n $OK_leptonica ]]; then + if [[ $OK_leptonica -eq 1 ]]; then run=1 fi ;; tiff) - if [[ -n $OK_jpeg ]]; then + if [[ $OK_jpeg -eq 1 ]]; then run=1 fi ;; twolame) - if [[ -n $OK_libsndfile ]]; then + if [[ $OK_libsndfile -eq 1 ]]; then run=1 fi ;; @@ -133,45 +133,26 @@ while [ ${#enabled_library_list[@]} -gt $completed ]; do REBUILD_FLAG=$(echo "REBUILD_${library}" | sed "s/\-/\_/g") DEPENDENCY_REBUILT_FLAG=$(echo "DEPENDENCY_REBUILT_${library}" | sed "s/\-/\_/g") - if [ $run -eq 1 ] && [[ -z ${!BUILD_COMPLETED_FLAG} ]]; then - ENABLED_LIBRARY_PATH="${INSTALL_BASE}/${library}" + if [[ $run -eq 1 ]] && [[ "${!BUILD_COMPLETED_FLAG}" != "1" ]]; then + LIBRARY_IS_INSTALLED=$(library_is_installed "${LIB_INSTALL_BASE}" "${library}") - LIBRARY_IS_INSTALLED=$(library_is_installed ${INSTALL_BASE} ${library}) - - echo -e "INFO: Flags detected for ${library}: already installed=${LIBRARY_IS_INSTALLED}, rebuild=${!REBUILD_FLAG}, dependency rebuilt=${!DEPENDENCY_REBUILT_FLAG}\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "INFO: Flags detected for ${library}: already installed=${LIBRARY_IS_INSTALLED}, rebuild requested by user=${!REBUILD_FLAG}, will be rebuilt due to dependency update=${!DEPENDENCY_REBUILT_FLAG}\n" 1>>"${BASEDIR}"/build.log 2>&1 # CHECK IF BUILD IS NECESSARY OR NOT - if [[ ${LIBRARY_IS_INSTALLED} -ne 0 ]] || [[ ${!REBUILD_FLAG} -eq 1 ]] || [[ ${!DEPENDENCY_REBUILT_FLAG} -eq 1 ]]; then - - echo -e "----------------------------------------------------------------" 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "\nINFO: Building $library with the following environment variables\n" 1>>"${BASEDIR}"/build.log 2>&1 - env 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "----------------------------------------------------------------\n" 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "INFO: System information\n" 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "INFO: $(uname -a)\n" 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "----------------------------------------------------------------\n" 1>>"${BASEDIR}"/build.log 2>&1 + if [[ ${LIBRARY_IS_INSTALLED} -ne 1 ]] || [[ ${!REBUILD_FLAG} -eq 1 ]] || [[ ${!DEPENDENCY_REBUILT_FLAG} -eq 1 ]]; then echo -n "${library}: " - # DELETE THE PREVIOUS BUILD OF THE LIBRARY - if [ -d ${ENABLED_LIBRARY_PATH} ]; then - rm -rf "${INSTALL_BASE}"/"${library}" || exit 1 - fi - - SCRIPT_PATH="${BASEDIR}/scripts/objc/${library}.sh" - - cd "${BASEDIR}" - - # EXECUTE BUILD SCRIPT OF EACH ENABLED LIBRARY - ${SCRIPT_PATH} 1>>"${BASEDIR}"/build.log 2>&1 + "${BASEDIR}"/scripts/run-apple.sh "${library}" 1>>"${BASEDIR}"/build.log 2>&1 + # SET SOME FLAGS AFTER THE BUILD if [ $? -eq 0 ]; then ((completed += 1)) declare "$BUILD_COMPLETED_FLAG=1" check_if_dependency_rebuilt "${library}" echo "ok" else - echo "failed" + echo -e "failed\n\nSee build.log for details\n" exit 1 fi else @@ -180,7 +161,7 @@ while [ ${#enabled_library_list[@]} -gt $completed ]; do echo "${library}: already built" fi else - echo -e "INFO: Skipping $library, run=$run, completed=${!BUILD_COMPLETED_FLAG}\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "INFO: Skipping $library, dependencies built=$run, already built=${!BUILD_COMPLETED_FLAG}\n" 1>>"${BASEDIR}"/build.log 2>&1 fi done done @@ -188,8 +169,27 @@ done # SKIP TO SPEED UP THE BUILD if [[ ${SKIP_ffmpeg} -ne 1 ]]; then + # PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} + LIB_NAME="ffmpeg" + set_toolchain_paths "${LIB_NAME}" + + # SET BUILD FLAGS + HOST=$(get_host) + export CFLAGS=$(get_cflags "${LIB_NAME}") + export CXXFLAGS=$(get_cxxflags "${LIB_NAME}") + export LDFLAGS=$(get_ldflags "${LIB_NAME}") + export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" + + cd "${BASEDIR}"/src/"${LIB_NAME}" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 + + LIB_INSTALL_PREFIX="${LIB_INSTALL_BASE}"/"${LIB_NAME}" + # BUILD FFMPEG - . "${BASEDIR}"/scripts/objc/ffmpeg.sh "$@" || exit 1 + source "${BASEDIR}"/scripts/apple/ffmpeg.sh "$@" + + if [[ $? -ne 0 ]]; then + exit 1 + fi else echo -e "\nffmpeg: skipped" fi @@ -198,7 +198,7 @@ fi if [[ ${SKIP_ffmpeg_kit} -ne 1 ]]; then # BUILD FFMPEG KIT - . "${BASEDIR}"/scripts/objc/ffmpeg-kit.sh "$@" || exit 1 + . "${BASEDIR}"/scripts/apple/ffmpeg-kit.sh "$@" || exit 1 else echo -e "\nffmpeg-kit: skipped" fi diff --git a/scripts/main-macos.sh b/scripts/main-macos.sh index 470ad16..ba8bf03 100755 --- a/scripts/main-macos.sh +++ b/scripts/main-macos.sh @@ -15,27 +15,22 @@ if [[ -z ${BASEDIR} ]]; then exit 1 fi -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - if [[ -z ${SDK_PATH} ]]; then echo -e "\n(*) SDK_PATH not defined\n" exit 1 fi # ENABLE COMMON FUNCTIONS -. "${BASEDIR}"/scripts/function-macos.sh +source "${BASEDIR}"/scripts/function-"${FFMPEG_KIT_BUILD_TYPE}".sh 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 echo -e "\nBuilding ${ARCH} platform\n" echo -e "\nINFO: Starting new build for ${ARCH} at $(date)\n" 1>>"${BASEDIR}"/build.log 2>&1 # SET BASE INSTALLATION DIRECTORY FOR THIS ARCHITECTURE -INSTALL_BASE="${BASEDIR}/prebuilt/$(get_target_build_directory)" +export LIB_INSTALL_BASE="${BASEDIR}/prebuilt/$(get_build_directory)" # CREATE PACKAGE CONFIG DIRECTORY FOR THIS ARCHITECTURE -PKG_CONFIG_DIRECTORY="${INSTALL_BASE}/pkgconfig" +PKG_CONFIG_DIRECTORY="${LIB_INSTALL_BASE}/pkgconfig" if [ ! -d "${PKG_CONFIG_DIRECTORY}" ]; then mkdir -p "${PKG_CONFIG_DIRECTORY}" || exit 1 fi @@ -43,7 +38,7 @@ fi # FILTER WHICH EXTERNAL LIBRARIES WILL BE BUILT # NOTE THAT BUILT-IN LIBRARIES ARE FORWARDED TO FFMPEG SCRIPT WITHOUT ANY PROCESSING enabled_library_list=() -for library in {1..46}; do +for library in {1..47}; do if [[ ${!library} -eq 1 ]]; then ENABLED_LIBRARY=$(get_library_name $((library - 1))) enabled_library_list+=(${ENABLED_LIBRARY}) @@ -59,67 +54,72 @@ while [ ${#enabled_library_list[@]} -gt $completed ]; do let run=0 case $library in fontconfig) - if [[ -n $OK_expat ]] && [[ -n $OK_freetype ]]; then + if [[ $OK_expat -eq 1 ]] && [[ $OK_freetype -eq 1 ]]; then run=1 fi ;; freetype) - if [[ -n $OK_libpng ]]; then + if [[ $OK_libpng -eq 1 ]]; then run=1 fi ;; gnutls) - if [[ -n $OK_nettle ]] && [[ -n $OK_gmp ]]; then + if [[ $OK_nettle -eq 1 ]] && [[ $OK_gmp -eq 1 ]]; then + run=1 + fi + ;; + harfbuzz) + if [[ $OK_fontconfig -eq 1 ]] && [[ $OK_freetype -eq 1 ]]; then run=1 fi ;; leptonica) - if [[ -n $OK_giflib ]] && [[ -n $OK_jpeg ]] && [[ -n $OK_libpng ]] && [[ -n $OK_tiff ]] && [[ -n $OK_libwebp ]]; then + if [[ $OK_giflib -eq 1 ]] && [[ $OK_jpeg -eq 1 ]] && [[ $OK_libpng -eq 1 ]] && [[ $OK_tiff -eq 1 ]] && [[ $OK_libwebp -eq 1 ]]; then run=1 fi ;; libass) - if [[ -n $OK_expat ]] && [[ -n $OK_freetype ]] && [[ -n $OK_fribidi ]] && [[ -n $OK_fontconfig ]] && [[ -n $OK_libpng ]]; then + if [[ $OK_expat -eq 1 ]] && [[ $OK_freetype -eq 1 ]] && [[ $OK_fribidi -eq 1 ]] && [[ $OK_fontconfig -eq 1 ]] && [[ $OK_libpng -eq 1 ]] && [[ $OK_harfbuzz -eq 1 ]]; then run=1 fi ;; libtheora) - if [[ -n $OK_libvorbis ]] && [[ -n $OK_libogg ]]; then + if [[ $OK_libvorbis -eq 1 ]] && [[ $OK_libogg -eq 1 ]]; then run=1 fi ;; libvorbis) - if [[ -n $OK_libogg ]]; then + if [[ $OK_libogg -eq 1 ]]; then run=1 fi ;; libwebp) - if [[ -n $OK_giflib ]] && [[ -n $OK_jpeg ]] && [[ -n $OK_libpng ]] && [[ -n $OK_tiff ]]; then + if [[ $OK_giflib -eq 1 ]] && [[ $OK_jpeg -eq 1 ]] && [[ $OK_libpng -eq 1 ]] && [[ $OK_tiff -eq 1 ]]; then run=1 fi ;; nettle) - if [[ -n $OK_gmp ]]; then + if [[ $OK_gmp -eq 1 ]]; then run=1 fi ;; rubberband) - if [[ -n $OK_libsndfile ]] && [[ -n $OK_libsamplerate ]]; then + if [[ $OK_libsndfile -eq 1 ]] && [[ $OK_libsamplerate -eq 1 ]]; then run=1 fi ;; tesseract) - if [[ -n $OK_leptonica ]]; then + if [[ $OK_leptonica -eq 1 ]]; then run=1 fi ;; tiff) - if [[ -n $OK_jpeg ]]; then + if [[ $OK_jpeg -eq 1 ]]; then run=1 fi ;; twolame) - if [[ -n $OK_libsndfile ]]; then + if [[ $OK_libsndfile -eq 1 ]]; then run=1 fi ;; @@ -133,45 +133,25 @@ while [ ${#enabled_library_list[@]} -gt $completed ]; do REBUILD_FLAG=$(echo "REBUILD_${library}" | sed "s/\-/\_/g") DEPENDENCY_REBUILT_FLAG=$(echo "DEPENDENCY_REBUILT_${library}" | sed "s/\-/\_/g") - if [ $run -eq 1 ] && [[ -z ${!BUILD_COMPLETED_FLAG} ]]; then - ENABLED_LIBRARY_PATH="${INSTALL_BASE}/${library}" + if [[ $run -eq 1 ]] && [[ "${!BUILD_COMPLETED_FLAG}" != "1" ]]; then + LIBRARY_IS_INSTALLED=$(library_is_installed "${LIB_INSTALL_BASE}" "${library}") - LIBRARY_IS_INSTALLED=$(library_is_installed ${INSTALL_BASE} ${library}) - - echo -e "INFO: Flags detected for ${library}: already installed=${LIBRARY_IS_INSTALLED}, rebuild=${!REBUILD_FLAG}, dependency rebuilt=${!DEPENDENCY_REBUILT_FLAG}\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "INFO: Flags detected for ${library}: already installed=${LIBRARY_IS_INSTALLED}, rebuild requested by user=${!REBUILD_FLAG}, will be rebuilt due to dependency update=${!DEPENDENCY_REBUILT_FLAG}\n" 1>>"${BASEDIR}"/build.log 2>&1 # CHECK IF BUILD IS NECESSARY OR NOT - if [[ ${LIBRARY_IS_INSTALLED} -ne 0 ]] || [[ ${!REBUILD_FLAG} -eq 1 ]] || [[ ${!DEPENDENCY_REBUILT_FLAG} -eq 1 ]]; then - - echo -e "----------------------------------------------------------------" 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "\nINFO: Building $library with the following environment variables\n" 1>>"${BASEDIR}"/build.log 2>&1 - env 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "----------------------------------------------------------------\n" 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "INFO: System information\n" 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "INFO: $(uname -a)\n" 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "----------------------------------------------------------------\n" 1>>"${BASEDIR}"/build.log 2>&1 - + if [[ ${LIBRARY_IS_INSTALLED} -ne 1 ]] || [[ ${!REBUILD_FLAG} -eq 1 ]] || [[ ${!DEPENDENCY_REBUILT_FLAG} -eq 1 ]]; then echo -n "${library}: " - # DELETE THE PREVIOUS BUILD OF THE LIBRARY - if [ -d ${ENABLED_LIBRARY_PATH} ]; then - rm -rf "${INSTALL_BASE}"/"${library}" || exit 1 - fi - - SCRIPT_PATH="${BASEDIR}/scripts/objc/${library}.sh" - - cd "${BASEDIR}" - - # EXECUTE BUILD SCRIPT OF EACH ENABLED LIBRARY - ${SCRIPT_PATH} 1>>"${BASEDIR}"/build.log 2>&1 + "${BASEDIR}"/scripts/run-apple.sh "${library}" 1>>"${BASEDIR}"/build.log 2>&1 + # SET SOME FLAGS AFTER THE BUILD if [ $? -eq 0 ]; then ((completed += 1)) declare "$BUILD_COMPLETED_FLAG=1" check_if_dependency_rebuilt "${library}" echo "ok" else - echo "failed" + echo -e "failed\n\nSee build.log for details\n" exit 1 fi else @@ -180,7 +160,7 @@ while [ ${#enabled_library_list[@]} -gt $completed ]; do echo "${library}: already built" fi else - echo -e "INFO: Skipping $library, run=$run, completed=${!BUILD_COMPLETED_FLAG}\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "INFO: Skipping $library, dependencies built=$run, already built=${!BUILD_COMPLETED_FLAG}\n" 1>>"${BASEDIR}"/build.log 2>&1 fi done done @@ -188,8 +168,27 @@ done # SKIP TO SPEED UP THE BUILD if [[ ${SKIP_ffmpeg} -ne 1 ]]; then + # PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} + LIB_NAME="ffmpeg" + set_toolchain_paths "${LIB_NAME}" + + # SET BUILD FLAGS + HOST=$(get_host) + export CFLAGS=$(get_cflags "${LIB_NAME}") + export CXXFLAGS=$(get_cxxflags "${LIB_NAME}") + export LDFLAGS=$(get_ldflags "${LIB_NAME}") + export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" + + cd "${BASEDIR}"/src/"${LIB_NAME}" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 + + LIB_INSTALL_PREFIX="${LIB_INSTALL_BASE}"/"${LIB_NAME}" + # BUILD FFMPEG - . "${BASEDIR}"/scripts/objc/ffmpeg.sh "$@" || exit 1 + source "${BASEDIR}"/scripts/apple/ffmpeg.sh "$@" + + if [[ $? -ne 0 ]]; then + exit 1 + fi else echo -e "\nffmpeg: skipped" fi @@ -198,7 +197,7 @@ fi if [[ ${SKIP_ffmpeg_kit} -ne 1 ]]; then # BUILD FFMPEG KIT - . "${BASEDIR}"/scripts/objc/ffmpeg-kit.sh "$@" || exit 1 + . "${BASEDIR}"/scripts/apple/ffmpeg-kit.sh "$@" || exit 1 else echo -e "\nffmpeg-kit: skipped" fi diff --git a/scripts/main-tvos.sh b/scripts/main-tvos.sh index 545190c..c76c4fd 100755 --- a/scripts/main-tvos.sh +++ b/scripts/main-tvos.sh @@ -15,27 +15,22 @@ if [[ -z ${BASEDIR} ]]; then exit 1 fi -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - if [[ -z ${SDK_PATH} ]]; then echo -e "\n(*) SDK_PATH not defined\n" exit 1 fi # ENABLE COMMON FUNCTIONS -. "${BASEDIR}"/scripts/function-tvos.sh +source "${BASEDIR}"/scripts/function-"${FFMPEG_KIT_BUILD_TYPE}".sh 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 echo -e "\nBuilding ${ARCH} platform\n" echo -e "\nINFO: Starting new build for ${ARCH} at $(date)\n" 1>>"${BASEDIR}"/build.log 2>&1 # SET BASE INSTALLATION DIRECTORY FOR THIS ARCHITECTURE -INSTALL_BASE="${BASEDIR}/prebuilt/$(get_target_build_directory)" +export LIB_INSTALL_BASE="${BASEDIR}/prebuilt/$(get_build_directory)" # CREATE PACKAGE CONFIG DIRECTORY FOR THIS ARCHITECTURE -PKG_CONFIG_DIRECTORY="${INSTALL_BASE}/pkgconfig" +PKG_CONFIG_DIRECTORY="${LIB_INSTALL_BASE}/pkgconfig" if [ ! -d "${PKG_CONFIG_DIRECTORY}" ]; then mkdir -p "${PKG_CONFIG_DIRECTORY}" || exit 1 fi @@ -43,7 +38,7 @@ fi # FILTER WHICH EXTERNAL LIBRARIES WILL BE BUILT # NOTE THAT BUILT-IN LIBRARIES ARE FORWARDED TO FFMPEG SCRIPT WITHOUT ANY PROCESSING enabled_library_list=() -for library in {1..46}; do +for library in {1..47}; do if [[ ${!library} -eq 1 ]]; then ENABLED_LIBRARY=$(get_library_name $((library - 1))) enabled_library_list+=(${ENABLED_LIBRARY}) @@ -59,67 +54,72 @@ while [ ${#enabled_library_list[@]} -gt $completed ]; do let run=0 case $library in fontconfig) - if [[ -n $OK_expat ]] && [[ -n $OK_freetype ]]; then + if [[ $OK_expat -eq 1 ]] && [[ $OK_freetype -eq 1 ]]; then run=1 fi ;; freetype) - if [[ -n $OK_libpng ]]; then + if [[ $OK_libpng -eq 1 ]]; then run=1 fi ;; gnutls) - if [[ -n $OK_nettle ]] && [[ -n $OK_gmp ]]; then + if [[ $OK_nettle -eq 1 ]] && [[ $OK_gmp -eq 1 ]]; then + run=1 + fi + ;; + harfbuzz) + if [[ $OK_fontconfig -eq 1 ]] && [[ $OK_freetype -eq 1 ]]; then run=1 fi ;; leptonica) - if [[ -n $OK_giflib ]] && [[ -n $OK_jpeg ]] && [[ -n $OK_libpng ]] && [[ -n $OK_tiff ]] && [[ -n $OK_libwebp ]]; then + if [[ $OK_giflib -eq 1 ]] && [[ $OK_jpeg -eq 1 ]] && [[ $OK_libpng -eq 1 ]] && [[ $OK_tiff -eq 1 ]] && [[ $OK_libwebp -eq 1 ]]; then run=1 fi ;; libass) - if [[ -n $OK_expat ]] && [[ -n $OK_freetype ]] && [[ -n $OK_fribidi ]] && [[ -n $OK_fontconfig ]] && [[ -n $OK_libpng ]]; then + if [[ $OK_expat -eq 1 ]] && [[ $OK_freetype -eq 1 ]] && [[ $OK_fribidi -eq 1 ]] && [[ $OK_fontconfig -eq 1 ]] && [[ $OK_libpng -eq 1 ]] && [[ $OK_harfbuzz -eq 1 ]]; then run=1 fi ;; libtheora) - if [[ -n $OK_libvorbis ]] && [[ -n $OK_libogg ]]; then + if [[ $OK_libvorbis -eq 1 ]] && [[ $OK_libogg -eq 1 ]]; then run=1 fi ;; libvorbis) - if [[ -n $OK_libogg ]]; then + if [[ $OK_libogg -eq 1 ]]; then run=1 fi ;; libwebp) - if [[ -n $OK_giflib ]] && [[ -n $OK_jpeg ]] && [[ -n $OK_libpng ]] && [[ -n $OK_tiff ]]; then + if [[ $OK_giflib -eq 1 ]] && [[ $OK_jpeg -eq 1 ]] && [[ $OK_libpng -eq 1 ]] && [[ $OK_tiff -eq 1 ]]; then run=1 fi ;; nettle) - if [[ -n $OK_gmp ]]; then + if [[ $OK_gmp -eq 1 ]]; then run=1 fi ;; rubberband) - if [[ -n $OK_libsndfile ]] && [[ -n $OK_libsamplerate ]]; then + if [[ $OK_libsndfile -eq 1 ]] && [[ $OK_libsamplerate -eq 1 ]]; then run=1 fi ;; tesseract) - if [[ -n $OK_leptonica ]]; then + if [[ $OK_leptonica -eq 1 ]]; then run=1 fi ;; tiff) - if [[ -n $OK_jpeg ]]; then + if [[ $OK_jpeg -eq 1 ]]; then run=1 fi ;; twolame) - if [[ -n $OK_libsndfile ]]; then + if [[ $OK_libsndfile -eq 1 ]]; then run=1 fi ;; @@ -132,45 +132,25 @@ while [ ${#enabled_library_list[@]} -gt $completed ]; do REBUILD_FLAG=$(echo "REBUILD_${library}" | sed "s/\-/\_/g") DEPENDENCY_REBUILT_FLAG=$(echo "DEPENDENCY_REBUILT_${library}" | sed "s/\-/\_/g") - if [ $run -eq 1 ] && [[ -z ${!BUILD_COMPLETED_FLAG} ]]; then - ENABLED_LIBRARY_PATH="${INSTALL_BASE}/${library}" + if [[ $run -eq 1 ]] && [[ "${!BUILD_COMPLETED_FLAG}" != "1" ]]; then + LIBRARY_IS_INSTALLED=$(library_is_installed "${LIB_INSTALL_BASE}" "${library}") - LIBRARY_IS_INSTALLED=$(library_is_installed "${INSTALL_BASE}" "${library}") - - echo -e "INFO: Flags detected for ${library}: already installed=${LIBRARY_IS_INSTALLED}, rebuild=${!REBUILD_FLAG}, dependency rebuilt=${!DEPENDENCY_REBUILT_FLAG}\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "INFO: Flags detected for ${library}: already installed=${LIBRARY_IS_INSTALLED}, rebuild requested by user=${!REBUILD_FLAG}, will be rebuilt due to dependency update=${!DEPENDENCY_REBUILT_FLAG}\n" 1>>"${BASEDIR}"/build.log 2>&1 # CHECK IF BUILD IS NECESSARY OR NOT - if [[ ${LIBRARY_IS_INSTALLED} -ne 0 ]] || [[ ${!REBUILD_FLAG} -eq 1 ]] || [[ ${!DEPENDENCY_REBUILT_FLAG} -eq 1 ]]; then - - echo -e "----------------------------------------------------------------" 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "\nINFO: Building $library with the following environment variables\n" 1>>"${BASEDIR}"/build.log 2>&1 - env 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "----------------------------------------------------------------\n" 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "INFO: System information\n" 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "INFO: $(uname -a)\n" 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "----------------------------------------------------------------\n" 1>>"${BASEDIR}"/build.log 2>&1 - + if [[ ${LIBRARY_IS_INSTALLED} -ne 1 ]] || [[ ${!REBUILD_FLAG} -eq 1 ]] || [[ ${!DEPENDENCY_REBUILT_FLAG} -eq 1 ]]; then echo -n "${library}: " - # DELETE THE PREVIOUS BUILD OF THE LIBRARY - if [ -d "${ENABLED_LIBRARY_PATH}" ]; then - rm -rf "${INSTALL_BASE}"/"${library}" || exit 1 - fi - - SCRIPT_PATH="${BASEDIR}/scripts/objc/${library}.sh" - - cd "${BASEDIR}" - - # EXECUTE BUILD SCRIPT OF EACH ENABLED LIBRARY - ${SCRIPT_PATH} 1>>"${BASEDIR}"/build.log 2>&1 + "${BASEDIR}"/scripts/run-apple.sh "${library}" 1>>"${BASEDIR}"/build.log 2>&1 + # SET SOME FLAGS AFTER THE BUILD if [ $? -eq 0 ]; then ((completed += 1)) declare "$BUILD_COMPLETED_FLAG=1" check_if_dependency_rebuilt "${library}" echo "ok" else - echo "failed" + echo -e "failed\n\nSee build.log for details\n" exit 1 fi else @@ -179,7 +159,7 @@ while [ ${#enabled_library_list[@]} -gt $completed ]; do echo "${library}: already built" fi else - echo -e "INFO: Skipping $library, run=$run, completed=${!BUILD_COMPLETED_FLAG}\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "INFO: Skipping $library, dependencies built=$run, already built=${!BUILD_COMPLETED_FLAG}\n" 1>>"${BASEDIR}"/build.log 2>&1 fi done done @@ -187,8 +167,27 @@ done # SKIP TO SPEED UP THE BUILD if [[ ${SKIP_ffmpeg} -ne 1 ]]; then + # PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} + LIB_NAME="ffmpeg" + set_toolchain_paths "${LIB_NAME}" + + # SET BUILD FLAGS + HOST=$(get_host) + export CFLAGS=$(get_cflags "${LIB_NAME}") + export CXXFLAGS=$(get_cxxflags "${LIB_NAME}") + export LDFLAGS=$(get_ldflags "${LIB_NAME}") + export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" + + cd "${BASEDIR}"/src/"${LIB_NAME}" 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 + + LIB_INSTALL_PREFIX="${LIB_INSTALL_BASE}/${LIB_NAME}" + # BUILD FFMPEG - . "${BASEDIR}"/scripts/objc/ffmpeg.sh "$@" || exit 1 + source "${BASEDIR}"/scripts/apple/ffmpeg.sh "$@" + + if [[ $? -ne 0 ]]; then + exit 1 + fi else echo -e "\nffmpeg: skipped" fi @@ -197,7 +196,7 @@ fi if [[ ${SKIP_ffmpeg_kit} -ne 1 ]]; then # BUILD FFMPEG - . "${BASEDIR}"/scripts/objc/ffmpeg-kit.sh "$@" || exit 1 + . "${BASEDIR}"/scripts/apple/ffmpeg-kit.sh "$@" || exit 1 else echo -e "\nffmpeg-kit: skipped" fi diff --git a/scripts/objc/chromaprint.sh b/scripts/objc/chromaprint.sh deleted file mode 100755 index 92d6fe2..0000000 --- a/scripts/objc/chromaprint.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="chromaprint" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -CFLAGS=$(get_cflags ${LIB_NAME}) -CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -if [ -d "build" ]; then - rm -rf build -fi - -mkdir build; -cd build - -cmake -Wno-dev \ - -DCMAKE_VERBOSE_MAKEFILE=0 \ - -DCMAKE_C_FLAGS="${CFLAGS}" \ - -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ - -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ - -DCMAKE_SYSROOT="${SDK_PATH}" \ - -DCMAKE_FIND_ROOT_PATH="${SDK_PATH}" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX="${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME}" \ - -DCMAKE_SYSTEM_NAME=Darwin \ - -DCMAKE_OSX_SYSROOT="" \ - -DCMAKE_C_COMPILER="$CC" \ - -DCMAKE_LINKER="$LD" \ - -DCMAKE_AR="$(xcrun --sdk $(get_sdk_name) -f ar)" \ - -DCMAKE_AS="$AS" \ - -DFFT_LIB=kissfft \ - -DCMAKE_SYSTEM_PROCESSOR=$(get_target_arch) \ - -DBUILD_SHARED_LIBS=0 .. || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp libchromaprint.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 diff --git a/scripts/objc/expat.sh b/scripts/objc/expat.sh deleted file mode 100755 index bb501ac..0000000 --- a/scripts/objc/expat.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -# ENABLE COMMON FUNCTIONS -source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="expat" -set_toolchain_paths ${LIB_NAME} - -# SET BUILD FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_expat} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${SDK_PATH} \ - --without-docbook \ - --without-xmlwf \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp ./expat.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 diff --git a/scripts/objc/ffmpeg-kit.sh b/scripts/objc/ffmpeg-kit.sh deleted file mode 100755 index 01b7293..0000000 --- a/scripts/objc/ffmpeg-kit.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash - -# ENABLE COMMON FUNCTIONS -source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="ffmpeg-kit" -set_toolchain_paths ${LIB_NAME} - -# PREPARE BUILD FLAGS -BUILD_HOST=$(get_build_host) -if [ ${ARCH} == "x86-64-mac-catalyst" ]; then - BUILD_HOST="x86_64-apple-darwin" -fi -COMMON_CFLAGS=$(get_cflags ${LIB_NAME}) -COMMON_LDFLAGS=$(get_ldflags ${LIB_NAME}) - -# SET BUILD FLAGS -export CFLAGS="${COMMON_CFLAGS} -I${BASEDIR}/prebuilt/$(get_target_build_directory)/ffmpeg/include" -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS="${COMMON_LDFLAGS} -L${BASEDIR}/prebuilt/$(get_target_build_directory)/ffmpeg/lib -framework Foundation -framework CoreVideo -lavdevice" -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -# ALWAYS BUILD STATIC LIBRARIES -BUILD_LIBRARY_OPTIONS="--enable-static --disable-shared" - -cd "${BASEDIR}"/objc || exit 1 - -echo -n -e "\n${LIB_NAME}: " - -make distclean 2>/dev/null 1>/dev/null - -rm -f "${BASEDIR}"/objc/src/libffmpegkit* 1>>"${BASEDIR}"/build.log 2>&1 - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_ffmpeg_kit} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -# CHECK IF VIDEOTOOLBOX IS ENABLED -VIDEOTOOLBOX_SUPPORT_FLAG="" -if [[ ${LIBRARY_OBJC_VIDEOTOOLBOX} -eq 1 ]]; then - VIDEOTOOLBOX_SUPPORT_FLAG="--enable-videotoolbox" -fi - -# REMOVE OPTIONS FROM CONFIGURE TO FIX THE FOLLOWING ERROR -# ld: -flat_namespace and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together -${SED_INLINE} 's/$wl-flat_namespace //g' configure -${SED_INLINE} 's/$wl-undefined //g' configure -${SED_INLINE} 's/${wl}suppress//g' configure - -./configure \ - --prefix="${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME}" \ - --with-pic \ - --with-sysroot=${SDK_PATH} \ - ${BUILD_LIBRARY_OPTIONS} \ - ${VIDEOTOOLBOX_SUPPORT_FLAG} \ - --disable-fast-install \ - --disable-maintainer-mode \ - --host=${BUILD_HOST} 1>>"${BASEDIR}"/build.log 2>&1 - -if [ $? -ne 0 ]; then - echo "failed" - exit 1 -fi - -rm -rf "${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME}" 1>>"${BASEDIR}"/build.log 2>&1 -make -j$(get_cpu_count) install 1>>"${BASEDIR}"/build.log 2>&1 - -if [ $? -eq 0 ]; then - echo "ok" -else - echo "failed" - exit 1 -fi diff --git a/scripts/objc/ffmpeg.sh b/scripts/objc/ffmpeg.sh deleted file mode 100755 index b88aaae..0000000 --- a/scripts/objc/ffmpeg.sh +++ /dev/null @@ -1,531 +0,0 @@ -#!/bin/bash - -# ENABLE COMMON FUNCTIONS -source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh - -# FIND pkg-config PATH -HOST_PKG_CONFIG_PATH=$(command -v pkg-config) -if [ -z "${HOST_PKG_CONFIG_PATH}" ]; then - echo -e "\n(*) pkg-config command not found\n" - exit 1 -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="ffmpeg" -set_toolchain_paths ${LIB_NAME} - -# PREPARE BUILD FLAGS -BUILD_HOST=$(get_build_host) -FFMPEG_CFLAGS="" -FFMPEG_LDFLAGS="" -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -# PREPARE BUILD OPTIONS -TARGET_CPU="" -TARGET_ARCH="" -ARCH_OPTIONS="" -BITCODE_FLAGS="" -case ${ARCH} in -armv7) - TARGET_CPU="armv7" - TARGET_ARCH="armv7" - ARCH_OPTIONS=" --enable-neon --enable-asm" - BITCODE_FLAGS="-fembed-bitcode -Wc,-fembed-bitcode" - ;; -armv7s) - TARGET_CPU="armv7s" - TARGET_ARCH="armv7s" - ARCH_OPTIONS=" --enable-neon --enable-asm" - BITCODE_FLAGS="-fembed-bitcode -Wc,-fembed-bitcode" - ;; -arm64) - TARGET_CPU="armv8" - TARGET_ARCH="aarch64" - ARCH_OPTIONS=" --enable-neon --enable-asm" - BITCODE_FLAGS="-fembed-bitcode -Wc,-fembed-bitcode" - ;; -arm64e) - TARGET_CPU="armv8.3-a" - TARGET_ARCH="aarch64" - ARCH_OPTIONS=" --enable-neon --enable-asm" - BITCODE_FLAGS="-fembed-bitcode -Wc,-fembed-bitcode" - ;; -i386) - TARGET_CPU="i386" - TARGET_ARCH="i386" - ARCH_OPTIONS=" --disable-neon --enable-asm" - BITCODE_FLAGS="" - ;; -x86-64) - TARGET_CPU="x86_64" - TARGET_ARCH="x86_64" - ARCH_OPTIONS=" --disable-neon --disable-asm" - BITCODE_FLAGS="" - ;; -x86-64-mac-catalyst) - TARGET_CPU="x86_64" - TARGET_ARCH="x86_64" - ARCH_OPTIONS=" --disable-neon --disable-asm" - BITCODE_FLAGS="-fembed-bitcode -Wc,-fembed-bitcode" - ;; -esac - -CONFIGURE_POSTFIX="" - -# PREPARE CONFIGURE OPTIONS -for library in {1..58}; do - if [[ ${!library} -eq 1 ]]; then - ENABLED_LIBRARY=$(get_library_name $((library - 1))) - - echo -e "INFO: Enabling library ${ENABLED_LIBRARY}\n" 1>>"${BASEDIR}"/build.log 2>&1 - - case ${ENABLED_LIBRARY} in - chromaprint) - FFMPEG_CFLAGS+=" $(pkg-config --cflags libchromaprint 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static libchromaprint 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-chromaprint" - ;; - fontconfig) - FFMPEG_CFLAGS+=" $(pkg-config --cflags fontconfig 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static fontconfig 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-libfontconfig" - ;; - freetype) - FFMPEG_CFLAGS+=" $(pkg-config --cflags freetype2 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static freetype2 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-libfreetype" - ;; - fribidi) - FFMPEG_CFLAGS+=" $(pkg-config --cflags fribidi 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static fribidi 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-libfribidi" - ;; - gmp) - FFMPEG_CFLAGS+=" $(pkg-config --cflags gmp 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static gmp 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-gmp" - ;; - gnutls) - FFMPEG_CFLAGS+=" $(pkg-config --cflags gnutls 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static gnutls 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-gnutls" - ;; - kvazaar) - FFMPEG_CFLAGS+=" $(pkg-config --cflags kvazaar 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static kvazaar 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-libkvazaar" - ;; - lame) - FFMPEG_CFLAGS+=" $(pkg-config --cflags libmp3lame 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static libmp3lame 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-libmp3lame" - ;; - libaom) - FFMPEG_CFLAGS+=" $(pkg-config --cflags aom 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static aom 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-libaom" - ;; - libass) - FFMPEG_CFLAGS+=" $(pkg-config --cflags libass 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static libass 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-libass" - ;; - libilbc) - FFMPEG_CFLAGS+=" $(pkg-config --cflags libilbc 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static libilbc 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-libilbc" - ;; - libtheora) - FFMPEG_CFLAGS+=" $(pkg-config --cflags theora 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static theora 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-libtheora" - ;; - libvidstab) - FFMPEG_CFLAGS+=" $(pkg-config --cflags vidstab 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static vidstab 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-libvidstab --enable-gpl" - ;; - libvorbis) - FFMPEG_CFLAGS+=" $(pkg-config --cflags vorbis 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static vorbis 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-libvorbis" - ;; - libvpx) - FFMPEG_CFLAGS+=" $(pkg-config --cflags vpx 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static vpx 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-libvpx" - ;; - libwebp) - FFMPEG_CFLAGS+=" $(pkg-config --cflags libwebp 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static libwebp 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-libwebp" - ;; - libxml2) - FFMPEG_CFLAGS+=" $(pkg-config --cflags libxml-2.0 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static libxml-2.0 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-libxml2" - ;; - opencore-amr) - FFMPEG_CFLAGS+=" $(pkg-config --cflags opencore-amrnb 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static opencore-amrnb 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-libopencore-amrnb" - ;; - openh264) - FFMPEG_CFLAGS+=" $(pkg-config --cflags openh264 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static openh264 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-libopenh264" - ;; - opus) - FFMPEG_CFLAGS+=" $(pkg-config --cflags opus 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static opus 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-libopus" - ;; - rubberband) - FFMPEG_CFLAGS+=" $(pkg-config --cflags rubberband 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static rubberband 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" -framework Accelerate" - CONFIGURE_POSTFIX+=" --enable-librubberband --enable-gpl" - ;; - sdl) - FFMPEG_CFLAGS+=" $(pkg-config --cflags sdl2 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static sdl2 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-sdl2" - ;; - shine) - FFMPEG_CFLAGS+=" $(pkg-config --cflags shine 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static shine 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-libshine" - ;; - snappy) - FFMPEG_CFLAGS+=" $(pkg-config --cflags snappy 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static snappy 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-libsnappy" - ;; - soxr) - FFMPEG_CFLAGS+=" $(pkg-config --cflags soxr 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static soxr 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-libsoxr" - ;; - speex) - FFMPEG_CFLAGS+=" $(pkg-config --cflags speex 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static speex 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-libspeex" - ;; - tesseract) - FFMPEG_CFLAGS+=" $(pkg-config --cflags tesseract 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static tesseract 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_CFLAGS+=" $(pkg-config --cflags giflib 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static giflib 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-libtesseract" - ;; - twolame) - FFMPEG_CFLAGS+=" $(pkg-config --cflags twolame 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static twolame 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-libtwolame" - ;; - vo-amrwbenc) - FFMPEG_CFLAGS+=" $(pkg-config --cflags vo-amrwbenc 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static vo-amrwbenc 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-libvo-amrwbenc" - ;; - wavpack) - FFMPEG_CFLAGS+=" $(pkg-config --cflags wavpack 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static wavpack 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-libwavpack" - ;; - x264) - FFMPEG_CFLAGS+=" $(pkg-config --cflags x264 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static x264 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-libx264 --enable-gpl" - ;; - x265) - FFMPEG_CFLAGS+=" $(pkg-config --cflags x265 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static x265 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-libx265 --enable-gpl" - ;; - xvidcore) - FFMPEG_CFLAGS+=" $(pkg-config --cflags xvidcore 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static xvidcore 1>>"${BASEDIR}"/build.log 2>&1)" - CONFIGURE_POSTFIX+=" --enable-libxvid --enable-gpl" - ;; - expat) - FFMPEG_CFLAGS+=" $(pkg-config --cflags expat 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static expat 1>>"${BASEDIR}"/build.log 2>&1)" - ;; - libogg) - FFMPEG_CFLAGS+=" $(pkg-config --cflags ogg 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static ogg 1>>"${BASEDIR}"/build.log 2>&1)" - ;; - libpng) - FFMPEG_CFLAGS+=" $(pkg-config --cflags libpng 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static libpng 1>>"${BASEDIR}"/build.log 2>&1)" - ;; - nettle) - FFMPEG_CFLAGS+=" $(pkg-config --cflags nettle 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static nettle 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_CFLAGS+=" $(pkg-config --cflags hogweed 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static hogweed 1>>"${BASEDIR}"/build.log 2>&1)" - ;; - ios-* | tvos-* | macos-*) - - # BUILT-IN LIBRARIES SHARE INCLUDE AND LIB DIRECTORIES - # INCLUDING ONLY ONE OF THEM IS ENOUGH - FFMPEG_CFLAGS+=" $(pkg-config --cflags zlib 1>>"${BASEDIR}"/build.log 2>&1)" - FFMPEG_LDFLAGS+=" $(pkg-config --libs --static zlib 1>>"${BASEDIR}"/build.log 2>&1)" - - case ${ENABLED_LIBRARY} in - *-audiotoolbox) - CONFIGURE_POSTFIX+=" --enable-audiotoolbox" - - if [[ ${FFMPEG_KIT_BUILD_TYPE} != "macos" ]]; then - - # NOT AVAILABLE ON IOS, TVOS - CONFIGURE_POSTFIX+=" --disable-outdev=audiotoolbox" - fi - ;; - *-avfoundation) - CONFIGURE_POSTFIX+=" --enable-avfoundation" - ;; - *-bzip2) - CONFIGURE_POSTFIX+=" --enable-bzlib" - ;; - *-coreimage) - CONFIGURE_POSTFIX+=" --enable-coreimage" - ;; - *-libiconv) - CONFIGURE_POSTFIX+=" --enable-iconv" - ;; - *-opencl) - CONFIGURE_POSTFIX+=" --enable-opencl" - ;; - *-opengl) - CONFIGURE_POSTFIX+=" --enable-opengl" - ;; - *-videotoolbox) - CONFIGURE_POSTFIX+=" --enable-videotoolbox" - ;; - *-zlib) - CONFIGURE_POSTFIX+=" --enable-zlib" - ;; - esac - ;; - esac - else - - # THE FOLLOWING LIBRARIES SHOULD BE EXPLICITLY DISABLED TO PREVENT AUTODETECT - # NOTE THAT IDS MUST BE +1 OF THE INDEX VALUE - if [[ ${library} -eq $((LIBRARY_SDL + 1)) ]]; then - CONFIGURE_POSTFIX+=" --disable-sdl2" - elif [[ ${library} -eq $((LIBRARY_OBJC_AUDIOTOOLBOX + 1)) ]]; then - CONFIGURE_POSTFIX+=" --disable-audiotoolbox" - elif [[ ${library} -eq $((LIBRARY_OBJC_AVFOUNDATION + 1)) ]]; then - CONFIGURE_POSTFIX+=" --disable-avfoundation" - elif [[ ${library} -eq $((LIBRARY_OBJC_BZIP2 + 1)) ]]; then - CONFIGURE_POSTFIX+=" --disable-bzlib" - elif [[ ${library} -eq $((LIBRARY_OBJC_COREIMAGE + 1)) ]]; then - CONFIGURE_POSTFIX+=" --disable-coreimage" - elif [[ ${library} -eq $((LIBRARY_OBJC_LIBICONV + 1)) ]]; then - CONFIGURE_POSTFIX+=" --disable-iconv" - elif [[ ${library} -eq $((LIBRARY_OBJC_OPENCL + 1)) ]]; then - CONFIGURE_POSTFIX+=" --disable-opencl" - elif [[ ${library} -eq $((LIBRARY_OBJC_OPENGL + 1)) ]]; then - CONFIGURE_POSTFIX+=" --disable-opengl" - elif [[ ${library} -eq $((LIBRARY_OBJC_VIDEOTOOLBOX + 1)) ]]; then - CONFIGURE_POSTFIX+=" --disable-videotoolbox" - elif [[ ${library} -eq $((LIBRARY_OBJC_ZLIB + 1)) ]]; then - CONFIGURE_POSTFIX+=" --disable-zlib" - fi - fi - - ((library++)) -done - -# ALWAYS BUILD STATIC LIBRARIES -BUILD_LIBRARY_OPTIONS="--enable-static --disable-shared" - -# OPTIMIZE FOR SPEED INSTEAD OF SIZE -if [[ -z ${FFMPEG_KIT_OPTIMIZED_FOR_SPEED} ]]; then - SIZE_OPTIONS="--enable-small" -else - SIZE_OPTIONS="" -fi - -# SET DEBUG OPTIONS -if [[ -z ${FFMPEG_KIT_DEBUG} ]]; then - DEBUG_OPTIONS="--disable-debug" -else - DEBUG_OPTIONS="--enable-debug --disable-stripping" -fi - -# PREPARE CFLAGS PARTS BEFORE COMBINING THEM -ARCH_CFLAGS=$(get_arch_specific_cflags) -APP_CFLAGS=$(get_app_specific_cflags ${LIB_NAME}) -COMMON_CFLAGS=$(get_common_cflags) -if [[ -z ${FFMPEG_KIT_DEBUG} ]]; then - OPTIMIZATION_CFLAGS="$(get_size_optimization_cflags ${LIB_NAME})" -else - OPTIMIZATION_CFLAGS="${FFMPEG_KIT_DEBUG}" -fi -MIN_VERSION_CFLAGS=$(get_min_version_cflags) -COMMON_INCLUDES=$(get_common_includes) - -# PREPARE CFLAGS LDFLAGS BEFORE COMBINING THEM -ARCH_LDFLAGS=$(get_arch_specific_ldflags) -if [[ -z ${FFMPEG_KIT_DEBUG} ]]; then - OPTIMIZATION_FLAGS="$(get_size_optimization_ldflags ${LIB_NAME})" -else - OPTIMIZATION_FLAGS="${FFMPEG_KIT_DEBUG}" -fi -LINKED_LIBRARIES=$(get_common_linked_libraries) -COMMON_LDFLAGS=$(get_common_ldflags) - -# SET BUILD FLAGS -export CFLAGS="${ARCH_CFLAGS} ${APP_CFLAGS} ${COMMON_CFLAGS} ${OPTIMIZATION_CFLAGS} ${MIN_VERSION_CFLAGS}${FFMPEG_CFLAGS} ${COMMON_INCLUDES}" -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS="${ARCH_LDFLAGS}${FFMPEG_LDFLAGS} ${LINKED_LIBRARIES} ${COMMON_LDFLAGS} ${BITCODE_FLAGS} ${OPTIMIZATION_FLAGS}" - -echo -n -e "\n${LIB_NAME}: " - -cd "${BASEDIR}"/src/${LIB_NAME} || exit 1 - -if [[ -z ${NO_WORKSPACE_CLEANUP_ffmpeg} ]]; then - echo -e "INFO: Cleaning workspace for ${LIB_NAME}\n" 1>>"${BASEDIR}"/build.log 2>&1 - make distclean 2>/dev/null 1>/dev/null -fi - -########################### CUSTOMIZATIONS ####################### - -# 1. Workaround to prevent adding of -mdynamic-no-pic flag -${SED_INLINE} 's/check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic;/check_cflags -mdynamic-no-pic;/g' ./configure 1>>"${BASEDIR}"/build.log 2>&1 - -# 2. Workaround for videotoolbox on mac catalyst -if [ ${ARCH} == "x86-64-mac-catalyst" ]; then - ${SED_INLINE} 's/ CFDictionarySetValue(buffer_attributes\, kCVPixelBufferOpenGLESCompatibilityKey/ \/\/ CFDictionarySetValue(buffer_attributes\, kCVPixelBufferOpenGLESCompatibilityKey/g' "${BASEDIR}"/src/${LIB_NAME}/libavcodec/videotoolbox.c -else - ${SED_INLINE} 's/ \/\/ CFDictionarySetValue(buffer_attributes\, kCVPixelBufferOpenGLESCompatibilityKey/ CFDictionarySetValue(buffer_attributes\, kCVPixelBufferOpenGLESCompatibilityKey/g' "${BASEDIR}"/src/${LIB_NAME}/libavcodec/videotoolbox.c -fi - -# 3. Use thread local log levels -${SED_INLINE} 's/static int av_log_level/__thread int av_log_level/g' "${BASEDIR}"/src/${LIB_NAME}/libavutil/log.c 1>>"${BASEDIR}"/build.log 2>&1 - -################################################################### - -./configure \ - --sysroot=${SDK_PATH} \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --enable-version3 \ - --arch="${TARGET_ARCH}" \ - --cpu="${TARGET_CPU}" \ - --target-os=darwin \ - ${ARCH_OPTIONS} \ - --ar="${AR}" \ - --cc="${CC}" \ - --cxx="${CXX}" \ - --as="${AS}" \ - --ranlib="${RANLIB}" \ - --strip="${STRIP}" \ - --disable-autodetect \ - --enable-cross-compile \ - --enable-pic \ - --enable-inline-asm \ - --enable-optimizations \ - --enable-swscale \ - ${BUILD_LIBRARY_OPTIONS} \ - --enable-pthreads \ - --disable-v4l2-m2m \ - --disable-outdev=v4l2 \ - --disable-outdev=fbdev \ - --disable-indev=v4l2 \ - --disable-indev=fbdev \ - ${SIZE_OPTIONS} \ - --disable-openssl \ - --disable-xmm-clobber-test \ - ${DEBUG_OPTIONS} \ - --disable-neon-clobber-test \ - --disable-programs \ - --disable-postproc \ - --disable-doc \ - --disable-htmlpages \ - --disable-manpages \ - --disable-podpages \ - --disable-txtpages \ - --disable-sndio \ - --disable-schannel \ - --disable-securetransport \ - --disable-xlib \ - --disable-cuda \ - --disable-cuvid \ - --disable-nvenc \ - --disable-vaapi \ - --disable-vdpau \ - --disable-appkit \ - --disable-alsa \ - --disable-cuda \ - --disable-cuvid \ - --disable-nvenc \ - --disable-vaapi \ - --disable-vdpau \ - ${CONFIGURE_POSTFIX} ${PLATFORM_OPTIONS} 1>>"${BASEDIR}"/build.log 2>&1 - -if [ $? -ne 0 ]; then - echo "failed" - exit 1 -fi - -if [[ -z ${NO_OUTPUT_REDIRECTION} ]]; then - make -j$(get_cpu_count) 1>>"${BASEDIR}"/build.log 2>&1 - - if [ $? -ne 0 ]; then - echo "failed" - exit 1 - fi -else - echo -e "started\n" - make -j$(get_cpu_count) 1>>"${BASEDIR}"/build.log 2>&1 - - if [ $? -ne 0 ]; then - echo -n -e "\n${LIB_NAME}: failed\n" - exit 1 - else - echo -n -e "\n${LIB_NAME}: " - fi -fi - -rm -rf "${BASEDIR}/prebuilt/$(get_target_build_directory)"/${LIB_NAME} 1>>"${BASEDIR}"/build.log 2>&1 -make install 1>>"${BASEDIR}"/build.log 2>&1 - -if [ $? -ne 0 ]; then - echo "failed" - exit 1 -fi - -# MANUALLY ADD REQUIRED HEADERS -mkdir -p "${BASEDIR}/prebuilt/$(get_target_build_directory)"/ffmpeg/include/libavutil/x86 -mkdir -p "${BASEDIR}/prebuilt/$(get_target_build_directory)"/ffmpeg/include/libavutil/arm -mkdir -p "${BASEDIR}/prebuilt/$(get_target_build_directory)"/ffmpeg/include/libavutil/aarch64 -mkdir -p "${BASEDIR}/prebuilt/$(get_target_build_directory)"/ffmpeg/include/libavcodec/x86 -mkdir -p "${BASEDIR}/prebuilt/$(get_target_build_directory)"/ffmpeg/include/libavcodec/arm -cp -f "${BASEDIR}"/src/ffmpeg/config.h "${BASEDIR}/prebuilt/$(get_target_build_directory)"/ffmpeg/include -cp -f "${BASEDIR}"/src/ffmpeg/libavcodec/mathops.h "${BASEDIR}/prebuilt/$(get_target_build_directory)"/ffmpeg/include/libavcodec -cp -f "${BASEDIR}"/src/ffmpeg/libavcodec/x86/mathops.h "${BASEDIR}/prebuilt/$(get_target_build_directory)"/ffmpeg/include/libavcodec/x86 -cp -f "${BASEDIR}"/src/ffmpeg/libavcodec/arm/mathops.h "${BASEDIR}/prebuilt/$(get_target_build_directory)"/ffmpeg/include/libavcodec/arm -cp -f "${BASEDIR}"/src/ffmpeg/libavformat/network.h "${BASEDIR}/prebuilt/$(get_target_build_directory)"/ffmpeg/include/libavformat -cp -f "${BASEDIR}"/src/ffmpeg/libavformat/os_support.h "${BASEDIR}/prebuilt/$(get_target_build_directory)"/ffmpeg/include/libavformat -cp -f "${BASEDIR}"/src/ffmpeg/libavformat/url.h "${BASEDIR}/prebuilt/$(get_target_build_directory)"/ffmpeg/include/libavformat -cp -f "${BASEDIR}"/src/ffmpeg/libavutil/internal.h "${BASEDIR}/prebuilt/$(get_target_build_directory)"/ffmpeg/include/libavutil -cp -f "${BASEDIR}"/src/ffmpeg/libavutil/libm.h "${BASEDIR}/prebuilt/$(get_target_build_directory)"/ffmpeg/include/libavutil -cp -f "${BASEDIR}"/src/ffmpeg/libavutil/reverse.h "${BASEDIR}/prebuilt/$(get_target_build_directory)"/ffmpeg/include/libavutil -cp -f "${BASEDIR}"/src/ffmpeg/libavutil/thread.h "${BASEDIR}/prebuilt/$(get_target_build_directory)"/ffmpeg/include/libavutil -cp -f "${BASEDIR}"/src/ffmpeg/libavutil/timer.h "${BASEDIR}/prebuilt/$(get_target_build_directory)"/ffmpeg/include/libavutil -cp -f "${BASEDIR}"/src/ffmpeg/libavutil/x86/asm.h "${BASEDIR}/prebuilt/$(get_target_build_directory)"/ffmpeg/include/libavutil/x86 -cp -f "${BASEDIR}"/src/ffmpeg/libavutil/x86/timer.h "${BASEDIR}/prebuilt/$(get_target_build_directory)"/ffmpeg/include/libavutil/x86 -cp -f "${BASEDIR}"/src/ffmpeg/libavutil/arm/timer.h "${BASEDIR}/prebuilt/$(get_target_build_directory)"/ffmpeg/include/libavutil/arm -cp -f "${BASEDIR}"/src/ffmpeg/libavutil/aarch64/timer.h "${BASEDIR}/prebuilt/$(get_target_build_directory)"/ffmpeg/include/libavutil/aarch64 -cp -f "${BASEDIR}"/src/ffmpeg/libavutil/x86/emms.h "${BASEDIR}/prebuilt/$(get_target_build_directory)"/ffmpeg/include/libavutil/x86 - -if [ $? -eq 0 ]; then - echo "ok" -else - echo "failed" - exit 1 -fi diff --git a/scripts/objc/fontconfig.sh b/scripts/objc/fontconfig.sh deleted file mode 100755 index 5b20d17..0000000 --- a/scripts/objc/fontconfig.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - -# ENABLE COMMON FUNCTIONS -source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="fontconfig" -set_toolchain_paths ${LIB_NAME} - -# SET BUILD FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR=${INSTALL_PKG_CONFIG_DIR} - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_fontconfig} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-pic \ - --with-libiconv-prefix=${SDK_PATH}/usr \ - --with-expat=${BASEDIR}/prebuilt/$(get_target_build_directory)/expat \ - --without-libintl-prefix \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --disable-rpath \ - --disable-libxml2 \ - --disable-docs \ - --host=${BUILD_HOST} || exit 1 - -# DISABLE IOS TESTS with system() calls - system() is deprecated for IOS -# 1. test-bz106632.c -rm -f ${BASEDIR}/src/${LIB_NAME}/test/test-bz106632.c -cp ${BASEDIR}/src/${LIB_NAME}/test/test-bz106618.c ${BASEDIR}/src/${LIB_NAME}/test/test-bz106632.c - -make -j$(get_cpu_count) || exit 1 - -# CREATE PACKAGE CONFIG MANUALLY -create_fontconfig_package_config "2.13.92" - -make install || exit 1 diff --git a/scripts/objc/freetype.sh b/scripts/objc/freetype.sh deleted file mode 100755 index ae3164e..0000000 --- a/scripts/objc/freetype.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -# ENABLE COMMON FUNCTIONS -source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="freetype" -set_toolchain_paths ${LIB_NAME} - -# SET BUILD FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# OVERRIDE PKG-CONFIG -export LIBPNG_CFLAGS="-I${BASEDIR}/prebuilt/$(get_target_build_directory)/libpng/include" -export LIBPNG_LIBS="-L${BASEDIR}/prebuilt/$(get_target_build_directory)/libpng/lib" - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-pic \ - --with-zlib \ - --with-png \ - --with-sysroot=${SDK_PATH} \ - --without-harfbuzz \ - --without-bzip2 \ - --without-fsref \ - --without-quickdraw-toolbox \ - --without-quickdraw-carbon \ - --without-ats \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --disable-mmap \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# CREATE PACKAGE CONFIG MANUALLY -create_freetype_package_config "23.2.17" - -make install || exit 1 diff --git a/scripts/objc/fribidi.sh b/scripts/objc/fribidi.sh deleted file mode 100755 index ef0610e..0000000 --- a/scripts/objc/fribidi.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - -# ENABLE COMMON FUNCTIONS -source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="fribidi" -set_toolchain_paths ${LIB_NAME} - -# SET BUILD FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_fribidi} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${SDK_PATH} \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --disable-debug \ - --disable-deprecated \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp ./*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 diff --git a/scripts/objc/giflib.sh b/scripts/objc/giflib.sh deleted file mode 100755 index b425a56..0000000 --- a/scripts/objc/giflib.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="giflib" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -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}) -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_giflib} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${SDK_PATH} \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# CREATE PACKAGE CONFIG MANUALLY -create_giflib_package_config "5.1.4" - -make install || exit 1 diff --git a/scripts/objc/gmp.sh b/scripts/objc/gmp.sh deleted file mode 100755 index ba46680..0000000 --- a/scripts/objc/gmp.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="gmp" -set_toolchain_paths ${LIB_NAME} - -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_gmp} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -# PREPARING FLAGS -case ${ARCH} in - i386) - unset gmp_cv_asm_w32 - BUILD_HOST="x86-apple-darwin" - ;; - x86-64-mac-catalyst) - # Workaround for 'cannot determine how to define a 32-bit word' error - export gmp_cv_asm_w32=".long" - BUILD_HOST=$(get_build_host) - ;; - *) - unset gmp_cv_asm_w32 - BUILD_HOST=$(get_build_host) - ;; -esac - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${SDK_PATH} \ - --enable-static \ - --disable-shared \ - --disable-assembly \ - --disable-fast-install \ - --disable-maintainer-mode \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# CREATE PACKAGE CONFIG MANUALLY -create_gmp_package_config "6.2.0" - -make install || exit 1 diff --git a/scripts/objc/gnutls.sh b/scripts/objc/gnutls.sh deleted file mode 100755 index 58c53a0..0000000 --- a/scripts/objc/gnutls.sh +++ /dev/null @@ -1,106 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="gnutls" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -COMMON_CFLAGS=$(get_cflags ${LIB_NAME}) -COMMON_CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -COMMON_LDFLAGS=$(get_ldflags ${LIB_NAME}) - -export CFLAGS="${COMMON_CFLAGS} -I${SDK_PATH}/usr/include" -export CXXFLAGS="${COMMON_CXXFLAGS}" -export LDFLAGS="${COMMON_LDFLAGS} -L${SDK_PATH}/usr/lib" - -export NETTLE_CFLAGS="-I${BASEDIR}/prebuilt/$(get_target_build_directory)/nettle/include" -export NETTLE_LIBS="-L${BASEDIR}/prebuilt/$(get_target_build_directory)/nettle/lib -lnettle -L${BASEDIR}/prebuilt/$(get_target_build_directory)/gmp/lib -lgmp" -export HOGWEED_CFLAGS="-I${BASEDIR}/prebuilt/$(get_target_build_directory)/nettle/include" -export HOGWEED_LIBS="-L${BASEDIR}/prebuilt/$(get_target_build_directory)/nettle/lib -lhogweed -L${BASEDIR}/prebuilt/$(get_target_build_directory)/gmp/lib -lgmp" -export GMP_CFLAGS="-I${BASEDIR}/prebuilt/$(get_target_build_directory)/gmp/include" -export GMP_LIBS="-L${BASEDIR}/prebuilt/$(get_target_build_directory)/gmp/lib -lgmp" - -ARCH_OPTIONS="" -case ${ARCH} in - arm64 | arm64e) - ARCH_OPTIONS="--enable-hardware-acceleration" - ;; - i386) - # DISABLING thread_local WHICH IS NOT SUPPORTED ON i386 - export CFLAGS+=" -D__thread=" - ARCH_OPTIONS="--enable-hardware-acceleration" - ;; - *) - ARCH_OPTIONS="--enable-hardware-acceleration" - ;; -esac - -# PATCH AARCH64 ASM FILES USING https://gitlab.com/gnutls/gnutls/merge_requests/661 -rm -rf ${BASEDIR}/src/gnutls/lib/accelerated/aarch64/macosx -cp -r ${BASEDIR}/tools/make/gnutls/ios/macosx ${BASEDIR}/src/gnutls/lib/accelerated/aarch64 - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_gnutls} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${SDK_PATH} \ - --with-included-libtasn1 \ - --with-included-unistring \ - --without-idn \ - --without-p11-kit \ - ${ARCH_OPTIONS} \ - --enable-static \ - --disable-openssl-compatibility \ - --disable-shared \ - --disable-fast-install \ - --disable-code-coverage \ - --disable-doc \ - --disable-manpages \ - --disable-guile \ - --disable-tests \ - --disable-tools \ - --disable-maintainer-mode \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# CREATE PACKAGE CONFIG MANUALLY -create_gnutls_package_config "3.6.13" - -make install || exit 1 diff --git a/scripts/objc/jpeg.sh b/scripts/objc/jpeg.sh deleted file mode 100755 index 4753b10..0000000 --- a/scripts/objc/jpeg.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash - -# ENABLE COMMON FUNCTIONS -source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="jpeg" -set_toolchain_paths ${LIB_NAME} -export CCAS=${AS} - -# SET BUILD FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export ASM_FLAGS=$(get_asmflags ${LIB_NAME}) - -# SET ARCH OPTIONS -ARCH_OPTIONS="" -case ${ARCH} in - armv7 | armv7s | arm64 | arm64e) - ARCH_OPTIONS="-DWITH_SIMD=1" - ;; - *) - ARCH_OPTIONS="-DWITH_SIMD=0" - ;; -esac - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -if [ -d "build" ]; then - rm -rf build -fi - -mkdir build || exit 1 -cd build || exit 1 - -# fixing asm flags -${SED_INLINE} 's/${CMAKE_C_FLAGS} ${CMAKE_ASM_FLAGS}/${CMAKE_ASM_FLAGS}/g' ${BASEDIR}/src/${LIB_NAME}/simd/CMakeLists.txt - -cmake -Wno-dev \ - -DCMAKE_VERBOSE_MAKEFILE=0 \ - -DCMAKE_C_FLAGS="${CFLAGS}" \ - -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ - -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ - -DCMAKE_SYSROOT="${SDK_PATH}" \ - -DCMAKE_FIND_ROOT_PATH="${SDK_PATH}" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX="${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME}" \ - -DCMAKE_SYSTEM_NAME=Darwin \ - -DCMAKE_OSX_SYSROOT="" \ - -DCMAKE_C_COMPILER="$CC" \ - -DCMAKE_LINKER="$LD" \ - -DCMAKE_AR="$(xcrun --sdk $(get_sdk_name) -f ar)" \ - -DCMAKE_ASM_FLAGS="$ASM_FLAGS" \ - -DENABLE_PIC=1 \ - -DENABLE_STATIC=1 \ - -DENABLE_SHARED=0 \ - -DWITH_JPEG8=1 \ - ${ARCH_OPTIONS} \ - -DWITH_TURBOJPEG=0 \ - -DWITH_JAVA=0 \ - -DCMAKE_SYSTEM_PROCESSOR=$(get_target_arch) \ - -DBUILD_SHARED_LIBS=0 .. || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp ${BASEDIR}/src/${LIB_NAME}/build/pkgscripts/libjpeg.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 diff --git a/scripts/objc/kvazaar.sh b/scripts/objc/kvazaar.sh deleted file mode 100755 index 83cc6e6..0000000 --- a/scripts/objc/kvazaar.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="kvazaar" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -ARCH_OPTIONS="" -case ${ARCH} in - i386) - BUILD_HOST="x86-apple-darwin" - ;; - x86-64 | x86-64-mac-catalyst) - ARCH_OPTIONS="--disable-asm" - BUILD_HOST=$(get_build_host) - ;; - *) - BUILD_HOST=$(get_build_host) - ;; -esac -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# ALWAYS RECONFIGURE -autoreconf_library ${LIB_NAME} - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${SDK_PATH} \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - ${ARCH_OPTIONS} \ - --host=${BUILD_HOST} || exit 1 - -make || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp ./src/kvazaar.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 diff --git a/scripts/objc/lame.sh b/scripts/objc/lame.sh deleted file mode 100755 index cc2a51c..0000000 --- a/scripts/objc/lame.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="lame" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_lame} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${SDK_PATH} \ - --with-libiconv-prefix=${SDK_PATH}/usr \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --disable-maintainer-mode \ - --disable-frontend \ - --disable-efence \ - --disable-gtktest \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# CREATE PACKAGE CONFIG MANUALLY -create_libmp3lame_package_config "3.100" - -make install || exit 1 diff --git a/scripts/objc/leptonica.sh b/scripts/objc/leptonica.sh deleted file mode 100755 index dd6b4a4..0000000 --- a/scripts/objc/leptonica.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="leptonica" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS="$(get_cflags ${LIB_NAME})" -export CXXFLAGS="$(get_cxxflags ${LIB_NAME})" -export CPPFLAGS="-I${BASEDIR}/prebuilt/$(get_target_build_directory)/giflib/include" -export LDFLAGS="$(get_ldflags ${LIB_NAME}) -L${BASEDIR}/prebuilt/$(get_target_build_directory)/giflib/lib -lgif" -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -export LIBPNG_CFLAGS="$(pkg-config --cflags libpng)" -export LIBPNG_LIBS="$(pkg-config --libs --static libpng)" - -export LIBWEBP_CFLAGS="$(pkg-config --cflags libwebp)" -export LIBWEBP_LIBS="$(pkg-config --libs --static libwebp)" - -export LIBTIFF_CFLAGS="$(pkg-config --cflags libtiff-4)" -export LIBTIFF_LIBS="$(pkg-config --libs --static libtiff-4)" - -export ZLIB_CFLAGS="$(pkg-config --cflags zlib)" -export ZLIB_LIBS="$(pkg-config --libs --static zlib)" - -export JPEG_CFLAGS="$(pkg-config --cflags libjpeg)" -export JPEG_LIBS="$(pkg-config --libs --static libjpeg)" - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_leptonica} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-pic \ - --with-zlib \ - --with-libpng \ - --with-jpeg \ - --with-giflib \ - --with-libtiff \ - --with-libwebp \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --disable-programs \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp lept.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 diff --git a/scripts/objc/libaom.sh b/scripts/objc/libaom.sh deleted file mode 100755 index bc36c00..0000000 --- a/scripts/objc/libaom.sh +++ /dev/null @@ -1,122 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="libaom" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -CFLAGS="$(get_cflags ${LIB_NAME})" -CXXFLAGS="$(get_cxxflags ${LIB_NAME})" -LDFLAGS="$(get_ldflags ${LIB_NAME})" - -TOOLCHAIN_FILE="" -ARCH_OPTIONS="" -case ${ARCH} in - armv7) - TOOLCHAIN_FILE="${BASEDIR}/src/${LIB_NAME}/build/cmake/toolchains/armv7-ios.cmake" - ARCH_OPTIONS="-DARCH_ARM=1 -DENABLE_NEON=1 -DHAVE_NEON=1" - ;; - armv7s) - TOOLCHAIN_FILE="${BASEDIR}/src/${LIB_NAME}/build/cmake/toolchains/armv7s-ios.cmake" - ARCH_OPTIONS="-DARCH_ARM=1 -DENABLE_NEON=1 -DHAVE_NEON=1" - ;; - arm64) - TOOLCHAIN_FILE="${BASEDIR}/src/${LIB_NAME}/build/cmake/toolchains/arm64-ios.cmake" - ARCH_OPTIONS="-DARCH_ARM=1 -DENABLE_NEON=1 -DHAVE_NEON=1" - ;; - arm64e) - TOOLCHAIN_FILE="${BASEDIR}/src/${LIB_NAME}/build/cmake/toolchains/arm-ios-common.cmake" - ARCH_OPTIONS="-DAOM_TARGET_CPU=arm64 -DCMAKE_SYSTEM_PROCESSOR=arm64e -DCMAKE_OSX_ARCHITECTURES=arm64e -DARCH_ARM=1 -DENABLE_NEON=1 -DHAVE_NEON=1" - ;; - i386) - TOOLCHAIN_FILE="${BASEDIR}/src/${LIB_NAME}/build/cmake/toolchains/x86-ios-simulator.cmake" - ARCH_OPTIONS="-DARCH_X86=1 -DENABLE_SSE=1 -DHAVE_SSE=1 -DENABLE_SSE3=1 -DHAVE_SSE3=1" - ;; - x86-64) - TOOLCHAIN_FILE="${BASEDIR}/src/${LIB_NAME}/build/cmake/toolchains/x86_64-ios-simulator.cmake" - ARCH_OPTIONS="-DARCH_X86_64=1 -DENABLE_SSE4_1=1 -DHAVE_SSE4_2=1" - ;; - x86-64-mac-catalyst) - cp ${BASEDIR}/tools/cmake/libaom.x86_64-mac-catalyst.cmake ${BASEDIR}/src/${LIB_NAME}/build/cmake/toolchains/x86_64-mac-catalyst.cmake - TOOLCHAIN_FILE="${BASEDIR}/src/${LIB_NAME}/build/cmake/toolchains/x86_64-mac-catalyst.cmake" - ARCH_OPTIONS="-DARCH_X86_64=0 -DENABLE_SSE=0 -DENABLE_SSE2=0 -DENABLE_SSE3=0 -DENABLE_SSE4_1=0 -DENABLE_SSE4_2=0 -DENABLE_MMX=0 -DCONFIG_OS_SUPPORT=0 -DCONFIG_RUNTIME_CPU_DETECT=0" - ;; -esac - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -if [ -d "cmake-build" ]; then - rm -rf cmake-build -fi - -mkdir cmake-build; -cd cmake-build - -# Workaround to disable asm on mac catalyst -if [ ${ARCH} == "x86-64-mac-catalyst" ]; then - ${SED_INLINE} 's/define aom_clear_system_state() aom_reset_mmx_state()/define aom_clear_system_state()/g' ${BASEDIR}/src/${LIB_NAME}/aom_ports/system_state.h - ${SED_INLINE} 's/ add_asm_library("aom_ports/#add_asm_library("aom_ports/g' ${BASEDIR}/src/${LIB_NAME}/aom_ports/aom_ports.cmake - ${SED_INLINE} 's/ target_sources(aom_ports/#target_sources(aom_ports/g' ${BASEDIR}/src/${LIB_NAME}/aom_ports/aom_ports.cmake -else - ${SED_INLINE} 's/define aom_clear_system_state()/define aom_clear_system_state() aom_reset_mmx_state()/g' ${BASEDIR}/src/${LIB_NAME}/aom_ports/system_state.h - ${SED_INLINE} 's/#add_asm_library("aom_ports/ add_asm_library("aom_ports/g' ${BASEDIR}/src/${LIB_NAME}/aom_ports/aom_ports.cmake - ${SED_INLINE} 's/#target_sources(aom_ports/ target_sources(aom_ports/g' ${BASEDIR}/src/${LIB_NAME}/aom_ports/aom_ports.cmake -fi - -cmake -Wno-dev \ - -DCMAKE_VERBOSE_MAKEFILE=0 \ - -DCONFIG_PIC=1 \ - -DCMAKE_C_FLAGS="${CFLAGS}" \ - -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ - -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ - -DCMAKE_SYSROOT="${SDK_PATH}" \ - -DCMAKE_FIND_ROOT_PATH="${SDK_PATH}" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX="${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME}" \ - -DCMAKE_CXX_COMPILER="$CXX" \ - -DCMAKE_C_COMPILER="$CC" \ - -DCMAKE_LINKER="$LD" \ - -DCMAKE_AR="$(xcrun --sdk $(get_sdk_name) -f ar)" \ - -DCMAKE_AS="$AS" \ - -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \ - ${ARCH_OPTIONS} \ - -DENABLE_TESTS=0 \ - -DENABLE_EXAMPLES=0 \ - -DENABLE_TOOLS=0 \ - -DCONFIG_UNIT_TESTS=0 \ - -DBUILD_SHARED_LIBS=0 .. || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp ${BASEDIR}/src/${LIB_NAME}/cmake-build/aom.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 \ No newline at end of file diff --git a/scripts/objc/libass.sh b/scripts/objc/libass.sh deleted file mode 100755 index 2907332..0000000 --- a/scripts/objc/libass.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash - -# ENABLE COMMON FUNCTIONS -source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="libass" -set_toolchain_paths ${LIB_NAME} - -# SET BUILD FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR=${INSTALL_PKG_CONFIG_DIR} - -# SET ARCH OPTIONS -ARCH_OPTIONS="" -case ${ARCH} in - x86-64 | x86-64-mac-catalyst) - ARCH_OPTIONS="--disable-asm" - ;; - *) - ARCH_OPTIONS="--enable-asm" - ;; -esac - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_libass} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${SDK_PATH} \ - --disable-libtool-lock \ - --enable-static \ - --disable-shared \ - --disable-harfbuzz \ - --disable-fast-install \ - --disable-test \ - ${ARCH_OPTIONS} \ - --disable-profile \ - --disable-coretext \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp ./*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 diff --git a/scripts/objc/libilbc.sh b/scripts/objc/libilbc.sh deleted file mode 100755 index fea6487..0000000 --- a/scripts/objc/libilbc.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -# ENABLE COMMON FUNCTIONS -source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="libilbc" -set_toolchain_paths ${LIB_NAME} - -# SET BUILD FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_libilbc} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${SDK_PATH} \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp ./libilbc.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 diff --git a/scripts/objc/libogg.sh b/scripts/objc/libogg.sh deleted file mode 100755 index 8f85a67..0000000 --- a/scripts/objc/libogg.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="libogg" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_libogg} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -# FIX INCLUDE PATHS -${SED_INLINE} 's/sys\/types/stdint/g' ${BASEDIR}/src/libogg/include/ogg/os_types.h - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${SDK_PATH} \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp ogg.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 diff --git a/scripts/objc/libpng.sh b/scripts/objc/libpng.sh deleted file mode 100755 index 0c628f6..0000000 --- a/scripts/objc/libpng.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="libpng" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CPPFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -ARCH_OPTIONS="--enable-hardware-optimizations=yes" -case ${ARCH} in - x86 | x86-64 | x86-64-mac-catalyst) - ARCH_OPTIONS+=" --enable-intel-sse=yes" - ;; - armv7 | armv7s | arm64 | arm64e) - ARCH_OPTIONS+=" --enable-arm-neon=yes" - ;; -esac - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_libpng} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${SDK_PATH} \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --disable-unversioned-libpng-pc \ - --disable-unversioned-libpng-config \ - ${ARCH_OPTIONS} \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# CREATE PACKAGE CONFIG MANUALLY -create_libpng_package_config "1.6.37" - -make install || exit 1 diff --git a/scripts/objc/libsamplerate.sh b/scripts/objc/libsamplerate.sh deleted file mode 100755 index 3ac3077..0000000 --- a/scripts/objc/libsamplerate.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="libsamplerate" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR=${INSTALL_PKG_CONFIG_DIR} - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# DISABLE building of examples manually -${SED_INLINE} 's/examples tests//g' ${BASEDIR}/src/${LIB_NAME}/Makefile* - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_libsamplerate} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${SDK_PATH} \ - --enable-static \ - --disable-fftw \ - --disable-shared \ - --disable-fast-install \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp ./*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 diff --git a/scripts/objc/libsndfile.sh b/scripts/objc/libsndfile.sh deleted file mode 100755 index 6c7080f..0000000 --- a/scripts/objc/libsndfile.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="libsndfile" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -if [[ ! -f ${BASEDIR}/src/${LIB_NAME}/configure ]] || [[ ${RECONF_libsndfile} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${SDK_PATH} \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --disable-sqlite \ - --disable-alsa \ - --disable-full-suite \ - --disable-external-libs \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp ./*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 diff --git a/scripts/objc/libtheora.sh b/scripts/objc/libtheora.sh deleted file mode 100755 index 7cd3c7f..0000000 --- a/scripts/objc/libtheora.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="libtheora" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_libtheora} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-pic \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --disable-examples \ - --disable-telemetry \ - --disable-sdltest \ - --disable-valgrind-testing \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp theoradec.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 -cp theoraenc.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 -cp theora.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 diff --git a/scripts/objc/libuuid.sh b/scripts/objc/libuuid.sh deleted file mode 100755 index 4ccc65e..0000000 --- a/scripts/objc/libuuid.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="libuuid" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_libuuid} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${SDK_PATH} \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# AUTO-GENERATED PKG-CONFIG FILE IS WRONG. CREATING IT MANUALLY -create_uuid_package_config "1.0.3" - -make install || exit 1 diff --git a/scripts/objc/libvidstab.sh b/scripts/objc/libvidstab.sh deleted file mode 100755 index 6d7a5f6..0000000 --- a/scripts/objc/libvidstab.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="libvidstab" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -CFLAGS=$(get_cflags ${LIB_NAME}) -CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -if [ -d "build" ]; then - rm -rf build -fi - -mkdir build; -cd build - -ASM_FLAGS="" -case ${ARCH} in - armv7 | armv7s | arm64 | arm64e) - ASM_FLAGS="-DSSE2_FOUND=0 -DSSE3_FOUND=0 -DSSSE3_FOUND=0 -DSSE4_1_FOUND=0" - ;; - *) - ASM_FLAGS="" - ;; -esac - -cmake -Wno-dev \ - -DCMAKE_VERBOSE_MAKEFILE=0 \ - -DCMAKE_C_FLAGS="${CFLAGS}" \ - -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ - -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ - -DCMAKE_SYSROOT="${SDK_PATH}" \ - -DCMAKE_FIND_ROOT_PATH="${SDK_PATH}" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX="${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME}" \ - -DCMAKE_SYSTEM_NAME=Darwin \ - -DCMAKE_C_COMPILER="$CC" \ - -DCMAKE_LINKER="$LD" \ - -DCMAKE_AR="$(xcrun --sdk $(get_sdk_name) -f ar)" \ - -DCMAKE_AS="$AS" \ - -DUSE_OMP=0 \ - ${ASM_FLAGS} \ - -DCMAKE_SYSTEM_PROCESSOR=$(get_target_arch) \ - -DBUILD_SHARED_LIBS=0 .. || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp vidstab.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 diff --git a/scripts/objc/libvorbis.sh b/scripts/objc/libvorbis.sh deleted file mode 100755 index 94135e0..0000000 --- a/scripts/objc/libvorbis.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="libvorbis" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_libvorbis} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -# -force_cpusubtype_ALL FLAG REMOVED DUE TO THE FOLLOWING ERROR -# ld: -force_cpusubtype_ALL and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together -${SED_INLINE} 's/-force_cpusubtype_ALL//g' ${BASEDIR}/src/${LIB_NAME}/configure - -PKG_CONFIG= ./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-ogg-includes=${BASEDIR}/prebuilt/$(get_target_build_directory)/libogg/include \ - --with-ogg-libraries=${BASEDIR}/prebuilt/$(get_target_build_directory)/libogg/lib \ - --with-pic \ - --with-sysroot=${SDK_PATH} \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --disable-docs \ - --disable-examples \ - --disable-oggtest \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# CREATE PACKAGE CONFIG MANUALLY -create_libvorbis_package_config "1.3.7" - -make install || exit 1 diff --git a/scripts/objc/libvpx.sh b/scripts/objc/libvpx.sh deleted file mode 100755 index 1b99229..0000000 --- a/scripts/objc/libvpx.sh +++ /dev/null @@ -1,140 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="libvpx" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -# PREPARE CPU & ARCH OPTIONS -TARGET="" -ASM_FLAGS="" -case ${ARCH} in - armv7 | armv7s) - - # note that --disable-runtime-cpu-detect is used for arm - # using --enable-runtime-cpu-detect cause the following error - # vpx_ports/arm_cpudetect.c:151:2: error: "--enable-runtime-cpu-detect selected, but no CPU detection method " "available for your platform. Reconfigure with --disable-runtime-cpu-detect." - - TARGET="$(get_target_arch)-darwin-gcc" - ASM_FLAGS="--disable-runtime-cpu-detect --enable-neon --enable-neon-asm" - ;; - arm64) - TARGET="arm64-darwin-gcc" - - # --enable-neon-asm option not added because it causes the following error - # vpx_dsp/arm/intrapred_neon_asm.asm.S:653:26: error: vector register expected - # vst1.64 - ASM_FLAGS="--disable-runtime-cpu-detect --enable-neon" - ;; - arm64e) - TARGET="arm64-darwin-gcc" - - ASM_FLAGS="--disable-runtime-cpu-detect --enable-neon" - ;; - i386) - TARGET="x86-iphonesimulator-gcc" - ASM_FLAGS="--enable-runtime-cpu-detect --disable-avx512" - ;; - x86-64) - TARGET="x86_64-iphonesimulator-gcc" - ASM_FLAGS="--enable-runtime-cpu-detect --disable-avx512 --disable-sse --disable-sse2 --disable-mmx" - ;; - x86-64-mac-catalyst) - TARGET="x86_64-macosx-gcc" - ASM_FLAGS="--enable-runtime-cpu-detect --disable-avx512 --disable-sse --disable-sse2 --disable-mmx" - ;; -esac - -# PREPARE CONFIGURE OPTIONS -rm -f ${BASEDIR}/src/${LIB_NAME}/build/make/configure.sh -case ${ARCH} in - arm64e) - cp ${BASEDIR}/tools/make/configure.libvpx.arm64e.sh ${BASEDIR}/src/${LIB_NAME}/build/make/configure.sh - ;; - x86-64-mac-catalyst) - cp ${BASEDIR}/tools/make/configure.libvpx.x86_64_mac_catalyst.sh ${BASEDIR}/src/${LIB_NAME}/build/make/configure.sh - ;; - *) - cp ${BASEDIR}/tools/make/configure.libvpx.all.sh ${BASEDIR}/src/${LIB_NAME}/build/make/configure.sh - ;; -esac - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --target="${TARGET}" \ - --extra-cflags="${CFLAGS}" \ - --extra-cxxflags="${CXXFLAGS}" \ - --as=yasm \ - --log=yes \ - --enable-libs \ - --enable-install-libs \ - --enable-pic \ - --enable-optimizations \ - --enable-better-hw-compatibility \ - ${ASM_FLAGS} \ - --enable-vp8 \ - --enable-vp9 \ - --enable-multithread \ - --enable-spatial-resampling \ - --enable-small \ - --enable-static \ - --disable-realtime-only \ - --disable-shared \ - --disable-debug \ - --disable-gprof \ - --disable-gcov \ - --disable-ccache \ - --disable-install-bins \ - --disable-install-srcs \ - --disable-install-docs \ - --disable-docs \ - --disable-tools \ - --disable-examples \ - --disable-unit-tests \ - --disable-decode-perf-tests \ - --disable-encode-perf-tests \ - --disable-codec-srcs \ - --disable-debug-libs \ - --disable-internal-stats || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp ./*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 diff --git a/scripts/objc/libwebp.sh b/scripts/objc/libwebp.sh deleted file mode 100755 index afa6760..0000000 --- a/scripts/objc/libwebp.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="libwebp" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -ARCH_OPTIONS="" -case ${ARCH} in - armv7 | armv7s | arm64 | arm64e) - ARCH_OPTIONS="--enable-neon --enable-neon-rtcd" - ;; - x86-64-mac-catalyst) - ARCH_OPTIONS="--disable-sse2 --disable-sse4.1" - ;; - *) - ARCH_OPTIONS="--enable-sse2 --enable-sse4.1" - ;; -esac - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# ALWAYS RECONFIGURE -autoreconf_library ${LIB_NAME} - -./configure \ - --prefix="${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME}" \ - --with-pic \ - --with-sysroot=${SDK_PATH} \ - --enable-static \ - --disable-shared \ - --disable-dependency-tracking \ - --enable-libwebpmux \ - ${ARCH_OPTIONS} \ - --with-pngincludedir="${BASEDIR}/prebuilt/$(get_target_build_directory)/libpng/include" \ - --with-pnglibdir="${BASEDIR}/prebuilt/$(get_target_build_directory)/libpng/lib" \ - --with-jpegincludedir="${BASEDIR}/prebuilt/$(get_target_build_directory)/jpeg/include" \ - --with-jpeglibdir="${BASEDIR}/prebuilt/$(get_target_build_directory)/jpeg/lib" \ - --with-gifincludedir="${BASEDIR}/prebuilt/$(get_target_build_directory)/giflib/include" \ - --with-giflibdir="${BASEDIR}/prebuilt/$(get_target_build_directory)/giflib/lib" \ - --with-tiffincludedir="${BASEDIR}/prebuilt/$(get_target_build_directory)/tiff/include" \ - --with-tifflibdir="${BASEDIR}/prebuilt/$(get_target_build_directory)/tiff/lib" \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp ${BASEDIR}/src/${LIB_NAME}/src/*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 -cp ${BASEDIR}/src/${LIB_NAME}/src/demux/*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 -cp ${BASEDIR}/src/${LIB_NAME}/src/mux/*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 diff --git a/scripts/objc/libxml2.sh b/scripts/objc/libxml2.sh deleted file mode 100755 index 7560fa2..0000000 --- a/scripts/objc/libxml2.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="libxml2" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# ALWAYS RECONFIGURE -autoreconf_library ${LIB_NAME} - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${SDK_PATH} \ - --with-zlib \ - --with-iconv=${SDK_PATH}/usr \ - --with-sax1 \ - --without-python \ - --without-debug \ - --without-lzma \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# CREATE PACKAGE CONFIG MANUALLY -create_libxml2_package_config "2.9.10" - -make install || exit 1 diff --git a/scripts/objc/nettle.sh b/scripts/objc/nettle.sh deleted file mode 100755 index d969db4..0000000 --- a/scripts/objc/nettle.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="nettle" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -OPTIONAL_CPU_SUPPORT="" -case ${ARCH} in - armv7 | armv7s | arm64 | arm64e) - OPTIONAL_CPU_SUPPORT="--enable-arm-neon" - ;; - i386 | x86-64 | x86-64-mac-catalyst) - OPTIONAL_CPU_SUPPORT="--enable-x86-aesni" - ;; -esac - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_nettle} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --enable-pic \ - --enable-static \ - --with-include-path=${BASEDIR}/prebuilt/$(get_target_build_directory)/gmp/include \ - --with-lib-path=${BASEDIR}/prebuilt/$(get_target_build_directory)/gmp/lib \ - --disable-shared \ - --disable-mini-gmp \ - --disable-assembler \ - --disable-openssl \ - --disable-gcov \ - --disable-documentation \ - ${OPTIONAL_CPU_SUPPORT} \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp ./*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 diff --git a/scripts/objc/opencore-amr.sh b/scripts/objc/opencore-amr.sh deleted file mode 100755 index ecb8df4..0000000 --- a/scripts/objc/opencore-amr.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="opencore-amr" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -# OVERRIDE CXX -case ${ARCH} in - x86-64 | x86-64-mac-catalyst) - export CXX="xcrun --sdk $(get_sdk_name) clang++ -arch x86_64" - ;; - *) - export CXX="xcrun --sdk $(get_sdk_name) clang++ -arch ${ARCH}" - ;; -esac - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_opencore_amr} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${SDK_PATH} \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --disable-maintainer-mode \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp amrnb/*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 diff --git a/scripts/objc/openh264.sh b/scripts/objc/openh264.sh deleted file mode 100755 index d65b8b1..0000000 --- a/scripts/objc/openh264.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash - -# ENABLE COMMON FUNCTIONS -source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="openh264" -set_toolchain_paths ${LIB_NAME} - -# SET BUILD FLAGS -BUILD_HOST=$(get_build_host) -CFLAGS=$(get_cflags ${LIB_NAME}) -CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -LDFLAGS=$(get_ldflags ${LIB_NAME}) - -# SET ARCH OPTIONS -ARCH_OPTIONS="OS=ios" -case ${ARCH} in - armv7 | armv7s) - CFLAGS+=" -DHAVE_NEON" - ;; - arm64 | arm64e) - CFLAGS+=" -DHAVE_NEON_AARCH64" - ;; - x86-64-mac-catalyst) - ARCH_OPTIONS="" - CFLAGS+=" -DHAVE_AVX2" - ;; - *) - CFLAGS+=" -DHAVE_AVX2" - ;; -esac - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -# MAKE SURE THAT ASM IS ENABLED FOR ALL IOS ARCHITECTURES - EXCEPT x86-64 -${SED_INLINE} 's/arm64 aarch64/arm64% aarch64/g' ${BASEDIR}/src/${LIB_NAME}/build/arch.mk -${SED_INLINE} 's/%86 x86_64,/%86 x86_64 x86-64,/g' ${BASEDIR}/src/${LIB_NAME}/build/arch.mk -${SED_INLINE} 's/filter-out arm64,/filter-out arm64%,/g' ${BASEDIR}/src/${LIB_NAME}/build/arch.mk -${SED_INLINE} 's/CFLAGS += -DHAVE_NEON/#CFLAGS += -DHAVE_NEON/g' ${BASEDIR}/src/${LIB_NAME}/build/arch.mk -${SED_INLINE} 's/ifeq (\$(ASM_ARCH), arm64)/ifneq (\$(filter arm64%, \$(ASM_ARCH)),)/g' ${BASEDIR}/src/${LIB_NAME}/codec/common/targets.mk -${SED_INLINE} 's/ifeq (\$(ASM_ARCH), arm)/ifneq (\$(filter armv%, \$(ASM_ARCH)),)/g' ${BASEDIR}/src/${LIB_NAME}/codec/common/targets.mk - -make clean 2>/dev/null 1>/dev/null - -make -j$(get_cpu_count) \ -ASM_ARCH="${ARCH}" \ -ARCH="${ARCH}" \ -CC="${CC}" \ -CFLAGS="$CFLAGS" \ -CXX="${CXX}" \ -CXXFLAGS="${CXXFLAGS}" \ -LDFLAGS="$LDFLAGS" \ -${ARCH_OPTIONS} \ -PREFIX="${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME}" \ -SDK_MIN="${IOS_MIN_VERSION}" \ -SDKROOT="${SDK_PATH}" \ -STATIC_LDFLAGS="-lc++" \ -install-static || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp ${BASEDIR}/src/${LIB_NAME}/openh264-static.pc ${INSTALL_PKG_CONFIG_DIR}/openh264.pc || exit 1 \ No newline at end of file diff --git a/scripts/objc/opus.sh b/scripts/objc/opus.sh deleted file mode 100755 index d9b78b3..0000000 --- a/scripts/objc/opus.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="opus" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_opus} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${SDK_PATH} \ - --enable-static \ - --enable-rtcd \ - --enable-asm \ - --enable-check-asm \ - --enable-custom-modes \ - --disable-shared \ - --disable-fast-install \ - --disable-maintainer-mode \ - --disable-doc \ - --disable-extra-programs \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp ./opus.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 diff --git a/scripts/objc/rubberband.sh b/scripts/objc/rubberband.sh deleted file mode 100755 index 06825b3..0000000 --- a/scripts/objc/rubberband.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="rubberband" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR=${INSTALL_PKG_CONFIG_DIR} - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# DISABLE OPTIONAL FEATURES MANUALLY, SINCE ./configure DOES NOT PROVIDE OPTIONS FOR THEM -rm -f ${BASEDIR}/src/${LIB_NAME}/configure.ac -cp ${BASEDIR}/tools/make/rubberband/configure.ac ${BASEDIR}/src/${LIB_NAME}/configure.ac -rm -f ${BASEDIR}/src/${LIB_NAME}/Makefile.in -cp ${BASEDIR}/tools/make/rubberband/Makefile.ios.in ${BASEDIR}/src/${LIB_NAME}/Makefile.in - -# FIX PACKAGE CONFIG FILE DEPENDENCIES -rm -f ${BASEDIR}/src/${LIB_NAME}/rubberband.pc.in -cp ${BASEDIR}/tools/make/rubberband/rubberband.pc.in ${BASEDIR}/src/${LIB_NAME}/rubberband.pc.in -${SED_INLINE} 's/%DEPENDENCIES%/sndfile, samplerate/g' ${BASEDIR}/src/${LIB_NAME}/rubberband.pc.in - -# ALWAYS RECONFIGURE -autoreconf_library ${LIB_NAME} - -# MANUALLY CREATE LIB DIRECTORY -mkdir -p ${BASEDIR}/src/${LIB_NAME}/lib || exit 1 - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --host=${BUILD_HOST} || exit 1 - -make AR="$AR" -j$(get_cpu_count) || exit 1 - -make install || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp ./*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 diff --git a/scripts/objc/sdl.sh b/scripts/objc/sdl.sh deleted file mode 100755 index c30365a..0000000 --- a/scripts/objc/sdl.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="sdl" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -case ${ARCH} in - x86-64-mac-catalyst) - BUILD_HOST="x86_64-apple-macosx" - ARCH_OPTIONS="--disable-video-cocoa --disable-render-metal --disable-haptic --disable-diskaudio" - ;; - *) - ARCH_OPTIONS="" - ;; -esac - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_sdl} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -export ac_cv_header_libunwind_h=no - -rm -f ${BASEDIR}/src/${LIB_NAME}/configure -cp ${BASEDIR}/tools/make/configure.sdl ${BASEDIR}/src/${LIB_NAME}/configure - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${SDK_PATH} \ - --enable-static \ - --disable-shared \ - --disable-video-opengl \ - ${ARCH_OPTIONS} \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp ./*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 diff --git a/scripts/objc/shine.sh b/scripts/objc/shine.sh deleted file mode 100755 index 0d62df1..0000000 --- a/scripts/objc/shine.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="shine" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_shine} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${SDK_PATH} \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp ./*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 diff --git a/scripts/objc/snappy.sh b/scripts/objc/snappy.sh deleted file mode 100755 index 6acefe6..0000000 --- a/scripts/objc/snappy.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="snappy" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -CFLAGS="$(get_cflags ${LIB_NAME}) -I${SDK_PATH}/usr/include" -CXXFLAGS="$(get_cxxflags ${LIB_NAME})" -LDFLAGS="$(get_ldflags ${LIB_NAME}) -L${SDK_PATH}/usr/lib" - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -if [ -d "build" ]; then - rm -rf build -fi - -mkdir build; -cd build - -cmake -Wno-dev \ - -DCMAKE_VERBOSE_MAKEFILE=0 \ - -DCMAKE_C_FLAGS="${CFLAGS}" \ - -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ - -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ - -DCMAKE_SYSROOT="${SDK_PATH}" \ - -DCMAKE_FIND_ROOT_PATH="${SDK_PATH}" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX="${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME}" \ - -DCMAKE_SYSTEM_NAME=Darwin \ - -DCMAKE_OSX_SYSROOT="" \ - -DCMAKE_CXX_COMPILER="$CXX" \ - -DCMAKE_C_COMPILER="$CC" \ - -DCMAKE_LINKER="$LD" \ - -DCMAKE_AR="$(xcrun --sdk $(get_sdk_name) -f ar)" \ - -DCMAKE_AS="$AS" \ - -DSNAPPY_BUILD_TESTS=0 \ - -DHAVE_LIBLZO2=0 \ - -DHAVE_LIBZ=1 \ - -DCMAKE_SYSTEM_PROCESSOR=$(get_target_arch) \ - -DBUILD_SHARED_LIBS=0 .. || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# CREATE PACKAGE CONFIG MANUALLY -create_snappy_package_config "1.1.8" - -make install || exit 1 diff --git a/scripts/objc/soxr.sh b/scripts/objc/soxr.sh deleted file mode 100755 index 9ee863f..0000000 --- a/scripts/objc/soxr.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="soxr" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -CFLAGS=$(get_cflags ${LIB_NAME}) -CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -if [ -d "build" ]; then - rm -rf build -fi - -mkdir build; -cd build - -cmake -Wno-dev \ - -DCMAKE_VERBOSE_MAKEFILE=0 \ - -DCMAKE_C_FLAGS="${CFLAGS}" \ - -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ - -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ - -DCMAKE_SYSROOT="${SDK_PATH}" \ - -DCMAKE_FIND_ROOT_PATH="${SDK_PATH}" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX="${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME}" \ - -DCMAKE_SYSTEM_NAME=Generic \ - -DCMAKE_C_COMPILER="$CC" \ - -DCMAKE_LINKER="$LD" \ - -DCMAKE_AR="$(xcrun --sdk $(get_sdk_name) -f ar)" \ - -DCMAKE_AS="$AS" \ - -DBUILD_TESTS=0 \ - -DWITH_DEV_TRACE=0 \ - -DWITH_LSR_BINDINGS=0 \ - -DWITH_OPENMP=0 \ - -DCMAKE_SYSTEM_PROCESSOR=$(get_target_arch) \ - -DBUILD_SHARED_LIBS=0 .. || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# CREATE PACKAGE CONFIG MANUALLY -create_soxr_package_config "0.1.3" - -make install || exit 1 diff --git a/scripts/objc/speex.sh b/scripts/objc/speex.sh deleted file mode 100755 index a15a721..0000000 --- a/scripts/objc/speex.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="speex" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -OPTIONAL_CPU_SUPPORT="" -if [ ${ARCH} == "x86" ] || [ ${ARCH} == "x86-64" ]; then - OPTIONAL_CPU_SUPPORT="--enable-sse" -fi - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_speex} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${SDK_PATH} \ - --enable-static \ - ${OPTIONAL_CPU_SUPPORT} \ - --disable-shared \ - --disable-binaries \ - --disable-fast-install \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp ./*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 diff --git a/scripts/objc/tesseract.sh b/scripts/objc/tesseract.sh deleted file mode 100755 index 38ca8da..0000000 --- a/scripts/objc/tesseract.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="tesseract" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ! -f ${BASEDIR}/src/${LIB_NAME}/configure ]] || [[ ${RECONF_tesseract} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -export LEPTONICA_CFLAGS="-I${BASEDIR}/prebuilt/$(get_target_build_directory)/leptonica/include/leptonica" -export LEPTONICA_LIBS="-L${BASEDIR}/prebuilt/$(get_target_build_directory)/leptonica/lib -llept" - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${SDK_PATH} \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --disable-debug \ - --disable-graphics \ - --disable-cube \ - --disable-tessdata-prefix \ - --disable-largefile \ - --host=${BUILD_HOST} || exit 1 - -${SED_INLINE} 's/$wl-bind_at_load//g' ${BASEDIR}/src/${LIB_NAME}/libtool -${SED_INLINE} 's/-lrt//g' ${BASEDIR}/src/${LIB_NAME}/api/Makefile - -make -j$(get_cpu_count) || exit 1 - -# CREATE PACKAGE CONFIG MANUALLY -create_tesseract_package_config "3.05.02" - -make install || exit 1 diff --git a/scripts/objc/tiff.sh b/scripts/objc/tiff.sh deleted file mode 100755 index 41f8d18..0000000 --- a/scripts/objc/tiff.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="tiff" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_tiff} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${SDK_PATH} \ - --with-jpeg-include-dir=${BASEDIR}/prebuilt/$(get_target_build_directory)/jpeg/include \ - --with-jpeg-lib-dir=${BASEDIR}/prebuilt/$(get_target_build_directory)/jpeg/lib \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --disable-maintainer-mode \ - --disable-cxx \ - --disable-win32-io \ - --disable-lzma \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp ./*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 diff --git a/scripts/objc/twolame.sh b/scripts/objc/twolame.sh deleted file mode 100755 index 7e32574..0000000 --- a/scripts/objc/twolame.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="twolame" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) -export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_twolame} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -export SNDFILE_CFLAGS="$(pkg-config --cflags sndfile)" -export SNDFILE_LIBS="$(pkg-config --libs --static sndfile)" - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${SDK_PATH} \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp ./*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 diff --git a/scripts/objc/vo-amrwbenc.sh b/scripts/objc/vo-amrwbenc.sh deleted file mode 100755 index 758abd8..0000000 --- a/scripts/objc/vo-amrwbenc.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="vo-amrwbenc" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -# OVERRIDE CXX -case ${ARCH} in - x86-64 | x86-64-mac-catalyst) - export CXX="xcrun --sdk $(get_sdk_name) clang++ -arch x86_64" - ;; - *) - export CXX="xcrun --sdk $(get_sdk_name) clang++ -arch ${ARCH}" - ;; -esac - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_vo_amrwbenc} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${SDK_PATH} \ - --enable-static \ - --disable-shared \ - --disable-fast-install \ - --disable-maintainer-mode \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp ./*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 diff --git a/scripts/objc/wavpack.sh b/scripts/objc/wavpack.sh deleted file mode 100755 index f49c3d0..0000000 --- a/scripts/objc/wavpack.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="wavpack" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_wavpack} -eq 1 ]]; then - autoreconf_library ${LIB_NAME} -fi - -ASM_FLAGS="" -case ${ARCH} in - armv7 | armv7s | arm64 | arm64e) - ASM_FLAGS="--disable-asm" - ;; - *) - ASM_FLAGS="--enable-asm" - ;; -esac - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --with-pic \ - --with-sysroot=${SDK_PATH} \ - --without-iconv \ - ${ASM_FLAGS} \ - --enable-static \ - --disable-shared \ - --disable-apps \ - --disable-fast-install \ - --disable-tests \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp ./*.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 diff --git a/scripts/objc/x264.sh b/scripts/objc/x264.sh deleted file mode 100755 index f1e114d..0000000 --- a/scripts/objc/x264.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -if ! [ -x "$(command -v tar)" ]; then - echo -e "\n(*) tar command not found\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="x264" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -ASM_FLAGS="" -case ${ARCH} in - i386 | x86-64 | x86-64-mac-catalyst) - ASM_FLAGS="--disable-asm" - - if ! [ -x "$(command -v nasm)" ]; then - echo -e "\n(*) nasm command not found\n" - exit 1 - fi - - export AS="$(command -v nasm)" - ;; -esac - -# DISABLE INLINE -arch DEFINITIONS -${SED_INLINE} 's/CFLAGS=\"\$CFLAGS \-arch x86_64/CFLAGS=\"\$CFLAGS/g' configure -${SED_INLINE} 's/LDFLAGS=\"\$LDFLAGS \-arch x86_64/LDFLAGS=\"\$CFLAGS/g' configure - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - --enable-pic \ - --sysroot=${SDK_PATH} \ - --enable-static \ - ${ASM_FLAGS} \ - --disable-cli \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp x264.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 diff --git a/scripts/objc/x265.sh b/scripts/objc/x265.sh deleted file mode 100755 index b4fca9e..0000000 --- a/scripts/objc/x265.sh +++ /dev/null @@ -1,126 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="x265" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -CFLAGS=$(get_cflags ${LIB_NAME}) -CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -LDFLAGS=$(get_ldflags ${LIB_NAME}) - -# USE CLEAN SOURCE ON EACH BUILD -cd ${BASEDIR}/src || exit 1 -rm -rf ${LIB_NAME} || exit 1 -DOWNLOAD_RESULT=$(download_gpl_library_source ${LIB_NAME}) -if [[ ${DOWNLOAD_RESULT} -ne 0 ]]; then - exit 1 -fi -cd ${BASEDIR}/src/${LIB_NAME} || exit 1 - -ARCH_OPTIONS="" -case ${ARCH} in - armv7 | armv7s) - ARCH_OPTIONS="-DENABLE_ASSEMBLY=1 -DCROSS_COMPILE_ARM=1" - ;; - arm64 | arm64e) - ARCH_OPTIONS="-DENABLE_ASSEMBLY=0 -DCROSS_COMPILE_ARM=1" - ;; - x86-64-mac-catalyst) - ARCH_OPTIONS="-DENABLE_ASSEMBLY=0 -DCROSS_COMPILE_ARM=0" - ;; - *) - ARCH_OPTIONS="-DENABLE_ASSEMBLY=1 -DCROSS_COMPILE_ARM=0" - ;; -esac - -if [ -d "cmake-build" ]; then - rm -rf cmake-build -fi - -mkdir cmake-build || exit 1 -cd cmake-build || exit 1 - -# fix x86 and x86_64 assembly -${SED_INLINE} 's/win64/macho64 -DPREFIX/g' ${BASEDIR}/src/x265/source/cmake/CMakeASM_NASMInformation.cmake -${SED_INLINE} 's/win/macho/g' ${BASEDIR}/src/x265/source/cmake/CMakeASM_NASMInformation.cmake - -# fixing constant shift -${SED_INLINE} 's/lsr 16/lsr #16/g' ${BASEDIR}/src/x265/source/common/arm/blockcopy8.S - -# fixing leading underscores -${SED_INLINE} 's/function x265_/function _x265_/g' ${BASEDIR}/src/x265/source/common/arm/*.S -${SED_INLINE} 's/ x265_/ _x265_/g' ${BASEDIR}/src/x265/source/common/arm/pixel-util.S - -# fixing relocation errors -${SED_INLINE} 's/sad12_mask:/sad12_mask_bytes:/g' ${BASEDIR}/src/x265/source/common/arm/sad-a.S -${SED_INLINE} 's/g_lumaFilter:/g_lumaFilter_bytes:/g' ${BASEDIR}/src/x265/source/common/arm/ipfilter8.S -${SED_INLINE} 's/g_chromaFilter:/g_chromaFilter_bytes:/g' ${BASEDIR}/src/x265/source/common/arm/ipfilter8.S -${SED_INLINE} 's/\.text/.equ sad12_mask, .-sad12_mask_bytes\ -\ -.text/g' ${BASEDIR}/src/x265/source/common/arm/sad-a.S -${SED_INLINE} 's/\.text/.equ g_lumaFilter, .-g_lumaFilter_bytes\ -.equ g_chromaFilter, .-g_chromaFilter_bytes\ -\ -.text/g' ${BASEDIR}/src/x265/source/common/arm/ipfilter8.S - -# using customized build file -rm -f ${BASEDIR}/src/${LIB_NAME}/source/CMakeLists.txt || exit 1 -cp ${BASEDIR}/tools/cmake/CMakeLists.x265.ios.txt ${BASEDIR}/src/${LIB_NAME}/source/CMakeLists.txt || exit 1 - -cmake -Wno-dev \ - -DCMAKE_VERBOSE_MAKEFILE=0 \ - -DCMAKE_C_FLAGS="${CFLAGS}" \ - -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ - -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ - -DCMAKE_SYSROOT="${SDK_PATH}" \ - -DCMAKE_FIND_ROOT_PATH="${SDK_PATH}" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX="${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME}" \ - -DCMAKE_SYSTEM_NAME=Generic \ - -DCMAKE_C_COMPILER="$CC" \ - -DCMAKE_CXX_COMPILER="$CXX" \ - -DCMAKE_LINKER="$LD" \ - -DCMAKE_AR="$(xcrun --sdk $(get_sdk_name) -f ar)" \ - -DCMAKE_AS="$AS" \ - -DSTATIC_LINK_CRT=1 \ - -DENABLE_PIC=1 \ - -DENABLE_CLI=0 \ - ${ARCH_OPTIONS} \ - -DCMAKE_SYSTEM_PROCESSOR=$(get_target_arch) \ - -DENABLE_SHARED=0 ../source || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# MANUALLY COPY PKG-CONFIG FILES -cp x265.pc ${INSTALL_PKG_CONFIG_DIR} || exit 1 - -make install || exit 1 diff --git a/scripts/objc/xvidcore.sh b/scripts/objc/xvidcore.sh deleted file mode 100755 index 13a822c..0000000 --- a/scripts/objc/xvidcore.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash - -if [[ -z ${ARCH} ]]; then - echo -e "\n(*) ARCH not defined\n" - exit 1 -fi - -if [[ -z ${TARGET_SDK} ]]; then - echo -e "\n(*) TARGET_SDK not defined\n" - exit 1 -fi - -if [[ -z ${SDK_PATH} ]]; then - echo -e "\n(*) SDK_PATH not defined\n" - exit 1 -fi - -if [[ -z ${BASEDIR} ]]; then - echo -e "\n(*) BASEDIR not defined\n" - exit 1 -fi - -# ENABLE COMMON FUNCTIONS -if [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then - . ${BASEDIR}/build/tvos-common.sh -else - . ${BASEDIR}/build/ios-common.sh -fi - -# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} -LIB_NAME="xvidcore" -set_toolchain_paths ${LIB_NAME} - -# PREPARING FLAGS -BUILD_HOST=$(get_build_host) -export CFLAGS=$(get_cflags ${LIB_NAME}) -export CXXFLAGS=$(get_cxxflags ${LIB_NAME}) -export LDFLAGS=$(get_ldflags ${LIB_NAME}) - -cd ${BASEDIR}/src/${LIB_NAME}/build/generic || exit 1 - -make distclean 2>/dev/null 1>/dev/null - -# RECONFIGURE IF REQUESTED -if [[ ${RECONF_xvidcore} -eq 1 ]]; then - ./bootstrap.sh -fi - -ASM_FLAGS="" -case ${ARCH} in - armv7 | armv7s | arm64 | arm64e) - ASM_FLAGS="" - - # REMOVING -flat_namespace OPTION FROM CONFIGURE TO FIX THE FOLLOWING ERROR - # ld: -flat_namespace and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together - ${SED_INLINE} 's/ -flat_namespace//g' configure - - # REMOVING -Wl,-read_only_relocs,suppress OPTION FROM CONFIGURE TO FIX THE FOLLOWING ERROR - # ld: -read_only_relocs and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together - ${SED_INLINE} 's/-Wl,-read_only_relocs,suppress//g' configure - - ;; - i386 | x86-64 | x86-64-mac-catalyst) - ASM_FLAGS="--disable-assembly" - ;; -esac - -./configure \ - --prefix=${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME} \ - ${ASM_FLAGS} \ - --host=${BUILD_HOST} || exit 1 - -make -j$(get_cpu_count) || exit 1 - -# CREATE PACKAGE CONFIG MANUALLY -create_xvidcore_package_config "1.3.6" - -make install || exit 1 - -# REMOVE DYNAMIC LIBS -rm -f ${BASEDIR}/prebuilt/$(get_target_build_directory)/${LIB_NAME}/lib/libxvidcore.dylib* \ No newline at end of file diff --git a/scripts/run-android.sh b/scripts/run-android.sh new file mode 100755 index 0000000..5ce3b95 --- /dev/null +++ b/scripts/run-android.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# ENABLE COMMON FUNCTIONS +source "${BASEDIR}"/scripts/function-"${FFMPEG_KIT_BUILD_TYPE}".sh || return 1 + +LIB_NAME=$1 + +echo -e "----------------------------------------------------------------" +echo -e "\nINFO: Building ${LIB_NAME} with the following environment variables\n" +env +echo -e "----------------------------------------------------------------\n" +echo -e "INFO: System information\n" +echo -e "INFO: $(uname -a)\n" +echo -e "----------------------------------------------------------------\n" + +ENABLED_LIBRARY_PATH="${LIB_INSTALL_BASE}/${LIB_NAME}" + +# DELETE THE PREVIOUS BUILD OF THE LIBRARY +if [ -d "${ENABLED_LIBRARY_PATH}" ]; then + rm -rf "${ENABLED_LIBRARY_PATH}" || return 1 +fi + +# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} +SCRIPT_PATH="${BASEDIR}/scripts/android/${LIB_NAME}.sh" +set_toolchain_paths "${LIB_NAME}" + +# SET BUILD FLAGS +HOST=$(get_host) +export CFLAGS=$(get_cflags "${LIB_NAME}") +export CXXFLAGS=$(get_cxxflags "${LIB_NAME}") +export LDFLAGS=$(get_ldflags "${LIB_NAME}") +export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" + +cd "${BASEDIR}"/src/"${LIB_NAME}" || return 1 + +LIB_INSTALL_PREFIX="${ENABLED_LIBRARY_PATH}" +ANDROID_SYSROOT="${ANDROID_NDK_ROOT}"/toolchains/llvm/prebuilt/"${TOOLCHAIN}"/sysroot +BUILD_DIR=$(get_cmake_build_directory) + +rm -rf "${LIB_INSTALL_PREFIX}" || return 1 +rm -rf "${BUILD_DIR}" || return 1 + +# EXECUTE BUILD SCRIPT OF EACH ENABLED LIBRARY +source "${SCRIPT_PATH}" diff --git a/scripts/run-apple.sh b/scripts/run-apple.sh new file mode 100755 index 0000000..397d6bc --- /dev/null +++ b/scripts/run-apple.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# ENABLE COMMON FUNCTIONS +source "${BASEDIR}"/scripts/function-"${FFMPEG_KIT_BUILD_TYPE}".sh || return 1 + +LIB_NAME=$1 + +echo -e "----------------------------------------------------------------" +echo -e "\nINFO: Building ${LIB_NAME} with the following environment variables\n" +env +echo -e "----------------------------------------------------------------\n" +echo -e "INFO: System information\n" +echo -e "INFO: $(uname -a)\n" +echo -e "----------------------------------------------------------------\n" + +ENABLED_LIBRARY_PATH="${LIB_INSTALL_BASE}/${LIB_NAME}" + +# DELETE THE PREVIOUS BUILD OF THE LIBRARY +if [ -d "${ENABLED_LIBRARY_PATH}" ]; then + rm -rf "${ENABLED_LIBRARY_PATH}" || return 1 +fi + +# PREPARE PATHS & DEFINE ${INSTALL_PKG_CONFIG_DIR} +SCRIPT_PATH="${BASEDIR}/scripts/apple/${LIB_NAME}.sh" +set_toolchain_paths "${LIB_NAME}" + +# SET BUILD FLAGS +HOST=$(get_host) +export CFLAGS=$(get_cflags "${LIB_NAME}") +export CXXFLAGS=$(get_cxxflags "${LIB_NAME}") +export LDFLAGS=$(get_ldflags "${LIB_NAME}") +export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}" + +cd "${BASEDIR}"/src/"${LIB_NAME}" || return 1 + +LIB_INSTALL_PREFIX="${ENABLED_LIBRARY_PATH}" +BUILD_DIR=$(get_cmake_build_directory) +CMAKE_SYSTEM_NAME=$(get_apple_cmake_system_name) + +rm -rf "${LIB_INSTALL_PREFIX}" || return 1 +rm -rf "${BUILD_DIR}" || return 1 + +# EXECUTE BUILD SCRIPT OF EACH ENABLED LIBRARY +source "${SCRIPT_PATH}" diff --git a/scripts/source.sh b/scripts/source.sh old mode 100644 new mode 100755 index 32054be..842d3ad --- a/scripts/source.sh +++ b/scripts/source.sh @@ -6,6 +6,16 @@ # get_library_source() { case $1 in + config) + SOURCE_REPO_URL="https://github.com/tanersener/gnu-config" + SOURCE_ID="v20201222" + SOURCE_TYPE="TAG" + ;; + chromaprint) + SOURCE_REPO_URL="https://github.com/tanersener/chromaprint" + SOURCE_ID="v1.5.0" + SOURCE_TYPE="TAG" + ;; cpu-features) SOURCE_REPO_URL="https://github.com/tanersener/cpu_features" SOURCE_ID="v0.4.1.1" @@ -36,11 +46,51 @@ get_library_source() { SOURCE_ID="v1.0.10" SOURCE_TYPE="TAG" ;; + giflib) + SOURCE_REPO_URL="https://github.com/tanersener/giflib" + SOURCE_ID="5.1.4" + SOURCE_TYPE="TAG" + ;; + gmp) + SOURCE_REPO_URL="https://github.com/tanersener/gmp" + SOURCE_ID="v6.2.0" + SOURCE_TYPE="TAG" + ;; + gnutls) + SOURCE_REPO_URL="https://github.com/tanersener/gnutls" + SOURCE_ID="3.6.15.1" + SOURCE_TYPE="TAG" + ;; + harfbuzz) + SOURCE_REPO_URL="https://github.com/tanersener/harfbuzz" + SOURCE_ID="2.7.2" + SOURCE_TYPE="TAG" + ;; jpeg) SOURCE_REPO_URL="https://github.com/tanersener/libjpeg-turbo" SOURCE_ID="2.0.5" SOURCE_TYPE="TAG" ;; + kvazaar) + SOURCE_REPO_URL="https://github.com/tanersener/kvazaar" + SOURCE_ID="v2.0.0" + SOURCE_TYPE="TAG" + ;; + lame) + SOURCE_REPO_URL="https://github.com/tanersener/lame" + SOURCE_ID="RELEASE__3_100" + SOURCE_TYPE="TAG" + ;; + leptonica) + SOURCE_REPO_URL="https://github.com/tanersener/leptonica" + SOURCE_ID="1.78.0" + SOURCE_TYPE="TAG" + ;; + libaom) + SOURCE_REPO_URL="https://github.com/tanersener/libaom" + SOURCE_ID="v2.0.0" + SOURCE_TYPE="TAG" + ;; libass) SOURCE_REPO_URL="https://github.com/tanersener/libass" SOURCE_ID="0.15.0" @@ -48,7 +98,7 @@ get_library_source() { ;; libiconv) SOURCE_REPO_URL="https://github.com/tanersener/libiconv" - SOURCE_ID="v1.16" + SOURCE_ID="v1.16.2" SOURCE_TYPE="TAG" ;; libilbc) @@ -56,11 +106,151 @@ get_library_source() { SOURCE_ID="v2.0.2" SOURCE_TYPE="TAG" ;; + libogg) + SOURCE_REPO_URL="https://github.com/tanersener/ogg" + SOURCE_ID="v1.3.4" + SOURCE_TYPE="TAG" + ;; + libpng) + SOURCE_REPO_URL="https://github.com/tanersener/libpng" + SOURCE_ID="v1.6.37" + SOURCE_TYPE="TAG" + ;; + libsamplerate) + SOURCE_REPO_URL="https://github.com/tanersener/libsamplerate" + SOURCE_ID="v0.1.9" + SOURCE_TYPE="TAG" + ;; + libsndfile) + SOURCE_REPO_URL="https://github.com/tanersener/libsndfile" + SOURCE_ID="v1.0.30" + SOURCE_TYPE="TAG" + ;; + libtheora) + SOURCE_REPO_URL="https://github.com/tanersener/theora" + SOURCE_ID="v1.1.1" + SOURCE_TYPE="TAG" + ;; + libuuid) + SOURCE_REPO_URL="https://github.com/tanersener/libuuid" + SOURCE_ID="libuuid-1.0.3" + SOURCE_TYPE="TAG" + ;; + libvidstab) + SOURCE_REPO_URL="https://github.com/tanersener/vid.stab" + SOURCE_ID="v1.1.0" + SOURCE_TYPE="TAG" + ;; + libvorbis) + SOURCE_REPO_URL="https://github.com/tanersener/vorbis" + SOURCE_ID="v1.3.7" + SOURCE_TYPE="TAG" + ;; + libvpx) + SOURCE_REPO_URL="https://github.com/tanersener/libvpx" + SOURCE_ID="v1.9.0" + SOURCE_TYPE="TAG" + ;; + libwebp) + SOURCE_REPO_URL="https://github.com/tanersener/libwebp" + SOURCE_ID="v1.1.0" + SOURCE_TYPE="TAG" + ;; + libxml2) + SOURCE_REPO_URL="https://github.com/tanersener/libxml2" + SOURCE_ID="v2.9.10" + SOURCE_TYPE="TAG" + ;; + nettle) + SOURCE_REPO_URL="https://github.com/tanersener/nettle" + SOURCE_ID="nettle_3.6_release_20200429" + SOURCE_TYPE="TAG" + ;; + opencore-amr) + SOURCE_REPO_URL="https://github.com/tanersener/opencore-amr" + SOURCE_ID="v0.1.5" + SOURCE_TYPE="TAG" + ;; openh264) SOURCE_REPO_URL="https://github.com/tanersener/openh264" SOURCE_ID="v2.1.1" SOURCE_TYPE="TAG" ;; + opus) + SOURCE_REPO_URL="https://github.com/tanersener/opus" + SOURCE_ID="v1.3.1" + SOURCE_TYPE="TAG" + ;; + rubberband) + SOURCE_REPO_URL="https://github.com/tanersener/rubberband" + SOURCE_ID="v1.8.2" + SOURCE_TYPE="TAG" + ;; + sdl) + SOURCE_REPO_URL="https://github.com/tanersener/SDL" + SOURCE_ID="release-2.0.8" + SOURCE_TYPE="TAG" + ;; + shine) + SOURCE_REPO_URL="https://github.com/tanersener/shine" + SOURCE_ID="3.1.1" + SOURCE_TYPE="TAG" + ;; + snappy) + SOURCE_REPO_URL="https://github.com/tanersener/snappy" + SOURCE_ID="1.1.8" + SOURCE_TYPE="TAG" + ;; + soxr) + SOURCE_REPO_URL="https://github.com/tanersener/soxr" + SOURCE_ID="0.1.3" + SOURCE_TYPE="TAG" + ;; + speex) + SOURCE_REPO_URL="https://github.com/tanersener/speex" + SOURCE_ID="Speex-1.2.0" + SOURCE_TYPE="TAG" + ;; + tesseract) + SOURCE_REPO_URL="https://github.com/tanersener/tesseract" + SOURCE_ID="3.05.02" + SOURCE_TYPE="TAG" + ;; + tiff) + SOURCE_REPO_URL="https://github.com/tanersener/libtiff" + SOURCE_ID="v4.1.0" + SOURCE_TYPE="TAG" + ;; + twolame) + SOURCE_REPO_URL="https://github.com/tanersener/twolame" + SOURCE_ID="0.4.0" + SOURCE_TYPE="TAG" + ;; + vo-amrwbenc) + SOURCE_REPO_URL="https://github.com/tanersener/vo-amrwbenc" + SOURCE_ID="v0.1.3" + SOURCE_TYPE="TAG" + ;; + wavpack) + SOURCE_REPO_URL="https://github.com/tanersener/wavpack" + SOURCE_ID="5.3.0" + SOURCE_TYPE="TAG" + ;; + x264) + SOURCE_REPO_URL="https://github.com/tanersener/x264" + SOURCE_ID="d198931a63049db1f2c92d96c34904c69fde8117" + SOURCE_TYPE="COMMIT" # COMMIT -> r3027 + ;; + x265) + SOURCE_REPO_URL="https://github.com/tanersener/x265" + SOURCE_ID="3.4" + SOURCE_TYPE="TAG" + ;; + xvidcore) + SOURCE_REPO_URL="https://github.com/tanersener/xvidcore" + SOURCE_ID="release-1_3_7" + SOURCE_TYPE="TAG" + ;; esac case $2 in diff --git a/scripts/variable.sh b/scripts/variable.sh old mode 100644 new mode 100755 index 4961d29..9d21684 --- a/scripts/variable.sh +++ b/scripts/variable.sh @@ -4,10 +4,10 @@ export FFMPEG_KIT_TMPDIR="${BASEDIR}/.tmp" # ARRAY OF ENABLED ARCHITECTURES -ENABLED_ARCHITECTURES=(0 0 0 0 0 0 0 0 0 0 0) +ENABLED_ARCHITECTURES=(0 0 0 0 0 0 0 0 0 0 0 0 0) # ARRAY OF ENABLED LIBRARIES -ENABLED_LIBRARIES=(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) +ENABLED_LIBRARIES=(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) # ARRAY OF LIBRARIES THAT WILL BE RE-CONFIGURED RECONF_LIBRARIES=() @@ -24,12 +24,14 @@ ARCH_ARM_V7A_NEON=1 # android ARCH_ARMV7=2 # ios ARCH_ARMV7S=3 # ios ARCH_ARM64_V8A=4 # android -ARCH_ARM64=5 # ios, tvos +ARCH_ARM64=5 # ios, tvos, macos ARCH_ARM64E=6 # ios ARCH_I386=7 # ios ARCH_X86=8 # android ARCH_X86_64=9 # android, ios, macos, tvos ARCH_X86_64_MAC_CATALYST=10 # ios +ARCH_ARM64_MAC_CATALYST=11 # ios +ARCH_ARM64_SIMULATOR=12 # ios # LIBRARY INDEXES LIBRARY_FONTCONFIG=0 @@ -77,16 +79,17 @@ LIBRARY_EXPAT=41 LIBRARY_SNDFILE=42 LIBRARY_LEPTONICA=43 LIBRARY_LIBSAMPLERATE=44 -LIBRARY_CPU_FEATURES=45 -LIBRARY_ANDROID_ZLIB=46 -LIBRARY_ANDROID_MEDIA_CODEC=47 -LIBRARY_OBJC_ZLIB=48 -LIBRARY_OBJC_AUDIOTOOLBOX=49 -LIBRARY_OBJC_BZIP2=50 -LIBRARY_OBJC_VIDEOTOOLBOX=51 -LIBRARY_OBJC_AVFOUNDATION=52 -LIBRARY_OBJC_LIBICONV=53 -LIBRARY_OBJC_LIBUUID=54 -LIBRARY_OBJC_COREIMAGE=55 -LIBRARY_OBJC_OPENCL=56 -LIBRARY_OBJC_OPENGL=57 +LIBRARY_HARFBUZZ=45 +LIBRARY_CPU_FEATURES=46 +LIBRARY_ANDROID_ZLIB=47 +LIBRARY_ANDROID_MEDIA_CODEC=48 +LIBRARY_APPLE_ZLIB=49 +LIBRARY_APPLE_AUDIOTOOLBOX=50 +LIBRARY_APPLE_BZIP2=51 +LIBRARY_APPLE_VIDEOTOOLBOX=52 +LIBRARY_APPLE_AVFOUNDATION=53 +LIBRARY_APPLE_LIBICONV=54 +LIBRARY_APPLE_LIBUUID=55 +LIBRARY_APPLE_COREIMAGE=56 +LIBRARY_APPLE_OPENCL=57 +LIBRARY_APPLE_OPENGL=58 diff --git a/src/.gitignore b/src/.gitignore index c0783f1..ef0459d 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1,5 +1,48 @@ +chromaprint cpu-features +expat ffmpeg fontconfig freetype +fribidi +giflib +gmp +gnutls +harfbuzz +jpeg +kvazaar +lame +leptonica +libaom +libass libiconv +libilbc +libogg +libpng +libsamplerate +libsndfile +libtheora +libuuid +libvidstab +libvorbis +libvpx +libwebp +libxml2 +nettle +opencore-amr +openh264 +opus +rubberband +sdl +shine +snappy +soxr +speex +tesseract +tiff +twolame +vo-amrwbenc +wavpack +x264 +x265 +xvidcore diff --git a/tools/patch/cmake/x265/CMakeLists.txt b/tools/patch/cmake/x265/CMakeLists.txt new file mode 100644 index 0000000..1e17f86 --- /dev/null +++ b/tools/patch/cmake/x265/CMakeLists.txt @@ -0,0 +1,789 @@ +# vim: syntax=cmake +if(NOT CMAKE_BUILD_TYPE) + # default to Release build for GCC builds + set(CMAKE_BUILD_TYPE Release CACHE STRING + "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." + FORCE) +endif() +message(STATUS "cmake version ${CMAKE_VERSION}") +if(POLICY CMP0025) + cmake_policy(SET CMP0025 OLD) # report Apple's Clang as just Clang +endif() +if(POLICY CMP0042) + cmake_policy(SET CMP0042 NEW) # MACOSX_RPATH +endif() +if(POLICY CMP0054) + cmake_policy(SET CMP0054 OLD) # Only interpret if() arguments as variables or keywords when unquoted +endif() + +project (x265) +cmake_minimum_required (VERSION 2.8.8) # OBJECT libraries require 2.8.8 +include(CheckIncludeFiles) +include(CheckFunctionExists) +include(CheckSymbolExists) +include(CheckCXXCompilerFlag) + +option(FPROFILE_GENERATE "Compile executable to generate usage data" OFF) +option(FPROFILE_USE "Compile executable using generated usage data" OFF) +option(NATIVE_BUILD "Target the build CPU" OFF) +option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF) +mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD) +# X265_BUILD must be incremented each time the public API is changed +set(X265_BUILD 192) +configure_file("${PROJECT_SOURCE_DIR}/x265.def.in" + "${PROJECT_BINARY_DIR}/x265.def") +configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in" + "${PROJECT_BINARY_DIR}/x265_config.h") + +SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}") + +# System architecture detection +string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" SYSPROC) +set(X86_ALIASES x86 i386 i686 x86_64 amd64) +set(ARM_ALIASES armv6l armv7 armv7s aarch64) +list(FIND X86_ALIASES "${SYSPROC}" X86MATCH) +list(FIND ARM_ALIASES "${SYSPROC}" ARMMATCH) +set(POWER_ALIASES ppc64 ppc64le) +list(FIND POWER_ALIASES "${SYSPROC}" POWERMATCH) +if("${SYSPROC}" STREQUAL "" OR X86MATCH GREATER "-1") + set(X86 1) + add_definitions(-DX265_ARCH_X86=1) + if(CMAKE_CXX_FLAGS STREQUAL "-m32") + message(STATUS "Detected x86 target processor") + elseif("${CMAKE_SIZEOF_VOID_P}" MATCHES 8) + set(X64 1) + add_definitions(-DX86_64=1) + message(STATUS "Detected x86_64 target processor") + endif() +elseif(POWERMATCH GREATER "-1") + message(STATUS "Detected POWER target processor") + set(POWER 1) + add_definitions(-DX265_ARCH_POWER=1) + if("${CMAKE_SIZEOF_VOID_P}" MATCHES 8) + set(PPC64 1) + add_definitions(-DPPC64=1) + message(STATUS "Detected POWER PPC64 target processor") + endif() +elseif(ARMMATCH GREATER "-1") + if(CROSS_COMPILE_ARM) + message(STATUS "Cross compiling for ARM arch") + else() + set(CROSS_COMPILE_ARM 0) + endif() + set(ARM 1) + if("${CMAKE_SIZEOF_VOID_P}" MATCHES 8) + message(STATUS "Detected ARM64 target processor") + set(ARM64 1) + add_definitions(-DX265_ARCH_ARM=1 -DX265_ARCH_ARM64=1 -DHAVE_ARMV6=0) + else() + message(STATUS "Detected ARM target processor") + add_definitions(-DX265_ARCH_ARM=1 -DX265_ARCH_ARM64=0) + endif() +else() + message(STATUS "CMAKE_SYSTEM_PROCESSOR value `${CMAKE_SYSTEM_PROCESSOR}` is unknown") + message(STATUS "Please add this value near ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE}") +endif() + +if(UNIX) + list(APPEND PLATFORM_LIBS pthread) + find_library(LIBRT rt) + if(LIBRT) + list(APPEND PLATFORM_LIBS rt) + endif() + mark_as_advanced(LIBRT) + find_library(LIBDL dl) + if(LIBDL) + list(APPEND PLATFORM_LIBS dl) + endif() + option(ENABLE_LIBNUMA "Enable libnuma usage (Linux only)" ON) + if(ENABLE_LIBNUMA) + find_package(Numa) + if(NUMA_FOUND) + link_directories(${NUMA_LIBRARY_DIR}) + list(APPEND CMAKE_REQUIRED_LIBRARIES numa) + list(APPEND CMAKE_REQUIRED_INCLUDES ${NUMA_INCLUDE_DIR}) + list(APPEND CMAKE_REQUIRED_LINK_OPTIONS "-L${NUMA_LIBRARY_DIR}") + check_symbol_exists(numa_node_of_cpu numa.h NUMA_V2) + if(NUMA_V2) + add_definitions(-DHAVE_LIBNUMA) + message(STATUS "libnuma found, building with support for NUMA nodes") + list(APPEND PLATFORM_LIBS numa) + include_directories(${NUMA_INCLUDE_DIR}) + endif() + endif() + mark_as_advanced(NUMA_FOUND) + endif(ENABLE_LIBNUMA) + option(NO_ATOMICS "Use a slow mutex to replace atomics" OFF) + if(NO_ATOMICS) + add_definitions(-DNO_ATOMICS=1) + endif(NO_ATOMICS) + find_library(VMAF vmaf) + option(ENABLE_LIBVMAF "Enable VMAF" OFF) + if(ENABLE_LIBVMAF) + add_definitions(-DENABLE_LIBVMAF) + endif() +endif(UNIX) + +if(X64 AND NOT WIN32) + option(ENABLE_PIC "Enable Position Independent Code" ON) +else() + option(ENABLE_PIC "Enable Position Independent Code" OFF) +endif(X64 AND NOT WIN32) + +# Compiler detection +if(CMAKE_GENERATOR STREQUAL "Xcode") + set(XCODE 1) +endif() +if(APPLE) + add_definitions(-DMACOS=1) +endif() + +if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") + set(CLANG 1) +endif() +if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel") + set(INTEL_CXX 1) +endif() +if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") + set(GCC 1) +endif() + +if(INTEL_CXX AND WIN32) + # treat icl roughly like MSVC + set(MSVC 1) +endif() +if(MSVC) + if(STATIC_LINK_CRT) + set(CompilerFlags CMAKE_CXX_FLAGS_RELEASE CMAKE_C_FLAGS_RELEASE) + foreach(CompilerFlag ${CompilerFlags}) + string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}") + endforeach() + endif(STATIC_LINK_CRT) + add_definitions(/W4) # Full warnings + add_definitions(/Ob2) # always inline + add_definitions(/MP) # multithreaded build + + # disable Microsofts suggestions for proprietary secure APIs + add_definitions(/D_CRT_SECURE_NO_WARNINGS) + + check_include_files(stdint.h HAVE_STDINT_H) + if(NOT HAVE_STDINT_H) + include_directories(compat/msvc) + endif() +endif(MSVC) + +check_include_files(inttypes.h HAVE_INT_TYPES_H) +if(HAVE_INT_TYPES_H) + add_definitions(-DHAVE_INT_TYPES_H=1) +endif() + +if(INTEL_CXX AND UNIX) + set(GCC 1) # treat icpc roughly like gcc +elseif(CLANG) + set(GCC 1) # treat clang roughly like gcc +elseif(CMAKE_COMPILER_IS_GNUCXX) + set(GCC 1) +endif() + +if(CC STREQUAL "xlc") + message(STATUS "Use XLC compiler") + set(XLC 1) + set(GCC 0) + #set(CMAKE_C_COMPILER "/usr/bin/xlc") + #set(CMAKE_CXX_COMPILER "/usr/bin/xlc++") + add_definitions(-D__XLC__=1) + add_definitions(-O3 -qstrict -qhot -qaltivec) + add_definitions(-qinline=level=10 -qpath=IL:/data/video_files/latest.tpo/) +endif() +# this option is to enable the inclusion of dynamic HDR10 library to the libx265 compilation +option(ENABLE_HDR10_PLUS "Enable dynamic HDR10 compilation" OFF) +if(MSVC AND (MSVC_VERSION LESS 1800) AND ENABLE_HDR10_PLUS) + message(FATAL_ERROR "MSVC version 12.0 or above required to support hdr10plus") +endif() +if(WIN32 AND (MSVC_VERSION GREATER 1800)) + if(CMAKE_VERSION VERSION_LESS 3.7) + message(FATAL_ERROR "cmake version not compatible for VS 2017. Update the cmake to versions 3.7 or above") + endif() +endif() +if(GCC) + add_definitions(-Wall -Wextra -Wshadow) + add_definitions(-D__STDC_LIMIT_MACROS=1) + if(NOT INTEL_CXX AND NOT CLANG AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0) + add_definitions(-Wno-class-memaccess) + endif() + if(ENABLE_HDR10_PLUS) + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.8") + message(FATAL_ERROR "gcc version above 4.8 required to support hdr10plus") + endif() + add_definitions(-std=gnu++11) + else() + add_definitions(-std=gnu++98) + endif() + if(ENABLE_PIC) + add_definitions(-fPIC) + endif(ENABLE_PIC) + if(NATIVE_BUILD) + if(INTEL_CXX) + add_definitions(-xhost) + else() + add_definitions(-march=native) + endif() + elseif(X86 AND NOT X64) + string(FIND "${CMAKE_CXX_FLAGS}" "-march" marchPos) + if(marchPos LESS "0") + add_definitions(-march=i686) + if(WIN32 AND NOT INTEL_CXX AND NOT CLANG AND + CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0) + add_definitions(-mpreferred-stack-boundary=2) + endif() + endif() + endif() + if(ARM AND CROSS_COMPILE_ARM) + message(STATUS "cross compile arm") + separate_arguments(AS_ARGUMENTS WINDOWS_COMMAND $ENV{AS_ARGUMENTS}) + separate_arguments(ARM_ARGS WINDOWS_COMMAND $ENV{ASM_FLAGS}) + # ALL IOS ARM CPUS HAVE NEON + add_definitions(-DHAVE_NEON) + elseif(ARM) + if(ARM64) + set(ARM_ARGS -fPIC) + add_definitions(-DHAVE_NEON) + else() + find_package(Neon) + if(CPU_HAS_NEON) + set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=neon -marm -fPIC) + add_definitions(-DHAVE_NEON) + else() + set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=vfp -marm) + endif() + endif() + endif() + add_definitions(${ARM_ARGS}) + if(FPROFILE_GENERATE) + if(INTEL_CXX) + add_definitions(-prof-gen -prof-dir="${CMAKE_CURRENT_BINARY_DIR}") + list(APPEND LINKER_OPTIONS "-prof-gen") + else() + check_cxx_compiler_flag(-fprofile-generate CC_HAS_PROFILE_GENERATE) + if(CC_HAS_PROFILE_GENERATE) + add_definitions(-fprofile-generate) + list(APPEND LINKER_OPTIONS "-fprofile-generate") + endif(CC_HAS_PROFILE_GENERATE) + endif(INTEL_CXX) + endif(FPROFILE_GENERATE) + if(FPROFILE_USE) + if(INTEL_CXX) + add_definitions(-prof-use -prof-dir="${CMAKE_CURRENT_BINARY_DIR}") + list(APPEND LINKER_OPTIONS "-prof-use") + else() + check_cxx_compiler_flag(-fprofile-use CC_HAS_PROFILE_USE) + check_cxx_compiler_flag(-fprofile-correction CC_HAS_PROFILE_CORRECTION) + check_cxx_compiler_flag(-Wno-error=coverage-mismatch CC_HAS_COVMISMATCH) + if(CC_HAS_PROFILE_USE) + add_definitions(-fprofile-use) + list(APPEND LINKER_OPTIONS "-fprofile-use") + endif(CC_HAS_PROFILE_USE) + if(CC_HAS_PROFILE_CORRECTION) + # auto-correct corrupted counters (happens a lot with x265) + add_definitions(-fprofile-correction) + endif(CC_HAS_PROFILE_CORRECTION) + if(CC_HAS_COVMISMATCH) + # ignore coverage mismatches (also happens a lot) + add_definitions(-Wno-error=coverage-mismatch) + endif(CC_HAS_COVMISMATCH) + endif(INTEL_CXX) + endif(FPROFILE_USE) + if(STATIC_LINK_CRT) + add_definitions(-static) + list(APPEND LINKER_OPTIONS "-static-libgcc") + endif(STATIC_LINK_CRT) + check_cxx_compiler_flag(-Wno-strict-overflow CC_HAS_NO_STRICT_OVERFLOW) + check_cxx_compiler_flag(-Wno-narrowing CC_HAS_NO_NARROWING) + check_cxx_compiler_flag(-Wno-array-bounds CC_HAS_NO_ARRAY_BOUNDS) + if (CC_HAS_NO_ARRAY_BOUNDS) + add_definitions(-Wno-array-bounds) # these are unhelpful + endif() + check_cxx_compiler_flag(-ffast-math CC_HAS_FAST_MATH) + if (CC_HAS_FAST_MATH) + add_definitions(-ffast-math) + endif() + check_cxx_compiler_flag(-mstackrealign CC_HAS_STACK_REALIGN) + if (CC_HAS_STACK_REALIGN) + add_definitions(-mstackrealign) + endif() + # Disable exceptions. Reduce executable size, increase compability. + check_cxx_compiler_flag(-fno-exceptions CC_HAS_FNO_EXCEPTIONS_FLAG) + if(CC_HAS_FNO_EXCEPTIONS_FLAG) + add_definitions(-fno-exceptions) + endif() + set(FSANITIZE "" CACHE STRING "-fsanitize options for GCC/clang") + if(FSANITIZE) + add_definitions(-fsanitize=${FSANITIZE}) + # clang and gcc need the sanitize options to be passed at link + # time so the appropriate ASAN/TSAN runtime libraries can be + # linked. + list(APPEND LINKER_OPTIONS "-fsanitize=${FSANITIZE}") + endif() + option(ENABLE_AGGRESSIVE_CHECKS "Enable stack protection and -ftrapv" OFF) + if(ENABLE_AGGRESSIVE_CHECKS) + # use with care, -ftrapv can cause testbench SIGILL exceptions + # since it is testing corner cases of signed integer math + add_definitions(-DUSING_FTRAPV=1) + check_cxx_compiler_flag(-fsanitize=undefined-trap CC_HAS_CATCH_UNDEFINED) # clang + check_cxx_compiler_flag(-ftrapv CC_HAS_FTRAPV) # gcc + check_cxx_compiler_flag(-fstack-protector-all CC_HAS_STACK_PROTECT) # gcc + if(CC_HAS_FTRAPV) + add_definitions(-ftrapv) + endif() + if(CC_HAS_CATCH_UNDEFINED) + add_definitions(-fsanitize=undefined-trap -fsanitize-undefined-trap-on-error) + endif() + if(CC_HAS_STACK_PROTECT) + add_definitions(-fstack-protector-all) + if(MINGW) + list(APPEND PLATFORM_LIBS ssp) + endif() + endif() + endif(ENABLE_AGGRESSIVE_CHECKS) + execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE CC_VERSION) +endif(GCC) + +find_package(Nasm) +if(ARM OR CROSS_COMPILE_ARM) + option(ENABLE_ASSEMBLY "Enable use of assembly coded primitives" ON) +elseif(NASM_FOUND AND X86) + if (NASM_VERSION_STRING VERSION_LESS "2.13.0") + message(STATUS "Nasm version ${NASM_VERSION_STRING} is too old. 2.13.0 or later required") + option(ENABLE_ASSEMBLY "Enable use of assembly coded primitives" OFF) + else() + message(STATUS "Found Nasm ${NASM_VERSION_STRING} to build assembly primitives") + option(ENABLE_ASSEMBLY "Enable use of assembly coded primitives" ON) + endif() +else() + option(ENABLE_ASSEMBLY "Enable use of assembly coded primitives" OFF) +endif() + +option(CHECKED_BUILD "Enable run-time sanity checks (debugging)" OFF) +if(CHECKED_BUILD) + add_definitions(-DCHECKED_BUILD=1) +endif() + +# Build options +set(LIB_INSTALL_DIR lib CACHE STRING "Install location of libraries") +set(BIN_INSTALL_DIR bin CACHE STRING "Install location of executables") +set(EXTRA_LIB "" CACHE STRING "Extra libraries to link against") +set(EXTRA_LINK_FLAGS "" CACHE STRING "Extra link flags") +if(EXTRA_LINK_FLAGS) + list(APPEND LINKER_OPTIONS ${EXTRA_LINK_FLAGS}) +endif() +if(EXTRA_LIB) + option(LINKED_8BIT "8bit libx265 is being linked with this library" OFF) + option(LINKED_10BIT "10bit libx265 is being linked with this library" OFF) + option(LINKED_12BIT "12bit libx265 is being linked with this library" OFF) +endif(EXTRA_LIB) +mark_as_advanced(EXTRA_LIB EXTRA_LINK_FLAGS) + +if(X64) + # NOTE: We only officially support high-bit-depth compiles of x265 + # on 64bit architectures. Main10 plus large resolution plus slow + # preset plus 32bit address space usually means malloc failure. You + # can disable this if(X64) check if you desparately need a 32bit + # build with 10bit/12bit support, but this violates the "shrink wrap + # license" so to speak. If it breaks you get to keep both halves. + # You will need to disable assembly manually. + option(HIGH_BIT_DEPTH "Store pixel samples as 16bit values (Main10/Main12)" OFF) +endif(X64) +if(HIGH_BIT_DEPTH) + option(MAIN12 "Support Main12 instead of Main10" OFF) + if(MAIN12) + add_definitions(-DHIGH_BIT_DEPTH=1 -DX265_DEPTH=12) + else() + add_definitions(-DHIGH_BIT_DEPTH=1 -DX265_DEPTH=10) + endif() +else(HIGH_BIT_DEPTH) + add_definitions(-DHIGH_BIT_DEPTH=0 -DX265_DEPTH=8) +endif(HIGH_BIT_DEPTH) + +if (ENABLE_HDR10_PLUS) + include_directories(. dynamicHDR10 "${PROJECT_BINARY_DIR}") + add_subdirectory(dynamicHDR10) + add_definitions(-DENABLE_HDR10_PLUS) +endif(ENABLE_HDR10_PLUS) + +option(ENABLE_SVT_HEVC "Enable SVT HEVC Encoder" OFF) +if(ENABLE_SVT_HEVC) + find_package(svthevc) + if(SVTHEVC_FOUND) + add_definitions(-DSVT_HEVC) + include_directories(${SVT_HEVC_INCLUDE_DIR}) + endif(SVTHEVC_FOUND) +endif(ENABLE_SVT_HEVC) + +# this option can only be used when linking multiple libx265 libraries +# together, and some alternate API access method is implemented. +option(EXPORT_C_API "Implement public C programming interface" ON) +mark_as_advanced(EXPORT_C_API) +if(EXPORT_C_API) + set(X265_NS x265) + add_definitions(-DEXPORT_C_API=1) +elseif(HIGH_BIT_DEPTH) + if(MAIN12) + set(X265_NS x265_12bit) + else() + set(X265_NS x265_10bit) + endif() + add_definitions(-DEXPORT_C_API=0) +else() + set(X265_NS x265_8bit) + add_definitions(-DEXPORT_C_API=0) +endif() +add_definitions(-DX265_NS=${X265_NS}) + +option(WARNINGS_AS_ERRORS "Stop compiles on first warning" OFF) +if(WARNINGS_AS_ERRORS) + if(GCC) + add_definitions(-Werror) + elseif(MSVC) + add_definitions(/WX) + endif() +endif(WARNINGS_AS_ERRORS) + +if(WIN32) + # Visual leak detector + find_package(VLD QUIET) + if(VLD_FOUND) + add_definitions(-DHAVE_VLD) + include_directories(${VLD_INCLUDE_DIRS}) + list(APPEND PLATFORM_LIBS ${VLD_LIBRARIES}) + link_directories(${VLD_LIBRARY_DIRS}) + endif() + option(WINXP_SUPPORT "Make binaries compatible with Windows XP and Vista" OFF) + if(WINXP_SUPPORT) + # force use of workarounds for CONDITION_VARIABLE and atomic + # intrinsics introduced after XP + add_definitions(-D_WIN32_WINNT=_WIN32_WINNT_WINXP -D_WIN32_WINNT_WIN7=0x0601) + else(WINXP_SUPPORT) + # default to targeting Windows 7 for the NUMA APIs + add_definitions(-D_WIN32_WINNT=_WIN32_WINNT_WIN7) + endif(WINXP_SUPPORT) +endif() + +if(POWER) + # IBM Power8 + option(ENABLE_ALTIVEC "Enable ALTIVEC profiling instrumentation" ON) + if(ENABLE_ALTIVEC) + add_definitions(-DHAVE_ALTIVEC=1 -maltivec -mabi=altivec) + add_definitions(-flax-vector-conversions -fpermissive) + else() + add_definitions(-DHAVE_ALTIVEC=0) + endif() + + option(CPU_POWER8 "Enable CPU POWER8 profiling instrumentation" ON) + if(CPU_POWER8) + add_definitions(-mcpu=power8 -DX265_ARCH_POWER8=1) + endif() +endif() + +include(version) # determine X265_VERSION and X265_LATEST_TAG +include_directories(. common encoder "${PROJECT_BINARY_DIR}") + +option(ENABLE_PPA "Enable PPA profiling instrumentation" OFF) +if(ENABLE_PPA) + add_definitions(-DENABLE_PPA) + list(APPEND PLATFORM_LIBS PPA) + if(UNIX) + list(APPEND PLATFORM_LIBS dl) + endif(UNIX) + add_subdirectory(profile/PPA) +endif(ENABLE_PPA) + +option(ENABLE_VTUNE "Enable Vtune profiling instrumentation" OFF) +if(ENABLE_VTUNE) + find_package(Vtune) + if(VTUNE_FOUND) + add_definitions(-DENABLE_VTUNE) + include_directories(${VTUNE_INCLUDE_DIR}) + list(APPEND PLATFORM_LIBS vtune) + link_directories(${VTUNE_LIBRARY_DIR}) + if(WIN32) + list(APPEND PLATFORM_LIBS libittnotify.lib) + else() + list(APPEND PLATFORM_LIBS libittnotify.a dl) + endif() + add_subdirectory(profile/vtune) + endif(VTUNE_FOUND) +endif(ENABLE_VTUNE) + +option(DETAILED_CU_STATS "Enable internal profiling of encoder work" OFF) +if(DETAILED_CU_STATS) + add_definitions(-DDETAILED_CU_STATS) +endif(DETAILED_CU_STATS) + +add_subdirectory(encoder) +add_subdirectory(common) + +if((MSVC_IDE OR XCODE OR GCC) AND ENABLE_ASSEMBLY) + # this is required because of this cmake bug + # http://www.cmake.org/Bug/print_bug_page.php?bug_id=8170 + if(WIN32) + set(SUFFIX obj) + else() + set(SUFFIX o) + endif() + + if(ARM OR CROSS_COMPILE_ARM) + # compile ARM arch asm files here + enable_language(ASM) + foreach(ASM ${ARM_ASMS}) + if(ARM64) + set(ASM_SRC ${CMAKE_CURRENT_SOURCE_DIR}/common/aarch64/${ASM}) + else() + set(ASM_SRC ${CMAKE_CURRENT_SOURCE_DIR}/common/arm/${ASM}) + endif() + list(APPEND ASM_SRCS ${ASM_SRC}) + list(APPEND ASM_OBJS ${ASM}.${SUFFIX}) + add_custom_command( + OUTPUT ${ASM}.${SUFFIX} + COMMAND ${CMAKE_AS} ${AS_ARGUMENTS} -- ${CMAKE_C_COMPILER} ${ARM_ARGS} -c ${ASM_SRC} -o ${ASM}.${SUFFIX} + DEPENDS ${ASM_SRC}) + endforeach() + elseif(X86) + # compile X86 arch asm files here + foreach(ASM ${MSVC_ASMS}) + set(ASM_SRC ${CMAKE_CURRENT_SOURCE_DIR}/common/x86/${ASM}) + list(APPEND ASM_SRCS ${ASM_SRC}) + list(APPEND ASM_OBJS ${ASM}.${SUFFIX}) + add_custom_command( + OUTPUT ${ASM}.${SUFFIX} + COMMAND ${NASM_EXECUTABLE} ARGS ${NASM_FLAGS} ${ASM_SRC} -o ${ASM}.${SUFFIX} + DEPENDS ${ASM_SRC}) + endforeach() + endif() +endif() +source_group(ASM FILES ${ASM_SRCS}) +if(ENABLE_HDR10_PLUS) + add_library(x265-static STATIC $ $ $ ${ASM_OBJS}) + add_library(hdr10plus-static STATIC $) + set_target_properties(hdr10plus-static PROPERTIES OUTPUT_NAME hdr10plus) +else() + add_library(x265-static STATIC $ $ ${ASM_OBJS}) +endif() +if(NOT MSVC) + set_target_properties(x265-static PROPERTIES OUTPUT_NAME x265) +endif() +if(EXTRA_LIB) + target_link_libraries(x265-static ${EXTRA_LIB}) +endif() +if(ENABLE_LIBVMAF) + target_link_libraries(x265-static ${VMAF}) +endif() +if(SVTHEVC_FOUND) + target_link_libraries(x265-static ${SVT_HEVC_LIBRARY}) +endif() +install(TARGETS x265-static + LIBRARY DESTINATION ${LIB_INSTALL_DIR} + ARCHIVE DESTINATION ${LIB_INSTALL_DIR}) + +if(ENABLE_HDR10_PLUS) + install(TARGETS hdr10plus-static + LIBRARY DESTINATION ${LIB_INSTALL_DIR} + ARCHIVE DESTINATION ${LIB_INSTALL_DIR}) +endif() + +if(SVTHEVC_FOUND) + install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbApi.h" DESTINATION include) + install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbErrorCodes.h" DESTINATION include) + install(FILES "${SVT_HEVC_LIBRARY}" DESTINATION ${LIB_INSTALL_DIR}) +endif() + +install(FILES x265.h "${PROJECT_BINARY_DIR}/x265_config.h" DESTINATION include) +if((WIN32 AND ENABLE_CLI) OR (WIN32 AND ENABLE_SHARED)) + if(MSVC_IDE) + install(FILES "${PROJECT_BINARY_DIR}/Debug/x265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS Debug) + install(FILES "${PROJECT_BINARY_DIR}/RelWithDebInfo/x265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS RelWithDebInfo) + install(FILES "${PROJECT_BINARY_DIR}/Debug/libx265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS Debug OPTIONAL NAMELINK_ONLY) + install(FILES "${PROJECT_BINARY_DIR}/RelWithDebInfo/libx265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS RelWithDebInfo OPTIONAL NAMELINK_ONLY) + else() + install(FILES "${PROJECT_BINARY_DIR}/x265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS Debug) + install(FILES "${PROJECT_BINARY_DIR}/x265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS RelWithDebInfo) + install(FILES "${PROJECT_BINARY_DIR}/libx265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS Debug OPTIONAL NAMELINK_ONLY) + install(FILES "${PROJECT_BINARY_DIR}/libx265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS RelWithDebInfo OPTIONAL NAMELINK_ONLY) + endif() +endif() +if(CMAKE_RC_COMPILER) + # The resource compiler does not need CFLAGS or macro defines. It + # often breaks them + string(REPLACE "" "" CMAKE_RC_COMPILE_OBJECT "${CMAKE_RC_COMPILE_OBJECT}") + string(REPLACE "" "" CMAKE_RC_COMPILE_OBJECT "${CMAKE_RC_COMPILE_OBJECT}") + # convert X265_LATEST_TAG (ex: 0.7) and X265_TAG_DISTANCE (ex: 103) to + # @X265_VERSION_MAJOR@,@X265_VERSION_MINOR@,@X265_BRANCH_ID@,@X265_TAG_DISTANCE@ + string(REGEX MATCHALL "([0-9]+)" VERSION_LIST "${X265_LATEST_TAG}") + list(GET VERSION_LIST 0 X265_VERSION_MAJOR) + list(GET VERSION_LIST 1 X265_VERSION_MINOR) + set(X265_BRANCH_ID 0) # TODO: 0 - stable, 1 - default or other + set(X265_RC_FILE "${CMAKE_CURRENT_BINARY_DIR}/x265.rc") + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/x265.rc.in" "${X265_RC_FILE}" @ONLY) +endif() + +if(NOT (MSVC_IDE OR XCODE)) + add_custom_target(clean-generated COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/clean-generated.cmake) +endif() +option(ENABLE_SHARED "Build shared library" ON) +if(ENABLE_SHARED) + if(ENABLE_HDR10_PLUS) + add_library(x265-shared SHARED "${PROJECT_BINARY_DIR}/x265.def" ${ASM_OBJS} + ${X265_RC_FILE} $ $ $) + add_library(hdr10plus-shared SHARED $) + + if(MSVC) + set_target_properties(hdr10plus-shared PROPERTIES OUTPUT_NAME libhdr10plus) + else() + set_target_properties(hdr10plus-shared PROPERTIES OUTPUT_NAME hdr10plus) + endif() + else() + add_library(x265-shared SHARED "${PROJECT_BINARY_DIR}/x265.def" ${ASM_OBJS} + ${X265_RC_FILE} $ $) + endif() + if(EXTRA_LIB) + target_link_libraries(x265-shared ${EXTRA_LIB}) + endif() + target_link_libraries(x265-shared ${PLATFORM_LIBS}) + if(SVTHEVC_FOUND) + target_link_libraries(x265-shared ${SVT_HEVC_LIBRARY}) + endif(SVTHEVC_FOUND) + if(MSVC) + set_target_properties(x265-shared PROPERTIES OUTPUT_NAME libx265) + else() + set_target_properties(x265-shared PROPERTIES OUTPUT_NAME x265) + endif() + if(UNIX) + set_target_properties(x265-shared PROPERTIES VERSION ${X265_BUILD}) + if(APPLE) + set_target_properties(x265-shared PROPERTIES MACOSX_RPATH 1) + elseif(CYGWIN) + # Cygwin is not officially supported or tested. MinGW with msys is recommended. + else() + list(APPEND LINKER_OPTIONS "-Wl,-Bsymbolic,-znoexecstack") + endif() + endif() + set_target_properties(x265-shared PROPERTIES SOVERSION ${X265_BUILD}) + if(X265_LATEST_TAG) + if(WINDOWS) + set_target_properties(x265-shared PROPERTIES VERSION ${X265_LATEST_TAG}) + endif() + # shared library is not installed if a tag is not found + install(TARGETS x265-shared + LIBRARY DESTINATION ${LIB_INSTALL_DIR} + ARCHIVE DESTINATION ${LIB_INSTALL_DIR} + RUNTIME DESTINATION ${BIN_INSTALL_DIR}) + endif() + if(ENABLE_HDR10_PLUS) + install(TARGETS hdr10plus-shared + LIBRARY DESTINATION ${LIB_INSTALL_DIR} + ARCHIVE DESTINATION ${LIB_INSTALL_DIR}) + endif() + if(LINKER_OPTIONS) + # set_target_properties can't do list expansion + string(REPLACE ";" " " LINKER_OPTION_STR "${LINKER_OPTIONS}") + set_target_properties(x265-shared PROPERTIES LINK_FLAGS "${LINKER_OPTION_STR}") + endif() +endif() + +if(X265_LATEST_TAG) + # convert lists of link libraries into -lstdc++ -lm etc.. + foreach(LIB ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES} ${PLATFORM_LIBS}) + if(IS_ABSOLUTE ${LIB} AND EXISTS ${LIB}) + list(APPEND PLIBLIST "${LIB}") + else() + list(APPEND PLIBLIST "-l${LIB}") + endif() + endforeach() + if(PLIBLIST) + # blacklist of libraries that should not be in Libs.private + list(REMOVE_ITEM PLIBLIST "-lc" "-lpthread" "-lmingwex" "-lmingwthrd" + "-lmingw32" "-lmoldname" "-lmsvcrt" "-ladvapi32" "-lshell32" + "-luser32" "-lkernel32") + string(REPLACE ";" " " PRIVATE_LIBS "${PLIBLIST}") + else() + set(PRIVATE_LIBS "") + endif(PLIBLIST) + + # Produce a pkg-config file + configure_file("x265.pc.in" "x265.pc" @ONLY) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/x265.pc" + DESTINATION "${LIB_INSTALL_DIR}/pkgconfig") +endif() + +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake" + IMMEDIATE @ONLY) +add_custom_target(uninstall + "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake") + +# Main CLI application +set(ENABLE_CLI ON CACHE BOOL "Build standalone CLI application") +if(ENABLE_CLI) + file(GLOB InputFiles input/input.cpp input/yuv.cpp input/y4m.cpp input/*.h) + file(GLOB OutputFiles output/output.cpp output/reconplay.cpp output/*.h + output/yuv.cpp output/y4m.cpp # recon + output/raw.cpp) # muxers + source_group(input FILES ${InputFiles}) + source_group(output FILES ${OutputFiles}) + + check_include_files(getopt.h HAVE_GETOPT_H) + if(NOT HAVE_GETOPT_H) + if(MSVC) + set_source_files_properties(compat/getopt/getopt.c PROPERTIES COMPILE_FLAGS "/wd4100 /wd4131 -DHAVE_STRING_H=1") + endif(MSVC) + include_directories(compat/getopt) + set(GETOPT compat/getopt/getopt.c compat/getopt/getopt.h) + endif(NOT HAVE_GETOPT_H) + if(WIN32) + set(ExportDefs "${PROJECT_BINARY_DIR}/x265.def") + endif(WIN32) + if(XCODE) + # Xcode seems unable to link the CLI with libs, so link as one targget + if(ENABLE_HDR10_PLUS) + add_executable(cli ../COPYING ${InputFiles} ${OutputFiles} ${GETOPT} + x265.cpp x265.h x265cli.cpp x265cli.h abrEncApp.cpp abrEncApp.h + $ $ $ ${ASM_OBJS}) + else() + add_executable(cli ../COPYING ${InputFiles} ${OutputFiles} ${GETOPT} + x265.cpp x265.h x265cli.cpp x265cli.h abrEncApp.cpp abrEncApp.h + $ $ ${ASM_OBJS}) + endif() + else() + add_executable(cli ../COPYING ${InputFiles} ${OutputFiles} ${GETOPT} ${X265_RC_FILE} + ${ExportDefs} x265.cpp x265.h x265cli.cpp x265cli.h abrEncApp.cpp abrEncApp.h) + if(WIN32 OR NOT ENABLE_SHARED OR INTEL_CXX) + # The CLI cannot link to the shared library on Windows, it + # requires internal APIs not exported from the DLL + target_link_libraries(cli x265-static ${PLATFORM_LIBS}) + else() + target_link_libraries(cli x265-shared ${PLATFORM_LIBS}) + endif() + endif() + set_target_properties(cli PROPERTIES OUTPUT_NAME x265) + if(LINKER_OPTIONS) + # set_target_properties can't do list expansion + string(REPLACE ";" " " LINKER_OPTION_STR "${LINKER_OPTIONS}") + set_target_properties(cli PROPERTIES LINK_FLAGS "${LINKER_OPTION_STR}") + endif() + + install(TARGETS cli DESTINATION ${BIN_INSTALL_DIR}) +endif(ENABLE_CLI) + +if(ENABLE_ASSEMBLY AND NOT XCODE) + option(ENABLE_TESTS "Enable Unit Tests" OFF) + if(ENABLE_TESTS) + add_subdirectory(test) + endif() +endif() + +get_directory_property(hasParent PARENT_DIRECTORY) +if(hasParent) + if(PLATFORM_LIBS) + LIST(REMOVE_DUPLICATES PLATFORM_LIBS) + set(PLATFORM_LIBS ${PLATFORM_LIBS} PARENT_SCOPE) + endif(PLATFORM_LIBS) +endif(hasParent) diff --git a/tools/patch/make/libvpx/configure.sh b/tools/patch/make/libvpx/configure.sh new file mode 100644 index 0000000..f036044 --- /dev/null +++ b/tools/patch/make/libvpx/configure.sh @@ -0,0 +1,1565 @@ +#!/bin/sh +## +## configure.sh +## +## This script is sourced by the main configure script and contains +## utility functions and other common bits that aren't strictly libvpx +## related. +## +## This build system is based in part on the FFmpeg configure script. +## + + +# +# Logging / Output Functions +# +die_unknown(){ + echo "Unknown option \"$1\"." + echo "See $0 --help for available options." + clean_temp_files + exit 1 +} + +die() { + echo "$@" + echo + echo "Configuration failed. This could reflect a misconfiguration of your" + echo "toolchains, improper options selected, or another problem. If you" + echo "don't see any useful error messages above, the next step is to look" + echo "at the configure error log file ($logfile) to determine what" + echo "configure was trying to do when it died." + clean_temp_files + exit 1 +} + +log(){ + echo "$@" >>$logfile +} + +log_file(){ + log BEGIN $1 + cat -n $1 >>$logfile + log END $1 +} + +log_echo() { + echo "$@" + log "$@" +} + +fwrite () { + outfile=$1 + shift + echo "$@" >> ${outfile} +} + +show_help_pre(){ + for opt in ${CMDLINE_SELECT}; do + opt2=`echo $opt | sed -e 's;_;-;g'` + if enabled $opt; then + eval "toggle_${opt}=\"--disable-${opt2}\"" + else + eval "toggle_${opt}=\"--enable-${opt2} \"" + fi + done + + cat <>${logfile} 2>&1 +} + +check_cc() { + log check_cc "$@" + cat >${TMP_C} + log_file ${TMP_C} + check_cmd ${CC} ${CFLAGS} "$@" -c -o ${TMP_O} ${TMP_C} +} + +check_cxx() { + log check_cxx "$@" + cat >${TMP_CC} + log_file ${TMP_CC} + check_cmd ${CXX} ${CXXFLAGS} "$@" -c -o ${TMP_O} ${TMP_CC} +} + +check_cpp() { + log check_cpp "$@" + cat > ${TMP_C} + log_file ${TMP_C} + check_cmd ${CC} ${CFLAGS} "$@" -E -o ${TMP_O} ${TMP_C} +} + +check_ld() { + log check_ld "$@" + check_cc $@ \ + && check_cmd ${LD} ${LDFLAGS} "$@" -o ${TMP_X} ${TMP_O} ${extralibs} +} + +check_lib() { + log check_lib "$@" + check_cc $@ \ + && check_cmd ${LD} ${LDFLAGS} -o ${TMP_X} ${TMP_O} "$@" ${extralibs} +} + +check_header(){ + log check_header "$@" + header=$1 + shift + var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'` + disable_feature $var + check_cpp "$@" <${TMP_ASM} <${TMP_X} + log_file ${TMP_X} + if ! grep -q '\.rodata .* 16$' ${TMP_X}; then + die "${AS} ${ASFLAGS} does not support section alignment (nasm <=2.08?)" + fi +} + +# tests for -m$1 toggling the feature given in $2. If $2 is empty $1 is used. +check_gcc_machine_option() { + opt="$1" + feature="$2" + [ -n "$feature" ] || feature="$opt" + + if enabled gcc && ! disabled "$feature" && ! check_cflags "-m$opt"; then + RTCD_OPTIONS="${RTCD_OPTIONS}--disable-$feature " + else + soft_enable "$feature" + fi +} + +# tests for -m$2, -m$3, -m$4... toggling the feature given in $1. +check_gcc_machine_options() { + feature="$1" + shift + flags="-m$1" + shift + for opt in $*; do + flags="$flags -m$opt" + done + + if enabled gcc && ! disabled "$feature" && ! check_cflags $flags; then + RTCD_OPTIONS="${RTCD_OPTIONS}--disable-$feature " + else + soft_enable "$feature" + fi +} + +check_gcc_avx512_compiles() { + if disabled gcc; then + return + fi + + check_cc -mavx512f < +void f(void) { + __m512i x = _mm512_set1_epi16(0); + (void)x; +} +EOF + compile_result=$? + if [ ${compile_result} -ne 0 ]; then + log_echo " disabling avx512: not supported by compiler" + disable_feature avx512 + RTCD_OPTIONS="${RTCD_OPTIONS}--disable-avx512 " + fi +} + +write_common_config_banner() { + print_webm_license config.mk "##" "" + echo '# This file automatically generated by configure. Do not edit!' >> config.mk + echo "TOOLCHAIN := ${toolchain}" >> config.mk + + case ${toolchain} in + *-linux-rvct) + echo "ALT_LIBC := ${alt_libc}" >> config.mk + ;; + esac +} + +write_common_config_targets() { + for t in ${all_targets}; do + if enabled ${t}; then + if enabled child; then + fwrite config.mk "ALL_TARGETS += ${t}-${toolchain}" + else + fwrite config.mk "ALL_TARGETS += ${t}" + fi + fi + true; + done + true +} + +write_common_target_config_mk() { + saved_CC="${CC}" + saved_CXX="${CXX}" + enabled ccache && CC="ccache ${CC}" + enabled ccache && CXX="ccache ${CXX}" + print_webm_license $1 "##" "" + + cat >> $1 << EOF +# This file automatically generated by configure. Do not edit! +SRC_PATH="$source_path" +SRC_PATH_BARE=$source_path +BUILD_PFX=${BUILD_PFX} +TOOLCHAIN=${toolchain} +ASM_CONVERSION=${asm_conversion_cmd:-${source_path}/build/make/ads2gas.pl} +GEN_VCPROJ=${gen_vcproj_cmd} +MSVS_ARCH_DIR=${msvs_arch_dir} + +CC=${CC} +CXX=${CXX} +AR=${AR} +LD=${LD} +AS=${AS} +STRIP=${STRIP} +NM=${NM} + +CFLAGS = ${CFLAGS} +CXXFLAGS = ${CXXFLAGS} +ARFLAGS = -crs\$(if \$(quiet),,v) +LDFLAGS = ${LDFLAGS} +ASFLAGS = ${ASFLAGS} +extralibs = ${extralibs} +AS_SFX = ${AS_SFX:-.asm} +EXE_SFX = ${EXE_SFX} +VCPROJ_SFX = ${VCPROJ_SFX} +RTCD_OPTIONS = ${RTCD_OPTIONS} +LIBYUV_CXXFLAGS = ${LIBYUV_CXXFLAGS} +EOF + + if enabled rvct; then cat >> $1 << EOF +fmt_deps = sed -e 's;^__image.axf;\${@:.d=.o} \$@;' #hide +EOF + else cat >> $1 << EOF +fmt_deps = sed -e 's;^\([a-zA-Z0-9_]*\)\.o;\${@:.d=.o} \$@;' +EOF + fi + + print_config_mk VPX_ARCH "${1}" ${ARCH_LIST} + print_config_mk HAVE "${1}" ${HAVE_LIST} + print_config_mk CONFIG "${1}" ${CONFIG_LIST} + print_config_mk HAVE "${1}" gnu_strip + + enabled msvs && echo "CONFIG_VS_VERSION=${vs_version}" >> "${1}" + + CC="${saved_CC}" + CXX="${saved_CXX}" +} + +write_common_target_config_h() { + print_webm_license ${TMP_H} "/*" " */" + cat >> ${TMP_H} << EOF +/* This file automatically generated by configure. Do not edit! */ +#ifndef VPX_CONFIG_H +#define VPX_CONFIG_H +#define RESTRICT ${RESTRICT} +#define INLINE ${INLINE} +EOF + print_config_h VPX_ARCH "${TMP_H}" ${ARCH_LIST} + print_config_h HAVE "${TMP_H}" ${HAVE_LIST} + print_config_h CONFIG "${TMP_H}" ${CONFIG_LIST} + print_config_vars_h "${TMP_H}" ${VAR_LIST} + echo "#endif /* VPX_CONFIG_H */" >> ${TMP_H} + mkdir -p `dirname "$1"` + cmp "$1" ${TMP_H} >/dev/null 2>&1 || mv ${TMP_H} "$1" +} + +write_win_arm64_neon_h_workaround() { + print_webm_license ${TMP_H} "/*" " */" + cat >> ${TMP_H} << EOF +/* This file automatically generated by configure. Do not edit! */ +#ifndef VPX_WIN_ARM_NEON_H_WORKAROUND +#define VPX_WIN_ARM_NEON_H_WORKAROUND +/* The Windows SDK has arm_neon.h, but unlike on other platforms it is + * ARM32-only. ARM64 NEON support is provided by arm64_neon.h, a proper + * superset of arm_neon.h. Work around this by providing a more local + * arm_neon.h that simply #includes arm64_neon.h. + */ +#include +#endif /* VPX_WIN_ARM_NEON_H_WORKAROUND */ +EOF + mkdir -p `dirname "$1"` + cmp "$1" ${TMP_H} >/dev/null 2>&1 || mv ${TMP_H} "$1" +} + +process_common_cmdline() { + for opt in "$@"; do + optval="${opt#*=}" + case "$opt" in + --child) + enable_feature child + ;; + --log*) + logging="$optval" + if ! disabled logging ; then + enabled logging || logfile="$logging" + else + logfile=/dev/null + fi + ;; + --target=*) + toolchain="${toolchain:-${optval}}" + ;; + --force-target=*) + toolchain="${toolchain:-${optval}}" + enable_feature force_toolchain + ;; + --cpu=*) + tune_cpu="$optval" + ;; + --extra-cflags=*) + extra_cflags="${optval}" + ;; + --extra-cxxflags=*) + extra_cxxflags="${optval}" + ;; + --enable-?*|--disable-?*) + eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'` + if is_in ${option} ${ARCH_EXT_LIST}; then + [ $action = "disable" ] && RTCD_OPTIONS="${RTCD_OPTIONS}--disable-${option} " + elif [ $action = "disable" ] && ! disabled $option ; then + is_in ${option} ${CMDLINE_SELECT} || die_unknown $opt + log_echo " disabling $option" + elif [ $action = "enable" ] && ! enabled $option ; then + is_in ${option} ${CMDLINE_SELECT} || die_unknown $opt + log_echo " enabling $option" + fi + ${action}_feature $option + ;; + --require-?*) + eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'` + if is_in ${option} ${ARCH_EXT_LIST}; then + RTCD_OPTIONS="${RTCD_OPTIONS}${opt} " + else + die_unknown $opt + fi + ;; + --force-enable-?*|--force-disable-?*) + eval `echo "$opt" | sed 's/--force-/action=/;s/-/ option=/;s/-/_/g'` + ${action}_feature $option + ;; + --libc=*) + [ -d "${optval}" ] || die "Not a directory: ${optval}" + disable_feature builtin_libc + alt_libc="${optval}" + ;; + --as=*) + [ "${optval}" = yasm ] || [ "${optval}" = nasm ] \ + || [ "${optval}" = auto ] \ + || die "Must be yasm, nasm or auto: ${optval}" + alt_as="${optval}" + ;; + --size-limit=*) + w="${optval%%x*}" + h="${optval##*x}" + VAR_LIST="DECODE_WIDTH_LIMIT ${w} DECODE_HEIGHT_LIMIT ${h}" + [ ${w} -gt 0 ] && [ ${h} -gt 0 ] || die "Invalid size-limit: too small." + [ ${w} -lt 65536 ] && [ ${h} -lt 65536 ] \ + || die "Invalid size-limit: too big." + enable_feature size_limit + ;; + --prefix=*) + prefix="${optval}" + ;; + --libdir=*) + libdir="${optval}" + ;; + --libc|--as|--prefix|--libdir) + die "Option ${opt} requires argument" + ;; + --help|-h) + show_help + ;; + *) + die_unknown $opt + ;; + esac + done +} + +process_cmdline() { + for opt do + optval="${opt#*=}" + case "$opt" in + *) + process_common_cmdline $opt + ;; + esac + done +} + +post_process_common_cmdline() { + prefix="${prefix:-/usr/local}" + prefix="${prefix%/}" + libdir="${libdir:-${prefix}/lib}" + libdir="${libdir%/}" + if [ "${libdir#${prefix}}" = "${libdir}" ]; then + die "Libdir ${libdir} must be a subdirectory of ${prefix}" + fi +} + +post_process_cmdline() { + true; +} + +setup_gnu_toolchain() { + CC=${CC:-${CROSS}gcc} + CXX=${CXX:-${CROSS}g++} + AR=${AR:-${CROSS}ar} + LD=${LD:-${CROSS}${link_with_cc:-ld}} + AS=${AS:-${CROSS}as} + STRIP=${STRIP:-${CROSS}strip} + NM=${NM:-${CROSS}nm} + AS_SFX=.S + EXE_SFX= +} + +# Reliably find the newest available Darwin SDKs. (Older versions of +# xcrun don't support --show-sdk-path.) +show_darwin_sdk_path() { + xcrun --sdk $1 --show-sdk-path 2>/dev/null || + xcodebuild -sdk $1 -version Path 2>/dev/null +} + +# Print the major version number of the Darwin SDK specified by $1. +show_darwin_sdk_major_version() { + xcrun --sdk $1 --show-sdk-version 2>/dev/null | cut -d. -f1 +} + +# Print the Xcode version. +show_xcode_version() { + xcodebuild -version | head -n1 | cut -d' ' -f2 +} + +# Fails when Xcode version is less than 6.3. +check_xcode_minimum_version() { + xcode_major=$(show_xcode_version | cut -f1 -d.) + xcode_minor=$(show_xcode_version | cut -f2 -d.) + xcode_min_major=6 + xcode_min_minor=3 + if [ ${xcode_major} -lt ${xcode_min_major} ]; then + return 1 + fi + if [ ${xcode_major} -eq ${xcode_min_major} ] \ + && [ ${xcode_minor} -lt ${xcode_min_minor} ]; then + return 1 + fi +} + +process_common_toolchain() { + if [ -z "$toolchain" ]; then + gcctarget="${CHOST:-$(gcc -dumpmachine 2> /dev/null)}" + # detect tgt_isa + case "$gcctarget" in + aarch64*) + tgt_isa=arm64 + ;; + armv7*-hardfloat* | armv7*-gnueabihf | arm-*-gnueabihf) + tgt_isa=armv7 + float_abi=hard + ;; + armv7*) + tgt_isa=armv7 + float_abi=softfp + ;; + *x86_64*|*amd64*) + tgt_isa=x86_64 + ;; + *i[3456]86*) + tgt_isa=x86 + ;; + *sparc*) + tgt_isa=sparc + ;; + power*64le*-*) + tgt_isa=ppc64le + ;; + *mips64el*) + tgt_isa=mips64 + ;; + *mips32el*) + tgt_isa=mips32 + ;; + esac + + # detect tgt_os + case "$gcctarget" in + *darwin1[0-9]*) + tgt_isa=x86_64 + tgt_os=`echo $gcctarget | sed 's/.*\(darwin1[0-9]\).*/\1/'` + ;; + x86_64*mingw32*) + tgt_os=win64 + ;; + x86_64*cygwin*) + tgt_os=win64 + ;; + *mingw32*|*cygwin*) + [ -z "$tgt_isa" ] && tgt_isa=x86 + tgt_os=win32 + ;; + *linux*|*bsd*) + tgt_os=linux + ;; + *solaris2.10) + tgt_os=solaris + ;; + *os2*) + tgt_os=os2 + ;; + esac + + if [ -n "$tgt_isa" ] && [ -n "$tgt_os" ]; then + toolchain=${tgt_isa}-${tgt_os}-gcc + fi + fi + + toolchain=${toolchain:-generic-gnu} + + is_in ${toolchain} ${all_platforms} || enabled force_toolchain \ + || die "Unrecognized toolchain '${toolchain}'" + + enabled child || log_echo "Configuring for target '${toolchain}'" + + # + # Set up toolchain variables + # + tgt_isa=$(echo ${toolchain} | awk 'BEGIN{FS="-"}{print $1}') + tgt_os=$(echo ${toolchain} | awk 'BEGIN{FS="-"}{print $2}') + tgt_cc=$(echo ${toolchain} | awk 'BEGIN{FS="-"}{print $3}') + + # Mark the specific ISA requested as enabled + soft_enable ${tgt_isa} + enable_feature ${tgt_os} + enable_feature ${tgt_cc} + + # Enable the architecture family + case ${tgt_isa} in + arm*) + enable_feature arm + ;; + mips*) + enable_feature mips + ;; + ppc*) + enable_feature ppc + ;; + esac + + # PIC is probably what we want when building shared libs + enabled shared && soft_enable pic + + # Minimum iOS version for all target platforms (darwin and iphonesimulator). + # Shared library framework builds are only possible on iOS 8 and later. + if enabled shared; then + IOS_VERSION_OPTIONS="--enable-shared" + else + IOS_VERSION_OPTIONS="" + fi + + # Handle darwin variants. Newer SDKs allow targeting older + # platforms, so use the newest one available. + case ${toolchain} in + arm*-darwin*) + iphoneos_sdk_dir="$(show_darwin_sdk_path iphoneos)" + ;; + x86*-darwin*) + osx_sdk_dir="$(show_darwin_sdk_path macosx)" + # if [ -d "${osx_sdk_dir}" ]; then + # add_cflags "-isysroot ${osx_sdk_dir}" + # add_ldflags "-isysroot ${osx_sdk_dir}" + # fi + ;; + esac + + case ${toolchain} in + *-darwin8-*) + add_cflags "-mmacosx-version-min=10.4" + add_ldflags "-mmacosx-version-min=10.4" + ;; + *-darwin9-*) + add_cflags "-mmacosx-version-min=10.5" + add_ldflags "-mmacosx-version-min=10.5" + ;; + *-darwin10-*) + add_cflags "-mmacosx-version-min=10.6" + add_ldflags "-mmacosx-version-min=10.6" + ;; + *-darwin11-*) + add_cflags "-mmacosx-version-min=10.7" + add_ldflags "-mmacosx-version-min=10.7" + ;; + *-darwin12-*) + add_cflags "-mmacosx-version-min=10.8" + add_ldflags "-mmacosx-version-min=10.8" + ;; + *-darwin13-*) + add_cflags "-mmacosx-version-min=10.9" + add_ldflags "-mmacosx-version-min=10.9" + ;; + *-darwin14-*) + add_cflags "-mmacosx-version-min=10.10" + add_ldflags "-mmacosx-version-min=10.10" + ;; + *-darwin15-*) + add_cflags "-mmacosx-version-min=10.11" + add_ldflags "-mmacosx-version-min=10.11" + ;; + *-darwin16-*) + add_cflags "-mmacosx-version-min=10.12" + add_ldflags "-mmacosx-version-min=10.12" + ;; + *-darwin17-*) + add_cflags "-mmacosx-version-min=10.13" + add_ldflags "-mmacosx-version-min=10.13" + ;; + *-darwin18-*) + add_cflags "-mmacosx-version-min=10.14" + add_ldflags "-mmacosx-version-min=10.14" + ;; + *-darwin19-*) + add_cflags "-mmacosx-version-min=10.15" + add_ldflags "-mmacosx-version-min=10.15" + ;; + esac + + # Handle Solaris variants. Solaris 10 needs -lposix4 + case ${toolchain} in + sparc-solaris-*) + add_extralibs -lposix4 + ;; + *-solaris-*) + add_extralibs -lposix4 + ;; + esac + + # Process ARM architecture variants + case ${toolchain} in + arm*) + # on arm, isa versions are supersets + case ${tgt_isa} in + arm64|armv8) + soft_enable neon + ;; + armv7|armv7s) + soft_enable neon + # Only enable neon_asm when neon is also enabled. + enabled neon && soft_enable neon_asm + # If someone tries to force it through, die. + if disabled neon && enabled neon_asm; then + die "Disabling neon while keeping neon-asm is not supported" + fi + ;; + esac + + asm_conversion_cmd="cat" + + case ${tgt_cc} in + gcc) + link_with_cc=gcc + setup_gnu_toolchain + arch_int=${tgt_isa##armv} + arch_int=${arch_int%%te} + tune_cflags="-mtune=" + + if [ ${tgt_isa} = "armv7" ] || [ ${tgt_isa} = "armv7s" ]; then + if enabled neon || enabled neon_asm; then + check_add_cflags -mfpu=neon #-ftree-vectorize + check_add_asflags -mfpu=neon + fi + elif [ ${tgt_isa} = "arm64" ] || [ ${tgt_isa} = "armv8" ]; then + check_add_cflags -march=armv8-a + check_add_asflags -march=armv8-a + else + check_add_cflags -march=${tgt_isa} + check_add_asflags -march=${tgt_isa} + fi + + enabled debug && add_asflags -g + asm_conversion_cmd="${source_path}/build/make/ads2gas.pl" + + case ${tgt_os} in + win*) + asm_conversion_cmd="$asm_conversion_cmd -noelf" + AS="$CC -c" + EXE_SFX=.exe + enable_feature thumb + ;; + esac + + if enabled thumb; then + asm_conversion_cmd="$asm_conversion_cmd -thumb" + check_add_cflags -mthumb + check_add_asflags -mthumb -mimplicit-it=always + fi + ;; + vs*) + # A number of ARM-based Windows platforms are constrained by their + # respective SDKs' limitations. Fortunately, these are all 32-bit ABIs + # and so can be selected as 'win32'. + if [ ${tgt_os} = "win32" ]; then + asm_conversion_cmd="${source_path}/build/make/ads2armasm_ms.pl" + AS_SFX=.S + msvs_arch_dir=arm-msvs + disable_feature multithread + disable_feature unit_tests + if [ ${tgt_cc##vs} -ge 12 ]; then + # MSVC 2013 doesn't allow doing plain .exe projects for ARM32, + # only "AppContainerApplication" which requires an AppxManifest. + # Therefore disable the examples, just build the library. + disable_feature examples + disable_feature tools + fi + else + # Windows 10 on ARM, on the other hand, has full Windows SDK support + # for building Win32 ARM64 applications in addition to ARM64 + # Windows Store apps. It is the only 64-bit ARM ABI that + # Windows supports, so it is the default definition of 'win64'. + # ARM64 build support officially shipped in Visual Studio 15.9.0. + + # Because the ARM64 Windows SDK's arm_neon.h is ARM32-specific + # while LLVM's is not, probe its validity. + if enabled neon; then + if [ -n "${CC}" ]; then + check_header arm_neon.h || check_header arm64_neon.h && \ + enable_feature win_arm64_neon_h_workaround + else + # If a probe is not possible, assume this is the pure Windows + # SDK and so the workaround is necessary. + enable_feature win_arm64_neon_h_workaround + fi + fi + fi + ;; + rvct) + CC=armcc + AR=armar + AS=armasm + LD="${source_path}/build/make/armlink_adapter.sh" + STRIP=arm-none-linux-gnueabi-strip + NM=arm-none-linux-gnueabi-nm + tune_cflags="--cpu=" + tune_asflags="--cpu=" + if [ -z "${tune_cpu}" ]; then + if [ ${tgt_isa} = "armv7" ]; then + if enabled neon || enabled neon_asm + then + check_add_cflags --fpu=softvfp+vfpv3 + check_add_asflags --fpu=softvfp+vfpv3 + fi + check_add_cflags --cpu=Cortex-A8 + check_add_asflags --cpu=Cortex-A8 + else + check_add_cflags --cpu=${tgt_isa##armv} + check_add_asflags --cpu=${tgt_isa##armv} + fi + fi + arch_int=${tgt_isa##armv} + arch_int=${arch_int%%te} + enabled debug && add_asflags -g + add_cflags --gnu + add_cflags --enum_is_int + add_cflags --wchar32 + ;; + esac + + case ${tgt_os} in + none*) + disable_feature multithread + disable_feature os_support + ;; + + android*) + echo "Assuming standalone build with NDK toolchain." + echo "See build/make/Android.mk for details." + check_add_ldflags -static + soft_enable unit_tests + ;; + + darwin*) + if ! enabled external_build; then + XCRUN_FIND="xcrun --sdk iphoneos --find" + CXX="$(${XCRUN_FIND} clang++)" + CC="$(${XCRUN_FIND} clang)" + AR="$(${XCRUN_FIND} ar)" + AS="$(${XCRUN_FIND} as)" + STRIP="$(${XCRUN_FIND} strip)" + NM="$(${XCRUN_FIND} nm)" + RANLIB="$(${XCRUN_FIND} ranlib)" + AS_SFX=.S + LD="${CXX:-$(${XCRUN_FIND} ld)}" + + # ASFLAGS is written here instead of using check_add_asflags + # because we need to overwrite all of ASFLAGS and purge the + # options that were put in above + ASFLAGS="-arch ${tgt_isa} -g" + + # add_cflags -arch ${tgt_isa} + # add_ldflags -arch ${tgt_isa} + + alt_libc="$(show_darwin_sdk_path iphoneos)" + # if [ -d "${alt_libc}" ]; then + # add_cflags -isysroot ${alt_libc} + # fi + + for d in lib usr/lib usr/lib/system; do + try_dir="${alt_libc}/${d}" + [ -d "${try_dir}" ] && add_ldflags -L"${try_dir}" + done + + case ${tgt_isa} in + armv7|armv7s|armv8|arm64) + if enabled neon && ! check_xcode_minimum_version; then + soft_disable neon + log_echo " neon disabled: upgrade Xcode (need v6.3+)." + if enabled neon_asm; then + soft_disable neon_asm + log_echo " neon_asm disabled: upgrade Xcode (need v6.3+)." + fi + fi + ;; + esac + + if [ "$(show_darwin_sdk_major_version iphoneos)" -gt 8 ]; then + check_add_cflags -fembed-bitcode + check_add_asflags -fembed-bitcode + check_add_ldflags -fembed-bitcode + fi + fi + + asm_conversion_cmd="${source_path}/build/make/ads2gas_apple.pl" + ;; + + linux*) + enable_feature linux + if enabled rvct; then + # Check if we have CodeSourcery GCC in PATH. Needed for + # libraries + which arm-none-linux-gnueabi-gcc 2>&- || \ + die "Couldn't find CodeSourcery GCC from PATH" + + # Use armcc as a linker to enable translation of + # some gcc specific options such as -lm and -lpthread. + LD="armcc --translate_gcc" + + # create configuration file (uses path to CodeSourcery GCC) + armcc --arm_linux_configure --arm_linux_config_file=arm_linux.cfg + + add_cflags --arm_linux_paths --arm_linux_config_file=arm_linux.cfg + add_asflags --no_hide_all --apcs=/interwork + add_ldflags --arm_linux_paths --arm_linux_config_file=arm_linux.cfg + enabled pic && add_cflags --apcs=/fpic + enabled pic && add_asflags --apcs=/fpic + enabled shared && add_cflags --shared + fi + ;; + esac + ;; + mips*) + link_with_cc=gcc + setup_gnu_toolchain + tune_cflags="-mtune=" + if enabled dspr2; then + check_add_cflags -mips32r2 -mdspr2 + fi + + if enabled runtime_cpu_detect; then + disable_feature runtime_cpu_detect + fi + + if [ -n "${tune_cpu}" ]; then + case ${tune_cpu} in + p5600) + check_add_cflags -mips32r5 -mload-store-pairs + check_add_cflags -msched-weight -mhard-float -mfp64 + check_add_asflags -mips32r5 -mhard-float -mfp64 + check_add_ldflags -mfp64 + ;; + i6400|p6600) + check_add_cflags -mips64r6 -mabi=64 -msched-weight + check_add_cflags -mload-store-pairs -mhard-float -mfp64 + check_add_asflags -mips64r6 -mabi=64 -mhard-float -mfp64 + check_add_ldflags -mips64r6 -mabi=64 -mfp64 + ;; + esac + + if enabled msa; then + # TODO(libyuv:793) + # The new mips functions in libyuv do not build + # with the toolchains we currently use for testing. + soft_disable libyuv + + add_cflags -mmsa + add_asflags -mmsa + add_ldflags -mmsa + fi + fi + + if enabled mmi; then + tgt_isa=loongson3a + check_add_ldflags -march=loongson3a + fi + + check_add_asflags -KPIC + ;; + ppc64le*) + link_with_cc=gcc + setup_gnu_toolchain + # Do not enable vsx by default. + # https://bugs.chromium.org/p/webm/issues/detail?id=1522 + enabled vsx || RTCD_OPTIONS="${RTCD_OPTIONS}--disable-vsx " + if [ -n "${tune_cpu}" ]; then + case ${tune_cpu} in + power?) + tune_cflags="-mcpu=" + ;; + esac + fi + ;; + x86*) + case ${tgt_os} in + android) + soft_enable realtime_only + ;; + win*) + enabled gcc && add_cflags -fno-common + ;; + solaris*) + CC=${CC:-${CROSS}gcc} + CXX=${CXX:-${CROSS}g++} + LD=${LD:-${CROSS}gcc} + CROSS=${CROSS-g} + ;; + os2) + disable_feature pic + AS=${AS:-nasm} + add_ldflags -Zhigh-mem + ;; + esac + + AS="${alt_as:-${AS:-auto}}" + case ${tgt_cc} in + icc*) + CC=${CC:-icc} + LD=${LD:-icc} + setup_gnu_toolchain + add_cflags -use-msasm # remove -use-msasm too? + # add -no-intel-extensions to suppress warning #10237 + # refer to http://software.intel.com/en-us/forums/topic/280199 + add_ldflags -i-static -no-intel-extensions + enabled x86_64 && add_cflags -ipo -static -O3 -no-prec-div + enabled x86_64 && AR=xiar + case ${tune_cpu} in + atom*) + tune_cflags="-x" + tune_cpu="SSE3_ATOM" + ;; + esac + ;; + gcc*) + link_with_cc=gcc + setup_gnu_toolchain + #for 32 bit x86 builds, -O3 did not turn on this flag + enabled optimizations && disabled gprof && check_add_cflags -fomit-frame-pointer + ;; + vs*) + # When building with Microsoft Visual Studio the assembler is + # invoked directly. Checking at configure time is unnecessary. + # Skip the check by setting AS arbitrarily + AS=msvs + msvs_arch_dir=x86-msvs + case ${tgt_cc##vs} in + 14) + echo "${tgt_cc} does not support avx512, disabling....." + RTCD_OPTIONS="${RTCD_OPTIONS}--disable-avx512 " + soft_disable avx512 + ;; + esac + ;; + esac + + bits=32 + enabled x86_64 && bits=64 + check_cpp < sse4 + check_gcc_machine_option ${ext%_*} $ext + fi + fi + done + + if enabled external_build; then + log_echo " skipping assembler detection" + else + case "${AS}" in + auto|"") + which nasm >/dev/null 2>&1 && AS=nasm + which yasm >/dev/null 2>&1 && AS=yasm + if [ "${AS}" = nasm ] ; then + # Apple ships version 0.98 of nasm through at least Xcode 6. Revisit + # this check if they start shipping a compatible version. + apple=`nasm -v | grep "Apple"` + [ -n "${apple}" ] \ + && echo "Unsupported version of nasm: ${apple}" \ + && AS="" + fi + [ "${AS}" = auto ] || [ -z "${AS}" ] \ + && die "Neither yasm nor nasm have been found." \ + "See the prerequisites section in the README for more info." + ;; + esac + log_echo " using $AS" + fi + AS_SFX=.asm + case ${tgt_os} in + win32) + add_asflags -f win32 + enabled debug && add_asflags -g cv8 + EXE_SFX=.exe + ;; + win64) + add_asflags -f win64 + enabled debug && add_asflags -g cv8 + EXE_SFX=.exe + ;; + linux*|solaris*|android*) + add_asflags -f elf${bits} + enabled debug && [ "${AS}" = yasm ] && add_asflags -g dwarf2 + enabled debug && [ "${AS}" = nasm ] && add_asflags -g + [ "${AS##*/}" = nasm ] && check_asm_align + ;; + darwin*) + add_asflags -f macho${bits} + enabled icc && ! enabled pic && add_cflags -fno-pic + ;; + iphonesimulator) + add_asflags -f macho${bits} + ;; + os2) + add_asflags -f aout + enabled debug && add_asflags -g + EXE_SFX=.exe + ;; + *) + log "Warning: Unknown os $tgt_os while setting up $AS flags" + ;; + esac + ;; + *-gcc|generic-gnu) + link_with_cc=gcc + enable_feature gcc + setup_gnu_toolchain + ;; + esac + + # Try to enable CPU specific tuning + if [ -n "${tune_cpu}" ]; then + if [ -n "${tune_cflags}" ]; then + check_add_cflags ${tune_cflags}${tune_cpu} || \ + die "Requested CPU '${tune_cpu}' not supported by compiler" + fi + if [ -n "${tune_asflags}" ]; then + check_add_asflags ${tune_asflags}${tune_cpu} || \ + die "Requested CPU '${tune_cpu}' not supported by assembler" + fi + if [ -z "${tune_cflags}${tune_asflags}" ]; then + log_echo "Warning: CPU tuning not supported by this toolchain" + fi + fi + + if enabled debug; then + check_add_cflags -g && check_add_ldflags -g + else + check_add_cflags -DNDEBUG + fi + + enabled gprof && check_add_cflags -pg && check_add_ldflags -pg + enabled gcov && + check_add_cflags -fprofile-arcs -ftest-coverage && + check_add_ldflags -fprofile-arcs -ftest-coverage + + if enabled optimizations; then + if enabled rvct; then + enabled small && check_add_cflags -Ospace || check_add_cflags -Otime + else + enabled small && check_add_cflags -O2 || check_add_cflags -O3 + fi + fi + + # Position Independent Code (PIC) support, for building relocatable + # shared objects + enabled gcc && enabled pic && check_add_cflags -fPIC + + # Work around longjmp interception on glibc >= 2.11, to improve binary + # compatibility. See http://code.google.com/p/webm/issues/detail?id=166 + enabled linux && check_add_cflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 + + # Check for strip utility variant + ${STRIP} -V 2>/dev/null | grep GNU >/dev/null && enable_feature gnu_strip + + # Try to determine target endianness + check_cc </dev/null 2>&1 && enable_feature big_endian + + # Try to find which inline keywords are supported + check_cc < +#include +int main(void) { return pthread_create(NULL, NULL, NULL, NULL); } +EOF + ;; + esac + fi + + # only for MIPS platforms + case ${toolchain} in + mips*) + if enabled big_endian; then + if enabled dspr2; then + echo "dspr2 optimizations are available only for little endian platforms" + disable_feature dspr2 + fi + if enabled msa; then + echo "msa optimizations are available only for little endian platforms" + disable_feature msa + fi + if enabled mmi; then + echo "mmi optimizations are available only for little endian platforms" + disable_feature mmi + fi + fi + ;; + esac + + # glibc needs these + if enabled linux; then + add_cflags -D_LARGEFILE_SOURCE + add_cflags -D_FILE_OFFSET_BITS=64 + fi +} + +process_toolchain() { + process_common_toolchain +} + +print_config_mk() { + saved_prefix="${prefix}" + prefix=$1 + makefile=$2 + shift 2 + for cfg; do + if enabled $cfg; then + upname="`toupper $cfg`" + echo "${prefix}_${upname}=yes" >> $makefile + fi + done + prefix="${saved_prefix}" +} + +print_config_h() { + saved_prefix="${prefix}" + prefix=$1 + header=$2 + shift 2 + for cfg; do + upname="`toupper $cfg`" + if enabled $cfg; then + echo "#define ${prefix}_${upname} 1" >> $header + else + echo "#define ${prefix}_${upname} 0" >> $header + fi + done + prefix="${saved_prefix}" +} + +print_config_vars_h() { + header=$1 + shift + while [ $# -gt 0 ]; do + upname="`toupper $1`" + echo "#define ${upname} $2" >> $header + shift 2 + done +} + +print_webm_license() { + saved_prefix="${prefix}" + destination=$1 + prefix="$2" + suffix="$3" + shift 3 + cat < ${destination} +${prefix} Copyright (c) 2011 The WebM project authors. All Rights Reserved.${suffix} +${prefix} ${suffix} +${prefix} Use of this source code is governed by a BSD-style license${suffix} +${prefix} that can be found in the LICENSE file in the root of the source${suffix} +${prefix} tree. An additional intellectual property rights grant can be found${suffix} +${prefix} in the file PATENTS. All contributing project authors may${suffix} +${prefix} be found in the AUTHORS file in the root of the source tree.${suffix} +EOF + prefix="${saved_prefix}" +} + +process_targets() { + true; +} + +process_detect() { + true; +} + +enable_feature logging +logfile="config.log" +self=$0 +process() { + cmdline_args="$@" + process_cmdline "$@" + if enabled child; then + echo "# ${self} $@" >> ${logfile} + else + echo "# ${self} $@" > ${logfile} + fi + post_process_common_cmdline + post_process_cmdline + process_toolchain + process_detect + process_targets + + OOT_INSTALLS="${OOT_INSTALLS}" + if enabled source_path_used; then + # Prepare the PWD for building. + for f in ${OOT_INSTALLS}; do + install -D "${source_path}/$f" "$f" + done + fi + cp "${source_path}/build/make/Makefile" . + + clean_temp_files + true +} diff --git a/tools/patch/make/libvpx/configure.x86_64_mac_catalyst.sh b/tools/patch/make/libvpx/configure.x86_64_mac_catalyst.sh new file mode 100644 index 0000000..f788a28 --- /dev/null +++ b/tools/patch/make/libvpx/configure.x86_64_mac_catalyst.sh @@ -0,0 +1,1547 @@ +#!/bin/sh +## +## configure.sh +## +## This script is sourced by the main configure script and contains +## utility functions and other common bits that aren't strictly libvpx +## related. +## +## This build system is based in part on the FFmpeg configure script. +## + + +# +# Logging / Output Functions +# +die_unknown(){ + echo "Unknown option \"$1\"." + echo "See $0 --help for available options." + clean_temp_files + exit 1 +} + +die() { + echo "$@" + echo + echo "Configuration failed. This could reflect a misconfiguration of your" + echo "toolchains, improper options selected, or another problem. If you" + echo "don't see any useful error messages above, the next step is to look" + echo "at the configure error log file ($logfile) to determine what" + echo "configure was trying to do when it died." + clean_temp_files + exit 1 +} + +log(){ + echo "$@" >>$logfile +} + +log_file(){ + log BEGIN $1 + cat -n $1 >>$logfile + log END $1 +} + +log_echo() { + echo "$@" + log "$@" +} + +fwrite () { + outfile=$1 + shift + echo "$@" >> ${outfile} +} + +show_help_pre(){ + for opt in ${CMDLINE_SELECT}; do + opt2=`echo $opt | sed -e 's;_;-;g'` + if enabled $opt; then + eval "toggle_${opt}=\"--disable-${opt2}\"" + else + eval "toggle_${opt}=\"--enable-${opt2} \"" + fi + done + + cat <>${logfile} 2>&1 +} + +check_cc() { + log check_cc "$@" + cat >${TMP_C} + log_file ${TMP_C} + check_cmd ${CC} ${CFLAGS} "$@" -c -o ${TMP_O} ${TMP_C} +} + +check_cxx() { + log check_cxx "$@" + cat >${TMP_CC} + log_file ${TMP_CC} + check_cmd ${CXX} ${CXXFLAGS} "$@" -c -o ${TMP_O} ${TMP_CC} +} + +check_cpp() { + log check_cpp "$@" + cat > ${TMP_C} + log_file ${TMP_C} + check_cmd ${CC} ${CFLAGS} "$@" -E -o ${TMP_O} ${TMP_C} +} + +check_ld() { + log check_ld "$@" + check_cc $@ \ + && check_cmd ${LD} ${LDFLAGS} "$@" -o ${TMP_X} ${TMP_O} ${extralibs} +} + +check_lib() { + log check_lib "$@" + check_cc $@ \ + && check_cmd ${LD} ${LDFLAGS} -o ${TMP_X} ${TMP_O} "$@" ${extralibs} +} + +check_header(){ + log check_header "$@" + header=$1 + shift + var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'` + disable_feature $var + check_cpp "$@" <${TMP_ASM} <${TMP_X} + log_file ${TMP_X} + if ! grep -q '\.rodata .* 16$' ${TMP_X}; then + die "${AS} ${ASFLAGS} does not support section alignment (nasm <=2.08?)" + fi +} + +# tests for -m$1 toggling the feature given in $2. If $2 is empty $1 is used. +check_gcc_machine_option() { + opt="$1" + feature="$2" + [ -n "$feature" ] || feature="$opt" + + if enabled gcc && ! disabled "$feature" && ! check_cflags "-m$opt"; then + RTCD_OPTIONS="${RTCD_OPTIONS}--disable-$feature " + else + soft_enable "$feature" + fi +} + +# tests for -m$2, -m$3, -m$4... toggling the feature given in $1. +check_gcc_machine_options() { + feature="$1" + shift + flags="-m$1" + shift + for opt in $*; do + flags="$flags -m$opt" + done + + if enabled gcc && ! disabled "$feature" && ! check_cflags $flags; then + RTCD_OPTIONS="${RTCD_OPTIONS}--disable-$feature " + else + soft_enable "$feature" + fi +} + +check_gcc_avx512_compiles() { + if disabled gcc; then + return + fi + + check_cc -mavx512f < +void f(void) { + __m512i x = _mm512_set1_epi16(0); + (void)x; +} +EOF + compile_result=$? + if [ ${compile_result} -ne 0 ]; then + log_echo " disabling avx512: not supported by compiler" + disable_feature avx512 + RTCD_OPTIONS="${RTCD_OPTIONS}--disable-avx512 " + fi +} + +write_common_config_banner() { + print_webm_license config.mk "##" "" + echo '# This file automatically generated by configure. Do not edit!' >> config.mk + echo "TOOLCHAIN := ${toolchain}" >> config.mk + + case ${toolchain} in + *-linux-rvct) + echo "ALT_LIBC := ${alt_libc}" >> config.mk + ;; + esac +} + +write_common_config_targets() { + for t in ${all_targets}; do + if enabled ${t}; then + if enabled child; then + fwrite config.mk "ALL_TARGETS += ${t}-${toolchain}" + else + fwrite config.mk "ALL_TARGETS += ${t}" + fi + fi + true; + done + true +} + +write_common_target_config_mk() { + saved_CC="${CC}" + saved_CXX="${CXX}" + enabled ccache && CC="ccache ${CC}" + enabled ccache && CXX="ccache ${CXX}" + print_webm_license $1 "##" "" + + cat >> $1 << EOF +# This file automatically generated by configure. Do not edit! +SRC_PATH="$source_path" +SRC_PATH_BARE=$source_path +BUILD_PFX=${BUILD_PFX} +TOOLCHAIN=${toolchain} +ASM_CONVERSION=${asm_conversion_cmd:-${source_path}/build/make/ads2gas.pl} +GEN_VCPROJ=${gen_vcproj_cmd} +MSVS_ARCH_DIR=${msvs_arch_dir} + +CC=${CC} +CXX=${CXX} +AR=${AR} +LD=${LD} +AS=${AS} +STRIP=${STRIP} +NM=${NM} + +CFLAGS = ${CFLAGS} +CXXFLAGS = ${CXXFLAGS} +ARFLAGS = -crs\$(if \$(quiet),,v) +LDFLAGS = ${LDFLAGS} +ASFLAGS = ${ASFLAGS} +extralibs = ${extralibs} +AS_SFX = ${AS_SFX:-.asm} +EXE_SFX = ${EXE_SFX} +VCPROJ_SFX = ${VCPROJ_SFX} +RTCD_OPTIONS = ${RTCD_OPTIONS} +LIBYUV_CXXFLAGS = ${LIBYUV_CXXFLAGS} +EOF + + if enabled rvct; then cat >> $1 << EOF +fmt_deps = sed -e 's;^__image.axf;\${@:.d=.o} \$@;' #hide +EOF + else cat >> $1 << EOF +fmt_deps = sed -e 's;^\([a-zA-Z0-9_]*\)\.o;\${@:.d=.o} \$@;' +EOF + fi + + print_config_mk VPX_ARCH "${1}" ${ARCH_LIST} + print_config_mk HAVE "${1}" ${HAVE_LIST} + print_config_mk CONFIG "${1}" ${CONFIG_LIST} + print_config_mk HAVE "${1}" gnu_strip + + enabled msvs && echo "CONFIG_VS_VERSION=${vs_version}" >> "${1}" + + CC="${saved_CC}" + CXX="${saved_CXX}" +} + +write_common_target_config_h() { + print_webm_license ${TMP_H} "/*" " */" + cat >> ${TMP_H} << EOF +/* This file automatically generated by configure. Do not edit! */ +#ifndef VPX_CONFIG_H +#define VPX_CONFIG_H +#define RESTRICT ${RESTRICT} +#define INLINE ${INLINE} +EOF + print_config_h VPX_ARCH "${TMP_H}" ${ARCH_LIST} + print_config_h HAVE "${TMP_H}" ${HAVE_LIST} + print_config_h CONFIG "${TMP_H}" ${CONFIG_LIST} + print_config_vars_h "${TMP_H}" ${VAR_LIST} + echo "#endif /* VPX_CONFIG_H */" >> ${TMP_H} + mkdir -p `dirname "$1"` + cmp "$1" ${TMP_H} >/dev/null 2>&1 || mv ${TMP_H} "$1" +} + +write_win_arm64_neon_h_workaround() { + print_webm_license ${TMP_H} "/*" " */" + cat >> ${TMP_H} << EOF +/* This file automatically generated by configure. Do not edit! */ +#ifndef VPX_WIN_ARM_NEON_H_WORKAROUND +#define VPX_WIN_ARM_NEON_H_WORKAROUND +/* The Windows SDK has arm_neon.h, but unlike on other platforms it is + * ARM32-only. ARM64 NEON support is provided by arm64_neon.h, a proper + * superset of arm_neon.h. Work around this by providing a more local + * arm_neon.h that simply #includes arm64_neon.h. + */ +#include +#endif /* VPX_WIN_ARM_NEON_H_WORKAROUND */ +EOF + mkdir -p `dirname "$1"` + cmp "$1" ${TMP_H} >/dev/null 2>&1 || mv ${TMP_H} "$1" +} + +process_common_cmdline() { + for opt in "$@"; do + optval="${opt#*=}" + case "$opt" in + --child) + enable_feature child + ;; + --log*) + logging="$optval" + if ! disabled logging ; then + enabled logging || logfile="$logging" + else + logfile=/dev/null + fi + ;; + --target=*) + toolchain="${toolchain:-${optval}}" + ;; + --force-target=*) + toolchain="${toolchain:-${optval}}" + enable_feature force_toolchain + ;; + --cpu=*) + tune_cpu="$optval" + ;; + --extra-cflags=*) + extra_cflags="${optval}" + ;; + --extra-cxxflags=*) + extra_cxxflags="${optval}" + ;; + --enable-?*|--disable-?*) + eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'` + if is_in ${option} ${ARCH_EXT_LIST}; then + [ $action = "disable" ] && RTCD_OPTIONS="${RTCD_OPTIONS}--disable-${option} " + elif [ $action = "disable" ] && ! disabled $option ; then + is_in ${option} ${CMDLINE_SELECT} || die_unknown $opt + log_echo " disabling $option" + elif [ $action = "enable" ] && ! enabled $option ; then + is_in ${option} ${CMDLINE_SELECT} || die_unknown $opt + log_echo " enabling $option" + fi + ${action}_feature $option + ;; + --require-?*) + eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'` + if is_in ${option} ${ARCH_EXT_LIST}; then + RTCD_OPTIONS="${RTCD_OPTIONS}${opt} " + else + die_unknown $opt + fi + ;; + --force-enable-?*|--force-disable-?*) + eval `echo "$opt" | sed 's/--force-/action=/;s/-/ option=/;s/-/_/g'` + ${action}_feature $option + ;; + --libc=*) + [ -d "${optval}" ] || die "Not a directory: ${optval}" + disable_feature builtin_libc + alt_libc="${optval}" + ;; + --as=*) + [ "${optval}" = yasm ] || [ "${optval}" = nasm ] \ + || [ "${optval}" = auto ] \ + || die "Must be yasm, nasm or auto: ${optval}" + alt_as="${optval}" + ;; + --size-limit=*) + w="${optval%%x*}" + h="${optval##*x}" + VAR_LIST="DECODE_WIDTH_LIMIT ${w} DECODE_HEIGHT_LIMIT ${h}" + [ ${w} -gt 0 ] && [ ${h} -gt 0 ] || die "Invalid size-limit: too small." + [ ${w} -lt 65536 ] && [ ${h} -lt 65536 ] \ + || die "Invalid size-limit: too big." + enable_feature size_limit + ;; + --prefix=*) + prefix="${optval}" + ;; + --libdir=*) + libdir="${optval}" + ;; + --libc|--as|--prefix|--libdir) + die "Option ${opt} requires argument" + ;; + --help|-h) + show_help + ;; + *) + die_unknown $opt + ;; + esac + done +} + +process_cmdline() { + for opt do + optval="${opt#*=}" + case "$opt" in + *) + process_common_cmdline $opt + ;; + esac + done +} + +post_process_common_cmdline() { + prefix="${prefix:-/usr/local}" + prefix="${prefix%/}" + libdir="${libdir:-${prefix}/lib}" + libdir="${libdir%/}" + if [ "${libdir#${prefix}}" = "${libdir}" ]; then + die "Libdir ${libdir} must be a subdirectory of ${prefix}" + fi +} + +post_process_cmdline() { + true; +} + +setup_gnu_toolchain() { + CC=${CC:-${CROSS}gcc} + CXX=${CXX:-${CROSS}g++} + AR=${AR:-${CROSS}ar} + LD=${LD:-${CROSS}${link_with_cc:-ld}} + AS=${AS:-${CROSS}as} + STRIP=${STRIP:-${CROSS}strip} + NM=${NM:-${CROSS}nm} + AS_SFX=.S + EXE_SFX= +} + +# Reliably find the newest available Darwin SDKs. (Older versions of +# xcrun don't support --show-sdk-path.) +show_darwin_sdk_path() { + xcrun --sdk $1 --show-sdk-path 2>/dev/null || + xcodebuild -sdk $1 -version Path 2>/dev/null +} + +# Print the major version number of the Darwin SDK specified by $1. +show_darwin_sdk_major_version() { + xcrun --sdk $1 --show-sdk-version 2>/dev/null | cut -d. -f1 +} + +# Print the Xcode version. +show_xcode_version() { + xcodebuild -version | head -n1 | cut -d' ' -f2 +} + +# Fails when Xcode version is less than 6.3. +check_xcode_minimum_version() { + xcode_major=$(show_xcode_version | cut -f1 -d.) + xcode_minor=$(show_xcode_version | cut -f2 -d.) + xcode_min_major=6 + xcode_min_minor=3 + if [ ${xcode_major} -lt ${xcode_min_major} ]; then + return 1 + fi + if [ ${xcode_major} -eq ${xcode_min_major} ] \ + && [ ${xcode_minor} -lt ${xcode_min_minor} ]; then + return 1 + fi +} + +process_common_toolchain() { + if [ -z "$toolchain" ]; then + gcctarget="${CHOST:-$(gcc -dumpmachine 2> /dev/null)}" + # detect tgt_isa + case "$gcctarget" in + aarch64*) + tgt_isa=arm64 + ;; + armv7*-hardfloat* | armv7*-gnueabihf | arm-*-gnueabihf) + tgt_isa=armv7 + float_abi=hard + ;; + armv7*) + tgt_isa=armv7 + float_abi=softfp + ;; + *x86_64*|*amd64*) + tgt_isa=x86_64 + ;; + *i[3456]86*) + tgt_isa=x86 + ;; + *sparc*) + tgt_isa=sparc + ;; + power*64le*-*) + tgt_isa=ppc64le + ;; + *mips64el*) + tgt_isa=mips64 + ;; + *mips32el*) + tgt_isa=mips32 + ;; + esac + + # detect tgt_os + case "$gcctarget" in + *darwin1[0-9]*) + tgt_isa=x86_64 + tgt_os=`echo $gcctarget | sed 's/.*\(darwin1[0-9]\).*/\1/'` + ;; + x86_64*mingw32*) + tgt_os=win64 + ;; + x86_64*cygwin*) + tgt_os=win64 + ;; + *mingw32*|*cygwin*) + [ -z "$tgt_isa" ] && tgt_isa=x86 + tgt_os=win32 + ;; + *linux*|*bsd*) + tgt_os=linux + ;; + *solaris2.10) + tgt_os=solaris + ;; + *os2*) + tgt_os=os2 + ;; + esac + + if [ -n "$tgt_isa" ] && [ -n "$tgt_os" ]; then + toolchain=${tgt_isa}-${tgt_os}-gcc + fi + fi + + toolchain=${toolchain:-generic-gnu} + + all_platforms="${all_platforms} x86_64-macosx-gcc" + + is_in ${toolchain} ${all_platforms} || enabled force_toolchain \ + || die "Unrecognized toolchain '${toolchain}'" + + enabled child || log_echo "Configuring for target '${toolchain}'" + + # + # Set up toolchain variables + # + tgt_isa=$(echo ${toolchain} | awk 'BEGIN{FS="-"}{print $1}') + tgt_os=$(echo ${toolchain} | awk 'BEGIN{FS="-"}{print $2}') + tgt_cc=$(echo ${toolchain} | awk 'BEGIN{FS="-"}{print $3}') + + # Mark the specific ISA requested as enabled + soft_enable ${tgt_isa} + enable_feature ${tgt_os} + enable_feature ${tgt_cc} + + # Enable the architecture family + case ${tgt_isa} in + arm*) + enable_feature arm + ;; + mips*) + enable_feature mips + ;; + ppc*) + enable_feature ppc + ;; + esac + + # PIC is probably what we want when building shared libs + enabled shared && soft_enable pic + + # Minimum iOS version for all target platforms (darwin and iphonesimulator). + # Shared library framework builds are only possible on iOS 8 and later. + if enabled shared; then + IOS_VERSION_OPTIONS="--enable-shared" + else + IOS_VERSION_OPTIONS="" + fi + + # Handle darwin variants. Newer SDKs allow targeting older + # platforms, so use the newest one available. + case ${toolchain} in + arm*-darwin*) + iphoneos_sdk_dir="$(show_darwin_sdk_path iphoneos)" + ;; + x86*-darwin*) + osx_sdk_dir="$(show_darwin_sdk_path macosx)" + if [ -d "${osx_sdk_dir}" ]; then + add_cflags "-isysroot ${osx_sdk_dir}" + add_ldflags "-isysroot ${osx_sdk_dir}" + fi + ;; + esac + + case ${toolchain} in + *-darwin8-*) + add_cflags "-mmacosx-version-min=10.4" + add_ldflags "-mmacosx-version-min=10.4" + ;; + *-darwin9-*) + add_cflags "-mmacosx-version-min=10.5" + add_ldflags "-mmacosx-version-min=10.5" + ;; + *-darwin10-*) + add_cflags "-mmacosx-version-min=10.6" + add_ldflags "-mmacosx-version-min=10.6" + ;; + *-darwin11-*) + add_cflags "-mmacosx-version-min=10.7" + add_ldflags "-mmacosx-version-min=10.7" + ;; + *-darwin12-*) + add_cflags "-mmacosx-version-min=10.8" + add_ldflags "-mmacosx-version-min=10.8" + ;; + *-darwin13-*) + add_cflags "-mmacosx-version-min=10.9" + add_ldflags "-mmacosx-version-min=10.9" + ;; + *-darwin14-*) + add_cflags "-mmacosx-version-min=10.10" + add_ldflags "-mmacosx-version-min=10.10" + ;; + *-darwin15-*) + add_cflags "-mmacosx-version-min=10.11" + add_ldflags "-mmacosx-version-min=10.11" + ;; + *-darwin16-*) + add_cflags "-mmacosx-version-min=10.12" + add_ldflags "-mmacosx-version-min=10.12" + ;; + *-darwin17-*) + add_cflags "-mmacosx-version-min=10.13" + add_ldflags "-mmacosx-version-min=10.13" + ;; + *-darwin18-*) + add_cflags "-mmacosx-version-min=10.14" + add_ldflags "-mmacosx-version-min=10.14" + ;; + *-darwin19-*) + add_cflags "-mmacosx-version-min=10.15" + add_ldflags "-mmacosx-version-min=10.15" + ;; + esac + + # Handle Solaris variants. Solaris 10 needs -lposix4 + case ${toolchain} in + sparc-solaris-*) + add_extralibs -lposix4 + ;; + *-solaris-*) + add_extralibs -lposix4 + ;; + esac + + # Process ARM architecture variants + case ${toolchain} in + arm*) + # on arm, isa versions are supersets + case ${tgt_isa} in + arm64|armv8) + soft_enable neon + ;; + armv7|armv7s) + soft_enable neon + # Only enable neon_asm when neon is also enabled. + enabled neon && soft_enable neon_asm + # If someone tries to force it through, die. + if disabled neon && enabled neon_asm; then + die "Disabling neon while keeping neon-asm is not supported" + fi + ;; + esac + + asm_conversion_cmd="cat" + + case ${tgt_cc} in + gcc) + link_with_cc=gcc + setup_gnu_toolchain + arch_int=${tgt_isa##armv} + arch_int=${arch_int%%te} + tune_cflags="-mtune=" + + enabled debug && add_asflags -g + asm_conversion_cmd="${source_path}/build/make/ads2gas.pl" + + case ${tgt_os} in + win*) + asm_conversion_cmd="$asm_conversion_cmd -noelf" + AS="$CC -c" + EXE_SFX=.exe + enable_feature thumb + ;; + esac + + if enabled thumb; then + asm_conversion_cmd="$asm_conversion_cmd -thumb" + check_add_cflags -mthumb + check_add_asflags -mthumb -mimplicit-it=always + fi + ;; + vs*) + # A number of ARM-based Windows platforms are constrained by their + # respective SDKs' limitations. Fortunately, these are all 32-bit ABIs + # and so can be selected as 'win32'. + if [ ${tgt_os} = "win32" ]; then + asm_conversion_cmd="${source_path}/build/make/ads2armasm_ms.pl" + AS_SFX=.S + msvs_arch_dir=arm-msvs + disable_feature multithread + disable_feature unit_tests + if [ ${tgt_cc##vs} -ge 12 ]; then + # MSVC 2013 doesn't allow doing plain .exe projects for ARM32, + # only "AppContainerApplication" which requires an AppxManifest. + # Therefore disable the examples, just build the library. + disable_feature examples + disable_feature tools + fi + else + # Windows 10 on ARM, on the other hand, has full Windows SDK support + # for building Win32 ARM64 applications in addition to ARM64 + # Windows Store apps. It is the only 64-bit ARM ABI that + # Windows supports, so it is the default definition of 'win64'. + # ARM64 build support officially shipped in Visual Studio 15.9.0. + + # Because the ARM64 Windows SDK's arm_neon.h is ARM32-specific + # while LLVM's is not, probe its validity. + if enabled neon; then + if [ -n "${CC}" ]; then + check_header arm_neon.h || check_header arm64_neon.h && \ + enable_feature win_arm64_neon_h_workaround + else + # If a probe is not possible, assume this is the pure Windows + # SDK and so the workaround is necessary. + enable_feature win_arm64_neon_h_workaround + fi + fi + fi + ;; + rvct) + CC=armcc + AR=armar + AS=armasm + LD="${source_path}/build/make/armlink_adapter.sh" + STRIP=arm-none-linux-gnueabi-strip + NM=arm-none-linux-gnueabi-nm + tune_cflags="--cpu=" + tune_asflags="--cpu=" + if [ -z "${tune_cpu}" ]; then + if [ ${tgt_isa} = "armv7" ]; then + if enabled neon || enabled neon_asm + then + check_add_cflags --fpu=softvfp+vfpv3 + check_add_asflags --fpu=softvfp+vfpv3 + fi + check_add_cflags --cpu=Cortex-A8 + check_add_asflags --cpu=Cortex-A8 + else + check_add_cflags --cpu=${tgt_isa##armv} + check_add_asflags --cpu=${tgt_isa##armv} + fi + fi + arch_int=${tgt_isa##armv} + arch_int=${arch_int%%te} + enabled debug && add_asflags -g + add_cflags --gnu + add_cflags --enum_is_int + add_cflags --wchar32 + ;; + esac + + case ${tgt_os} in + none*) + disable_feature multithread + disable_feature os_support + ;; + + android*) + echo "Assuming standalone build with NDK toolchain." + echo "See build/make/Android.mk for details." + check_add_ldflags -static + soft_enable unit_tests + ;; + + darwin*) + if ! enabled external_build; then + XCRUN_FIND="xcrun --sdk iphoneos --find" + CXX="$(${XCRUN_FIND} clang++)" + CC="$(${XCRUN_FIND} clang)" + AR="$(${XCRUN_FIND} ar)" + AS="$(${XCRUN_FIND} as)" + STRIP="$(${XCRUN_FIND} strip)" + NM="$(${XCRUN_FIND} nm)" + RANLIB="$(${XCRUN_FIND} ranlib)" + AS_SFX=.S + LD="${CXX:-$(${XCRUN_FIND} ld)}" + + # ASFLAGS is written here instead of using check_add_asflags + # because we need to overwrite all of ASFLAGS and purge the + # options that were put in above + ASFLAGS="-arch ${tgt_isa} -g" + + add_cflags -arch ${tgt_isa} + add_ldflags -arch ${tgt_isa} + + alt_libc="$(show_darwin_sdk_path iphoneos)" + if [ -d "${alt_libc}" ]; then + add_cflags -isysroot ${alt_libc} + fi + + for d in lib usr/lib usr/lib/system; do + try_dir="${alt_libc}/${d}" + [ -d "${try_dir}" ] && add_ldflags -L"${try_dir}" + done + + case ${tgt_isa} in + armv7|armv7s|armv8|arm64) + if enabled neon && ! check_xcode_minimum_version; then + soft_disable neon + log_echo " neon disabled: upgrade Xcode (need v6.3+)." + if enabled neon_asm; then + soft_disable neon_asm + log_echo " neon_asm disabled: upgrade Xcode (need v6.3+)." + fi + fi + ;; + esac + + if [ "$(show_darwin_sdk_major_version iphoneos)" -gt 8 ]; then + check_add_cflags -fembed-bitcode + check_add_asflags -fembed-bitcode + check_add_ldflags -fembed-bitcode + fi + fi + + asm_conversion_cmd="${source_path}/build/make/ads2gas_apple.pl" + ;; + + linux*) + enable_feature linux + if enabled rvct; then + # Check if we have CodeSourcery GCC in PATH. Needed for + # libraries + which arm-none-linux-gnueabi-gcc 2>&- || \ + die "Couldn't find CodeSourcery GCC from PATH" + + # Use armcc as a linker to enable translation of + # some gcc specific options such as -lm and -lpthread. + LD="armcc --translate_gcc" + + # create configuration file (uses path to CodeSourcery GCC) + armcc --arm_linux_configure --arm_linux_config_file=arm_linux.cfg + + add_cflags --arm_linux_paths --arm_linux_config_file=arm_linux.cfg + add_asflags --no_hide_all --apcs=/interwork + add_ldflags --arm_linux_paths --arm_linux_config_file=arm_linux.cfg + enabled pic && add_cflags --apcs=/fpic + enabled pic && add_asflags --apcs=/fpic + enabled shared && add_cflags --shared + fi + ;; + esac + ;; + mips*) + link_with_cc=gcc + setup_gnu_toolchain + tune_cflags="-mtune=" + if enabled dspr2; then + check_add_cflags -mips32r2 -mdspr2 + fi + + if enabled runtime_cpu_detect; then + disable_feature runtime_cpu_detect + fi + + if [ -n "${tune_cpu}" ]; then + case ${tune_cpu} in + p5600) + check_add_cflags -mips32r5 -mload-store-pairs + check_add_cflags -msched-weight -mhard-float -mfp64 + check_add_asflags -mips32r5 -mhard-float -mfp64 + check_add_ldflags -mfp64 + ;; + i6400|p6600) + check_add_cflags -mips64r6 -mabi=64 -msched-weight + check_add_cflags -mload-store-pairs -mhard-float -mfp64 + check_add_asflags -mips64r6 -mabi=64 -mhard-float -mfp64 + check_add_ldflags -mips64r6 -mabi=64 -mfp64 + ;; + esac + + if enabled msa; then + # TODO(libyuv:793) + # The new mips functions in libyuv do not build + # with the toolchains we currently use for testing. + soft_disable libyuv + + add_cflags -mmsa + add_asflags -mmsa + add_ldflags -mmsa + fi + fi + + if enabled mmi; then + tgt_isa=loongson3a + check_add_ldflags -march=loongson3a + fi + + check_add_asflags -KPIC + ;; + ppc64le*) + link_with_cc=gcc + setup_gnu_toolchain + # Do not enable vsx by default. + # https://bugs.chromium.org/p/webm/issues/detail?id=1522 + enabled vsx || RTCD_OPTIONS="${RTCD_OPTIONS}--disable-vsx " + if [ -n "${tune_cpu}" ]; then + case ${tune_cpu} in + power?) + tune_cflags="-mcpu=" + ;; + esac + fi + ;; + x86*) + case ${tgt_os} in + android) + soft_enable realtime_only + ;; + win*) + enabled gcc && add_cflags -fno-common + ;; + solaris*) + CC=${CC:-${CROSS}gcc} + CXX=${CXX:-${CROSS}g++} + LD=${LD:-${CROSS}gcc} + CROSS=${CROSS-g} + ;; + os2) + disable_feature pic + AS=${AS:-nasm} + add_ldflags -Zhigh-mem + ;; + esac + + AS="${alt_as:-${AS:-auto}}" + case ${tgt_cc} in + icc*) + CC=${CC:-icc} + LD=${LD:-icc} + setup_gnu_toolchain + add_cflags -use-msasm # remove -use-msasm too? + # add -no-intel-extensions to suppress warning #10237 + # refer to http://software.intel.com/en-us/forums/topic/280199 + add_ldflags -i-static -no-intel-extensions + enabled x86_64 && add_cflags -ipo -static -O3 -no-prec-div + enabled x86_64 && AR=xiar + case ${tune_cpu} in + atom*) + tune_cflags="-x" + tune_cpu="SSE3_ATOM" + ;; + esac + ;; + gcc*) + link_with_cc=gcc + setup_gnu_toolchain + #for 32 bit x86 builds, -O3 did not turn on this flag + enabled optimizations && disabled gprof && check_add_cflags -fomit-frame-pointer + ;; + vs*) + # When building with Microsoft Visual Studio the assembler is + # invoked directly. Checking at configure time is unnecessary. + # Skip the check by setting AS arbitrarily + AS=msvs + msvs_arch_dir=x86-msvs + case ${tgt_cc##vs} in + 14) + echo "${tgt_cc} does not support avx512, disabling....." + RTCD_OPTIONS="${RTCD_OPTIONS}--disable-avx512 " + soft_disable avx512 + ;; + esac + ;; + esac + + bits=32 + enabled x86_64 && bits=64 + check_cpp < sse4 + check_gcc_machine_option ${ext%_*} $ext + fi + fi + done + + if enabled external_build; then + log_echo " skipping assembler detection" + else + case "${AS}" in + auto|"") + which nasm >/dev/null 2>&1 && AS=nasm + which yasm >/dev/null 2>&1 && AS=yasm + if [ "${AS}" = nasm ] ; then + # Apple ships version 0.98 of nasm through at least Xcode 6. Revisit + # this check if they start shipping a compatible version. + apple=`nasm -v | grep "Apple"` + [ -n "${apple}" ] \ + && echo "Unsupported version of nasm: ${apple}" \ + && AS="" + fi + [ "${AS}" = auto ] || [ -z "${AS}" ] \ + && die "Neither yasm nor nasm have been found." \ + "See the prerequisites section in the README for more info." + ;; + esac + log_echo " using $AS" + fi + AS_SFX=.asm + case ${tgt_os} in + win32) + add_asflags -f win32 + enabled debug && add_asflags -g cv8 + EXE_SFX=.exe + ;; + win64) + add_asflags -f win64 + enabled debug && add_asflags -g cv8 + EXE_SFX=.exe + ;; + linux*|solaris*|android*) + add_asflags -f elf${bits} + enabled debug && [ "${AS}" = yasm ] && add_asflags -g dwarf2 + enabled debug && [ "${AS}" = nasm ] && add_asflags -g + [ "${AS##*/}" = nasm ] && check_asm_align + ;; + os2) + add_asflags -f aout + enabled debug && add_asflags -g + EXE_SFX=.exe + ;; + *) + log "Warning: Unknown os $tgt_os while setting up $AS flags" + ;; + esac + ;; + *-gcc|generic-gnu) + link_with_cc=gcc + enable_feature gcc + setup_gnu_toolchain + ;; + esac + + # Try to enable CPU specific tuning + if [ -n "${tune_cpu}" ]; then + if [ -n "${tune_cflags}" ]; then + check_add_cflags ${tune_cflags}${tune_cpu} || \ + die "Requested CPU '${tune_cpu}' not supported by compiler" + fi + if [ -n "${tune_asflags}" ]; then + check_add_asflags ${tune_asflags}${tune_cpu} || \ + die "Requested CPU '${tune_cpu}' not supported by assembler" + fi + if [ -z "${tune_cflags}${tune_asflags}" ]; then + log_echo "Warning: CPU tuning not supported by this toolchain" + fi + fi + + if enabled debug; then + check_add_cflags -g && check_add_ldflags -g + else + check_add_cflags -DNDEBUG + fi + + enabled gprof && check_add_cflags -pg && check_add_ldflags -pg + enabled gcov && + check_add_cflags -fprofile-arcs -ftest-coverage && + check_add_ldflags -fprofile-arcs -ftest-coverage + + if enabled optimizations; then + if enabled rvct; then + enabled small && check_add_cflags -Ospace || check_add_cflags -Otime + else + enabled small && check_add_cflags -O2 || check_add_cflags -O3 + fi + fi + + # Position Independent Code (PIC) support, for building relocatable + # shared objects + enabled gcc && enabled pic && check_add_cflags -fPIC + + # Work around longjmp interception on glibc >= 2.11, to improve binary + # compatibility. See http://code.google.com/p/webm/issues/detail?id=166 + enabled linux && check_add_cflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 + + # Check for strip utility variant + ${STRIP} -V 2>/dev/null | grep GNU >/dev/null && enable_feature gnu_strip + + # Try to determine target endianness + check_cc </dev/null 2>&1 && enable_feature big_endian + + # Try to find which inline keywords are supported + check_cc < +#include +int main(void) { return pthread_create(NULL, NULL, NULL, NULL); } +EOF + ;; + esac + fi + + # only for MIPS platforms + case ${toolchain} in + mips*) + if enabled big_endian; then + if enabled dspr2; then + echo "dspr2 optimizations are available only for little endian platforms" + disable_feature dspr2 + fi + if enabled msa; then + echo "msa optimizations are available only for little endian platforms" + disable_feature msa + fi + if enabled mmi; then + echo "mmi optimizations are available only for little endian platforms" + disable_feature mmi + fi + fi + ;; + esac + + # glibc needs these + if enabled linux; then + add_cflags -D_LARGEFILE_SOURCE + add_cflags -D_FILE_OFFSET_BITS=64 + fi +} + +process_toolchain() { + process_common_toolchain +} + +print_config_mk() { + saved_prefix="${prefix}" + prefix=$1 + makefile=$2 + shift 2 + for cfg; do + if enabled $cfg; then + upname="`toupper $cfg`" + echo "${prefix}_${upname}=yes" >> $makefile + fi + done + prefix="${saved_prefix}" +} + +print_config_h() { + saved_prefix="${prefix}" + prefix=$1 + header=$2 + shift 2 + for cfg; do + upname="`toupper $cfg`" + if enabled $cfg; then + echo "#define ${prefix}_${upname} 1" >> $header + else + echo "#define ${prefix}_${upname} 0" >> $header + fi + done + prefix="${saved_prefix}" +} + +print_config_vars_h() { + header=$1 + shift + while [ $# -gt 0 ]; do + upname="`toupper $1`" + echo "#define ${upname} $2" >> $header + shift 2 + done +} + +print_webm_license() { + saved_prefix="${prefix}" + destination=$1 + prefix="$2" + suffix="$3" + shift 3 + cat < ${destination} +${prefix} Copyright (c) 2011 The WebM project authors. All Rights Reserved.${suffix} +${prefix} ${suffix} +${prefix} Use of this source code is governed by a BSD-style license${suffix} +${prefix} that can be found in the LICENSE file in the root of the source${suffix} +${prefix} tree. An additional intellectual property rights grant can be found${suffix} +${prefix} in the file PATENTS. All contributing project authors may${suffix} +${prefix} be found in the AUTHORS file in the root of the source tree.${suffix} +EOF + prefix="${saved_prefix}" +} + +process_targets() { + true; +} + +process_detect() { + true; +} + +enable_feature logging +logfile="config.log" +self=$0 +process() { + cmdline_args="$@" + process_cmdline "$@" + if enabled child; then + echo "# ${self} $@" >> ${logfile} + else + echo "# ${self} $@" > ${logfile} + fi + post_process_common_cmdline + post_process_cmdline + process_toolchain + process_detect + process_targets + + OOT_INSTALLS="${OOT_INSTALLS}" + if enabled source_path_used; then + # Prepare the PWD for building. + for f in ${OOT_INSTALLS}; do + install -D "${source_path}/$f" "$f" + done + fi + cp "${source_path}/build/make/Makefile" . + + clean_temp_files + true +} diff --git a/tools/patch/make/nettle/aclocal.m4 b/tools/patch/make/nettle/aclocal.m4 new file mode 100644 index 0000000..ec96784 --- /dev/null +++ b/tools/patch/make/nettle/aclocal.m4 @@ -0,0 +1,559 @@ +dnl Choose cc flags for compiling position independent code +dnl FIXME: Doesn't do the right thing when crosscompiling. +AC_DEFUN([LSH_CCPIC], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_MSG_CHECKING(CCPIC) +AC_CACHE_VAL(lsh_cv_sys_ccpic,[ + if test -z "$CCPIC" ; then + if test "$GCC" = yes ; then + case "$host_os" in + bsdi4.*) CCPIC="-fPIC" ;; + bsdi*) CCPIC="" ;; + darwin*) CCPIC="-fPIC" ;; + # Could also use -fpic, depending on the number of symbol references + solaris*) CCPIC="-fPIC" ;; + cygwin*) CCPIC="" ;; + mingw32*) CCPIC="" ;; + *) CCPIC="-fpic" ;; + esac + else + case "$host_os" in + darwin*) CCPIC="-fPIC" ;; + irix*) CCPIC="-share" ;; + hpux*) CCPIC="+z"; ;; + *freebsd*) CCPIC="-fpic" ;; + sco*|sysv4.*) CCPIC="-KPIC -dy -Bdynamic" ;; + solaris*) CCPIC="-KPIC -Bdynamic" ;; + winnt*) CCPIC="-shared" ;; + *) CCPIC="" ;; + esac + fi + fi + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $CCPIC" + AC_TRY_COMPILE([], [exit(0);], + lsh_cv_sys_ccpic="$CCPIC", lsh_cv_sys_ccpic='') + CFLAGS="$OLD_CFLAGS" +]) +CCPIC="$lsh_cv_sys_ccpic" +AC_MSG_RESULT($CCPIC)]) + +dnl LSH_PATH_ADD(path-id, directory) +AC_DEFUN([LSH_PATH_ADD], +[AC_MSG_CHECKING($2) +ac_exists=no +if test -d "$2/." ; then + ac_real_dir=`cd $2 && pwd` + if test -n "$ac_real_dir" ; then + ac_exists=yes + for old in $1_REAL_DIRS ; do + ac_found=no + if test x$ac_real_dir = x$old ; then + ac_found=yes; + break; + fi + done + if test $ac_found = yes ; then + AC_MSG_RESULT(already added) + else + AC_MSG_RESULT(added) + # LDFLAGS="$LDFLAGS -L $2" + $1_REAL_DIRS="$ac_real_dir [$]$1_REAL_DIRS" + $1_DIRS="$2 [$]$1_DIRS" + fi + fi +fi +if test $ac_exists = no ; then + AC_MSG_RESULT(not found) +fi +]) + +dnl LSH_RPATH_ADD(dir) +AC_DEFUN([LSH_RPATH_ADD], [LSH_PATH_ADD(RPATH_CANDIDATE, $1)]) + +dnl LSH_RPATH_INIT(candidates) +AC_DEFUN([LSH_RPATH_INIT], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_MSG_CHECKING([for -R flag]) +RPATHFLAG='' +case "$host_os" in + osf1*) RPATHFLAG="-rpath " ;; + irix6.*|irix5.*) RPATHFLAG="-rpath " ;; + solaris*) + if test "$TCC" = "yes"; then + # tcc doesn't know about -R + RPATHFLAG="-Wl,-R," + else + RPATHFLAG=-R + fi + ;; + linux*|freebsd*) RPATHFLAG="-Wl,-rpath," ;; + *) RPATHFLAG="" ;; +esac + +if test x$RPATHFLAG = x ; then + AC_MSG_RESULT(none) +else + AC_MSG_RESULT([using $RPATHFLAG]) +fi + +RPATH_CANDIDATE_REAL_DIRS='' +RPATH_CANDIDATE_DIRS='' + +AC_MSG_RESULT([Searching for libraries]) + +for d in $1 ; do + LSH_RPATH_ADD($d) +done +]) + +dnl Try to execute a main program, and if it fails, try adding some +dnl -R flag. +dnl LSH_RPATH_FIX +AC_DEFUN([LSH_RPATH_FIX], +[if test $cross_compiling = no -a "x$RPATHFLAG" != x ; then + ac_success=no + AC_TRY_RUN([int main(int argc, char **argv) { return 0; }], + ac_success=yes, ac_success=no, :) + + if test $ac_success = no ; then + AC_MSG_CHECKING([Running simple test program failed. Trying -R flags]) +dnl echo RPATH_CANDIDATE_DIRS = $RPATH_CANDIDATE_DIRS + ac_remaining_dirs='' + ac_rpath_save_LDFLAGS="$LDFLAGS" + for d in $RPATH_CANDIDATE_DIRS ; do + if test $ac_success = yes ; then + ac_remaining_dirs="$ac_remaining_dirs $d" + else + LDFLAGS="$RPATHFLAG$d $LDFLAGS" +dnl echo LDFLAGS = $LDFLAGS + AC_TRY_RUN([int main(int argc, char **argv) { return 0; }], + [ac_success=yes + ac_rpath_save_LDFLAGS="$LDFLAGS" + AC_MSG_RESULT([adding $RPATHFLAG$d]) + ], + [ac_remaining_dirs="$ac_remaining_dirs $d"], :) + LDFLAGS="$ac_rpath_save_LDFLAGS" + fi + done + RPATH_CANDIDATE_DIRS=$ac_remaining_dirs + fi + if test $ac_success = no ; then + AC_MSG_RESULT(failed) + fi +fi +]) + +dnl LSH_GCC_ATTRIBUTES +dnl Check for gcc's __attribute__ construction + +AC_DEFUN([LSH_GCC_ATTRIBUTES], +[AC_CACHE_CHECK(for __attribute__, + lsh_cv_c_attribute, +[ AC_TRY_COMPILE([ +#include + +static void foo(void) __attribute__ ((noreturn)); + +static void __attribute__ ((noreturn)) +foo(void) +{ + exit(1); +} +],[], +lsh_cv_c_attribute=yes, +lsh_cv_c_attribute=no)]) + +AH_TEMPLATE([HAVE_GCC_ATTRIBUTE], [Define if the compiler understands __attribute__]) +if test "x$lsh_cv_c_attribute" = "xyes"; then + AC_DEFINE(HAVE_GCC_ATTRIBUTE) +fi + +AH_BOTTOM( +[#if __GNUC__ && HAVE_GCC_ATTRIBUTE +# define NORETURN __attribute__ ((__noreturn__)) +# define PRINTF_STYLE(f, a) __attribute__ ((__format__ (__printf__, f, a))) +# define UNUSED __attribute__ ((__unused__)) +#else +# define NORETURN +# define PRINTF_STYLE(f, a) +# define UNUSED +#endif +])]) + +# Check for alloca, and include the standard blurb in config.h +AC_DEFUN([LSH_FUNC_ALLOCA], +[AC_FUNC_ALLOCA +AC_CHECK_HEADERS([malloc.h]) +AH_BOTTOM( +[/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +/* Needed for alloca on windows */ +# if HAVE_MALLOC_H +# include +# endif +# endif +#else /* defined __GNUC__ */ +# if HAVE_ALLOCA_H +# include +# else +/* Needed for alloca on windows, also with gcc */ +# if HAVE_MALLOC_H +# include +# endif +# endif +#endif +])]) + +AC_DEFUN([LSH_FUNC_STRERROR], +[AC_CHECK_FUNCS(strerror) +AH_BOTTOM( +[#if HAVE_STRERROR +#define STRERROR strerror +#else +#define STRERROR(x) (sys_errlist[x]) +#endif +])]) + +AC_DEFUN([LSH_FUNC_STRSIGNAL], +[AC_CHECK_FUNCS(strsignal) +AC_CHECK_DECLS([sys_siglist, _sys_siglist]) +AH_BOTTOM( +[#if HAVE_STRSIGNAL +# define STRSIGNAL strsignal +#else /* !HAVE_STRSIGNAL */ +# if HAVE_DECL_SYS_SIGLIST +# define STRSIGNAL(x) (sys_siglist[x]) +# else +# if HAVE_DECL__SYS_SIGLIST +# define STRSIGNAL(x) (_sys_siglist[x]) +# else +# define STRSIGNAL(x) "Unknown signal" +# if __GNUC__ +# warning Using dummy STRSIGNAL +# endif +# endif +# endif +#endif /* !HAVE_STRSIGNAL */ +])]) + +dnl LSH_DEPENDENCY_TRACKING + +dnl Defines compiler flags DEP_FLAGS to generate dependency +dnl information, and DEP_PROCESS that is any shell commands needed for +dnl massaging the dependency information further. Dependencies are +dnl generated as a side effect of compilation. Dependency files +dnl themselves are not treated as targets. + +AC_DEFUN([LSH_DEPENDENCY_TRACKING], +[AC_ARG_ENABLE(dependency_tracking, + AC_HELP_STRING([--disable-dependency-tracking], + [Disable dependency tracking. Dependency tracking doesn't work with BSD make]),, + [enable_dependency_tracking=yes]) + +DEP_FLAGS='' +DEP_PROCESS='true' +if test x$enable_dependency_tracking = xyes ; then + if test x$GCC = xyes ; then + gcc_version=`gcc --version | head -1` + case "$gcc_version" in + 2.*|*[[!0-9.]]2.*) + enable_dependency_tracking=no + AC_MSG_WARN([Dependency tracking disabled, gcc-3.x is needed]) + ;; + *) + DEP_FLAGS='-MT $[]@ -MD -MP -MF $[]@.d' + DEP_PROCESS='true' + ;; + esac + else + enable_dependency_tracking=no + AC_MSG_WARN([Dependency tracking disabled]) + fi +fi + +AC_SUBST([DEP_FLAGS]) +AC_SUBST([DEP_PROCESS])]) + +dnl GMP_TRY_ASSEMBLE(asm-code,[action-success][,action-fail]) +dnl ---------------------------------------------------------- +dnl Attempt to assemble the given code. +dnl Do "action-success" if this succeeds, "action-fail" if not. +dnl +dnl conftest.o and conftest.out are available for inspection in +dnl "action-success". If either action does a "break" out of a loop then +dnl an explicit "rm -f conftest*" will be necessary. +dnl +dnl This is not unlike AC_TRY_COMPILE, but there's no default includes or +dnl anything in "asm-code", everything wanted must be given explicitly. + +AC_DEFUN([GMP_TRY_ASSEMBLE], +[cat >conftest.s <&AC_FD_CC + ifelse([$2],,:,[$2]) +else + cat conftest.out >&AC_FD_CC + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.s >&AC_FD_CC + ifelse([$3],,:,[$3]) +fi +rm -f conftest* +]) + +dnl GMP_PROG_CC_FOR_BUILD +dnl --------------------- +dnl Establish CC_FOR_BUILD, a C compiler for the build system. +dnl +dnl If CC_FOR_BUILD is set then it's expected to work, likewise the old +dnl style HOST_CC, otherwise some likely candidates are tried, the same as +dnl configfsf.guess. + +AC_DEFUN([GMP_PROG_CC_FOR_BUILD], +[AC_REQUIRE([AC_PROG_CC]) +if test -n "$CC_FOR_BUILD"; then + GMP_PROG_CC_FOR_BUILD_WORKS($CC_FOR_BUILD,, + [AC_MSG_ERROR([Specified CC_FOR_BUILD doesn't seem to work])]) +elif test -n "$HOST_CC"; then + GMP_PROG_CC_FOR_BUILD_WORKS($HOST_CC, + [CC_FOR_BUILD=$HOST_CC], + [AC_MSG_ERROR([Specified HOST_CC doesn't seem to work])]) +else + if test $cross_compiling = no ; then + CC_FOR_BUILD="$CC" + else + for i in gcc cc c89 c99; do + GMP_PROG_CC_FOR_BUILD_WORKS($i, + [CC_FOR_BUILD=$i + break]) + done + if test -z "$CC_FOR_BUILD"; then + AC_MSG_ERROR([Cannot find a build system compiler]) + fi + fi + if test "$CC_FOR_BUILD" = gcc ; then + CC_FOR_BUILD="$CC_FOR_BUILD -Wno-implicit-function-declaration -O -g" + fi +fi + +AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler]) +AC_SUBST(CC_FOR_BUILD) +]) + + +dnl GMP_PROG_CC_FOR_BUILD_WORKS(cc/cflags[,[action-if-good][,action-if-bad]]) +dnl ------------------------------------------------------------------------- +dnl See if the given cc/cflags works on the build system. +dnl +dnl It seems easiest to just use the default compiler output, rather than +dnl figuring out the .exe or whatever at this stage. + +AC_DEFUN([GMP_PROG_CC_FOR_BUILD_WORKS], +[AC_MSG_CHECKING([build system compiler $1]) +# remove anything that might look like compiler output to our "||" expression +rm -f conftest* a.out b.out a.exe a_out.exe +cat >conftest.c < +int +main () +{ + exit(0); +} +EOF +gmp_compile="$1 conftest.c" +cc_for_build_works=no +if AC_TRY_EVAL(gmp_compile); then + if (./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest) >&AC_FD_CC 2>&1; then + cc_for_build_works=yes + fi +fi +rm -f conftest* a.out b.out a.exe a_out.exe +AC_MSG_RESULT($cc_for_build_works) +if test "$cc_for_build_works" = yes; then + ifelse([$2],,:,[$2]) +else + ifelse([$3],,:,[$3]) +fi +]) + +dnl GMP_PROG_EXEEXT_FOR_BUILD +dnl ------------------------- +dnl Determine EXEEXT_FOR_BUILD, the build system executable suffix. +dnl +dnl The idea is to find what "-o conftest$foo" will make it possible to run +dnl the program with ./conftest. On Unix-like systems this is of course +dnl nothing, for DOS it's ".exe", or for a strange RISC OS foreign file +dnl system cross compile it can be ",ff8" apparently. Not sure if the +dnl latter actually applies to a build-system executable, maybe it doesn't, +dnl but it won't hurt to try. + +AC_DEFUN([GMP_PROG_EXEEXT_FOR_BUILD], +[AC_REQUIRE([GMP_PROG_CC_FOR_BUILD]) +AC_CACHE_CHECK([for build system executable suffix], + gmp_cv_prog_exeext_for_build, +[if test $cross_compiling = no ; then + gmp_cv_prog_exeext_for_build="$EXEEXT" +else + cat >conftest.c < +int +main () +{ + exit (0); +} +EOF + for i in .exe ,ff8 ""; do + gmp_compile="$CC_FOR_BUILD conftest.c -o conftest$i" + if AC_TRY_EVAL(gmp_compile); then + if (./conftest) 2>&AC_FD_CC; then + gmp_cv_prog_exeext_for_build=$i + break + fi + fi + done + rm -f conftest* + if test "${gmp_cv_prog_exeext_for_build+set}" != set; then + AC_MSG_ERROR([Cannot determine executable suffix]) + fi +fi +]) +AC_SUBST(EXEEXT_FOR_BUILD,$gmp_cv_prog_exeext_for_build) +]) + +dnl NETTLE_CHECK_ARM_NEON +dnl --------------------- +dnl Check if ARM Neon instructions should be used. +dnl Obeys enable_arm_neon, which should be set earlier. +AC_DEFUN([NETTLE_CHECK_ARM_NEON], +[if test "$enable_arm_neon" = auto ; then + if test "$cross_compiling" = yes ; then + dnl Check if compiler/assembler accepts it, + dnl without an explicit .fpu neon directive. + AC_CACHE_CHECK([if assembler accepts Neon instructions], + nettle_cv_asm_arm_neon, + [GMP_TRY_ASSEMBLE([ +.text +foo: + vmlal.u32 q1, d0, d1 +], + [nettle_cv_asm_arm_neon=yes], + [nettle_cv_asm_arm_neon=no])]) + enable_arm_neon="$nettle_cv_asm_arm_neon" + else + AC_MSG_CHECKING([if /proc/cpuinfo claims neon support]) + if grep '^Features.*:.* neon' /proc/cpuinfo >/dev/null ; then + enable_arm_neon=yes + else + enable_arm_neon=no + fi + AC_MSG_RESULT($enable_arm_neon) + fi +fi +]) + +dnl NETTLE_CHECK_IFUNC +dnl ------------------ +dnl Check if __attribute__ ((ifunc(...))) works +AC_DEFUN([NETTLE_CHECK_IFUNC], +[AC_REQUIRE([AC_PROG_CC]) +AC_CACHE_CHECK([for ifunc support], + nettle_cv_link_ifunc, + [AC_LINK_IFELSE([AC_LANG_PROGRAM([ +static int +foo_imp(int x) +{ + return 1; +} + +typedef void void_func (void); + +static void_func * +foo_resolv(void) +{ + return (void_func *) foo_imp; +} + +int foo (int x) __attribute__ ((ifunc("foo_resolv"))); +],[ + return foo(0); + +])], +[nettle_cv_link_ifunc=yes], +[nettle_cv_link_ifunc=no])]) +AH_TEMPLATE([HAVE_LINK_IFUNC], [Define if compiler and linker supports __attribute__ ifunc]) +if test "x$nettle_cv_link_ifunc" = xyes ; then + AC_DEFINE(HAVE_LINK_IFUNC) +fi +]) + +# ld-version-script.m4 serial 3 +dnl Copyright (C) 2008-2014 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Simon Josefsson + +# FIXME: The test below returns a false positive for mingw +# cross-compiles, 'local:' statements does not reduce number of +# exported symbols in a DLL. Use --disable-ld-version-script to work +# around the problem. + +# gl_LD_VERSION_SCRIPT +# -------------------- +# Check if LD supports linker scripts, and define automake conditional +# HAVE_LD_VERSION_SCRIPT if so. +AC_DEFUN([LD_VERSION_SCRIPT], +[ + AC_ARG_ENABLE([ld-version-script], + AS_HELP_STRING([--enable-ld-version-script], + [enable linker version script (default is enabled when possible)]), + [have_ld_version_script=$enableval], []) + if test -z "$have_ld_version_script"; then + AC_MSG_CHECKING([if LD -Wl,--version-script works]) + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map" + cat > conftest.map < conftest.map < rubberband.pc + +clean: + rm -f $(LIBRARY_OBJECTS) $(JNI_OBJECT) $(JAVA_OBJECT) $(PROGRAM_OBJECTS) $(LADSPA_OBJECTS) + +distclean: clean + rm -f $(PROGRAM_TARGET) $(STATIC_TARGET) $(DYNAMIC_TARGET) $(JNI_TARGET) $(JAR_TARGET) $(LADSPA_TARGET) + +depend: + makedepend -Y $(LIBRARY_SOURCES) $(PROGRAM_SOURCES) + + +# DO NOT DELETE + +src/rubberband-c.o: rubberband/rubberband-c.h +src/rubberband-c.o: rubberband/RubberBandStretcher.h +src/RubberBandStretcher.o: src/StretcherImpl.h +src/RubberBandStretcher.o: rubberband/RubberBandStretcher.h src/dsp/Window.h +src/RubberBandStretcher.o: src/dsp/SincWindow.h src/dsp/FFT.h +src/RubberBandStretcher.o: src/audiocurves/CompoundAudioCurve.h +src/RubberBandStretcher.o: src/dsp/AudioCurveCalculator.h +src/RubberBandStretcher.o: src/audiocurves/PercussiveAudioCurve.h +src/RubberBandStretcher.o: src/audiocurves/HighFrequencyAudioCurve.h +src/RubberBandStretcher.o: src/dsp/SampleFilter.h src/base/RingBuffer.h +src/RubberBandStretcher.o: src/base/Scavenger.h src/system/Thread.h +src/RubberBandStretcher.o: src/system/sysutils.h +src/StretcherProcess.o: src/StretcherImpl.h rubberband/RubberBandStretcher.h +src/StretcherProcess.o: src/dsp/Window.h src/dsp/SincWindow.h src/dsp/FFT.h +src/StretcherProcess.o: src/audiocurves/CompoundAudioCurve.h +src/StretcherProcess.o: src/dsp/AudioCurveCalculator.h +src/StretcherProcess.o: src/audiocurves/PercussiveAudioCurve.h +src/StretcherProcess.o: src/audiocurves/HighFrequencyAudioCurve.h +src/StretcherProcess.o: src/dsp/SampleFilter.h src/base/RingBuffer.h +src/StretcherProcess.o: src/base/Scavenger.h src/system/Thread.h +src/StretcherProcess.o: src/system/sysutils.h src/audiocurves/PercussiveAudioCurve.h +src/StretcherProcess.o: src/audiocurves/HighFrequencyAudioCurve.h +src/StretcherProcess.o: src/audiocurves/ConstantAudioCurve.h src/StretchCalculator.h +src/StretcherProcess.o: src/StretcherChannelData.h src/dsp/Resampler.h +src/StretcherProcess.o: src/base/Profiler.h src/system/VectorOps.h +src/StretcherProcess.o: src/system/sysutils.h +src/StretchCalculator.o: src/StretchCalculator.h src/system/sysutils.h +src/base/Profiler.o: src/base/Profiler.h src/system/sysutils.h +src/dsp/AudioCurveCalculator.o: src/dsp/AudioCurveCalculator.h +src/audiocurves/CompoundAudioCurve.o: src/audiocurves/CompoundAudioCurve.h +src/audiocurves/CompoundAudioCurve.o: src/dsp/AudioCurveCalculator.h +src/audiocurves/CompoundAudioCurve.o: src/audiocurves/PercussiveAudioCurve.h +src/audiocurves/CompoundAudioCurve.o: src/audiocurves/HighFrequencyAudioCurve.h +src/audiocurves/CompoundAudioCurve.o: src/dsp/SampleFilter.h src/dsp/MovingMedian.h +src/audiocurves/SpectralDifferenceAudioCurve.o: src/audiocurves/SpectralDifferenceAudioCurve.h +src/audiocurves/SpectralDifferenceAudioCurve.o: src/dsp/AudioCurveCalculator.h +src/audiocurves/SpectralDifferenceAudioCurve.o: src/dsp/Window.h +src/audiocurves/SpectralDifferenceAudioCurve.o: src/system/sysutils.h +src/audiocurves/SpectralDifferenceAudioCurve.o: src/system/VectorOps.h +src/audiocurves/SpectralDifferenceAudioCurve.o: src/system/sysutils.h +src/audiocurves/HighFrequencyAudioCurve.o: src/audiocurves/HighFrequencyAudioCurve.h +src/audiocurves/HighFrequencyAudioCurve.o: src/dsp/AudioCurveCalculator.h +src/audiocurves/SilentAudioCurve.o: src/audiocurves/SilentAudioCurve.h +src/audiocurves/SilentAudioCurve.o: src/dsp/AudioCurveCalculator.h +src/audiocurves/ConstantAudioCurve.o: src/audiocurves/ConstantAudioCurve.h +src/audiocurves/ConstantAudioCurve.o: src/dsp/AudioCurveCalculator.h +src/audiocurves/PercussiveAudioCurve.o: src/audiocurves/PercussiveAudioCurve.h +src/audiocurves/PercussiveAudioCurve.o: src/dsp/AudioCurveCalculator.h +src/audiocurves/PercussiveAudioCurve.o: src/system/VectorOps.h src/system/sysutils.h +src/dsp/Resampler.o: src/dsp/Resampler.h src/system/sysutils.h +src/dsp/Resampler.o: src/base/Profiler.h +src/dsp/FFT.o: src/dsp/FFT.h src/system/sysutils.h src/system/Thread.h +src/dsp/FFT.o: src/base/Profiler.h src/system/VectorOps.h +src/dsp/FFT.o: src/system/sysutils.h +src/system/Allocators.o: src/system/Allocators.h src/system/VectorOps.h +src/system/Allocators.o: src/system/sysutils.h +src/system/sysutils.o: src/system/sysutils.h +src/system/Thread.o: src/system/Thread.h +src/StretcherChannelData.o: src/StretcherChannelData.h src/StretcherImpl.h +src/StretcherChannelData.o: rubberband/RubberBandStretcher.h src/dsp/Window.h +src/StretcherChannelData.o: src/dsp/SincWindow.h src/dsp/FFT.h +src/StretcherChannelData.o: src/audiocurves/CompoundAudioCurve.h +src/StretcherChannelData.o: src/dsp/AudioCurveCalculator.h +src/StretcherChannelData.o: src/audiocurves/PercussiveAudioCurve.h +src/StretcherChannelData.o: src/audiocurves/HighFrequencyAudioCurve.h +src/StretcherChannelData.o: src/dsp/SampleFilter.h src/base/RingBuffer.h +src/StretcherChannelData.o: src/base/Scavenger.h src/system/Thread.h +src/StretcherChannelData.o: src/system/sysutils.h src/dsp/Resampler.h +src/StretcherChannelData.o: src/system/Allocators.h src/system/VectorOps.h +src/StretcherChannelData.o: src/system/sysutils.h +src/StretcherImpl.o: src/StretcherImpl.h rubberband/RubberBandStretcher.h +src/StretcherImpl.o: src/dsp/Window.h src/dsp/SincWindow.h src/dsp/FFT.h +src/StretcherImpl.o: src/audiocurves/CompoundAudioCurve.h +src/StretcherImpl.o: src/dsp/AudioCurveCalculator.h +src/StretcherImpl.o: src/audiocurves/PercussiveAudioCurve.h +src/StretcherImpl.o: src/audiocurves/HighFrequencyAudioCurve.h src/dsp/SampleFilter.h +src/StretcherImpl.o: src/base/RingBuffer.h src/base/Scavenger.h +src/StretcherImpl.o: src/system/Thread.h src/system/sysutils.h +src/StretcherImpl.o: src/audiocurves/PercussiveAudioCurve.h +src/StretcherImpl.o: src/audiocurves/HighFrequencyAudioCurve.h +src/StretcherImpl.o: src/audiocurves/SpectralDifferenceAudioCurve.h src/dsp/Window.h +src/StretcherImpl.o: src/system/VectorOps.h src/system/sysutils.h +src/StretcherImpl.o: src/audiocurves/SilentAudioCurve.h src/audiocurves/ConstantAudioCurve.h +src/StretcherImpl.o: src/dsp/Resampler.h src/StretchCalculator.h +src/StretcherImpl.o: src/StretcherChannelData.h src/base/Profiler.h +main/main.o: rubberband/RubberBandStretcher.h src/system/sysutils.h +main/main.o: src/base/Profiler.h diff --git a/tools/patch/make/rubberband/Makefile.ios.in b/tools/patch/make/rubberband/Makefile.ios.in new file mode 100644 index 0000000..38f4c44 --- /dev/null +++ b/tools/patch/make/rubberband/Makefile.ios.in @@ -0,0 +1,266 @@ + +PREFIX := @prefix@ +CXX := @CXX@ +CC := @CC@ +CXXFLAGS := -ffast-math -freciprocal-math -O3 -ftree-vectorize -DHAVE_LIBSAMPLERATE -DMALLOC_IS_ALIGNED -DHAVE_VDSP -DPROCESS_SAMPLE_TYPE=float -DUSE_POMMIER_MATHFUN -DNO_THREADING -DNO_THREAD_CHECKS -DNO_TIMING -DNO_TIMING_COMPLETE_NOOP -DNDEBUG -I. -Isrc -Irubberband @CXXFLAGS@ @SRC_CFLAGS@ @SNDFILE_CFLAGS@ $(OPTFLAGS) +CFLAGS := @CFLAGS@ $(OPTFLAGS) +LDFLAGS := @LDFLAGS@ -Wl,-framework,Accelerate $(LDFLAGS) + +JNI_CXXFLAGS := -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux +JAVAC := $(JAVA_HOME)/bin/javac +JAR := $(JAVA_HOME)/bin/jar + +LIBRARY_LIBS := @SRC_LIBS@ +PROGRAM_LIBS := @SNDFILE_LIBS@ $(LIBRARY_LIBS) +LADSPA_PLUGIN_LIBS := $(LIBRARY_LIBS) + +MKDIR := mkdir +AR := ar + +INSTALL_BINDIR := $(PREFIX)/bin +INSTALL_INCDIR := $(PREFIX)/include/rubberband +INSTALL_LIBDIR := $(PREFIX)/lib +INSTALL_LADSPADIR := $(PREFIX)/lib/ladspa +INSTALL_LRDFDIR := $(PREFIX)/share/ladspa/rdf +INSTALL_PKGDIR := $(PREFIX)/lib/pkgconfig + +LIBNAME := librubberband +JNINAME := librubberband-jni +JARNAME := rubberband.jar + +DYNAMIC_EXTENSION := .so +DYNAMIC_FULL_VERSION := 2.1.1 +DYNAMIC_ABI_VERSION := 2 +DYNAMIC_LDFLAGS := -shared -Wl,-Bsymbolic -Wl,-soname=$(LIBNAME)$(DYNAMIC_EXTENSION).$(DYNAMIC_ABI_VERSION) +LADSPA_LDFLAGS := -shared -Wl,-Bsymbolic -Wl,--version-script=ladspa/ladspa-plugin.map + +PROGRAM_TARGET := bin/rubberband +STATIC_TARGET := lib/$(LIBNAME).a +DYNAMIC_TARGET := lib/$(LIBNAME)$(DYNAMIC_EXTENSION) +JNI_TARGET := lib/$(JNINAME)$(DYNAMIC_EXTENSION) +JAR_TARGET := lib/$(JARNAME) +LADSPA_TARGET := lib/ladspa-rubberband$(DYNAMIC_EXTENSION) + +all: bin lib $(PROGRAM_TARGET) $(STATIC_TARGET) + +static: $(STATIC_TARGET) +dynamic: $(DYNAMIC_TARGET) +library: $(STATIC_TARGET) +jni: $(JNI_TARGET) $(JAR_TARGET) +program: $(PROGRAM_TARGET) +ladspa: $(LADSPA_TARGET) + +PUBLIC_INCLUDES := \ + rubberband/rubberband-c.h \ + rubberband/RubberBandStretcher.h + +LIBRARY_INCLUDES := \ + src/StretcherChannelData.h \ + src/float_cast/float_cast.h \ + src/StretcherImpl.h \ + src/StretchCalculator.h \ + src/base/Profiler.h \ + src/base/RingBuffer.h \ + src/base/Scavenger.h \ + src/dsp/AudioCurveCalculator.h \ + src/audiocurves/CompoundAudioCurve.h \ + src/audiocurves/ConstantAudioCurve.h \ + src/audiocurves/HighFrequencyAudioCurve.h \ + src/audiocurves/PercussiveAudioCurve.h \ + src/audiocurves/SilentAudioCurve.h \ + src/audiocurves/SpectralDifferenceAudioCurve.h \ + src/dsp/Resampler.h \ + src/dsp/FFT.h \ + src/dsp/MovingMedian.h \ + src/dsp/SincWindow.h \ + src/dsp/Window.h \ + src/system/Allocators.h \ + src/system/Thread.h \ + src/system/VectorOps.h \ + src/system/VectorOpsComplex.h \ + src/system/sysutils.h + +LIBRARY_SOURCES := \ + src/rubberband-c.cpp \ + src/RubberBandStretcher.cpp \ + src/StretcherProcess.cpp \ + src/StretchCalculator.cpp \ + src/base/Profiler.cpp \ + src/dsp/AudioCurveCalculator.cpp \ + src/audiocurves/CompoundAudioCurve.cpp \ + src/audiocurves/SpectralDifferenceAudioCurve.cpp \ + src/audiocurves/HighFrequencyAudioCurve.cpp \ + src/audiocurves/SilentAudioCurve.cpp \ + src/audiocurves/ConstantAudioCurve.cpp \ + src/audiocurves/PercussiveAudioCurve.cpp \ + src/dsp/Resampler.cpp \ + src/dsp/FFT.cpp \ + src/system/Allocators.cpp \ + src/system/sysutils.cpp \ + src/system/Thread.cpp \ + src/system/VectorOpsComplex.cpp \ + src/StretcherChannelData.cpp \ + src/StretcherImpl.cpp + +JNI_SOURCE := \ + src/jni/RubberBandStretcherJNI.cpp + +JAVA_SOURCE := \ + com/breakfastquay/rubberband/RubberBandStretcher.java + +PROGRAM_SOURCES := \ + main/main.cpp + +LADSPA_HEADERS := \ + ladspa/RubberBandPitchShifter.h + +LADSPA_SOURCES := \ + ladspa/RubberBandPitchShifter.cpp \ + ladspa/libmain.cpp + +LIBRARY_OBJECTS := $(LIBRARY_SOURCES:.cpp=.o) +LIBRARY_OBJECTS := $(LIBRARY_OBJECTS:.c=.o) +JNI_OBJECT := $(JNI_SOURCE:.cpp=.o) +JAVA_OBJECT := $(JAVA_SOURCE:.java=.class) +PROGRAM_OBJECTS := $(PROGRAM_SOURCES:.cpp=.o) +LADSPA_OBJECTS := $(LADSPA_SOURCES:.cpp=.o) + +$(PROGRAM_TARGET): $(LIBRARY_OBJECTS) $(PROGRAM_OBJECTS) + $(CXX) -o $@ $^ $(PROGRAM_LIBS) $(LDFLAGS) + +$(STATIC_TARGET): $(LIBRARY_OBJECTS) + $(AR) rsc $@ $^ + +$(DYNAMIC_TARGET): $(LIBRARY_OBJECTS) + $(CXX) $(DYNAMIC_LDFLAGS) $^ -o $@ $(LIBRARY_LIBS) $(LDFLAGS) + +$(JNI_OBJECT): $(JNI_SOURCE) + $(CXX) -c $(JNI_CXXFLAGS) $(CXXFLAGS) $^ -o $@ + +$(JNI_TARGET): $(LIBRARY_OBJECTS) $(JNI_OBJECT) + $(CXX) $(DYNAMIC_LDFLAGS) $^ -o $@ $(LIBRARY_LIBS) $(LDFLAGS) + +$(JAR_TARGET): $(JAVA_SOURCE) + $(JAVAC) $^ + $(JAR) cvf $@ $(JAVA_OBJECT) + +$(LADSPA_TARGET): $(LIBRARY_OBJECTS) $(LADSPA_OBJECTS) + $(CXX) $(LADSPA_LDFLAGS) -o $@ $^ $(LADSPA_PLUGIN_LIBS) $(LDFLAGS) + +bin: + $(MKDIR) $@ +lib: + $(MKDIR) $@ + +install: all + $(MKDIR) -p $(DESTDIR)$(INSTALL_BINDIR) + $(MKDIR) -p $(DESTDIR)$(INSTALL_INCDIR) + $(MKDIR) -p $(DESTDIR)$(INSTALL_LIBDIR) + $(MKDIR) -p $(DESTDIR)$(INSTALL_LADSPADIR) + $(MKDIR) -p $(DESTDIR)$(INSTALL_LRDFDIR) + $(MKDIR) -p $(DESTDIR)$(INSTALL_PKGDIR) + cp $(PROGRAM_TARGET) $(DESTDIR)$(INSTALL_BINDIR) + cp $(PUBLIC_INCLUDES) $(DESTDIR)$(INSTALL_INCDIR) + cp $(STATIC_TARGET) $(DESTDIR)$(INSTALL_LIBDIR) + sed "s,%PREFIX%,$(PREFIX)," rubberband.pc.in \ + > rubberband.pc + +clean: + rm -f $(LIBRARY_OBJECTS) $(JNI_OBJECT) $(JAVA_OBJECT) $(PROGRAM_OBJECTS) $(LADSPA_OBJECTS) + +distclean: clean + rm -f $(PROGRAM_TARGET) $(STATIC_TARGET) $(DYNAMIC_TARGET) $(JNI_TARGET) $(JAR_TARGET) $(LADSPA_TARGET) + +depend: + makedepend -Y $(LIBRARY_SOURCES) $(PROGRAM_SOURCES) + + +# DO NOT DELETE + +src/rubberband-c.o: rubberband/rubberband-c.h +src/rubberband-c.o: rubberband/RubberBandStretcher.h +src/RubberBandStretcher.o: src/StretcherImpl.h +src/RubberBandStretcher.o: rubberband/RubberBandStretcher.h src/dsp/Window.h +src/RubberBandStretcher.o: src/dsp/SincWindow.h src/dsp/FFT.h +src/RubberBandStretcher.o: src/audiocurves/CompoundAudioCurve.h +src/RubberBandStretcher.o: src/dsp/AudioCurveCalculator.h +src/RubberBandStretcher.o: src/audiocurves/PercussiveAudioCurve.h +src/RubberBandStretcher.o: src/audiocurves/HighFrequencyAudioCurve.h +src/RubberBandStretcher.o: src/dsp/SampleFilter.h src/base/RingBuffer.h +src/RubberBandStretcher.o: src/base/Scavenger.h src/system/Thread.h +src/RubberBandStretcher.o: src/system/sysutils.h +src/StretcherProcess.o: src/StretcherImpl.h rubberband/RubberBandStretcher.h +src/StretcherProcess.o: src/dsp/Window.h src/dsp/SincWindow.h src/dsp/FFT.h +src/StretcherProcess.o: src/audiocurves/CompoundAudioCurve.h +src/StretcherProcess.o: src/dsp/AudioCurveCalculator.h +src/StretcherProcess.o: src/audiocurves/PercussiveAudioCurve.h +src/StretcherProcess.o: src/audiocurves/HighFrequencyAudioCurve.h +src/StretcherProcess.o: src/dsp/SampleFilter.h src/base/RingBuffer.h +src/StretcherProcess.o: src/base/Scavenger.h src/system/Thread.h +src/StretcherProcess.o: src/system/sysutils.h src/audiocurves/PercussiveAudioCurve.h +src/StretcherProcess.o: src/audiocurves/HighFrequencyAudioCurve.h +src/StretcherProcess.o: src/audiocurves/ConstantAudioCurve.h src/StretchCalculator.h +src/StretcherProcess.o: src/StretcherChannelData.h src/dsp/Resampler.h +src/StretcherProcess.o: src/base/Profiler.h src/system/VectorOps.h +src/StretcherProcess.o: src/system/sysutils.h +src/StretchCalculator.o: src/StretchCalculator.h src/system/sysutils.h +src/base/Profiler.o: src/base/Profiler.h src/system/sysutils.h +src/dsp/AudioCurveCalculator.o: src/dsp/AudioCurveCalculator.h +src/audiocurves/CompoundAudioCurve.o: src/audiocurves/CompoundAudioCurve.h +src/audiocurves/CompoundAudioCurve.o: src/dsp/AudioCurveCalculator.h +src/audiocurves/CompoundAudioCurve.o: src/audiocurves/PercussiveAudioCurve.h +src/audiocurves/CompoundAudioCurve.o: src/audiocurves/HighFrequencyAudioCurve.h +src/audiocurves/CompoundAudioCurve.o: src/dsp/SampleFilter.h src/dsp/MovingMedian.h +src/audiocurves/SpectralDifferenceAudioCurve.o: src/audiocurves/SpectralDifferenceAudioCurve.h +src/audiocurves/SpectralDifferenceAudioCurve.o: src/dsp/AudioCurveCalculator.h +src/audiocurves/SpectralDifferenceAudioCurve.o: src/dsp/Window.h +src/audiocurves/SpectralDifferenceAudioCurve.o: src/system/sysutils.h +src/audiocurves/SpectralDifferenceAudioCurve.o: src/system/VectorOps.h +src/audiocurves/SpectralDifferenceAudioCurve.o: src/system/sysutils.h +src/audiocurves/HighFrequencyAudioCurve.o: src/audiocurves/HighFrequencyAudioCurve.h +src/audiocurves/HighFrequencyAudioCurve.o: src/dsp/AudioCurveCalculator.h +src/audiocurves/SilentAudioCurve.o: src/audiocurves/SilentAudioCurve.h +src/audiocurves/SilentAudioCurve.o: src/dsp/AudioCurveCalculator.h +src/audiocurves/ConstantAudioCurve.o: src/audiocurves/ConstantAudioCurve.h +src/audiocurves/ConstantAudioCurve.o: src/dsp/AudioCurveCalculator.h +src/audiocurves/PercussiveAudioCurve.o: src/audiocurves/PercussiveAudioCurve.h +src/audiocurves/PercussiveAudioCurve.o: src/dsp/AudioCurveCalculator.h +src/audiocurves/PercussiveAudioCurve.o: src/system/VectorOps.h src/system/sysutils.h +src/dsp/Resampler.o: src/dsp/Resampler.h src/system/sysutils.h +src/dsp/Resampler.o: src/base/Profiler.h +src/dsp/FFT.o: src/dsp/FFT.h src/system/sysutils.h src/system/Thread.h +src/dsp/FFT.o: src/base/Profiler.h src/system/VectorOps.h +src/dsp/FFT.o: src/system/sysutils.h +src/system/Allocators.o: src/system/Allocators.h src/system/VectorOps.h +src/system/Allocators.o: src/system/sysutils.h +src/system/sysutils.o: src/system/sysutils.h +src/system/Thread.o: src/system/Thread.h +src/StretcherChannelData.o: src/StretcherChannelData.h src/StretcherImpl.h +src/StretcherChannelData.o: rubberband/RubberBandStretcher.h src/dsp/Window.h +src/StretcherChannelData.o: src/dsp/SincWindow.h src/dsp/FFT.h +src/StretcherChannelData.o: src/audiocurves/CompoundAudioCurve.h +src/StretcherChannelData.o: src/dsp/AudioCurveCalculator.h +src/StretcherChannelData.o: src/audiocurves/PercussiveAudioCurve.h +src/StretcherChannelData.o: src/audiocurves/HighFrequencyAudioCurve.h +src/StretcherChannelData.o: src/dsp/SampleFilter.h src/base/RingBuffer.h +src/StretcherChannelData.o: src/base/Scavenger.h src/system/Thread.h +src/StretcherChannelData.o: src/system/sysutils.h src/dsp/Resampler.h +src/StretcherChannelData.o: src/system/Allocators.h src/system/VectorOps.h +src/StretcherChannelData.o: src/system/sysutils.h +src/StretcherImpl.o: src/StretcherImpl.h rubberband/RubberBandStretcher.h +src/StretcherImpl.o: src/dsp/Window.h src/dsp/SincWindow.h src/dsp/FFT.h +src/StretcherImpl.o: src/audiocurves/CompoundAudioCurve.h +src/StretcherImpl.o: src/dsp/AudioCurveCalculator.h +src/StretcherImpl.o: src/audiocurves/PercussiveAudioCurve.h +src/StretcherImpl.o: src/audiocurves/HighFrequencyAudioCurve.h src/dsp/SampleFilter.h +src/StretcherImpl.o: src/base/RingBuffer.h src/base/Scavenger.h +src/StretcherImpl.o: src/system/Thread.h src/system/sysutils.h +src/StretcherImpl.o: src/audiocurves/PercussiveAudioCurve.h +src/StretcherImpl.o: src/audiocurves/HighFrequencyAudioCurve.h +src/StretcherImpl.o: src/audiocurves/SpectralDifferenceAudioCurve.h src/dsp/Window.h +src/StretcherImpl.o: src/system/VectorOps.h src/system/sysutils.h +src/StretcherImpl.o: src/audiocurves/SilentAudioCurve.h src/audiocurves/ConstantAudioCurve.h +src/StretcherImpl.o: src/dsp/Resampler.h src/StretchCalculator.h +src/StretcherImpl.o: src/StretcherChannelData.h src/base/Profiler.h +main/main.o: rubberband/RubberBandStretcher.h src/system/sysutils.h +main/main.o: src/base/Profiler.h diff --git a/tools/patch/make/rubberband/configure.ac b/tools/patch/make/rubberband/configure.ac new file mode 100644 index 0000000..80a3fe7 --- /dev/null +++ b/tools/patch/make/rubberband/configure.ac @@ -0,0 +1,35 @@ + +AC_INIT(RubberBand, 1.8.2, chris.cannam@breakfastquay.com) + +AC_CONFIG_SRCDIR(src/StretcherImpl.h) +AC_PROG_CXX +AC_PROG_CC +AC_HEADER_STDC +AC_C_BIGENDIAN + +PKG_CHECK_MODULES([SRC],[samplerate]) +AC_SUBST(SRC_CFLAGS) +AC_SUBST(SRC_LIBS) + +PKG_CHECK_MODULES([SNDFILE],[sndfile]) +AC_SUBST(SNDFILE_CFLAGS) +AC_SUBST(SNDFILE_LIBS) + +AC_CHECK_HEADERS(ladspa.h) +AC_CHECK_HEADERS(pthread.h) + +changequote(,)dnl +if test "x$GCC" = "xyes"; then + case " $CFLAGS " in + *[\ \ ]-fPIC\ -Wall[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -fPIC -Wall" ;; + esac + case " $CXXFLAGS " in + *[\ \ ]-fPIC\ -Wall[\ \ ]*) ;; + *) CXXFLAGS="$CXXFLAGS -fPIC -Wall" ;; + esac +fi +changequote([,])dnl + +AC_OUTPUT([Makefile]) + diff --git a/tools/patch/make/rubberband/rubberband.pc.in b/tools/patch/make/rubberband/rubberband.pc.in new file mode 100644 index 0000000..cfb5302 --- /dev/null +++ b/tools/patch/make/rubberband/rubberband.pc.in @@ -0,0 +1,11 @@ +prefix=%PREFIX% +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: rubberband +Version: 1.8.2 +Description: +Requires: %DEPENDENCIES% +Libs: -L${libdir} -lrubberband +Cflags: -I${includedir} diff --git a/tools/patch/make/sdl/configure.in b/tools/patch/make/sdl/configure.in new file mode 100644 index 0000000..01771fa --- /dev/null +++ b/tools/patch/make/sdl/configure.in @@ -0,0 +1,4197 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(README.txt) +AC_CONFIG_HEADER(include/SDL_config.h) +AC_CONFIG_AUX_DIR(build-scripts) +AC_CONFIG_MACRO_DIR([acinclude]) + +dnl Save the CFLAGS to see whether they were passed in or generated +orig_CFLAGS="$CFLAGS" + +dnl Set various version strings - taken gratefully from the GTk sources +# +# Making releases: +# Edit include/SDL_version.h and change the version, then: +# SDL_MICRO_VERSION += 1; +# SDL_INTERFACE_AGE += 1; +# SDL_BINARY_AGE += 1; +# if any functions have been added, set SDL_INTERFACE_AGE to 0. +# if backwards compatibility has been broken, +# set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0. +# +SDL_MAJOR_VERSION=2 +SDL_MINOR_VERSION=0 +SDL_MICRO_VERSION=8 +SDL_INTERFACE_AGE=0 +SDL_BINARY_AGE=8 +SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION + +AC_SUBST(SDL_MAJOR_VERSION) +AC_SUBST(SDL_MINOR_VERSION) +AC_SUBST(SDL_MICRO_VERSION) +AC_SUBST(SDL_INTERFACE_AGE) +AC_SUBST(SDL_BINARY_AGE) +AC_SUBST(SDL_VERSION) + +# libtool versioning +LT_INIT([win32-dll]) + +LT_RELEASE=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION +LT_CURRENT=`expr $SDL_MICRO_VERSION - $SDL_INTERFACE_AGE` +LT_REVISION=$SDL_INTERFACE_AGE +LT_AGE=`expr $SDL_BINARY_AGE - $SDL_INTERFACE_AGE` +m4_pattern_allow([^LT_]) + +AC_SUBST(LT_RELEASE) +AC_SUBST(LT_CURRENT) +AC_SUBST(LT_REVISION) +AC_SUBST(LT_AGE) + +dnl Detect the canonical build and host environments +dnl AC_CANONICAL_HOST + +dnl Check for tools +AC_PROG_LIBTOOL +AC_PROG_CC +AC_PROG_CXX +AC_PROG_INSTALL +AC_PROG_MAKE_SET +AC_CHECK_TOOL(WINDRES, [windres], [:]) + +dnl Make sure that srcdir is a full pathname +case "$host" in + *-*-mingw32*) + # Except on msys, where make can't handle full pathnames (bug 1972) + ;; + *) + srcdir=`cd $srcdir && pwd` + ;; +esac + +dnl Set up the compiler and linker flags +INCLUDE="-I$srcdir/include -idirafter $srcdir/src/video/khronos" +if test x$srcdir != x.; then + INCLUDE="-Iinclude $INCLUDE" +elif test -d .hg; then + AC_MSG_ERROR([ +*** When building from Mercurial you should configure and build in a + separate directory so you don't clobber SDL_config.h, SDL_revision.h +]) +fi +BASE_CFLAGS="" +BASE_LDFLAGS="" +case "$host" in + *-*-cygwin*) + # We build SDL on cygwin without the UNIX emulation layer + save_CFLAGS="$CFLAGS" + have_no_cygwin=no + AC_MSG_CHECKING(for GCC -mno-cygwin option) + CFLAGS="$save_CFLAGS -mno-cygwin" + + AC_TRY_COMPILE([ + ],[ + ],[ + have_no_cygwin=yes + ]) + AC_MSG_RESULT($have_no_cygwin) + CFLAGS="$save_CFLAGS" + + if test x$have_no_cygwin = xyes; then + BASE_CFLAGS="-mno-cygwin" + BASE_LDFLAGS="-mno-cygwin" + fi + BASE_CFLAGS="$BASE_CFLAGS -I/usr/include/mingw" + ;; +esac +# Uncomment the following line if you want to force SDL and applications +# built with it to be compiled for a particular architecture. +#AX_GCC_ARCHFLAG([no], [BASE_CFLAGS="$BASE_CFLAGS $ax_cv_gcc_archflag]") +BUILD_CFLAGS="$CFLAGS $CPPFLAGS -DUSING_GENERATED_CONFIG_H" +# The default optimization for SDL is -O3 (Bug #31) +if test "x$orig_CFLAGS" = x; then + BUILD_CFLAGS=`echo $BUILD_CFLAGS | sed 's/-O2/-O3/'` +fi +EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS" +BUILD_LDFLAGS="$LDFLAGS" +EXTRA_LDFLAGS="$BASE_LDFLAGS" +## These are common directories to find software packages +#for path in /usr/freeware /usr/pkg /usr/X11R6 /usr/local; do +# if test -d $path/include; then +# EXTRA_CFLAGS="$EXTRA_CFLAGS -I$path/include" +# fi +# if test -d $path/lib; then +# EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$path/lib" +# fi +#done +SDL_CFLAGS="$BASE_CFLAGS" +SDL_LIBS="-lSDL2 $BASE_LDFLAGS" +CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS" +CFLAGS="$CFLAGS $EXTRA_CFLAGS" +LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS" + +dnl set this to use on systems that use lib64 instead of lib +base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'` + +dnl Function to find a library in the compiler search path +find_lib() +{ + gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | fgrep programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`] + gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`] + env_lib_path=[`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'`] + if test "$cross_compiling" = yes; then + host_lib_path="" + else + host_lib_path="/usr/$base_libdir /usr/local/$base_libdir" + fi + for path in $env_lib_path $gcc_bin_path $gcc_lib_path $host_lib_path; do + lib=[`ls -- $path/$1 2>/dev/null | sed -e '/\.so\..*\./d' -e 's,.*/,,' | sort | tail -1`] + if test x$lib != x; then + echo $lib + return + fi + done +} + +dnl Check for compiler characteristics +AC_C_CONST +AC_C_INLINE +AC_C_VOLATILE + +dnl See whether we want assertions for debugging/sanity checking SDL itself. +AC_ARG_ENABLE(assertions, +AC_HELP_STRING([--enable-assertions], + [Enable internal sanity checks (auto/disabled/release/enabled/paranoid) [[default=auto]]]), + , enable_assertions=auto) +case "$enable_assertions" in + auto) # Use optimization settings to determine assertion level + ;; + disabled) + AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 0, [ ]) + ;; + release) + AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 1, [ ]) + ;; + enabled) + AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 2, [ ]) + ;; + paranoid) + AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 3, [ ]) + ;; + *) + AC_MSG_ERROR([*** unknown assertion level. stop.]) + ;; +esac + +dnl See whether we can use gcc style dependency tracking +AC_ARG_ENABLE(dependency-tracking, +AC_HELP_STRING([--enable-dependency-tracking], + [Use gcc -MMD -MT dependency tracking [[default=yes]]]), + , enable_dependency_tracking=yes) +if test x$enable_dependency_tracking = xyes; then + have_gcc_mmd_mt=no + AC_MSG_CHECKING(for GCC -MMD -MT option) + AC_TRY_COMPILE([ + #if !defined(__GNUC__) || __GNUC__ < 3 + #error Dependency tracking requires GCC 3.0 or newer + #endif + ],[ + ],[ + have_gcc_mmd_mt=yes + ]) + AC_MSG_RESULT($have_gcc_mmd_mt) + + if test x$have_gcc_mmd_mt = xyes; then + DEPENDENCY_TRACKING_OPTIONS="-MMD -MT \$@" + fi +fi + +AC_MSG_CHECKING(for linker option --no-undefined) +have_no_undefined=no +case "$host" in + dnl Skip this on platforms where it is just simply busted. + *-*-openbsd*) + ;; + + *) + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -Wl,--no-undefined" + AC_TRY_LINK([ + ],[ + ],[ + have_no_undefined=yes + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--no-undefined" + ]) + LDFLAGS="$save_LDFLAGS" + ;; +esac +AC_MSG_RESULT($have_no_undefined) + +dnl See whether we are allowed to use the system C library +AC_ARG_ENABLE(libc, +AC_HELP_STRING([--enable-libc], [Use the system C library [[default=yes]]]), + , enable_libc=yes) +if test x$enable_libc = xyes; then + AC_DEFINE(HAVE_LIBC, 1, [ ]) + + dnl Check for C library headers + AC_HEADER_STDC + AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h wchar.h inttypes.h stdint.h limits.h ctype.h math.h float.h iconv.h signal.h) + + dnl Check for typedefs, structures, etc. + AC_TYPE_SIZE_T + + dnl Check for defines + AC_CHECK_DEFINE(M_PI, math.h) + + dnl Checks for library functions. + case "$host" in + *-*-cygwin* | *-*-mingw32*) + ;; + *) + AC_FUNC_ALLOCA + ;; + esac + + AC_FUNC_MEMCMP + if test x$ac_cv_func_memcmp_working = xyes; then + AC_DEFINE(HAVE_MEMCMP, 1, [ ]) + fi + AC_FUNC_STRTOD + if test x$ac_cv_func_strtod = xyes; then + AC_DEFINE(HAVE_STRTOD, 1, [ ]) + fi + AC_CHECK_FUNC(mprotect, + AC_TRY_COMPILE([ + #include + #include + ],[ + ],[ + AC_DEFINE(HAVE_MPROTECT, 1, [ ]) + ]), + ) + AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcscmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval poll) + + AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"]) + AC_CHECK_FUNCS(acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf fabs fabsf floor floorf fmod fmodf log logf log10 log10f pow powf scalbn scalbnf sin sinf sqrt sqrtf tan tanf) + + AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"]) + AC_CHECK_FUNCS(iconv) + + AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE([HAVE_SA_SIGACTION], 1, [ ])], ,[#include ]) + + dnl Check for additional non-standard headers + AC_CHECK_HEADERS(libunwind.h) +fi + +dnl AC_CHECK_SIZEOF(void*) + +dnl See whether we can use gcc atomic operations on this architecture +AC_ARG_ENABLE(gcc-atomics, +AC_HELP_STRING([--enable-gcc-atomics], + [Use gcc builtin atomics [[default=yes]]]), + , enable_gcc_atomics=yes) +if test x$enable_gcc_atomics = xyes; then + have_gcc_atomics=no + AC_MSG_CHECKING(for GCC builtin atomic operations) + AC_TRY_LINK([ + ],[ + int a; + void *x, *y, *z; + __sync_lock_test_and_set(&a, 4); + __sync_lock_test_and_set(&x, y); + __sync_fetch_and_add(&a, 1); + __sync_bool_compare_and_swap(&a, 5, 10); + __sync_bool_compare_and_swap(&x, y, z); + ],[ + have_gcc_atomics=yes + ]) + AC_MSG_RESULT($have_gcc_atomics) + + if test x$have_gcc_atomics = xyes; then + AC_DEFINE(HAVE_GCC_ATOMICS, 1, [ ]) + else + # See if we have the minimum operation needed for GCC atomics + AC_TRY_LINK([ + ],[ + int a; + __sync_lock_test_and_set(&a, 1); + __sync_lock_release(&a); + ],[ + have_gcc_sync_lock_test_and_set=yes + ]) + if test x$have_gcc_sync_lock_test_and_set = xyes; then + AC_DEFINE(HAVE_GCC_SYNC_LOCK_TEST_AND_SET, 1, [ ]) + fi + fi +fi + +# Standard C sources +SOURCES="$SOURCES $srcdir/src/*.c" +SOURCES="$SOURCES $srcdir/src/atomic/*.c" +SOURCES="$SOURCES $srcdir/src/audio/*.c" +SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c" +SOURCES="$SOURCES $srcdir/src/dynapi/*.c" +SOURCES="$SOURCES $srcdir/src/events/*.c" +SOURCES="$SOURCES $srcdir/src/file/*.c" +SOURCES="$SOURCES $srcdir/src/haptic/*.c" +SOURCES="$SOURCES $srcdir/src/joystick/*.c" +SOURCES="$SOURCES $srcdir/src/libm/*.c" +SOURCES="$SOURCES $srcdir/src/power/*.c" +#SOURCES="$SOURCES $srcdir/src/filesystem/*.c" +SOURCES="$SOURCES $srcdir/src/render/*.c" +SOURCES="$SOURCES $srcdir/src/render/*/*.c" +SOURCES="$SOURCES $srcdir/src/stdlib/*.c" +SOURCES="$SOURCES $srcdir/src/thread/*.c" +SOURCES="$SOURCES $srcdir/src/timer/*.c" +SOURCES="$SOURCES $srcdir/src/video/*.c" +SOURCES="$SOURCES $srcdir/src/video/yuv2rgb/*.c" + +dnl Enable/disable various subsystems of the SDL library + +AC_ARG_ENABLE(atomic, +AC_HELP_STRING([--enable-atomic], [Enable the atomic operations subsystem [[default=yes]]]), + , enable_atomic=yes) +if test x$enable_atomic != xyes; then + AC_DEFINE(SDL_ATOMIC_DISABLED, 1, [ ]) +else + SUMMARY_modules="${SUMMARY_modules} atomic" +fi +AC_ARG_ENABLE(audio, +AC_HELP_STRING([--enable-audio], [Enable the audio subsystem [[default=yes]]]), + , enable_audio=yes) +if test x$enable_audio != xyes; then + AC_DEFINE(SDL_AUDIO_DISABLED, 1, [ ]) +else + SUMMARY_modules="${SUMMARY_modules} audio" +fi +AC_ARG_ENABLE(video, +AC_HELP_STRING([--enable-video], [Enable the video subsystem [[default=yes]]]), + , enable_video=yes) +if test x$enable_video != xyes; then + AC_DEFINE(SDL_VIDEO_DISABLED, 1, [ ]) +else + SUMMARY_modules="${SUMMARY_modules} video" +fi +AC_ARG_ENABLE(render, +AC_HELP_STRING([--enable-render], [Enable the render subsystem [[default=yes]]]), + , enable_render=yes) +if test x$enable_render != xyes; then + AC_DEFINE(SDL_RENDER_DISABLED, 1, [ ]) +else + SUMMARY_modules="${SUMMARY_modules} render" +fi +AC_ARG_ENABLE(events, +AC_HELP_STRING([--enable-events], [Enable the events subsystem [[default=yes]]]), + , enable_events=yes) +if test x$enable_events != xyes; then + AC_DEFINE(SDL_EVENTS_DISABLED, 1, [ ]) +else + SUMMARY_modules="${SUMMARY_modules} events" +fi +AC_ARG_ENABLE(joystick, +AC_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [[default=yes]]]), + , enable_joystick=yes) +if test x$enable_joystick != xyes; then + AC_DEFINE(SDL_JOYSTICK_DISABLED, 1, [ ]) +else + SUMMARY_modules="${SUMMARY_modules} joystick" +fi +AC_ARG_ENABLE(haptic, +AC_HELP_STRING([--enable-haptic], [Enable the haptic (force feedback) subsystem [[default=yes]]]), + , enable_haptic=yes) +if test x$enable_haptic != xyes; then + AC_DEFINE(SDL_HAPTIC_DISABLED, 1, [ ]) +else + SUMMARY_modules="${SUMMARY_modules} haptic" +fi +AC_ARG_ENABLE(power, +AC_HELP_STRING([--enable-power], [Enable the power subsystem [[default=yes]]]), + , enable_power=yes) +if test x$enable_power != xyes; then + AC_DEFINE(SDL_POWER_DISABLED, 1, [ ]) +else + SUMMARY_modules="${SUMMARY_modules} power" +fi +AC_ARG_ENABLE(filesystem, +AC_HELP_STRING([--enable-filesystem], [Enable the filesystem subsystem [[default=yes]]]), + , enable_filesystem=yes) +if test x$enable_filesystem != xyes; then + AC_DEFINE(SDL_FILESYSTEM_DISABLED, 1, [ ]) +else + SUMMARY_modules="${SUMMARY_modules} filesystem" +fi +AC_ARG_ENABLE(threads, +AC_HELP_STRING([--enable-threads], [Enable the threading subsystem [[default=yes]]]), + , enable_threads=yes) +if test x$enable_threads != xyes; then + AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ]) +else + SUMMARY_modules="${SUMMARY_modules} threads" +fi +AC_ARG_ENABLE(timers, +AC_HELP_STRING([--enable-timers], [Enable the timer subsystem [[default=yes]]]), + , enable_timers=yes) +if test x$enable_timers != xyes; then + AC_DEFINE(SDL_TIMERS_DISABLED, 1, [ ]) +else + SUMMARY_modules="${SUMMARY_modules} timers" +fi +AC_ARG_ENABLE(file, +AC_HELP_STRING([--enable-file], [Enable the file subsystem [[default=yes]]]), + , enable_file=yes) +if test x$enable_file != xyes; then + AC_DEFINE(SDL_FILE_DISABLED, 1, [ ]) +else + SUMMARY_modules="${SUMMARY_modules} file" +fi +AC_ARG_ENABLE(loadso, +AC_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [[default=yes]]]), + , enable_loadso=yes) +if test x$enable_loadso != xyes; then + AC_DEFINE(SDL_LOADSO_DISABLED, 1, [ ]) +else + SUMMARY_modules="${SUMMARY_modules} loadso" +fi +AC_ARG_ENABLE(cpuinfo, +AC_HELP_STRING([--enable-cpuinfo], [Enable the cpuinfo subsystem [[default=yes]]]), + , enable_cpuinfo=yes) +if test x$enable_cpuinfo != xyes; then + AC_DEFINE(SDL_CPUINFO_DISABLED, 1, [ ]) +else + SUMMARY_modules="${SUMMARY_modules} cpuinfo" +fi +AC_ARG_ENABLE(assembly, +AC_HELP_STRING([--enable-assembly], [Enable assembly routines [[default=yes]]]), + , enable_assembly=yes) +if test x$enable_assembly = xyes; then + SUMMARY_modules="${SUMMARY_modules} assembly" + + AC_DEFINE(SDL_ASSEMBLY_ROUTINES, 1, [ ]) + + # Make sure that we don't generate floating point code that would + # cause illegal instruction exceptions on older processors + case "$host" in + *-*-darwin*) + # Don't need to worry about Apple hardware, it's all SSE capable + default_ssemath=yes + ;; + *64-*-*) + # x86 64-bit architectures all have SSE instructions + default_ssemath=yes + ;; + *) + default_ssemath=no + ;; + esac + AC_ARG_ENABLE(ssemath, +AC_HELP_STRING([--enable-ssemath], [Allow GCC to use SSE floating point math [[default=maybe]]]), + , enable_ssemath=$default_ssemath) + if test x$enable_ssemath = xno; then + if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes -o x$have_gcc_sse3 = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -mfpmath=387" + fi + fi + + dnl Check for various instruction support + AC_ARG_ENABLE(mmx, +AC_HELP_STRING([--enable-mmx], [use MMX assembly routines [[default=yes]]]), + , enable_mmx=yes) + if test x$enable_mmx = xyes; then + save_CFLAGS="$CFLAGS" + have_gcc_mmx=no + AC_MSG_CHECKING(for GCC -mmmx option) + mmx_CFLAGS="-mmmx" + CFLAGS="$save_CFLAGS $mmx_CFLAGS" + + AC_TRY_COMPILE([ + #ifdef __MINGW32__ + #include <_mingw.h> + #ifdef __MINGW64_VERSION_MAJOR + #include + #else + #include + #endif + #else + #include + #endif + #ifndef __MMX__ + #error Assembler CPP flag not enabled + #endif + ],[ + ],[ + have_gcc_mmx=yes + ]) + AC_MSG_RESULT($have_gcc_mmx) + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_mmx = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS $mmx_CFLAGS" + SUMMARY_math="${SUMMARY_math} mmx" + fi + fi + + AC_ARG_ENABLE(3dnow, +AC_HELP_STRING([--enable-3dnow], [use 3DNow! assembly routines [[default=yes]]]), + , enable_3dnow=yes) + if test x$enable_3dnow = xyes; then + save_CFLAGS="$CFLAGS" + have_gcc_3dnow=no + AC_MSG_CHECKING(for GCC -m3dnow option) + amd3dnow_CFLAGS="-m3dnow" + CFLAGS="$save_CFLAGS $amd3dnow_CFLAGS" + + AC_TRY_LINK([ + #include + #ifndef __3dNOW__ + #error Assembler CPP flag not enabled + #endif + ],[ + void *p = 0; + _m_prefetch(p); + ],[ + have_gcc_3dnow=yes + ]) + AC_MSG_RESULT($have_gcc_3dnow) + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_3dnow = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS $amd3dnow_CFLAGS" + SUMMARY_math="${SUMMARY_math} 3dnow" + fi + fi + + AC_ARG_ENABLE(sse, +AC_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]), + , enable_sse=yes) + if test x$enable_sse = xyes; then + save_CFLAGS="$CFLAGS" + have_gcc_sse=no + AC_MSG_CHECKING(for GCC -msse option) + sse_CFLAGS="-msse" + CFLAGS="$save_CFLAGS $sse_CFLAGS" + + AC_TRY_COMPILE([ + #ifdef __MINGW32__ + #include <_mingw.h> + #ifdef __MINGW64_VERSION_MAJOR + #include + #else + #include + #endif + #else + #include + #endif + #ifndef __SSE__ + #error Assembler CPP flag not enabled + #endif + ],[ + ],[ + have_gcc_sse=yes + ]) + AC_MSG_RESULT($have_gcc_sse) + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_sse = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS $sse_CFLAGS" + SUMMARY_math="${SUMMARY_math} sse" + fi + fi + + AC_ARG_ENABLE(sse2, +AC_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=maybe]]]), + , enable_sse2=$default_ssemath) + if test x$enable_sse2 = xyes; then + save_CFLAGS="$CFLAGS" + have_gcc_sse2=no + AC_MSG_CHECKING(for GCC -msse2 option) + sse2_CFLAGS="-msse2" + CFLAGS="$save_CFLAGS $sse2_CFLAGS" + + AC_TRY_COMPILE([ + #ifdef __MINGW32__ + #include <_mingw.h> + #ifdef __MINGW64_VERSION_MAJOR + #include + #else + #include + #endif + #else + #include + #endif + #ifndef __SSE2__ + #error Assembler CPP flag not enabled + #endif + ],[ + ],[ + have_gcc_sse2=yes + ]) + AC_MSG_RESULT($have_gcc_sse2) + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_sse2 = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS $sse2_CFLAGS" + SUMMARY_math="${SUMMARY_math} sse2" + fi + fi + + AC_ARG_ENABLE(sse3, +AC_HELP_STRING([--enable-sse3], [use SSE3 assembly routines [[default=maybe]]]), + , enable_sse3=$default_ssemath) + if test x$enable_sse3 = xyes; then + save_CFLAGS="$CFLAGS" + have_gcc_sse3=no + AC_MSG_CHECKING(for GCC -msse3 option) + sse3_CFLAGS="-msse3" + CFLAGS="$save_CFLAGS $sse3_CFLAGS" + + AC_TRY_COMPILE([ + #ifdef __MINGW32__ + #include <_mingw.h> + #ifdef __MINGW64_VERSION_MAJOR + #include + #else + #include + #endif + #else + #include + #endif + #ifndef __SSE2__ + #error Assembler CPP flag not enabled + #endif + ],[ + ],[ + have_gcc_sse3=yes + ]) + AC_MSG_RESULT($have_gcc_sse3) + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_sse3 = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS $sse3_CFLAGS" + SUMMARY_math="${SUMMARY_math} sse3" + fi + fi + + AC_CHECK_HEADER(immintrin.h, + have_immintrin_h_hdr=yes, + have_immintrin_h_hdr=no) + if test x$have_immintrin_h_hdr = xyes; then + AC_DEFINE(HAVE_IMMINTRIN_H, 1, [ ]) + fi + + AC_ARG_ENABLE(altivec, +AC_HELP_STRING([--enable-altivec], [use Altivec assembly routines [[default=yes]]]), + , enable_altivec=yes) + if test x$enable_altivec = xyes; then + save_CFLAGS="$CFLAGS" + have_gcc_altivec=no + have_altivec_h_hdr=no + altivec_CFLAGS="-maltivec" + CFLAGS="$save_CFLAGS $altivec_CFLAGS" + + AC_MSG_CHECKING(for Altivec with GCC altivec.h and -maltivec option) + AC_TRY_COMPILE([ + #include + vector unsigned int vzero() { + return vec_splat_u32(0); + } + ],[ + ],[ + have_gcc_altivec=yes + have_altivec_h_hdr=yes + ]) + AC_MSG_RESULT($have_gcc_altivec) + + if test x$have_gcc_altivec = xno; then + AC_MSG_CHECKING(for Altivec with GCC -maltivec option) + AC_TRY_COMPILE([ + vector unsigned int vzero() { + return vec_splat_u32(0); + } + ],[ + ],[ + have_gcc_altivec=yes + ]) + AC_MSG_RESULT($have_gcc_altivec) + fi + + if test x$have_gcc_altivec = xno; then + AC_MSG_CHECKING(for Altivec with GCC altivec.h and -faltivec option) + altivec_CFLAGS="-faltivec" + CFLAGS="$save_CFLAGS $altivec_CFLAGS" + AC_TRY_COMPILE([ + #include + vector unsigned int vzero() { + return vec_splat_u32(0); + } + ],[ + ],[ + have_gcc_altivec=yes + have_altivec_h_hdr=yes + ]) + AC_MSG_RESULT($have_gcc_altivec) + fi + + if test x$have_gcc_altivec = xno; then + AC_MSG_CHECKING(for Altivec with GCC -faltivec option) + AC_TRY_COMPILE([ + vector unsigned int vzero() { + return vec_splat_u32(0); + } + ],[ + ],[ + have_gcc_altivec=yes + ]) + AC_MSG_RESULT($have_gcc_altivec) + fi + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_altivec = xyes; then + AC_DEFINE(SDL_ALTIVEC_BLITTERS, 1, [ ]) + if test x$have_altivec_h_hdr = xyes; then + AC_DEFINE(HAVE_ALTIVEC_H, 1, [ ]) + fi + EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS" + SUMMARY_math="${SUMMARY_math} altivec" + fi + fi +fi + +dnl See if the OSS audio interface is supported +CheckOSS() +{ + AC_ARG_ENABLE(oss, +AC_HELP_STRING([--enable-oss], [support the OSS audio API [[default=maybe]]]), + , enable_oss=maybe) + + # OpenBSD "has" OSS, but it's not really for app use. They want you to + # use sndio instead. So on there, we default to disabled. You can force + # it on if you really want, though. + if test x$enable_oss = xmaybe; then + enable_oss=yes + case "$host" in + *-*-openbsd*) + enable_oss=no;; + esac + fi + + if test x$enable_audio = xyes -a x$enable_oss = xyes; then + AC_MSG_CHECKING(for OSS audio support) + have_oss=no + if test x$have_oss != xyes; then + AC_TRY_COMPILE([ + #include + ],[ + int arg = SNDCTL_DSP_SETFRAGMENT; + ],[ + have_oss=yes + ]) + fi + if test x$have_oss != xyes; then + AC_TRY_COMPILE([ + #include + ],[ + int arg = SNDCTL_DSP_SETFRAGMENT; + ],[ + have_oss=yes + AC_DEFINE(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H, 1, [ ]) + ]) + fi + AC_MSG_RESULT($have_oss) + if test x$have_oss = xyes; then + SUMMARY_audio="${SUMMARY_audio} oss" + AC_DEFINE(SDL_AUDIO_DRIVER_OSS, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/dsp/*.c" + have_audio=yes + + # We may need to link with ossaudio emulation library + case "$host" in + *-*-openbsd*|*-*-netbsd*) + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";; + esac + fi + fi +} + +dnl See if the ALSA audio interface is supported +CheckALSA() +{ + AC_ARG_ENABLE(alsa, +AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]), + , enable_alsa=yes) + if test x$enable_audio = xyes -a x$enable_alsa = xyes; then + AM_PATH_ALSA(1.0.11, have_alsa=yes, have_alsa=no) + # Restore all flags from before the ALSA detection runs + CFLAGS="$alsa_save_CFLAGS" + LDFLAGS="$alsa_save_LDFLAGS" + LIBS="$alsa_save_LIBS" + if test x$have_alsa = xyes; then + AC_ARG_ENABLE(alsa-shared, +AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[default=yes]]]), + , enable_alsa_shared=yes) + alsa_lib=[`find_lib "libasound.so.*" "$ALSA_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] + + AC_DEFINE(SDL_AUDIO_DRIVER_ALSA, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $ALSA_CFLAGS" + if test x$have_loadso != xyes && \ + test x$enable_alsa_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ALSA loading]) + fi + if test x$have_loadso = xyes && \ + test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then + echo "-- dynamic libasound -> $alsa_lib" + AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ALSA_DYNAMIC, "$alsa_lib", [ ]) + SUMMARY_audio="${SUMMARY_audio} alsa(dynamic)" + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ALSA_LIBS" + SUMMARY_audio="${SUMMARY_audio} alsa" + fi + have_audio=yes + fi + fi +} + +dnl Find JACK Audio +CheckJACK() +{ + AC_ARG_ENABLE(jack, +AC_HELP_STRING([--enable-jack], [use JACK audio [[default=yes]]]), + , enable_jack=yes) + if test x$enable_audio = xyes -a x$enable_jack = xyes; then + audio_jack=no + + JACK_REQUIRED_VERSION=0.125 + + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + AC_MSG_CHECKING(for JACK $JACK_REQUIRED_VERSION support) + if test x$PKG_CONFIG != xno; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $JACK_REQUIRED_VERSION jack; then + JACK_CFLAGS=`$PKG_CONFIG --cflags jack` + JACK_LIBS=`$PKG_CONFIG --libs jack` + audio_jack=yes + fi + fi + AC_MSG_RESULT($audio_jack) + + if test x$audio_jack = xyes; then + AC_ARG_ENABLE(jack-shared, +AC_HELP_STRING([--enable-jack-shared], [dynamically load JACK audio support [[default=yes]]]), + , enable_jack_shared=yes) + jack_lib=[`find_lib "libjack.so.*" "$JACK_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] + + AC_DEFINE(SDL_AUDIO_DRIVER_JACK, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/jack/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $JACK_CFLAGS" + if test x$have_loadso != xyes && \ + test x$enable_jack_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic JACK audio loading]) + fi + if test x$have_loadso = xyes && \ + test x$enable_jack_shared = xyes && test x$jack_lib != x; then + echo "-- dynamic libjack -> $jack_lib" + AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_JACK_DYNAMIC, "$jack_lib", [ ]) + SUMMARY_audio="${SUMMARY_audio} jack(dynamic)" + + case "$host" in + # On Solaris, jack must be linked deferred explicitly + # to prevent undefined symbol failures. + *-*-solaris*) + JACK_LIBS=`echo $JACK_LIBS | sed 's/\-l/-Wl,-l/g'` + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-zdeferred $JACK_LIBS -Wl,-znodeferred" + esac + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $JACK_LIBS" + SUMMARY_audio="${SUMMARY_audio} jack" + fi + have_audio=yes + fi + fi +} + +dnl Find the ESD includes and libraries +CheckESD() +{ + AC_ARG_ENABLE(esd, +AC_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [[default=yes]]]), + , enable_esd=yes) + if test x$enable_audio = xyes -a x$enable_esd = xyes; then + AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no) + if test x$have_esd = xyes; then + AC_ARG_ENABLE(esd-shared, +AC_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [[default=yes]]]), + , enable_esd_shared=yes) + esd_lib=[`find_lib "libesd.so.*" "$ESD_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] + + AC_DEFINE(SDL_AUDIO_DRIVER_ESD, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/esd/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS" + if test x$have_loadso != xyes && \ + test x$enable_esd_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ESD loading]) + fi + if test x$have_loadso = xyes && \ + test x$enable_esd_shared = xyes && test x$esd_lib != x; then + echo "-- dynamic libesd -> $esd_lib" + AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ESD_DYNAMIC, "$esd_lib", [ ]) + SUMMARY_audio="${SUMMARY_audio} esd(dynamic)" + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS" + SUMMARY_audio="${SUMMARY_audio} esd" + fi + have_audio=yes + fi + fi +} + +dnl Find PulseAudio +CheckPulseAudio() +{ + AC_ARG_ENABLE(pulseaudio, +AC_HELP_STRING([--enable-pulseaudio], [use PulseAudio [[default=yes]]]), + , enable_pulseaudio=yes) + if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then + audio_pulseaudio=no + + PULSEAUDIO_REQUIRED_VERSION=0.9 + + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + AC_MSG_CHECKING(for PulseAudio $PULSEAUDIO_REQUIRED_VERSION support) + if test x$PKG_CONFIG != xno; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSEAUDIO_REQUIRED_VERSION libpulse-simple; then + PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple` + PULSEAUDIO_LIBS=`$PKG_CONFIG --libs libpulse-simple` + audio_pulseaudio=yes + fi + fi + AC_MSG_RESULT($audio_pulseaudio) + + if test x$audio_pulseaudio = xyes; then + AC_ARG_ENABLE(pulseaudio-shared, +AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]), + , enable_pulseaudio_shared=yes) + pulseaudio_lib=[`find_lib "libpulse-simple.so.*" "$PULSEAUDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] + + AC_DEFINE(SDL_AUDIO_DRIVER_PULSEAUDIO, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/pulseaudio/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSEAUDIO_CFLAGS" + if test x$have_loadso != xyes && \ + test x$enable_pulseaudio_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic PulseAudio loading]) + fi + if test x$have_loadso = xyes && \ + test x$enable_pulseaudio_shared = xyes && test x$pulseaudio_lib != x; then + echo "-- dynamic libpulse-simple -> $pulseaudio_lib" + AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC, "$pulseaudio_lib", [ ]) + SUMMARY_audio="${SUMMARY_audio} pulse(dynamic)" + + case "$host" in + # On Solaris, pulseaudio must be linked deferred explicitly + # to prevent undefined symbol failures. + *-*-solaris*) + PULSEAUDIO_LIBS=`echo $PULSEAUDIO_LIBS | sed 's/\-l/-Wl,-l/g'` + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-zdeferred $PULSEAUDIO_LIBS -Wl,-znodeferred" + esac + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PULSEAUDIO_LIBS" + SUMMARY_audio="${SUMMARY_audio} pulse" + fi + have_audio=yes + fi + fi +} + +CheckARTSC() +{ + AC_ARG_ENABLE(arts, +AC_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [[default=yes]]]), + , enable_arts=yes) + if test x$enable_audio = xyes -a x$enable_arts = xyes; then + AC_PATH_PROG(ARTSCONFIG, artsc-config) + if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then + : # arts isn't installed + else + ARTS_CFLAGS=`$ARTSCONFIG --cflags` + ARTS_LIBS=`$ARTSCONFIG --libs` + AC_MSG_CHECKING(for aRts development environment) + audio_arts=no + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $ARTS_CFLAGS" + AC_TRY_COMPILE([ + #include + ],[ + arts_stream_t stream; + ],[ + audio_arts=yes + ]) + CFLAGS="$save_CFLAGS" + AC_MSG_RESULT($audio_arts) + if test x$audio_arts = xyes; then + AC_ARG_ENABLE(arts-shared, +AC_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [[default=yes]]]), + , enable_arts_shared=yes) + arts_lib=[`find_lib "libartsc.so.*" "$ARTS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] + + AC_DEFINE(SDL_AUDIO_DRIVER_ARTS, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/arts/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS" + if test x$have_loadso != xyes && \ + test x$enable_arts_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ARTS loading]) + fi + if test x$have_loadso = xyes && \ + test x$enable_arts_shared = xyes && test x$arts_lib != x; then + echo "-- dynamic libartsc -> $arts_lib" + AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib", [ ]) + SUMMARY_audio="${SUMMARY_audio} arts(dynamic)" + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS" + SUMMARY_audio="${SUMMARY_audio} arts" + fi + have_audio=yes + fi + fi + fi +} + +dnl See if the NAS audio interface is supported +CheckNAS() +{ + AC_ARG_ENABLE(nas, +AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]), + , enable_nas=yes) + if test x$enable_audio = xyes -a x$enable_nas = xyes; then + AC_CHECK_HEADER(audio/audiolib.h, have_nas_hdr=yes) + AC_CHECK_LIB(audio, AuOpenServer, have_nas_lib=yes) + + AC_MSG_CHECKING(for NAS audio support) + have_nas=no + + if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then + have_nas=yes + NAS_LIBS="-laudio" + + elif test -r /usr/X11R6/include/audio/audiolib.h; then + have_nas=yes + NAS_CFLAGS="-I/usr/X11R6/include/" + NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt" + + fi + + AC_MSG_RESULT($have_nas) + + if test x$have_nas = xyes; then + AC_ARG_ENABLE(nas-shared, +AC_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]), + , enable_nas_shared=yes) + nas_lib=[`find_lib "libaudio.so.*" "$NAS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] + + if test x$have_loadso != xyes && \ + test x$enable_nas_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading]) + fi + if test x$have_loadso = xyes && \ + test x$enable_nas_shared = xyes && test x$nas_lib != x; then + echo "-- dynamic libaudio -> $nas_lib" + AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_NAS_DYNAMIC, "$nas_lib", [ ]) + SUMMARY_audio="${SUMMARY_audio} nas(dynamic)" + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS" + SUMMARY_audio="${SUMMARY_audio} nas" + fi + + AC_DEFINE(SDL_AUDIO_DRIVER_NAS, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/nas/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS" + have_audio=yes + fi + fi +} + +dnl See if the sndio audio interface is supported +CheckSNDIO() +{ + AC_ARG_ENABLE(sndio, +AC_HELP_STRING([--enable-sndio], [support the sndio audio API [[default=yes]]]), + , enable_sndio=yes) + if test x$enable_audio = xyes -a x$enable_sndio = xyes; then + AC_CHECK_HEADER(sndio.h, have_sndio_hdr=yes) + AC_CHECK_LIB(sndio, sio_open, have_sndio_lib=yes) + + AC_MSG_CHECKING(for sndio audio support) + have_sndio=no + + if test x$have_sndio_hdr = xyes -a x$have_sndio_lib = xyes; then + have_sndio=yes + SNDIO_LIBS="-lsndio" + fi + + AC_MSG_RESULT($have_sndio) + + if test x$have_sndio = xyes; then + AC_ARG_ENABLE(sndio-shared, +AC_HELP_STRING([--enable-sndio-shared], [dynamically load sndio audio support [[default=yes]]]), + , enable_sndio_shared=yes) + sndio_lib=[`find_lib "libsndio.so.*" "$SNDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] + + if test x$have_loadso != xyes && \ + test x$enable_sndio_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic sndio loading]) + fi + if test x$have_loadso = xyes && \ + test x$enable_sndio_shared = xyes && test x$sndio_lib != x; then + echo "-- dynamic libsndio -> $sndio_lib" + AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC, "$sndio_lib", [ ]) + SUMMARY_audio="${SUMMARY_audio} sndio(dynamic)" + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SNDIO_LIBS" + SUMMARY_audio="${SUMMARY_audio} sndio" + fi + + AC_DEFINE(SDL_AUDIO_DRIVER_SNDIO, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/sndio/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $SNDIO_CFLAGS" + have_audio=yes + fi + fi +} + +dnl Find FusionSound +CheckFusionSound() +{ + AC_ARG_ENABLE(fusionsound, +AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]), + , enable_fusionsound=no) + if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then + fusionsound=no + + FUSIONSOUND_REQUIRED_VERSION=1.1.1 + + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + AC_MSG_CHECKING(for FusionSound $FUSIONSOUND_REQUIRED_VERSION support) + if test x$PKG_CONFIG != xno; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then + FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound` + FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound` + fusionsound=yes + fi + fi + AC_MSG_RESULT($fusionsound) + + if test x$fusionsound = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS" + + AC_ARG_ENABLE(fusionsound-shared, +AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]), + , enable_fusionsound_shared=yes) + fusionsound_shared=no + AC_MSG_CHECKING(for FusionSound dynamic loading support) + if test x$have_loadso != xyes && \ + test x$enable_fusionsound_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading]) + fi + if test x$have_loadso = xyes && \ + test x$enable_fusionsound_shared = xyes; then + AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so", [ ]) + fusionsound_shared=yes + SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)" + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS" + SUMMARY_audio="${SUMMARY_audio} fusionsound" + fi + AC_MSG_RESULT($fusionsound_shared) + + have_audio=yes + fi + fi +} + +dnl rcg07142001 See if the user wants the disk writer audio driver... +CheckDiskAudio() +{ + AC_ARG_ENABLE(diskaudio, +AC_HELP_STRING([--enable-diskaudio], [support the disk writer audio driver [[default=yes]]]), + , enable_diskaudio=yes) + if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_DISK, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/disk/*.c" + SUMMARY_audio="${SUMMARY_audio} disk" + fi +} + +dnl rcg03142006 See if the user wants the dummy audio driver... +CheckDummyAudio() +{ + AC_ARG_ENABLE(dummyaudio, +AC_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [[default=yes]]]), + , enable_dummyaudio=yes) + if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c" + SUMMARY_audio="${SUMMARY_audio} dummy" + fi +} + +dnl See if libsamplerate is available +CheckLibSampleRate() +{ + AC_ARG_ENABLE(libsamplerate, +AC_HELP_STRING([--enable-libsamplerate], [use libsamplerate for audio rate conversion [[default=yes]]]), + , enable_libsamplerate=yes) + if test x$enable_libsamplerate = xyes; then + AC_CHECK_HEADER(samplerate.h, + have_samplerate_h_hdr=yes, + have_samplerate_h_hdr=no) + if test x$have_samplerate_h_hdr = xyes; then + AC_DEFINE(HAVE_LIBSAMPLERATE_H, 1, [ ]) + + AC_ARG_ENABLE(libsamplerate-shared, +AC_HELP_STRING([--enable-libsamplerate-shared], [dynamically load libsamplerate [[default=yes]]]), + , enable_libsamplerate_shared=yes) + + samplerate_lib=[`find_lib "libsamplerate.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`] + + if test x$have_loadso != xyes && \ + test x$enable_libsamplerate_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic libsamplerate loading]) + fi + if test x$have_loadso = xyes && \ + test x$enable_libsamplerate_shared = xyes && test x$samplerate_lib != x; then + echo "-- dynamic libsamplerate -> $samplerate_lib" + AC_DEFINE_UNQUOTED(SDL_LIBSAMPLERATE_DYNAMIC, "$samplerate_lib", [ ]) + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lsamplerate" + fi + fi + fi +} + +dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually). +dnl Details of this flag are here: http://gcc.gnu.org/wiki/Visibility +CheckVisibilityHidden() +{ + AC_MSG_CHECKING(for GCC -fvisibility=hidden option) + have_gcc_fvisibility=no + + visibility_CFLAGS="-fvisibility=hidden" + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS $visibility_CFLAGS -Werror" + AC_TRY_COMPILE([ + #if !defined(__GNUC__) || __GNUC__ < 4 + #error SDL only uses visibility attributes in GCC 4 or newer + #endif + ],[ + ],[ + have_gcc_fvisibility=yes + ]) + AC_MSG_RESULT($have_gcc_fvisibility) + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_fvisibility = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS $visibility_CFLAGS" + fi +} + +dnl See if GCC's -mpreferred-stack-boundary is supported. +dnl Reference: http://bugzilla.libsdl.org/show_bug.cgi?id=1296 +CheckStackBoundary() +{ + AC_MSG_CHECKING(for GCC -mpreferred-stack-boundary option) + have_gcc_preferred_stack_boundary=no + + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS -mpreferred-stack-boundary=2" + AC_TRY_COMPILE([ + int x = 0; + ],[ + ],[ + have_gcc_preferred_stack_boundary=yes + ]) + AC_MSG_RESULT($have_gcc_preferred_stack_boundary) + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_preferred_stack_boundary = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -mpreferred-stack-boundary=2" + fi +} + +dnl See if GCC's -Wdeclaration-after-statement is supported. +dnl This lets us catch things that would fail on a C89 compiler when using +dnl a modern GCC. +CheckDeclarationAfterStatement() +{ + AC_MSG_CHECKING(for GCC -Wdeclaration-after-statement option) + have_gcc_declaration_after_statement=no + + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement" + AC_TRY_COMPILE([ + int x = 0; + ],[ + ],[ + have_gcc_declaration_after_statement=yes + ]) + AC_MSG_RESULT($have_gcc_declaration_after_statement) + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_declaration_after_statement = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement" + fi +} + +dnl See if GCC's -Wall is supported. +CheckWarnAll() +{ + AC_MSG_CHECKING(for GCC -Wall option) + have_gcc_Wall=no + + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS -Wall" + AC_TRY_COMPILE([ + int x = 0; + ],[ + ],[ + have_gcc_Wall=yes + ]) + AC_MSG_RESULT($have_gcc_Wall) + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_Wall = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall" + + dnl Haiku headers use multicharacter constants all over the place. Ignore these warnings when using -Wall. + AC_MSG_CHECKING(for necessary GCC -Wno-multichar option) + need_gcc_Wno_multichar=no + case "$host" in + *-*-haiku*) + need_gcc_Wno_multichar=yes + ;; + esac + AC_MSG_RESULT($need_gcc_Wno_multichar) + if test x$need_gcc_Wno_multichar = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-multichar" + fi + fi +} + +dnl Check for Wayland +CheckWayland() +{ + AC_ARG_ENABLE(video-wayland, +AC_HELP_STRING([--enable-video-wayland], [use Wayland video driver [[default=yes]]]), + ,enable_video_wayland=yes) + + AC_ARG_ENABLE(video-wayland-qt-touch, +AC_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for Wayland video driver [[default=yes]]]), + ,enable_video_wayland_qt_touch=yes) + + if test x$enable_video = xyes -a x$enable_video_wayland = xyes; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + AC_MSG_CHECKING(for Wayland support) + video_wayland=no + if test x$PKG_CONFIG != xno && \ + test x$video_opengl_egl = xyes && \ + test x$video_opengles_v2 = xyes; then + if $PKG_CONFIG --exists wayland-client wayland-scanner wayland-protocols wayland-egl wayland-cursor egl xkbcommon ; then + WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon` + WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon` + WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner` + WAYLAND_CORE_PROTOCOL_DIR=`$PKG_CONFIG --variable=pkgdatadir wayland-client` + WAYLAND_PROTOCOLS_DIR=`$PKG_CONFIG --variable=pkgdatadir wayland-protocols` + video_wayland=yes + fi + fi + AC_MSG_RESULT($video_wayland) + + if test x$video_wayland = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_WAYLAND, 1, [ ]) + if test x$enable_video_wayland_qt_touch = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH, 1, [ ]) + fi + + WAYLAND_PROTOCOLS_UNSTABLE="relative-pointer-unstable-v1 pointer-constraints-unstable-v1 xdg-shell-unstable-v6" + + SOURCES="$SOURCES $srcdir/src/video/wayland/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS -I\$(gen)" + AC_ARG_ENABLE(wayland-shared, +AC_HELP_STRING([--enable-wayland-shared], [dynamically load Wayland support [[default=maybe]]]), + , enable_wayland_shared=maybe) + + dnl FIXME: Do BSD and OS X need special cases? + case "$host" in + *) + wayland_client_lib=[`find_lib "libwayland-client.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] + wayland_egl_lib=[`find_lib "libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] + if test x$wayland_egl_lib = x; then + dnl This works in Ubuntu 13.10, maybe others + wayland_egl_lib=[`find_lib "mesa-egl/libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] + fi + wayland_cursor_lib=[`find_lib "libwayland-cursor.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] + xkbcommon_lib=[`find_lib "libxkbcommon.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] + ;; + esac + + if test x$enable_wayland_shared = xmaybe; then + enable_wayland_shared=yes + fi + if test x$have_loadso != xyes && \ + test x$enable_wayland_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic Wayland loading]) + enable_wayland_shared=no + fi + if test x$have_loadso = xyes && \ + test x$enable_wayland_shared = xyes && \ + test x$wayland_client_lib != x && \ + test x$wayland_egl_lib != x && \ + test x$wayland_cursor_lib != x && \ + test x$xkbcommon_lib != x; then + echo "-- dynamic libwayland-client -> $wayland_client_lib" + echo "-- dynamic libwayland-egl -> $wayland_egl_lib" + echo "-- dynamic libwayland-cursor -> $wayland_cursor_lib" + echo "-- dynamic libxkbcommon -> $xkbcommon_lib" + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC, "$wayland_client_lib", [ ]) + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL, "$wayland_egl_lib", [ ]) + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR, "$wayland_cursor_lib", [ ]) + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON, "$xkbcommon_lib", [ ]) + SUMMARY_video="${SUMMARY_video} wayland(dynamic)" + else + enable_wayland_shared=no + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $WAYLAND_LIBS" + SUMMARY_video="${SUMMARY_video} wayland" + fi + have_video=yes + fi + fi +} + +dnl Check for Mir +CheckMir() +{ + AC_ARG_ENABLE(video-mir, +AC_HELP_STRING([--enable-video-mir], [use Mir video driver [[default=no]]]), + ,enable_video_mir=no) + + if test x$enable_video = xyes -a x$enable_video_mir = xyes; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + AC_MSG_CHECKING(for Mir support) + video_mir=no + if test x$PKG_CONFIG != xno; then + if $PKG_CONFIG --exists mirclient egl xkbcommon ; then + MIR_CFLAGS=`$PKG_CONFIG --cflags mirclient egl xkbcommon` + MIR_LIBS=`$PKG_CONFIG --libs mirclient egl xkbcommon` + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS $MIR_CFLAGS" + + dnl This will disable Mir if >= v0.26 is not available + AC_TRY_COMPILE([ + #include + ],[ + MirWindowAttrib attrib = mir_window_attrib_state + ],[ + video_mir=yes + ]) + CFLAGS="$save_CFLAGS" + fi + fi + AC_MSG_RESULT($video_mir) + + if test x$video_mir = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_MIR, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/video/mir/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $MIR_CFLAGS" + AC_ARG_ENABLE(mir-shared, +AC_HELP_STRING([--enable-mir-shared], [dynamically load Mir support [[default=maybe]]]), + , enable_mir_shared=maybe) + + dnl FIXME: Do BSD and OS X need special cases? + case "$host" in + *) + mirclient_lib=[`find_lib "libmirclient.so.*" "$MIR_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] + xkbcommon_lib=[`find_lib "libxkbcommon.so.*" "$MIR_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] + ;; + esac + + if test x$enable_mir_shared = xmaybe; then + enable_mir_shared=yes + fi + if test x$have_loadso != xyes && \ + test x$enable_mir_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic Mir loading]) + enable_mir_shared=no + fi + if test x$have_loadso = xyes && \ + test x$enable_mir_shared = xyes && \ + test x$mirclient_lib != x && \ + test x$xkbcommon_lib != x; then + echo "-- dynamic libmirclient -> $mirclient_lib" + echo "-- dynamic libxkbcommon -> $xkbcommon_lib" + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_MIR_DYNAMIC, "$mirclient_lib", [ ]) + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON, "$xkbcommon_lib", [ ]) + SUMMARY_video="${SUMMARY_video} mir(dynamic)" + else + enable_mir_shared=no + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MIR_LIBS" + SUMMARY_video="${SUMMARY_video} mir" + fi + have_video=yes + fi + fi +} + +dnl Check for Native Client stuff +CheckNativeClient() +{ + AC_TRY_COMPILE([ + #if !defined(__native_client__) + #error "NO NACL" + #endif + ],[ + ],[ + AC_DEFINE(SDL_VIDEO_DRIVER_NACL, 1, [ ]) + AC_DEFINE(SDL_AUDIO_DRIVER_NACL, 1, [ ]) + AC_DEFINE(HAVE_POW, 1, [ ]) + AC_DEFINE(HAVE_OPENGLES2, 1, [ ]) + AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ]) + AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ]) + + SDL_LIBS="-lppapi_simple -lppapi_gles2 $SDL_LIBS" + + SDLMAIN_SOURCES="$srcdir/src/main/nacl/*.c" + SOURCES="$SOURCES $srcdir/src/audio/nacl/*.c" + SUMMARY_audio="${SUMMARY_audio} nacl" + SOURCES="$SOURCES $srcdir/src/video/nacl/*.c" + SUMMARY_video="${SUMMARY_video} nacl opengles2" + ]) +} + + +CheckRPI() +{ + AC_ARG_ENABLE(video-rpi, +AC_HELP_STRING([--enable-video-rpi], [use Raspberry Pi video driver [[default=yes]]]), + , enable_video_rpi=yes) + if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + if test x$PKG_CONFIG != xno && $PKG_CONFIG --exists bcm_host; then + RPI_CFLAGS=`$PKG_CONFIG --cflags bcm_host brcmegl` + RPI_LDFLAGS=`$PKG_CONFIG --libs bcm_host brcmegl` + elif test x$ARCH = xnetbsd; then + RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux" + RPI_LDFLAGS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host" + else + RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux" + RPI_LDFLAGS="-Wl,-rpath,/opt/vc/lib -L/opt/vc/lib -lbcm_host" + fi + + # Save the original compiler flags and libraries + ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS" + + # Add the Raspberry Pi compiler flags and libraries + CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_LDFLAGS" + + AC_MSG_CHECKING(for Raspberry Pi) + have_video_rpi=no + AC_TRY_LINK([ + #include + ],[ + bcm_host_init(); + ],[ + have_video_rpi=yes + ],[ + ]) + AC_MSG_RESULT($have_video_rpi) + + # Restore the compiler flags and libraries + CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs" + + if test x$have_video_rpi = xyes; then + CFLAGS="$CFLAGS $RPI_CFLAGS" + SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS" + EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LDFLAGS" + SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c" + AC_DEFINE(SDL_VIDEO_DRIVER_RPI, 1, [ ]) + SUMMARY_video="${SUMMARY_video} rpi" + fi + fi +} + +dnl Find the X11 include and library directories +CheckX11() +{ + AC_ARG_ENABLE(video-x11, +AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]), + , enable_video_x11=yes) + if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then + case "$host" in + *-*-darwin*) + # This isn't necessary for X11, but fixes GLX detection + if test "x$x_includes" = xNONE && \ + test "x$x_libraries" = xNONE && \ + test -d /usr/X11R6/include && \ + test -d /usr/X11R6/lib; then + x_includes="/usr/X11R6/include" + x_libraries="/usr/X11R6/lib" + fi + ;; + esac + AC_PATH_X + AC_PATH_XTRA + if test x$have_x = xyes; then + AC_ARG_ENABLE(x11-shared, +AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=maybe]]]), + , enable_x11_shared=maybe) + + case "$host" in + *-*-darwin*) + x11_lib='/usr/X11R6/lib/libX11.6.dylib' + x11ext_lib='/usr/X11R6/lib/libXext.6.dylib' + xcursor_lib='/usr/X11R6/lib/libXcursor.1.dylib' + xinerama_lib='/usr/X11R6/lib/libXinerama.1.dylib' + xinput_lib='/usr/X11R6/lib/libXi.6.dylib' + xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib' + xrender_lib='/usr/X11R6/lib/libXrender.1.dylib' + xss_lib='/usr/X11R6/lib/libXss.1.dylib' + xvidmode_lib='/usr/X11R6/lib/libXxf86vm.1.dylib' + ;; + *-*-openbsd*) + x11_lib='libX11.so' + x11ext_lib='libXext.so' + xcursor_lib='libXcursor.so' + xinerama_lib='libXinerama.so' + xinput_lib='libXi.so' + xrandr_lib='libXrandr.so' + xrender_lib='libXrender.so' + xss_lib='libXss.so' + xvidmode_lib='libXxf86vm.so' + ;; + *) + x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] + x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] + xcursor_lib=[`find_lib "libXcursor.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] + xinerama_lib=[`find_lib "libXinerama.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] + xinput_lib=[`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] + xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] + xrender_lib=[`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] + xss_lib=[`find_lib "libXss.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] + xvidmode_lib=[`find_lib "libXxf86vm.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] + ;; + esac + + if test x$ac_cv_func_shmat != xyes; then + X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY" + fi + CFLAGS="$CFLAGS $X_CFLAGS" + LDFLAGS="$LDFLAGS $X_LIBS" + + AC_CHECK_HEADER(X11/extensions/Xext.h, + have_xext_h_hdr=yes, + have_xext_h_hdr=no, + [#include + #include + ]) + if test x$have_xext_h_hdr != xyes; then + AC_MSG_ERROR([ +*** Missing Xext.h, maybe you need to install the libxext-dev package? + ]) + fi + + AC_DEFINE(SDL_VIDEO_DRIVER_X11, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/video/x11/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS" + + # Needed so SDL applications can include SDL_syswm.h + SDL_CFLAGS="$SDL_CFLAGS $X_CFLAGS" + + if test x$enable_x11_shared = xmaybe; then + enable_x11_shared=yes + fi + if test x$have_loadso != xyes && \ + test x$enable_x11_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading]) + enable_x11_shared=no + fi + if test x$have_loadso = xyes && \ + test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then + echo "-- dynamic libX11 -> $x11_lib" + echo "-- dynamic libX11ext -> $x11ext_lib" + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib", [ ]) + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib", [ ]) + SUMMARY_video="${SUMMARY_video} x11(dynamic)" + else + enable_x11_shared=no + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext" + SUMMARY_video="${SUMMARY_video} x11" + fi + have_video=yes + + AC_MSG_CHECKING(for const parameter to XextAddDisplay) + have_const_param_XextAddDisplay=no + AC_TRY_COMPILE([ + #include + #include + #include + #include + extern XExtDisplayInfo* XextAddDisplay(XExtensionInfo* a,Display* b,_Xconst char* c,XExtensionHooks* d,int e,XPointer f); + ],[ + ],[ + have_const_param_XextAddDisplay=yes + AC_DEFINE([SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY], 1, [ ]) + ]) + AC_MSG_RESULT($have_const_param_XextAddDisplay) + + dnl AC_CHECK_LIB(X11, XGetEventData, AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS, 1, [Have XGenericEvent])) + AC_MSG_CHECKING([for XGenericEvent]) + have_XGenericEvent=no + AC_TRY_COMPILE([ + #include + ],[ +Display *display; +XEvent event; +XGenericEventCookie *cookie = &event.xcookie; +XNextEvent(display, &event); +XGetEventData(display, cookie); +XFreeEventData(display, cookie); + ],[ + have_XGenericEvent=yes + AC_DEFINE([SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS], 1, [ ]) + ]) + AC_MSG_RESULT($have_XGenericEvent) + + AC_CHECK_LIB(X11, XkbKeycodeToKeysym, AC_DEFINE(SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM, 1, [Have XkbKeycodeToKeysym])) + + AC_ARG_ENABLE(video-x11-xcursor, +AC_HELP_STRING([--enable-video-x11-xcursor], [enable X11 Xcursor support [[default=yes]]]), + , enable_video_x11_xcursor=yes) + if test x$enable_video_x11_xcursor = xyes; then + definitely_enable_video_x11_xcursor=no + AC_CHECK_HEADER(X11/Xcursor/Xcursor.h, + have_xcursor_h_hdr=yes, + have_xcursor_h_hdr=no, + [#include + ]) + if test x$have_xcursor_h_hdr = xyes; then + if test x$enable_x11_shared = xyes && test x$xcursor_lib != x ; then + echo "-- dynamic libXcursor -> $xcursor_lib" + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR, "$xcursor_lib", [ ]) + definitely_enable_video_x11_xcursor=yes + else + AC_CHECK_LIB(Xcursor, XcursorImageCreate, have_xcursor_lib=yes) + if test x$have_xcursor_lib = xyes ; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXcursor" + definitely_enable_video_x11_xcursor=yes + fi + fi + fi + fi + if test x$definitely_enable_video_x11_xcursor = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_X11_XCURSOR, 1, [ ]) + SUMMARY_video_x11="${SUMMARY_video_x11} xcursor" + fi + AC_ARG_ENABLE(video-x11-xdbe, +AC_HELP_STRING([--enable-video-x11-xdbe], [enable X11 Xdbe support [[default=yes]]]), + , enable_video_x11_xdbe=yes) + if test x$enable_video_x11_xdbe = xyes; then + AC_CHECK_HEADER(X11/extensions/Xdbe.h, + have_dbe_h_hdr=yes, + have_dbe_h_hdr=no, + [#include + ]) + if test x$have_dbe_h_hdr = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_X11_XDBE, 1, [ ]) + SUMMARY_video_x11="${SUMMARY_video_x11} xdbe" + fi + fi + AC_ARG_ENABLE(video-x11-xinerama, +AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]), + , enable_video_x11_xinerama=yes) + if test x$enable_video_x11_xinerama = xyes; then + definitely_enable_video_x11_xinerama=no + AC_CHECK_HEADER(X11/extensions/Xinerama.h, + have_xinerama_h_hdr=yes, + have_xinerama_h_hdr=no, + [#include + ]) + if test x$have_xinerama_h_hdr = xyes; then + if test x$enable_x11_shared = xyes && test x$xinerama_lib != x ; then + echo "-- dynamic libXinerama -> $xinerama_lib" + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA, "$xinerama_lib", [ ]) + definitely_enable_video_x11_xinerama=yes + else + AC_CHECK_LIB(Xinerama, XineramaQueryExtension, have_xinerama_lib=yes) + if test x$have_xinerama_lib = xyes ; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXinerama" + definitely_enable_video_x11_xinerama=yes + fi + fi + fi + fi + if test x$definitely_enable_video_x11_xinerama = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA, 1, [ ]) + SUMMARY_video_x11="${SUMMARY_video_x11} xinerama" + fi + AC_ARG_ENABLE(video-x11-xinput, +AC_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for manymouse, tablets, etc [[default=yes]]]), + , enable_video_x11_xinput=yes) + if test x$enable_video_x11_xinput = xyes; then + definitely_enable_video_x11_xinput=no + AC_CHECK_HEADER(X11/extensions/XInput2.h, + have_xinput_h_hdr=yes, + have_xinput_h_hdr=no, + [#include + ]) + if test x$have_xinput_h_hdr = xyes; then + if test x$enable_x11_shared = xyes && test x$xinput_lib != x ; then + echo "-- dynamic libXi -> $xinput_lib" + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2, "$xinput_lib", [ ]) + definitely_enable_video_x11_xinput=yes + else + AC_CHECK_LIB(Xi, XOpenDevice, have_xinput_lib=yes) + if test x$have_xinput_lib = xyes ; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXi" + definitely_enable_video_x11_xinput=yes + fi + fi + fi + fi + if test x$definitely_enable_video_x11_xinput = xyes; then + SUMMARY_video_x11="${SUMMARY_video_x11} xinput2" + AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2, 1, [ ]) + AC_MSG_CHECKING(for xinput2 multitouch) + have_xinput2_multitouch=no + AC_TRY_COMPILE([ + #include + #include + #include + ],[ +int event_type = XI_TouchBegin; +XITouchClassInfo *t; + ],[ + have_xinput2_multitouch=yes + AC_DEFINE([SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH], 1, []) + SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch" + ]) + AC_MSG_RESULT($have_xinput2_multitouch) + fi + AC_ARG_ENABLE(video-x11-xrandr, +AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]), + , enable_video_x11_xrandr=yes) + if test x$enable_video_x11_xrandr = xyes; then + dnl XRRScreenResources is only present in Xrandr >= 1.2, we use that as a test. + definitely_enable_video_x11_xrandr=no + have_xrandr_h_hdr=no + AC_TRY_COMPILE([ + #include + #include + ],[ + XRRScreenResources *res = NULL; + ],[ + have_xrandr_h_hdr=yes + ]) + if test x$have_xrandr_h_hdr = xyes; then + if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then + echo "-- dynamic libXrandr -> $xrandr_lib" + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib", [ ]) + definitely_enable_video_x11_xrandr=yes + else + AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes) + if test x$have_xrandr_lib = xyes ; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr" + definitely_enable_video_x11_xrandr=yes + fi + fi + fi + fi + if test x$definitely_enable_video_x11_xrandr = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR, 1, [ ]) + SUMMARY_video_x11="${SUMMARY_video_x11} xrandr" + fi + AC_ARG_ENABLE(video-x11-scrnsaver, +AC_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension [[default=yes]]]), + , enable_video_x11_scrnsaver=yes) + if test x$enable_video_x11_scrnsaver = xyes; then + AC_CHECK_HEADER(X11/extensions/scrnsaver.h, + have_scrnsaver_h_hdr=yes, + have_scrnsaver_h_hdr=no, + [#include + ]) + if test x$have_scrnsaver_h_hdr = xyes; then + if test x$enable_x11_shared = xyes && test x$xss_lib != x ; then + echo "-- dynamic libXss -> $xss_lib" + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS, "$xss_lib", [ ]) + definitely_enable_video_x11_scrnsaver=yes + else + AC_CHECK_LIB(Xss, XScreenSaverSuspend, have_xss_lib=yes) + if test x$have_xss_lib = xyes ; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXss" + definitely_enable_video_x11_scrnsaver=yes + fi + fi + fi + fi + if test x$definitely_enable_video_x11_scrnsaver = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSCRNSAVER, 1, [ ]) + SUMMARY_video_x11="${SUMMARY_video_x11} xscrnsaver" + fi + AC_ARG_ENABLE(video-x11-xshape, +AC_HELP_STRING([--enable-video-x11-xshape], [enable X11 XShape support [[default=yes]]]), + , enable_video_x11_xshape=yes) + if test x$enable_video_x11_xshape = xyes; then + AC_CHECK_HEADER(X11/extensions/shape.h, + have_shape_h_hdr=yes, + have_shape_h_hdr=no, + [#include + ]) + if test x$have_shape_h_hdr = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSHAPE, 1, [ ]) + SUMMARY_video_x11="${SUMMARY_video_x11} xshape" + fi + fi + AC_ARG_ENABLE(video-x11-vm, +AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[default=yes]]]), + , enable_video_x11_vm=yes) + if test x$enable_video_x11_vm = xyes; then + definitely_enable_video_x11_vm=no + AC_CHECK_HEADER(X11/extensions/xf86vmode.h, + have_vm_h_hdr=yes, + have_vm_h_hdr=no, + [#include + ]) + if test x$have_vm_h_hdr = xyes; then + if test x$enable_x11_shared = xyes && test x$xvidmode_lib != x ; then + echo "-- dynamic libXxf86vm -> $xvidmode_lib" + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE, "$xvidmode_lib", [ ]) + definitely_enable_video_x11_vm=yes + else + AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryVersion, have_vm_lib=yes) + if test x$have_vm_lib = xyes ; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXxf86vm" + definitely_enable_video_x11_vm=yes + fi + fi + fi + fi + if test x$definitely_enable_video_x11_vm = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_X11_XVIDMODE, 1, [ ]) + SUMMARY_video_x11="${SUMMARY_video_x11} xvidmode" + fi + fi + fi +} + +dnl Set up the Vivante video driver if enabled +CheckVivanteVideo() +{ + AC_ARG_ENABLE(video-vivante, +AC_HELP_STRING([--enable-video-vivante], [use Vivante EGL video driver [[default=yes]]]), + , enable_video_vivante=yes) + if test x$enable_video = xyes -a x$enable_video_vivante = xyes; then + AC_MSG_CHECKING(for Vivante VDK API) + have_vivante_vdk=no + AC_TRY_COMPILE([ + #define LINUX + #define EGL_API_FB + #include + ],[ + ],[ + have_vivante_vdk=yes + ]) + AC_MSG_RESULT($have_vivante_vdk) + + AC_MSG_CHECKING(for Vivante FB API) + have_vivante_egl=no + AC_TRY_COMPILE([ + #define LINUX + #define EGL_API_FB + #include + ],[ + ],[ + have_vivante_egl=yes + ]) + AC_MSG_RESULT($have_vivante_egl) + + if test x$have_vivante_vdk = xyes -o x$have_vivante_egl = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_VIVANTE, 1, [ ]) + EXTRA_CFLAGS="$EXTRA_CFLAGS -DLINUX -DEGL_API_FB" + if test x$have_vivante_vdk = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_VIVANTE_VDK, 1, [ ]) + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lVDK" + fi + SOURCES="$SOURCES $srcdir/src/video/vivante/*.c" + SUMMARY_video="${SUMMARY_video} vivante" + have_video=yes + fi + fi +} + +dnl Set up the Haiku video driver if enabled +CheckHaikuVideo() +{ + if test x$enable_video = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_HAIKU, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/video/haiku/*.cc" + have_video=yes + SUMMARY_video="${SUMMARY_video} haiku" + fi +} + +dnl Set up the Cocoa video driver for Mac OS X (but not Darwin) +CheckCOCOA() +{ + AC_ARG_ENABLE(video-cocoa, +AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]), + , enable_video_cocoa=yes) + if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then + save_CFLAGS="$CFLAGS" + dnl Work around that we don't have Objective-C support in autoconf + CFLAGS="$CFLAGS -x objective-c" + AC_MSG_CHECKING(for Cocoa framework) + have_cocoa=no + AC_TRY_COMPILE([ + #import + ],[ + ],[ + have_cocoa=yes + ]) + AC_MSG_RESULT($have_cocoa) + CFLAGS="$save_CFLAGS" + if test x$have_cocoa = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_COCOA, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/video/cocoa/*.m" + SUMMARY_video="${SUMMARY_video} cocoa" + have_video=yes + fi + fi +} + +CheckMETAL() +{ + AC_ARG_ENABLE(render-metal, +AC_HELP_STRING([--enable-render-metal], [enable the Metal render driver [[default=yes]]]), + , enable_render_metal=yes) + if test x$enable_render = xyes -a x$enable_render_metal = xyes; then + save_CFLAGS="$CFLAGS" + dnl Work around that we don't have Objective-C support in autoconf + CFLAGS="$CFLAGS -x objective-c" + AC_MSG_CHECKING(for Metal framework) + have_metal=no + AC_TRY_COMPILE([ + #import + #import + #import + + #if !TARGET_CPU_X86_64 + #error Metal doesn't work on this configuration + #endif + ],[ + ],[ + have_metal=yes + ]) + CFLAGS="$save_CFLAGS" + AC_MSG_RESULT($have_metal) + if test x$have_metal = xyes; then + AC_DEFINE(SDL_VIDEO_RENDER_METAL, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/render/metal/*.m" + SUMMARY_video="${SUMMARY_video} metal" + else + enable_render_metal=no + fi + fi +} + + +dnl Find DirectFB +CheckDirectFB() +{ + AC_ARG_ENABLE(video-directfb, +AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=no]]]), + , enable_video_directfb=no) + if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then + video_directfb=no + + DIRECTFB_REQUIRED_VERSION=1.0.0 + AC_PATH_PROGS(DIRECTFBCONFIG, directfb-config, no, [$prefix/bin:$PATH]) + if test x$DIRECTFBCONFIG = xno; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + if test x$PKG_CONFIG != xno; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb; then + DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb` + DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb` + DIRECTFB_PREFIX=`$PKG_CONFIG --variable=prefix directfb` + video_directfb=yes + fi + fi + else + set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'` + NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3` + set -- `$DIRECTFBCONFIG --version | sed 's/\./ /g'` + HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3` + if test $HAVE_VERSION -ge $NEED_VERSION; then + DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags` + DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs` + DIRECTFB_PREFIX=`$DIRECTFBCONFIG --prefix` + video_directfb=yes + fi + fi + if test x$video_directfb = xyes; then + # SuSE 11.1 installs directfb-config without directfb-devel + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $DIRECTFB_CFLAGS" + AC_CHECK_HEADER(directfb.h, have_directfb_hdr=yes, have_directfb_hdr=no) + CPPFLAGS="$save_CPPFLAGS" + video_directfb=$have_directfb_hdr + fi + AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support) + AC_MSG_RESULT($video_directfb) + + if test x$video_directfb = xyes; then + AC_ARG_ENABLE(directfb-shared, +AC_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [[default=yes]]]), + , enable_directfb_shared=yes) + + AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/video/directfb/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS" + + AC_MSG_CHECKING(for directfb dynamic loading support) + directfb_shared=no + directfb_lib=[`find_lib "libdirectfb*.so.*" "$DIRECTFB_LIBS"`] + # | sed 's/.*\/\(.*\)/\1/; q'`] +AC_MSG_WARN("directfb $directfb_lib") + if test x$have_loadso != xyes && \ + test x$enable_directfb_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic directfb loading]) + fi + if test x$have_loadso = xyes && \ + test x$enable_directfb_shared = xyes && test x$directfb_lib != x; then + directfb_shared=yes + echo "-- $directfb_lib_spec -> $directfb_lib" + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC, "$directfb_lib", [ ]) + SUMMARY_video="${SUMMARY_video} directfb(dynamic)" + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS" + SUMMARY_video="${SUMMARY_video} directfb" + fi + AC_MSG_RESULT($directfb_shared) + SDL_CFLAGS="$SDL_CFLAGS $DIRECTFB_CFLAGS" + have_video=yes + fi + fi +} + +dnl Find KMSDRM +CheckKMSDRM() +{ + AC_ARG_ENABLE(video-kmsdrm, +AC_HELP_STRING([--enable-video-kmsdrm], [use KMSDRM video driver [[default=no]]]), + , enable_video_kmsdrm=no) + + if test x$enable_video = xyes -a x$enable_video_kmsdrm = xyes; then + video_kmsdrm=no + libdrm_avail=no + libgbm_avail=no + + LIBDRM_REQUIRED_VERSION=2.4.46 + LIBGBM_REQUIRED_VERSION=9.0.0 + + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + if test x$PKG_CONFIG != xno; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7; then + if $PKG_CONFIG --atleast-version $LIBDRM_REQUIRED_VERSION libdrm; then + LIBDRM_CFLAGS=`$PKG_CONFIG --cflags libdrm` + LIBDRM_LIBS=`$PKG_CONFIG --libs libdrm` + LIBDRM_PREFIX=`$PKG_CONFIG --variable=prefix libdrm` + libdrm_avail=yes + fi + if $PKG_CONFIG --atleast-version $LIBGBM_REQUIRED_VERSION gbm; then + LIBGBM_CFLAGS=`$PKG_CONFIG --cflags gbm` + LIBGBM_LIBS=`$PKG_CONFIG --libs gbm` + LIBGBM_PREFIX=`$PKG_CONFIG --variable=prefix gbm` + libgbm_avail=yes + fi + if test x$libdrm_avail = xyes -a x$libgbm_avail = xyes; then + video_kmsdrm=yes + fi + + AC_MSG_CHECKING(for libdrm $LIBDRM_REQUIRED_VERSION library for kmsdrm support) + AC_MSG_RESULT($libdrm_avail) + AC_MSG_CHECKING(for libgbm $LIBGBM_REQUIRED_VERSION library for kmsdrm support) + AC_MSG_RESULT($libgbm_avail) + + if test x$video_kmsdrm = xyes; then + AC_ARG_ENABLE(kmsdrm-shared, +AC_HELP_STRING([--enable-kmsdrm-shared], [dynamically load kmsdrm support [[default=yes]]]), + , enable_kmsdrm_shared=yes) + + AC_DEFINE(SDL_VIDEO_DRIVER_KMSDRM, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/video/kmsdrm/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBDRM_CFLAGS $LIBGBM_CFLAGS" + + AC_MSG_CHECKING(for kmsdrm dynamic loading support) + kmsdrm_shared=no + drm_lib=[`find_lib "libdrm.so.*" "$DRM_LIBS"`] + gbm_lib=[`find_lib "libgbm.so.*" "$DRM_LIBS"`] + if test x$have_loadso != xyes && \ + test x$enable_kmsdrm_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic kmsdrm loading]) + fi + if test x$have_loadso = xyes && \ + test x$enable_kmsdrm_shared = xyes && test x$drm_lib != x && test x$gbm_lib != x; then + kmsdrm_shared=yes + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC, "$drm_lib", [ ]) + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM, "$gbm_lib", [ ]) + AC_DEFINE_UNQUOTED(HAVE_KMSDRM_SHARED, "TRUE", [ ]) + SUMMARY_video="${SUMMARY_video} kmsdrm(dynamic)" + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBDRM_LIBS $LIBGBM_LIBS" + SUMMARY_video="${SUMMARY_video} kmsdrm" + fi + AC_MSG_RESULT($kmsdrm_shared) + have_video=yes + fi + fi + fi + fi +} + +dnl rcg04172001 Set up the Null video driver. +CheckDummyVideo() +{ + AC_ARG_ENABLE(video-dummy, +AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]), + , enable_video_dummy=yes) + if test x$enable_video_dummy = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/video/dummy/*.c" + have_video=yes + SUMMARY_video="${SUMMARY_video} dummy" + fi +} + +dnl Set up the QNX video driver if enabled +CheckQNXVideo() +{ + if test x$enable_video = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_QNX, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/video/qnx/*.c" + have_video=yes + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lscreen -lEGL -lGLESv2" + SUMMARY_video="${SUMMARY_video} qnx" + fi +} + +dnl Set up the QNX audio driver if enabled +CheckQNXAudio() +{ + if test x$enable_audio = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_QSA, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c" + have_audio=yes + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound" + SUMMARY_audio="${SUMMARY_audio} qsa" + fi +} + +dnl Check to see if OpenGL support is desired +AC_ARG_ENABLE(video-opengl, +AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]), + , enable_video_opengl=yes) + +dnl Find OpenGL +CheckOpenGLX11() +{ + if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then + AC_MSG_CHECKING(for OpenGL (GLX) support) + video_opengl=no + AC_TRY_COMPILE([ + #include + #include + ],[ + ],[ + video_opengl=yes + ]) + AC_MSG_RESULT($video_opengl) + if test x$video_opengl = xyes; then + AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ]) + AC_DEFINE(SDL_VIDEO_OPENGL_GLX, 1, [ ]) + AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ]) + SUMMARY_video="${SUMMARY_video} opengl" + fi + fi +} + +dnl Check to see if OpenGL ES support is desired +AC_ARG_ENABLE(video-opengles, +AC_HELP_STRING([--enable-video-opengles], [include OpenGL ES support [[default=yes]]]), + , enable_video_opengles=yes) +AC_ARG_ENABLE(video-opengles1, +AC_HELP_STRING([--enable-video-opengles1], [include OpenGL ES 1.1 support [[default=yes]]]), + , enable_video_opengles1=yes) +AC_ARG_ENABLE(video-opengles2, +AC_HELP_STRING([--enable-video-opengles2], [include OpenGL ES 2.0 support [[default=yes]]]), + , enable_video_opengles2=yes) + +dnl Find OpenGL ES +CheckOpenGLESX11() +{ + if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then + AC_MSG_CHECKING(for EGL support) + video_opengl_egl=no + AC_TRY_COMPILE([ + #define LINUX + #define EGL_API_FB + #include + #include + ],[ + ],[ + video_opengl_egl=yes + ]) + AC_MSG_RESULT($video_opengl_egl) + if test x$video_opengl_egl = xyes; then + AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ]) + fi + + if test x$enable_video_opengles1 = xyes; then + AC_MSG_CHECKING(for OpenGL ES v1 headers) + video_opengles_v1=no + AC_TRY_COMPILE([ + #include + #include + ],[ + ],[ + video_opengles_v1=yes + ]) + AC_MSG_RESULT($video_opengles_v1) + if test x$video_opengles_v1 = xyes; then + AC_DEFINE(SDL_VIDEO_OPENGL_ES, 1, [ ]) + AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES, 1, [ ]) + SUMMARY_video="${SUMMARY_video} opengl_es1" + fi + fi + + if test x$enable_video_opengles2 = xyes; then + AC_MSG_CHECKING(for OpenGL ES v2 headers) + video_opengles_v2=no + AC_TRY_COMPILE([ + #include + #include + ],[ + ],[ + video_opengles_v2=yes + ]) + AC_MSG_RESULT($video_opengles_v2) + if test x$video_opengles_v2 = xyes; then + AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ]) + AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ]) + SUMMARY_video="${SUMMARY_video} opengl_es2" + fi + fi + fi +} + +dnl Check for Windows OpenGL +CheckWINDOWSGL() +{ + if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then + AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ]) + AC_DEFINE(SDL_VIDEO_OPENGL_WGL, 1, [ ]) + AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ]) + SUMMARY_video="${SUMMARY_video} opengl" + fi +} + +dnl Check for Windows OpenGL +CheckWINDOWSGLES() +{ + if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then + + AC_MSG_CHECKING(for EGL support) + video_opengl_egl=no + AC_TRY_COMPILE([ + #include + ],[ + ],[ + video_opengl_egl=yes + ]) + AC_MSG_RESULT($video_opengl_egl) + if test x$video_opengl_egl = xyes; then + AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ]) + AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ]) + SUMMARY_video="${SUMMARY_video} opengl_es1" + fi + + AC_MSG_CHECKING(for OpenGL ES v2 headers) + video_opengles_v2=no + AC_TRY_COMPILE([ + #include + #include + ],[ + ],[ + video_opengles_v2=yes + ]) + AC_MSG_RESULT($video_opengles_v2) + if test x$video_opengles_v2 = xyes; then + AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ]) + AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ]) + AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ]) + SUMMARY_video="${SUMMARY_video} opengl_es2" + fi + fi +} + +dnl Check for Haiku OpenGL +CheckHaikuGL() +{ + if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then + AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ]) + AC_DEFINE(SDL_VIDEO_OPENGL_HAIKU, 1, [ ]) + AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ]) + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL" + SUMMARY_video="${SUMMARY_video} opengl" + fi +} + +dnl Check for MacOS OpenGL +CheckMacGL() +{ + if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then + AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ]) + AC_DEFINE(SDL_VIDEO_OPENGL_CGL, 1, [ ]) + AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ]) + SUMMARY_video="${SUMMARY_video} opengl" + fi +} + +CheckEmscriptenGLES() +{ + if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then + AC_MSG_CHECKING(for EGL support) + video_opengl_egl=no + AC_TRY_COMPILE([ + #include + ],[ + ],[ + video_opengl_egl=yes + ]) + AC_MSG_RESULT($video_opengl_egl) + if test x$video_opengl_egl = xyes; then + AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ]) + fi + + AC_MSG_CHECKING(for OpenGL ES v2 headers) + video_opengles_v2=no + AC_TRY_COMPILE([ + #include + #include + ],[ + ],[ + video_opengles_v2=yes + ]) + AC_MSG_RESULT($video_opengles_v2) + if test x$video_opengles_v2 = xyes; then + AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ]) + AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ]) + SUMMARY_video="${SUMMARY_video} opengl_es2" + fi + fi +} + +dnl Check to see if Vulkan support is desired +AC_ARG_ENABLE(video-vulkan, +AC_HELP_STRING([--enable-video-vulkan], [include Vulkan support [[default=yes]]]), + , enable_video_vulkan=yes) + +dnl Find Vulkan Header +CheckVulkan() +{ + if test x$enable_video = xyes -a x$enable_video_vulkan = xyes; then + case "$host" in + *-*-android*) + AC_TRY_COMPILE([ + #if defined(__ARM_ARCH) && __ARM_ARCH < 7 + #error Vulkan doesn't work on this configuration + #endif + ],[ + ],[ + ],[ + enable_video_vulkan=no + ]) + ;; + *-*-darwin*) + save_CFLAGS="$CFLAGS" + dnl Work around that we don't have Objective-C support in autoconf + CFLAGS="$CFLAGS -x objective-c" + AC_TRY_COMPILE([ + #include + #include + #include + + #if !TARGET_CPU_X86_64 + #error Vulkan doesn't work on this configuration + #endif + ],[ + ],[ + ],[ + enable_video_vulkan=no + ]) + CFLAGS="$save_CFLAGS" + ;; + *) + ;; + esac + if test x$enable_video_vulkan = xno; then + # For reasons I am totally unable to see, I get an undefined macro error if + # I put this in the AC_TRY_COMPILE. + AC_MSG_WARN([Vulkan does not work on this configuration.]) + fi + fi + if test x$enable_video_vulkan = xyes; then + AC_DEFINE(SDL_VIDEO_VULKAN, 1, [ ]) + SUMMARY_video="${SUMMARY_video} vulkan" + fi +} + +dnl See if we can use the new unified event interface in Linux 2.4 +CheckInputEvents() +{ + dnl Check for Linux 2.4 unified input event interface support + AC_MSG_CHECKING(for Linux 2.4 unified input interface) + use_input_events=no + AC_TRY_COMPILE([ + #include + ],[ + #ifndef EVIOCGNAME + #error EVIOCGNAME() ioctl not available + #endif + ],[ + use_input_events=yes + ]) + AC_MSG_RESULT($use_input_events) + if test x$use_input_events = xyes; then + AC_DEFINE(SDL_INPUT_LINUXEV, 1, [ ]) + SUMMARY_input="${SUMMARY_input} linuxev" + fi +} + +dnl See if we can use the kernel kd.h header +CheckInputKD() +{ + + AC_MSG_CHECKING(for Linux kd.h) + use_input_kd=no + AC_TRY_COMPILE([ + #include + #include + ],[ + struct kbentry kbe; + kbe.kb_table = KG_CTRL; + ioctl(0, KDGKBENT, &kbe); + ],[ + use_input_kd=yes + ]) + AC_MSG_RESULT($use_input_kd) + if test x$use_input_kd = xyes; then + AC_DEFINE(SDL_INPUT_LINUXKD, 1, [ ]) + SUMMARY_input="${SUMMARY_input} linuxkd" + fi +} + +dnl See if the platform offers libudev for device enumeration and hotplugging. +CheckLibUDev() +{ + AC_ARG_ENABLE(libudev, +AC_HELP_STRING([--enable-libudev], [enable libudev support [[default=yes]]]), + , enable_libudev=yes) + if test x$enable_libudev = xyes; then + AC_CHECK_HEADER(libudev.h, + have_libudev_h_hdr=yes, + have_libudev_h_hdr=no) + if test x$have_libudev_h_hdr = xyes; then + AC_DEFINE(HAVE_LIBUDEV_H, 1, [ ]) + + udev_lib=[`find_lib "libudev.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`] + if test x$udev_lib != x; then + echo "-- dynamic udev -> $udev_lib" + AC_DEFINE_UNQUOTED(SDL_UDEV_DYNAMIC, "$udev_lib", [ ]) + fi + fi + fi +} + +dnl See if the platform offers libdbus for various IPC techniques. +CheckDBus() +{ + AC_ARG_ENABLE(dbus, +AC_HELP_STRING([--enable-dbus], [enable D-Bus support [[default=yes]]]), + , enable_dbus=yes) + if test x$enable_dbus = xyes; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + if test x$PKG_CONFIG != xno; then + DBUS_CFLAGS=`$PKG_CONFIG --cflags dbus-1` + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS $DBUS_CFLAGS" + AC_CHECK_HEADER(dbus/dbus.h, + have_dbus_dbus_h_hdr=yes, + have_dbus_dbus_h_hdr=no) + CFLAGS="$save_CFLAGS" + if test x$have_dbus_dbus_h_hdr = xyes; then + AC_DEFINE(HAVE_DBUS_DBUS_H, 1, [ ]) + EXTRA_CFLAGS="$EXTRA_CFLAGS $DBUS_CFLAGS" + SOURCES="$SOURCES $srcdir/src/core/linux/SDL_dbus.c" + fi + fi + fi +} + +dnl See if the platform wanna IME support. +CheckIME() +{ + AC_ARG_ENABLE(ime, +AC_HELP_STRING([--enable-ime], [enable IME support [[default=yes]]]), + , enable_ime=yes) + if test x$enable_ime = xyes; then + AC_DEFINE(SDL_USE_IME, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c" + fi +} + +dnl See if the platform has libibus IME support. +CheckIBus() +{ + AC_ARG_ENABLE(ibus, +AC_HELP_STRING([--enable-ibus], [enable IBus support [[default=yes]]]), + , enable_ibus=yes) + if test x$enable_ibus = xyes; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + if test x$PKG_CONFIG != xno; then + IBUS_CFLAGS=`$PKG_CONFIG --cflags ibus-1.0` + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS $IBUS_CFLAGS" + AC_CHECK_HEADER(ibus-1.0/ibus.h, + have_ibus_ibus_h_hdr=yes, + have_ibus_ibus_h_hdr=no) + AC_CHECK_HEADER(sys/inotify.h, + have_inotify_inotify_h_hdr=yes, + have_inotify_inotify_h_hdr=no) + CFLAGS="$save_CFLAGS" + if test x$have_ibus_ibus_h_hdr = xyes; then + if test x$enable_ime != xyes; then + AC_MSG_WARN([IME support is required for IBus.]) + have_ibus_ibus_h_hdr=no + elif test x$enable_dbus != xyes; then + AC_MSG_WARN([DBus support is required for IBus.]) + have_ibus_ibus_h_hdr=no + elif test x$have_inotify_inotify_h_hdr != xyes; then + AC_MSG_WARN([INotify support is required for IBus.]) + have_ibus_ibus_h_hdr=no + else + AC_DEFINE(HAVE_IBUS_IBUS_H, 1, [ ]) + EXTRA_CFLAGS="$EXTRA_CFLAGS $IBUS_CFLAGS" + SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ibus.c" + fi + fi + fi + fi +} + +dnl See if the platform has fcitx IME support. +CheckFcitx() +{ + AC_ARG_ENABLE(fcitx, +AC_HELP_STRING([--enable-fcitx], [enable fcitx support [[default=yes]]]), + , enable_fcitx=yes) + if test x$enable_fcitx = xyes; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + if test x$PKG_CONFIG != xno; then + FCITX_CFLAGS=`$PKG_CONFIG --cflags fcitx` + CFLAGS="$CFLAGS $FCITX_CFLAGS" + AC_CHECK_HEADER(fcitx/frontend.h, + have_fcitx_frontend_h_hdr=yes, + have_fcitx_frontend_h_hdr=no) + CFLAGS="$save_CFLAGS" + if test x$have_fcitx_frontend_h_hdr = xyes; then + if test x$enable_ime != xyes; then + AC_MSG_WARN([IME support is required for fcitx.]) + have_fcitx_frontend_h_hdr=no + elif test x$enable_dbus != xyes; then + AC_MSG_WARN([DBus support is required for fcitx.]) + have_fcitx_frontend_h_hdr=no + else + AC_DEFINE(HAVE_FCITX_FRONTEND_H, 1, [ ]) + EXTRA_CFLAGS="$EXTRA_CFLAGS $FCITX_CFLAGS" + SOURCES="$SOURCES $srcdir/src/core/linux/SDL_fcitx.c" + fi + fi + fi + fi +} + +dnl See if we can use the Touchscreen input library +CheckTslib() +{ + AC_ARG_ENABLE(input-tslib, +AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]), + , enable_input_tslib=yes) + if test x$enable_input_tslib = xyes; then + AC_MSG_CHECKING(for Touchscreen library support) + enable_input_tslib=no + AC_TRY_COMPILE([ + #include "tslib.h" + ],[ + ],[ + enable_input_tslib=yes + ]) + AC_MSG_RESULT($enable_input_tslib) + if test x$enable_input_tslib = xyes; then + AC_DEFINE(SDL_INPUT_TSLIB, 1, [ ]) + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts" + SUMMARY_input="${SUMMARY_input} ts" + fi + fi +} + +dnl See what type of thread model to use on Linux and Solaris +CheckPTHREAD() +{ + dnl Check for pthread support + AC_ARG_ENABLE(pthreads, +AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]), + , enable_pthreads=yes) + dnl This is used on Linux for glibc binary compatibility (Doh!) + AC_ARG_ENABLE(pthread-sem, +AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]), + , enable_pthread_sem=yes) + case "$host" in + *-*-android*) + pthread_cflags="-D_REENTRANT -D_THREAD_SAFE" + pthread_lib="" + ;; + *-*-linux*|*-*-uclinux*) + pthread_cflags="-D_REENTRANT" + pthread_lib="-lpthread" + ;; + *-*-bsdi*) + pthread_cflags="-D_REENTRANT -D_THREAD_SAFE" + pthread_lib="" + ;; + *-*-darwin*) + pthread_cflags="-D_THREAD_SAFE" +# causes Carbon.p complaints? +# pthread_cflags="-D_REENTRANT -D_THREAD_SAFE" + ;; + *-*-freebsd*|*-*-dragonfly*) + pthread_cflags="-D_REENTRANT -D_THREAD_SAFE" + pthread_lib="-pthread" + ;; + *-*-netbsd*) + pthread_cflags="-D_REENTRANT -D_THREAD_SAFE" + pthread_lib="-lpthread" + ;; + *-*-openbsd*) + pthread_cflags="-D_REENTRANT" + pthread_lib="-pthread" + ;; + *-*-solaris2.9) + # From Solaris 9+, posix4's preferred name is rt. + pthread_cflags="-D_REENTRANT" + pthread_lib="-lpthread -lrt" + ;; + *-*-solaris2.10) + # Solaris 10+ merged pthread into libc. + pthread_cflags="-D_REENTRANT" + pthread_lib="-lrt" + ;; + *-*-solaris*) + # Solaris 11+ merged rt into libc. + pthread_cflags="-D_REENTRANT" + pthread_lib="" + ;; + *-*-sysv5*) + pthread_cflags="-D_REENTRANT -Kthread" + pthread_lib="" + ;; + *-*-aix*) + pthread_cflags="-D_REENTRANT -mthreads" + pthread_lib="-lpthread" + ;; + *-*-hpux11*) + pthread_cflags="-D_REENTRANT" + pthread_lib="-L/usr/lib -lpthread" + ;; + *-*-haiku*) + pthread_cflags="-D_REENTRANT" + pthread_lib="" + ;; + *-*-nto*) + pthread_cflags="-D_REENTRANT" + pthread_lib="" + ;; + *) + pthread_cflags="-D_REENTRANT" + pthread_lib="-lpthread" + ;; + esac + if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then + # Save the original compiler flags and libraries + ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS" + # Add the pthread compiler flags and libraries + CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib" + # Check to see if we have pthread support on this system + AC_MSG_CHECKING(for pthreads) + use_pthreads=no + AC_TRY_LINK([ + #include + ],[ + pthread_attr_t type; + pthread_attr_init(&type); + ],[ + use_pthreads=yes + ]) + AC_MSG_RESULT($use_pthreads) + # Restore the compiler flags and libraries + CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs" + + # Do futher testing if we have pthread support... + if test x$use_pthreads = xyes; then + AC_DEFINE(SDL_THREAD_PTHREAD, 1, [ ]) + EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib" + SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags" + + # Save the original compiler flags and libraries + ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS" + # Add the pthread compiler flags and libraries + CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib" + + # Check to see if recursive mutexes are available + AC_MSG_CHECKING(for recursive mutexes) + has_recursive_mutexes=no + if test x$has_recursive_mutexes = xno; then + AC_TRY_LINK([ + #define _GNU_SOURCE 1 + #include + ],[ + pthread_mutexattr_t attr; + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); + ],[ + has_recursive_mutexes=yes + AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX, 1, [ ]) + ]) + fi + if test x$has_recursive_mutexes = xno; then + AC_TRY_LINK([ + #define _GNU_SOURCE 1 + #include + ],[ + pthread_mutexattr_t attr; + pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP); + ],[ + has_recursive_mutexes=yes + AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP, 1, [ ]) + ]) + fi + AC_MSG_RESULT($has_recursive_mutexes) + + # Check to see if pthread semaphore support is missing + if test x$enable_pthread_sem = xyes; then + AC_MSG_CHECKING(for pthread semaphores) + have_pthread_sem=no + AC_TRY_COMPILE([ + #include + #include + ],[ + ],[ + have_pthread_sem=yes + ]) + AC_MSG_RESULT($have_pthread_sem) + fi + if test x$have_pthread_sem = xyes; then + AC_MSG_CHECKING(for sem_timedwait) + have_sem_timedwait=no + AC_TRY_LINK([ + #include + #include + ],[ + sem_timedwait(NULL, NULL); + ],[ + have_sem_timedwait=yes + AC_DEFINE([HAVE_SEM_TIMEDWAIT], 1, [ ]) + ]) + AC_MSG_RESULT($have_sem_timedwait) + fi + + AC_CHECK_HEADER(pthread_np.h, have_pthread_np_h=yes, have_pthread_np_h=no, [ #include ]) + if test x$have_pthread_np_h = xyes; then + AC_DEFINE(HAVE_PTHREAD_NP_H, 1, [ ]) + fi + + # Check to see if pthread naming is available + AC_MSG_CHECKING(for pthread_setname_np) + AC_TRY_LINK_FUNC(pthread_setname_np, [ + has_pthread_setname_np=yes + AC_DEFINE(HAVE_PTHREAD_SETNAME_NP, 1, [ ]) + ],[ + has_pthread_setname_np=no + ]) + AC_MSG_RESULT($has_pthread_setname_np) + + AC_MSG_CHECKING(for pthread_set_name_np) + AC_TRY_LINK_FUNC(pthread_set_name_np, [ + has_pthread_set_name_np=yes + AC_DEFINE(HAVE_PTHREAD_SET_NAME_NP, 1, [ ]) + ],[ + has_pthread_set_name_np=no + ]) + AC_MSG_RESULT($has_pthread_set_name_np) + + # Restore the compiler flags and libraries + CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs" + + # Basic thread creation functions + SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c" + + # Semaphores + # We can fake these with mutexes and condition variables if necessary + if test x$have_pthread_sem = xyes; then + SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c" + else + SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c" + fi + + # Mutexes + # We can fake these with semaphores if necessary + SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c" + + # Condition variables + # We can fake these with semaphores and mutexes if necessary + SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c" + + # Thread local storage + SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systls.c" + + have_threads=yes + fi + fi +} + +dnl Determine whether the compiler can produce Windows executables +CheckWINDOWS() +{ + AC_MSG_CHECKING(Windows compiler) + have_win32_gcc=no + AC_TRY_COMPILE([ + #include + ],[ + ],[ + have_win32_gcc=yes + ]) + AC_MSG_RESULT($have_win32_gcc) + if test x$have_win32_gcc != xyes; then + AC_MSG_ERROR([ +*** Your compiler ($CC) does not produce Windows executables! + ]) + fi + + AC_MSG_CHECKING(Windows CE) + have_wince=no + AC_TRY_COMPILE([ +#if !defined(_WIN32_WCE) && !defined(__MINGW32CE__) +#error This is not Windows CE +#endif + ],[ + ],[ + have_wince=yes + AC_MSG_ERROR([ +*** Sorry, Windows CE is no longer supported. + ]) + ]) + AC_MSG_RESULT($have_wince) + + # This fixes Windows stack alignment with newer GCC + CheckStackBoundary +} + +dnl Find the DirectX includes and libraries +CheckDIRECTX() +{ + AC_ARG_ENABLE(directx, +AC_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[default=yes]]]), + , enable_directx=yes) + if test x$enable_directx = xyes; then + AC_CHECK_HEADER(d3d9.h, have_d3d=yes) + AC_CHECK_HEADER(d3d11_1.h, have_d3d11=yes) + AC_CHECK_HEADER(ddraw.h, have_ddraw=yes) + AC_CHECK_HEADER(dsound.h, have_dsound=yes) + AC_CHECK_HEADER(dinput.h, have_dinput=yes) + AC_CHECK_HEADER(dxgi.h, have_dxgi=yes) + AC_CHECK_HEADER(xinput.h, have_xinput=yes) + AC_CHECK_HEADER(mmdeviceapi.h, have_wasapi=yes) + AC_CHECK_HEADER(audioclient.h,,have_wasapi=no) + AC_TRY_COMPILE([ +#include +#include +XINPUT_GAMEPAD_EX x1; + ],[],[have_xinput_gamepadex=yes]) + AC_TRY_COMPILE([ +#include +#include +XINPUT_STATE_EX s1; + ],[],[have_xinput_stateex=yes]) + + if test x$have_ddraw = xyes; then + AC_DEFINE(HAVE_DDRAW_H, 1, [ ]) + fi + if test x$have_dinput = xyes; then + AC_DEFINE(HAVE_DINPUT_H, 1, [ ]) + fi + if test x$have_dsound = xyes; then + AC_DEFINE(HAVE_DSOUND_H, 1, [ ]) + fi + if test x$have_dxgi = xyes; then + AC_DEFINE(HAVE_DXGI_H, 1, [ ]) + fi + if test x$have_xinput = xyes; then + AC_DEFINE(HAVE_XINPUT_H, 1, [ ]) + fi + if test x$have_xinput_gamepadex = xyes; then + AC_DEFINE(HAVE_XINPUT_GAMEPAD_EX, 1, [ ]) + fi + if test x$have_xinput_stateex = xyes; then + AC_DEFINE(HAVE_XINPUT_STATE_EX, 1, [ ]) + fi + + SUMMARY_video="${SUMMARY_video} directx" + SUMMARY_audio="${SUMMARY_audio} directx" + + # FIXME: latest Cygwin finds dinput headers, but we die on other win32 headers. + # FIXME: ...so force it off for now. + case "$host" in + *-*-cygwin*) + have_dinput=false + ;; + esac + fi +} + +dnl Check for the dlfcn.h interface for dynamically loading objects +CheckDLOPEN() +{ + AC_ARG_ENABLE(sdl-dlopen, +AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]), + , enable_sdl_dlopen=yes) + if test x$enable_sdl_dlopen = xyes; then + AC_MSG_CHECKING(for dlopen) + have_dlopen=no + AC_TRY_COMPILE([ + #include + ],[ + void *handle = dlopen("", RTLD_NOW); + const char *loaderror = (char *) dlerror(); + ],[ + have_dlopen=yes + ]) + AC_MSG_RESULT($have_dlopen) + + if test x$have_dlopen = xyes; then + AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS", + AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl", + AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl"))) + AC_DEFINE(SDL_LOADSO_DLOPEN, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c" + have_loadso=yes + fi + fi +} + +dnl Check for the usbhid(3) library on *BSD +CheckUSBHID() +{ + case "$host" in + *-*-*bsd*) + if test x$enable_joystick = xyes; then + AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes) + if test x$have_libusbhid = xyes; then + AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"]) + AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"]) + USB_LIBS="$USB_LIBS -lusbhid" + else + AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"]) + AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"]) + AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"]) + fi + + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $USB_CFLAGS" + + AC_MSG_CHECKING(for usbhid) + have_usbhid=no + AC_TRY_COMPILE([ + #include + #if defined(HAVE_USB_H) + #include + #endif + #ifdef __DragonFly__ + # include + # include + #else + # include + # include + #endif + #if defined(HAVE_USBHID_H) + #include + #elif defined(HAVE_LIBUSB_H) + #include + #elif defined(HAVE_LIBUSBHID_H) + #include + #endif + ],[ + struct report_desc *repdesc; + struct usb_ctl_report *repbuf; + hid_kind_t hidkind; + ],[ + have_usbhid=yes + ]) + AC_MSG_RESULT($have_usbhid) + + if test x$have_usbhid = xyes; then + AC_MSG_CHECKING(for ucr_data member of usb_ctl_report) + have_usbhid_ucr_data=no + AC_TRY_COMPILE([ + #include + #if defined(HAVE_USB_H) + #include + #endif + #ifdef __DragonFly__ + # include + # include + #else + # include + # include + #endif + #if defined(HAVE_USBHID_H) + #include + #elif defined(HAVE_LIBUSB_H) + #include + #elif defined(HAVE_LIBUSBHID_H) + #include + #endif + ],[ + struct usb_ctl_report buf; + if (buf.ucr_data) { } + ],[ + have_usbhid_ucr_data=yes + ]) + if test x$have_usbhid_ucr_data = xyes; then + USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA" + fi + AC_MSG_RESULT($have_usbhid_ucr_data) + + AC_MSG_CHECKING(for new usbhid API) + have_usbhid_new=no + AC_TRY_COMPILE([ + #include + #if defined(HAVE_USB_H) + #include + #endif + #ifdef __DragonFly__ + #include + #include + #else + #include + #include + #endif + #if defined(HAVE_USBHID_H) + #include + #elif defined(HAVE_LIBUSB_H) + #include + #elif defined(HAVE_LIBUSBHID_H) + #include + #endif + ],[ + report_desc_t d; + hid_start_parse(d, 1, 1); + ],[ + have_usbhid_new=yes + ]) + if test x$have_usbhid_new = xyes; then + USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW" + fi + AC_MSG_RESULT($have_usbhid_new) + + AC_MSG_CHECKING(for struct joystick in machine/joystick.h) + have_machine_joystick=no + AC_TRY_COMPILE([ + #include + ],[ + struct joystick t; + ],[ + have_machine_joystick=yes + ]) + if test x$have_machine_joystick = xyes; then + AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H, 1, [ ]) + fi + AC_MSG_RESULT($have_machine_joystick) + + AC_DEFINE(SDL_JOYSTICK_USBHID, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS" + have_joystick=yes + fi + CFLAGS="$save_CFLAGS" + fi + ;; + esac +} + +dnl Check for clock_gettime() +CheckClockGettime() +{ + AC_ARG_ENABLE(clock_gettime, +AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=yes]]]), + , enable_clock_gettime=yes) + if test x$enable_clock_gettime = xyes; then + AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes) + if test x$have_clock_gettime = xyes; then + AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ]) + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt" + else + AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes) + if test x$have_clock_gettime = xyes; then + AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ]) + EXTRA_LDFLAGS="$EXTRA_LDFLAGS" + fi + fi + fi +} + +dnl Check for a valid linux/version.h +CheckLinuxVersion() +{ + AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes) + if test x$have_linux_version_h = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H" + fi +} + +dnl Check if we want to use RPATH +CheckRPATH() +{ + AC_ARG_ENABLE(rpath, +AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]), + , enable_rpath=yes) +} + +dnl Do this on all platforms, before everything else (other things might want to override it). +CheckWarnAll + +dnl Set up the configuration based on the host platform! +case "$host" in + *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*|*-*-nto*) + case "$host" in + *-*-android*) + # Android + ARCH=android + ANDROID_CFLAGS="-DGL_GLEXT_PROTOTYPES" + CFLAGS="$CFLAGS $ANDROID_CFLAGS" + SDL_CFLAGS="$SDL_CFLAGS $ANDROID_CFLAGS" + EXTRA_CFLAGS="$EXTRA_CFLAGS $ANDROID_CFLAGS" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl -lGLESv1_CM -lGLESv2 -llog -landroid" + SDLMAIN_SOURCES="$srcdir/src/main/android/*.c" + + if test x$enable_video = xyes; then + SOURCES="$SOURCES $srcdir/src/core/android/*.c $srcdir/src/video/android/*.c" + # FIXME: confdefs? Not AC_DEFINE? + $as_echo "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h + SUMMARY_video="${SUMMARY_video} android" + fi + ;; + *-*-linux*) ARCH=linux ;; + *-*-uclinux*) ARCH=linux ;; + *-*-kfreebsd*-gnu) ARCH=kfreebsd-gnu ;; + *-*-knetbsd*-gnu) ARCH=knetbsd-gnu ;; + *-*-kopenbsd*-gnu) ARCH=kopenbsd-gnu ;; + *-*-gnu*) ARCH=gnu ;; # must be last of the gnu variants + *-*-bsdi*) ARCH=bsdi ;; + *-*-freebsd*) ARCH=freebsd ;; + *-*-dragonfly*) ARCH=freebsd ;; + *-*-netbsd*) ARCH=netbsd ;; + *-*-openbsd*) ARCH=openbsd ;; + *-*-sysv5*) ARCH=sysv5 ;; + *-*-solaris*) ARCH=solaris ;; + *-*-hpux*) ARCH=hpux ;; + *-*-aix*) ARCH=aix ;; + *-*-minix*) ARCH=minix ;; + *-*-nto*) ARCH=nto + CheckQNXVideo + ;; + esac + CheckVisibilityHidden + CheckDeclarationAfterStatement + CheckDummyVideo + CheckDiskAudio + CheckDummyAudio + CheckDLOPEN + CheckOSS + CheckALSA + CheckPulseAudio + CheckJACK + CheckARTSC + CheckESD + CheckNAS + CheckSNDIO + CheckFusionSound + CheckLibSampleRate + # Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails! + CheckRPI + CheckX11 + CheckDirectFB + CheckKMSDRM + CheckOpenGLX11 + CheckOpenGLESX11 + CheckVulkan + CheckMir + CheckWayland + CheckLibUDev + CheckDBus + CheckIME + CheckIBus + CheckFcitx + case $ARCH in + linux) + CheckInputEvents + CheckInputKD + ;; + esac + CheckTslib + CheckUSBHID + CheckPTHREAD + CheckClockGettime + CheckLinuxVersion + CheckRPATH + CheckVivanteVideo + + # Set up files for the audio library + if test x$enable_audio = xyes; then + case $ARCH in + sysv5|solaris|hpux) + AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/sun/*.c" + SUMMARY_audio="${SUMMARY_audio} sun" + have_audio=yes + ;; + netbsd) # Don't use this on OpenBSD, it's busted. + AC_DEFINE(SDL_AUDIO_DRIVER_NETBSD, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/netbsd/*.c" + SUMMARY_audio="${SUMMARY_audio} netbsd" + have_audio=yes + ;; + aix) + AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c" + SUMMARY_audio="${SUMMARY_audio} paudio" + have_audio=yes + ;; + android) + AC_DEFINE(SDL_AUDIO_DRIVER_ANDROID, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/android/*.c" + SUMMARY_audio="${SUMMARY_audio} android" + have_audio=yes + ;; + nto) + CheckQNXAudio + ;; + esac + fi + # Set up files for the joystick library + if test x$enable_joystick = xyes; then + case $ARCH in + linux) + AC_DEFINE(SDL_JOYSTICK_LINUX, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c" + SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" + have_joystick=yes + ;; + android) + AC_DEFINE(SDL_JOYSTICK_ANDROID, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/joystick/android/*.c" + SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" + have_joystick=yes + ;; + esac + fi + # Set up files for the haptic library + if test x$enable_haptic = xyes; then + case $ARCH in + linux) + if test x$use_input_events = xyes; then + AC_DEFINE(SDL_HAPTIC_LINUX, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c" + have_haptic=yes + fi + ;; + android) + AC_DEFINE(SDL_HAPTIC_ANDROID, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/haptic/android/*.c" + have_haptic=yes + ;; + esac + fi + # Set up files for the power library + if test x$enable_power = xyes; then + case $ARCH in + linux) + AC_DEFINE(SDL_POWER_LINUX, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/power/linux/*.c" + have_power=yes + ;; + android) + AC_DEFINE(SDL_POWER_ANDROID, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/power/android/*.c" + have_power=yes + ;; + esac + fi + # Set up files for the filesystem library + if test x$enable_filesystem = xyes; then + case $ARCH in + android) + AC_DEFINE(SDL_FILESYSTEM_ANDROID, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/filesystem/android/*.c" + have_filesystem=yes + ;; + *) + AC_DEFINE(SDL_FILESYSTEM_UNIX, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/filesystem/unix/*.c" + have_filesystem=yes + ;; + esac + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + AC_DEFINE(SDL_TIMER_UNIX, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" + have_timers=yes + fi + # Set up files for udev hotplugging support + if test x$enable_libudev = xyes && test x$have_libudev_h_hdr = xyes; then + SOURCES="$SOURCES $srcdir/src/core/linux/SDL_udev.c" + fi + # Set up files for evdev input + if test x$use_input_events = xyes; then + SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev*.c" + fi + # Set up other core UNIX files + SOURCES="$SOURCES $srcdir/src/core/unix/*.c" + ;; + *-*-cygwin* | *-*-mingw32*) + ARCH=win32 + if test "$build" != "$host"; then # cross-compiling + # Default cross-compile location + ac_default_prefix=/usr/local/cross-tools/$host + else + # Look for the location of the tools and install there + if test "$BUILD_PREFIX" != ""; then + ac_default_prefix=$BUILD_PREFIX + fi + fi + CheckDeclarationAfterStatement + CheckDummyVideo + CheckDiskAudio + CheckDummyAudio + CheckWINDOWS + CheckWINDOWSGL + CheckWINDOWSGLES + CheckVulkan + CheckDIRECTX + + # Set up the core platform files + SOURCES="$SOURCES $srcdir/src/core/windows/*.c" + + # Set up files for the video library + if test x$enable_video = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_WINDOWS, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/video/windows/*.c" + have_video=yes + AC_ARG_ENABLE(render-d3d, +AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]), + , enable_render_d3d=yes) + if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then + AC_DEFINE(SDL_VIDEO_RENDER_D3D, 1, [ ]) + fi + if test x$enable_render_d3d = xyes -a x$have_d3d11 = xyes; then + AC_DEFINE(SDL_VIDEO_RENDER_D3D11, 1, [ ]) + fi + fi + # Set up files for the audio library + if test x$enable_audio = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_WINMM, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/winmm/*.c" + if test x$have_dsound = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c" + fi + if test x$have_wasapi = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_WASAPI, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/wasapi/*.c" + fi + have_audio=yes + fi + # Set up files for the joystick library + if test x$enable_joystick = xyes; then + if test x$have_dinput = xyes -o x$have_xinput = xyes; then + if test x$have_xinput = xyes; then + AC_DEFINE(SDL_JOYSTICK_XINPUT, 1, [ ]) + fi + if test x$have_dinput = xyes; then + AC_DEFINE(SDL_JOYSTICK_DINPUT, 1, [ ]) + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8" + fi + else + AC_DEFINE(SDL_JOYSTICK_WINMM, 1, [ ]) + fi + SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c" + have_joystick=yes + fi + if test x$enable_haptic = xyes; then + if test x$have_dinput = xyes -o x$have_xinput = xyes; then + if test x$have_xinput = xyes; then + AC_DEFINE(SDL_HAPTIC_XINPUT, 1, [ ]) + fi + if test x$have_dinput = xyes; then + AC_DEFINE(SDL_HAPTIC_DINPUT, 1, [ ]) + fi + SOURCES="$SOURCES $srcdir/src/haptic/windows/*.c" + have_haptic=yes + fi + fi + if test x$enable_power = xyes; then + AC_DEFINE(SDL_POWER_WINDOWS, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/power/windows/SDL_syspower.c" + have_power=yes + fi + if test x$enable_filesystem = xyes; then + AC_DEFINE(SDL_FILESYSTEM_WINDOWS, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/filesystem/windows/SDL_sysfilesystem.c" + have_filesystem=yes + fi + # Set up files for the thread library + if test x$enable_threads = xyes; then + AC_DEFINE(SDL_THREAD_WINDOWS, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/thread/windows/*.c" + SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c" + have_threads=yes + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + AC_DEFINE(SDL_TIMER_WINDOWS, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/timer/windows/*.c" + have_timers=yes + fi + # Set up files for the shared object loading library + if test x$enable_loadso = xyes; then + AC_DEFINE(SDL_LOADSO_WINDOWS, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/loadso/windows/*.c" + have_loadso=yes + fi + # Set up the system libraries we need + if test -f /lib/w32api/libuuid.a; then + LIBUUID=/lib/w32api/libuuid.a + else + LIBUUID=-luuid + fi + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion $LIBUUID -static-libgcc" + # The Windows platform requires special setup + VERSION_SOURCES="$srcdir/src/main/windows/*.rc" + SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c" + SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main" + SDL_LIBS="-lSDL2main $SDL_LIBS -mwindows" + + # Check to see if this is a mingw or cygwin build + have_mingw32= + AC_CHECK_LIB(mingw32, main, [have_mingw32=yes]) + if test x$have_mingw32 = xyes; then + SDL_LIBS="-lmingw32 $SDL_LIBS" + else + SDL_LIBS="-lcygwin $SDL_LIBS" + fi + ;; + + dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. + *-*-beos*) + AC_MSG_ERROR([ +*** BeOS support has been removed as of SDL 2.0.2. + ]) + ;; + + *-*-haiku*) + ARCH=haiku + ac_default_prefix=/boot/system + CheckDummyVideo + CheckDiskAudio + CheckDummyAudio + CheckDLOPEN + CheckHaikuVideo + CheckHaikuGL + CheckPTHREAD + + # Set up files for the audio library + if test x$enable_audio = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_HAIKU, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/haiku/*.cc" + SUMMARY_audio="${SUMMARY_audio} haiku" + have_audio=yes + fi + # Set up files for the joystick library + if test x$enable_joystick = xyes; then + AC_DEFINE(SDL_JOYSTICK_HAIKU, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/joystick/haiku/*.cc" + have_joystick=yes + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + AC_DEFINE(SDL_TIMER_HAIKU, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/timer/haiku/*.c" + have_timers=yes + fi + # Set up files for the system power library + if test x$enable_power = xyes; then + AC_DEFINE(SDL_POWER_HAIKU, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/power/haiku/*.c" + have_power=yes + fi + # Set up files for the system filesystem library + if test x$enable_filesystem = xyes; then + AC_DEFINE(SDL_FILESYSTEM_HAIKU, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/filesystem/haiku/*.cc" + have_filesystem=yes + fi + # The Haiku platform requires special setup. + SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding" + # Haiku's x86 spins use libstdc++.r4.so (for binary compat?), but + # other spins, like x86-64, use a more standard "libstdc++.so.*" + AC_CHECK_FILE("/boot/system/lib/libstdc++.r4.so", EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lstdc++.r4", EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lstdc++") + ;; + arm*-apple-darwin*|*-ios-*|*-tvos-*) + ARCH=ios + + CheckVisibilityHidden + CheckDeclarationAfterStatement + CheckDummyVideo + CheckDiskAudio + CheckDummyAudio + CheckDLOPEN + CheckMETAL + CheckVulkan + CheckPTHREAD + + # Set up files for the audio library + if test x$enable_audio = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m" + SUMMARY_audio="${SUMMARY_audio} coreaudio" + have_audio=yes + fi + # Set up files for the joystick library + if test x$enable_joystick = xyes; then + AC_DEFINE(SDL_JOYSTICK_MFI, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/joystick/iphoneos/*.m" + SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" + have_joystick=yes + fi + # Set up files for the haptic library + #if test x$enable_haptic = xyes; then + # SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c" + # have_haptic=yes + # EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback" + #fi + # Set up files for the power library + if test x$enable_power = xyes; then + AC_DEFINE(SDL_POWER_UIKIT, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/power/uikit/*.m" + have_power=yes + fi + # Set up files for the filesystem library + if test x$enable_filesystem = xyes; then + SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m" + have_filesystem=yes + fi + # Set up additional files for the file library + if test x$enable_file = xyes; then + AC_DEFINE(SDL_FILESYSTEM_COCOA, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m" + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + AC_DEFINE(SDL_TIMER_UNIX, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" + have_timers=yes + fi + # Set up other core UNIX files + SOURCES="$SOURCES $srcdir/src/core/unix/*.c" + # The iOS platform requires special setup. + AC_DEFINE(SDL_VIDEO_DRIVER_UIKIT, 1, [ ]) + + if test x$video_opengles_v1 = xyes; then + AC_DEFINE(SDL_VIDEO_OPENGL_ES, 1, [ ]) + AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES, 1, [ ]) + SUMMARY_video="${SUMMARY_video} opengl_es1" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGLES" + fi + + if test x$video_opengles_v2 = xyes; then + AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ]) + AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ]) + SUMMARY_video="${SUMMARY_video} opengl_es2" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGLES" + fi + + SOURCES="$SOURCES $srcdir/src/video/uikit/*.m" + + case "$host" in + *-ios-*) + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreMotion" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit" + ;; + *-tvos-*) + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit" + ;; + *-darwin-*) + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreMotion" + ;; + esac + + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AVFoundation" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreGraphics" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Foundation" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,GameController" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore" + + if test x$enable_render = xyes -a x$enable_render_metal = xyes; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Metal" + fi + ;; + *-*-darwin* ) + # This could be either full "Mac OS X", or plain "Darwin" which is + # just the OS X kernel sans upper layers like Carbon and Cocoa. + # Next line is broken, and a few files below require Mac OS X (full) + ARCH=macosx + + # Mac OS X builds with both the Carbon and OSX APIs at the moment + EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON" + EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX" + + CheckVisibilityHidden + CheckDeclarationAfterStatement + CheckDummyVideo + CheckDiskAudio + CheckDummyAudio + CheckDLOPEN + CheckCOCOA + CheckMETAL + CheckX11 + CheckMacGL + CheckOpenGLX11 + CheckVulkan + CheckPTHREAD + + # Set up files for the audio library + if test x$enable_audio = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox" + SUMMARY_audio="${SUMMARY_audio} coreaudio" + have_audio=yes + fi + # Set up files for the joystick library + if test x$enable_joystick = xyes; then + AC_DEFINE(SDL_JOYSTICK_IOKIT, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c" + have_joystick=yes + fi + # Set up files for the haptic library + if test x$enable_haptic = xyes; then + AC_DEFINE(SDL_HAPTIC_IOKIT, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback" + have_haptic=yes + fi + # Set up files for the power library + if test x$enable_power = xyes; then + AC_DEFINE(SDL_POWER_MACOSX, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/power/macosx/*.c" + have_power=yes + fi + # Set up files for the filesystem library + if test x$enable_filesystem = xyes; then + AC_DEFINE(SDL_FILESYSTEM_COCOA, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m" + have_filesystem=yes + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + AC_DEFINE(SDL_TIMER_UNIX, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" + have_timers=yes + fi + # Set up additional files for the file library + if test x$enable_file = xyes; then + SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m" + fi + # Set up other core UNIX files + SOURCES="$SOURCES $srcdir/src/core/unix/*.c" + # The Mac OS X platform requires special setup. + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreVideo" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit" + + if test x$enable_render = xyes -a x$enable_render_metal = xyes; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-weak_framework,QuartzCore -Wl,-weak_framework,Metal" + fi + ;; + *-nacl|*-pnacl) + ARCH=nacl + CheckNativeClient + CheckDummyAudio + CheckDummyVideo + CheckInputEvents + CheckPTHREAD + + # Set up files for the timer library + if test x$enable_timers = xyes; then + AC_DEFINE(SDL_TIMER_UNIX, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" + have_timers=yes + fi + + if test x$enable_filesystem = xyes; then + AC_DEFINE(SDL_FILESYSTEM_NACL, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/filesystem/nacl/*.c" + have_filesystem=yes + fi + ;; + *-*-emscripten* ) + if test x$enable_video = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_EMSCRIPTEN, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/video/emscripten/*.c" + have_video=yes + SUMMARY_video="${SUMMARY_video} emscripten" + fi + + if test x$enable_audio = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_EMSCRIPTEN, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/emscripten/*.c" + have_audio=yes + SUMMARY_audio="${SUMMARY_audio} emscripten" + fi + + CheckVisibilityHidden + CheckDeclarationAfterStatement + CheckDummyVideo + CheckDiskAudio + CheckDummyAudio + CheckDLOPEN + CheckClockGettime + CheckEmscriptenGLES + + # Set up files for the power library + if test x$enable_power = xyes; then + AC_DEFINE(SDL_POWER_EMSCRIPTEN, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/power/emscripten/*.c" + have_power=yes + fi + + # Set up files for the power library + if test x$enable_joystick = xyes; then + AC_DEFINE(SDL_JOYSTICK_EMSCRIPTEN, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/joystick/emscripten/*.c" + have_joystick=yes + fi + + # Set up files for the filesystem library + if test x$enable_filesystem = xyes; then + AC_DEFINE(SDL_FILESYSTEM_EMSCRIPTEN, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/filesystem/emscripten/*.c" + have_filesystem=yes + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + AC_DEFINE(SDL_TIMER_UNIX, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" + have_timers=yes + fi + ;; + *) + AC_MSG_ERROR([ +*** Unsupported host: Please add to configure.in + ]) + ;; +esac + +# Verify that we have all the platform specific files we need + +if test x$have_joystick != xyes; then + if test x$enable_joystick = xyes; then + AC_DEFINE(SDL_JOYSTICK_DISABLED, 1, [ ]) + fi + SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c" +fi +if test x$have_haptic != xyes; then + if test x$enable_haptic = xyes; then + AC_DEFINE(SDL_HAPTIC_DISABLED, 1, [ ]) + fi + SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c" +fi +if test x$have_threads != xyes; then + if test x$enable_threads = xyes; then + AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ]) + fi + SOURCES="$SOURCES $srcdir/src/thread/generic/*.c" +fi +if test x$have_timers != xyes; then + if test x$enable_timers = xyes; then + AC_DEFINE(SDL_TIMERS_DISABLED, 1, [ ]) + fi + SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c" +fi +if test x$have_filesystem != xyes; then + if test x$enable_filesystem = xyes; then + AC_DEFINE(SDL_FILESYSTEM_DISABLED, 1, [ ]) + fi + SOURCES="$SOURCES $srcdir/src/filesystem/dummy/*.c" +fi +if test x$have_loadso != xyes; then + if test x$enable_loadso = xyes; then + AC_DEFINE(SDL_LOADSO_DISABLED, 1, [ ]) + fi + SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c" +fi +if test x$SDLMAIN_SOURCES = x; then + SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c" +fi +SDLTEST_SOURCES="$srcdir/src/test/*.c" + +if test x$video_wayland = xyes; then + WAYLAND_CORE_PROTOCOL_SOURCE='$(gen)/wayland-protocol.c' + WAYLAND_CORE_PROTOCOL_HEADER='$(gen)/wayland-client-protocol.h' + WAYLAND_PROTOCOLS_UNSTABLE_SOURCES=`echo $WAYLAND_PROTOCOLS_UNSTABLE |\ + sed 's,[[^ ]]\+,\\$(gen)/&-protocol.c,g'` + WAYLAND_PROTOCOLS_UNSTABLE_HEADERS=`echo $WAYLAND_PROTOCOLS_UNSTABLE |\ + sed 's,[[^ ]]\+,\\$(gen)/&-client-protocol.h,g'` + GEN_SOURCES="$GEN_SOURCES $WAYLAND_CORE_PROTOCOL_SOURCE $WAYLAND_PROTOCOLS_UNSTABLE_SOURCES" + GEN_HEADERS="$GEN_HEADERS $WAYLAND_CORE_PROTOCOL_HEADER $WAYLAND_PROTOCOLS_UNSTABLE_HEADERS" + + WAYLAND_CORE_PROTOCOL_SOURCE_DEPENDS=" +$WAYLAND_CORE_PROTOCOL_SOURCE: $WAYLAND_CORE_PROTOCOL_DIR/wayland.xml + \$(SHELL) \$(auxdir)/mkinstalldirs \$(gen) + \$(RUN_CMD_GEN)\$(WAYLAND_SCANNER) code \$< \$@" + + WAYLAND_CORE_PROTOCOL_HEADER_DEPENDS=" +$WAYLAND_CORE_PROTOCOL_HEADER: $WAYLAND_CORE_PROTOCOL_DIR/wayland.xml + \$(SHELL) \$(auxdir)/mkinstalldirs \$(gen) + \$(RUN_CMD_GEN)\$(WAYLAND_SCANNER) client-header \$< \$@" + + WAYLAND_CORE_PROTOCOL_OBJECT=" +\$(objects)/`echo $WAYLAND_CORE_PROTOCOL_SOURCE | sed 's/\$(gen)\/\(.*\).c$/\1.lo/'`: $WAYLAND_CORE_PROTOCOL_SOURCE + \$(RUN_CMD_CC)\$(LIBTOOL) --tag=CC --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \$< -o \$@" + + WAYLAND_PROTOCOLS_CLIENT_HEADER_UNSTABLE_DEPENDS=`for p in $WAYLAND_PROTOCOLS_UNSTABLE;\ + do echo ; echo \$p | sed\ + "s,^\\([[a-z\\-]]\\+\\)-unstable-\\(v[[0-9]]\+\\)\$,\\$(gen)/&-client-protocol.h: $WAYLAND_PROTOCOLS_DIR/unstable/\1/&.xml\\\\ + \\$(SHELL) \\$(auxdir)/mkinstalldirs \\$(gen)\\\\ + \\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) client-header \\$< \\$@," ; done` + + WAYLAND_PROTOCOLS_CODE_UNSTABLE_DEPENDS=`for p in $WAYLAND_PROTOCOLS_UNSTABLE;\ + do echo ; echo \$p | sed\ + "s,^\\([[a-z\\-]]\\+\\)-unstable-\\(v[[0-9]]\+\\)\$,\\$(gen)/&-protocol.c: $WAYLAND_PROTOCOLS_DIR/unstable/\1/&.xml\\\\ + \\$(SHELL) \\$(auxdir)/mkinstalldirs \\$(gen)\\\\ + \\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) code \\$< \\$@," ; done` + + WAYLAND_PROTOCOLS_OBJECTS_UNSTABLE=`for p in $WAYLAND_PROTOCOLS_UNSTABLE;\ + do echo ; echo \$p | sed\ + "s,^\\([[a-z\\-]]\\+\\)-unstable-\\(v[[0-9]]\+\\)\$,\\\$(objects)/&-protocol.lo: \\$(gen)/&-protocol.c \\$(gen)/&-client-protocol.h\\\\ + \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@," ; done` + + WAYLAND_PROTOCOLS_DEPENDS=" +$WAYLAND_CORE_PROTOCOL_SOURCE_DEPENDS +$WAYLAND_CORE_PROTOCOL_HEADER_DEPENDS +$WAYLAND_CORE_PROTOCOL_OBJECT +$WAYLAND_PROTOCOLS_CLIENT_HEADER_UNSTABLE_DEPENDS +$WAYLAND_PROTOCOLS_CODE_UNSTABLE_DEPENDS +$WAYLAND_PROTOCOLS_OBJECTS_UNSTABLE +" +fi + +OBJECTS=`echo $SOURCES` +DEPENDS=`echo $SOURCES | tr ' ' '\n'` +for EXT in asm cc m c S; do + OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.'$EXT',$(objects)/\1.lo,g'` + DEPENDS=`echo "$DEPENDS" | sed "s,^\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.$EXT\\$,\\\\ +\\$(objects)/\\2.lo: \\1/\\2.$EXT\\\\ + \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"` +done + +GEN_OBJECTS=`echo "$GEN_SOURCES" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'` + +VERSION_OBJECTS=`echo $VERSION_SOURCES` +VERSION_DEPENDS=`echo $VERSION_SOURCES` +VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'` +VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.rc,\\\\ +\\$(objects)/\\2.o: \\1/\\2.rc\\\\ + \\$(WINDRES) \\$< \\$@,g"` + +SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES` +SDLMAIN_DEPENDS=`echo $SDLMAIN_SOURCES` +SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'` +SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\ +\\$(objects)/\\2.lo: \\1/\\2.c\\\\ + \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"` + +SDLTEST_OBJECTS=`echo $SDLTEST_SOURCES` +SDLTEST_DEPENDS=`echo $SDLTEST_SOURCES` +SDLTEST_OBJECTS=`echo "$SDLTEST_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'` +SDLTEST_DEPENDS=`echo "$SDLTEST_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\ +\\$(objects)/\\2.lo: \\1/\\2.c\\\\ + \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"` + +# Set runtime shared library paths as needed + +if test "x$enable_rpath" = "xyes"; then + if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then + SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}" + + AC_MSG_CHECKING(for linker option --enable-new-dtags) + have_enable_new_dtags=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -Wl,--enable-new-dtags" + AC_TRY_LINK([ + ],[ + ],[ + have_enable_new_dtags=yes + SDL_RLD_FLAGS="$SDL_RLD_FLAGS -Wl,--enable-new-dtags" + ]) + LDFLAGS="$save_LDFLAGS" + AC_MSG_RESULT($have_enable_new_dtags) + fi + if test $ARCH = solaris; then + SDL_RLD_FLAGS="-R\${libdir}" + fi +else + SDL_RLD_FLAGS="" +fi + +SDL_STATIC_LIBS="$SDL_LIBS $EXTRA_LDFLAGS" + +dnl Expand the cflags and libraries needed by apps using SDL +AC_SUBST(SDL_CFLAGS) +AC_SUBST(SDL_LIBS) +AC_SUBST(SDL_STATIC_LIBS) +AC_SUBST(SDL_RLD_FLAGS) +if test x$enable_shared = xyes; then + ENABLE_SHARED_TRUE= + ENABLE_SHARED_FALSE="#" +else + ENABLE_SHARED_TRUE="#" + ENABLE_SHARED_FALSE= +fi +if test x$enable_static = xyes; then + ENABLE_STATIC_TRUE= + ENABLE_STATIC_FALSE="#" +else + ENABLE_STATIC_TRUE="#" + ENABLE_STATIC_FALSE= +fi +AC_SUBST(ENABLE_SHARED_TRUE) +AC_SUBST(ENABLE_SHARED_FALSE) +AC_SUBST(ENABLE_STATIC_TRUE) +AC_SUBST(ENABLE_STATIC_FALSE) + +dnl Expand the sources and objects needed to build the library +AC_SUBST(ac_aux_dir) +AC_SUBST(INCLUDE) +AC_SUBST(OBJECTS) +AC_SUBST(GEN_HEADERS) +AC_SUBST(GEN_OBJECTS) +AC_SUBST(VERSION_OBJECTS) +AC_SUBST(SDLMAIN_OBJECTS) +AC_SUBST(SDLTEST_OBJECTS) +AC_SUBST(BUILD_CFLAGS) +AC_SUBST(EXTRA_CFLAGS) +AC_SUBST(BUILD_LDFLAGS) +AC_SUBST(EXTRA_LDFLAGS) +AC_SUBST(WINDRES) +AC_SUBST(WAYLAND_SCANNER) + +cat >Makefile.rules <<__EOF__ + +# Build rules for objects +-include \$(OBJECTS:.lo=.d) + +# Special dependency for SDL.c, since it depends on SDL_revision.h +$srcdir/src/SDL.c: update-revision +$DEPENDS +$VERSION_DEPENDS +$SDLMAIN_DEPENDS +$SDLTEST_DEPENDS +$WAYLAND_PROTOCOLS_DEPENDS +__EOF__ + +AC_CONFIG_FILES([ + Makefile:Makefile.in:Makefile.rules sdl2-config sdl2-config.cmake SDL2.spec sdl2.pc +]) +AC_CONFIG_COMMANDS([sdl2_config],[chmod a+x sdl2-config]) + +SUMMARY="SDL2 Configure Summary:\n" +if test x$enable_shared = xyes; then + SUMMARY="${SUMMARY}Building Shared Libraries\n" +fi +if test x$enable_static = xyes; then + SUMMARY="${SUMMARY}Building Static Libraries\n" +fi +SUMMARY="${SUMMARY}Enabled modules :${SUMMARY_modules}\n" +SUMMARY="${SUMMARY}Assembly Math :${SUMMARY_math}\n" +SUMMARY="${SUMMARY}Audio drivers :${SUMMARY_audio}\n" +SUMMARY="${SUMMARY}Video drivers :${SUMMARY_video}\n" +if test x$have_x = xyes; then + SUMMARY="${SUMMARY}X11 libraries :${SUMMARY_video_x11}\n" +fi +SUMMARY="${SUMMARY}Input drivers :${SUMMARY_input}\n" +if test x$have_samplerate_h_hdr = xyes; then + SUMMARY="${SUMMARY}Using libsamplerate : YES\n" +else + SUMMARY="${SUMMARY}Using libsamplerate : NO\n" +fi +if test x$have_libudev_h_hdr = xyes; then + SUMMARY="${SUMMARY}Using libudev : YES\n" +else + SUMMARY="${SUMMARY}Using libudev : NO\n" +fi +if test x$have_dbus_dbus_h_hdr = xyes; then + SUMMARY="${SUMMARY}Using dbus : YES\n" +else + SUMMARY="${SUMMARY}Using dbus : NO\n" +fi +if test x$enable_ime = xyes; then + SUMMARY="${SUMMARY}Using ime : YES\n" +else + SUMMARY="${SUMMARY}Using ime : NO\n" +fi +if test x$have_ibus_ibus_h_hdr = xyes; then + SUMMARY="${SUMMARY}Using ibus : YES\n" +else + SUMMARY="${SUMMARY}Using ibus : NO\n" +fi +if test x$have_fcitx_frontend_h_hdr = xyes; then + SUMMARY="${SUMMARY}Using fcitx : YES\n" +else + SUMMARY="${SUMMARY}Using fcitx : NO\n" +fi +AC_CONFIG_COMMANDS([summary], [echo -en "$SUMMARY"], [SUMMARY="$SUMMARY"]) + +AC_OUTPUT diff --git a/tvos.sh b/tvos.sh index f88f788..b856399 100755 --- a/tvos.sh +++ b/tvos.sh @@ -30,8 +30,9 @@ echo -e "\nINFO: Build options: $*\n" 1>>"${BASEDIR}"/build.log 2>&1 # SET DEFAULT BUILD OPTIONS GPL_ENABLED="no" DISPLAY_HELP="" -BUILD_FULL="" BUILD_TYPE_ID="" +BUILD_FULL="" +FFMPEG_KIT_XCF_BUILD="" BUILD_FORCE="" BUILD_VERSION=$(git describe --tags --always 2>>"${BASEDIR}"/build.log) if [[ -z ${BUILD_VERSION} ]]; then @@ -58,7 +59,7 @@ while [ ! $# -eq 0 ]; do exit 0 ;; --skip-*) - SKIP_LIBRARY=$(echo $1 | sed -e 's/^--[A-Za-z]*-//g') + SKIP_LIBRARY=$(echo "$1" | sed -e 's/^--[A-Za-z]*-//g') skip_library "${SKIP_LIBRARY}" ;; @@ -77,8 +78,11 @@ while [ ! $# -eq 0 ]; do optimize_for_speed ;; -l | --lts) ;; + -x | --xcframework) + FFMPEG_KIT_XCF_BUILD="1" + ;; -f | --force) - BUILD_FORCE="1" + export BUILD_FORCE="1" ;; --reconf-*) CONF_LIBRARY=$(echo $1 | sed -e 's/^--[A-Za-z]*-//g') @@ -128,12 +132,12 @@ fi # PROCESS FULL OPTION AS LAST OPTION if [[ -n ${BUILD_FULL} ]]; then - for library in {0..57}; do + for library in {0..58}; do if [ ${GPL_ENABLED} == "yes" ]; then - enable_library "$(get_library_name $library)" 1 + enable_library "$(get_library_name "$library")" 1 else - if [[ $(is_gpl_licensed $library) -eq 1 ]]; then - enable_library "$(get_library_name $library)" 1 + if [[ $(is_gpl_licensed "$library") -eq 1 ]]; then + enable_library "$(get_library_name "$library")" 1 fi fi done @@ -145,6 +149,14 @@ if [[ -n ${DISPLAY_HELP} ]]; then exit 0 fi +# CHECK SOME RULES FOR .xcframework BUNDLES + +# 1. DO NOT ALLOW --lts AND --xcframework OPTIONS TOGETHER +if [[ -n ${FFMPEG_KIT_XCF_BUILD} ]] && [[ -n ${FFMPEG_KIT_LTS_BUILD} ]]; then + echo -e "\n(*) LTS packages does not support xcframework bundles.\n" + exit 1 +fi + echo -e "\nBuilding ffmpeg-kit ${BUILD_TYPE_ID}static library for tvOS\n" echo -e -n "INFO: Building ffmpeg-kit ${BUILD_VERSION} ${BUILD_TYPE_ID}for tvOS: " 1>>"${BASEDIR}"/build.log 2>&1 echo -e "$(date)\n" 1>>"${BASEDIR}"/build.log 2>&1 @@ -159,7 +171,7 @@ print_redownload_requested_libraries # VALIDATE GPL FLAGS for gpl_library in {$LIBRARY_X264,$LIBRARY_XVIDCORE,$LIBRARY_X265,$LIBRARY_LIBVIDSTAB,$LIBRARY_RUBBERBAND}; do if [[ ${ENABLED_LIBRARIES[$gpl_library]} -eq 1 ]]; then - library_name=$(get_library_name ${gpl_library}) + library_name=$(get_library_name "${gpl_library}") if [ ${GPL_ENABLED} != "yes" ]; then echo -e "\n(*) Invalid configuration detected. GPL library ${library_name} enabled without --enable-gpl flag.\n" @@ -172,6 +184,9 @@ done echo -n -e "\nDownloading sources: " echo -e "INFO: Downloading source code of ffmpeg and enabled external libraries.\n" 1>>"${BASEDIR}"/build.log 2>&1 +# DOWNLOAD GNU CONFIG +download_gnu_config + # DOWNLOAD LIBRARY SOURCES downloaded_enabled_library_sources "${ENABLED_LIBRARIES[@]}" @@ -179,515 +194,51 @@ downloaded_enabled_library_sources "${ENABLED_LIBRARIES[@]}" TARGET_ARCH_LIST=() # BUILD ENABLED LIBRARIES ON ENABLED ARCHITECTURES -for run_arch in {0..10}; do +for run_arch in {0..12}; do if [[ ${ENABLED_ARCHITECTURES[$run_arch]} -eq 1 ]]; then - export ARCH=$(get_arch_name $run_arch) - export TARGET_SDK=$(get_target_sdk) + export ARCH=$(get_arch_name "$run_arch") + export FULL_ARCH=$(get_full_arch_name "$run_arch") export SDK_PATH=$(get_sdk_path) export SDK_NAME=$(get_sdk_name) - export LIPO="$(xcrun --sdk "$(get_sdk_name)" -f lipo)" - # EXECUTE MAIN BUILD SCRIPT . "${BASEDIR}"/scripts/main-tvos.sh "${ENABLED_LIBRARIES[@]}" - case ${ARCH} in - x86-64) - TARGET_ARCH="x86_64" - ;; - *) - TARGET_ARCH="${ARCH}" - ;; - esac - TARGET_ARCH_LIST+=(${TARGET_ARCH}) + + TARGET_ARCH_LIST+=("${FULL_ARCH}") # CLEAR FLAGS - for library in {0..57}; do - library_name=$(get_library_name ${library}) + for library in {0..58}; do + library_name=$(get_library_name "${library}") unset "$(echo "OK_${library_name}" | sed "s/\-/\_/g")" unset "$(echo "DEPENDENCY_REBUILT_${library_name}" | sed "s/\-/\_/g")" done fi done -FFMPEG_LIBS="libavcodec libavdevice libavfilter libavformat libavutil libswresample libswscale" - -# BUILD STATIC LIBRARIES -BUILD_LIBRARY_EXTENSION="a" - # BUILD FFMPEG-KIT if [[ -n ${TARGET_ARCH_LIST[0]} ]]; then - echo -e -n "\n\nCreating frameworks and universal libraries under prebuilt: " + # INITIALIZE TARGET FOLDERS + initialize_prebuilt_tvos_folders - # CREATE FFMPEG + # PREPARE PLATFORM ARCHITECTURE STRINGS + build_apple_architecture_variant_strings - # INITIALIZE UNIVERSAL LIBRARY DIRECTORY - rm -rf "${BASEDIR}"/prebuilt/tvos-universal 1>>"${BASEDIR}"/build.log 2>&1 - mkdir -p "${BASEDIR}"/prebuilt/tvos-universal 1>>"${BASEDIR}"/build.log 2>&1 - rm -rf "${BASEDIR}"/prebuilt/tvos-framework 1>>"${BASEDIR}"/build.log 2>&1 - mkdir -p "${BASEDIR}"/prebuilt/tvos-framework 1>>"${BASEDIR}"/build.log 2>&1 + if [[ -n ${FFMPEG_KIT_XCF_BUILD} ]]; then + echo -e -n "\n\nCreating universal libraries and xcframeworks under prebuilt: " - # CREATE ENABLED LIBRARY PACKAGES - for library in {0..57}; do - if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then - library_name=$(get_library_name ${library}) + create_universal_libraries_for_tvos_xcframeworks - # EACH ENABLED LIBRARY HAS TO HAVE A .pc FILE AND A VERSION - package_config_file_name=$(get_package_config_file_name ${library}) - library_version=$(get_external_library_version "${package_config_file_name}") - if [[ -z ${library_version} ]]; then - echo -e "Failed to detect version for ${library_name} from ${package_config_file_name}.pc\n" 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "failed\n" - exit 1 - fi + create_frameworks_for_tvos_xcframeworks - echo -e "Creating universal library for ${library_name}\n" 1>>"${BASEDIR}"/build.log 2>&1 - - # SOME CUSTOM CODE TO HANDLE LIBRARIES THAT PRODUCE MULTIPLE LIBRARY FILES - if [[ ${LIBRARY_LIBTHEORA} == "$library" ]]; then - - LIBRARY_CREATED=$(create_static_fat_library "libtheora.a" "libtheora") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - LIBRARY_CREATED=$(create_static_fat_library "libtheoraenc.a" "libtheoraenc") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - LIBRARY_CREATED=$(create_static_fat_library "libtheoradec.a" "libtheoradec") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - FRAMEWORK_CREATED=$(create_static_framework "libtheora" "libtheora.a" $library_version) - if [[ ${FRAMEWORK_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - FRAMEWORK_CREATED=$(create_static_framework "libtheoraenc" "libtheoraenc.a" $library_version) - if [[ ${FRAMEWORK_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - FRAMEWORK_CREATED=$(create_static_framework "libtheoradec" "libtheoradec.a" $library_version) - if [[ ${FRAMEWORK_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - $(cp $(get_external_library_license_path ${library}) "${BASEDIR}"/prebuilt/tvos-universal/libtheora-universal/LICENSE 1>>"${BASEDIR}"/build.log 2>&1) - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - $(cp $(get_external_library_license_path ${library}) "${BASEDIR}"/prebuilt/tvos-universal/libtheoraenc-universal/LICENSE 1>>"${BASEDIR}"/build.log 2>&1) - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - $(cp $(get_external_library_license_path ${library}) "${BASEDIR}"/prebuilt/tvos-universal/libtheoradec-universal/LICENSE 1>>"${BASEDIR}"/build.log 2>&1) - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - $(cp $(get_external_library_license_path ${library}) "${BASEDIR}"/prebuilt/tvos-framework/libtheora.framework/LICENSE 1>>"${BASEDIR}"/build.log 2>&1) - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - $(cp $(get_external_library_license_path ${library}) "${BASEDIR}"/prebuilt/tvos-framework/libtheoraenc.framework/LICENSE 1>>"${BASEDIR}"/build.log 2>&1) - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - $(cp $(get_external_library_license_path ${library}) "${BASEDIR}"/prebuilt/tvos-framework/libtheoradec.framework/LICENSE 1>>"${BASEDIR}"/build.log 2>&1) - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - elif [[ ${LIBRARY_LIBVORBIS} == "$library" ]]; then - - LIBRARY_CREATED=$(create_static_fat_library "libvorbisfile.a" "libvorbisfile") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - LIBRARY_CREATED=$(create_static_fat_library "libvorbisenc.a" "libvorbisenc") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - LIBRARY_CREATED=$(create_static_fat_library "libvorbis.a" "libvorbis") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - FRAMEWORK_CREATED=$(create_static_framework "libvorbisfile" "libvorbisfile.a" $library_version) - if [[ ${FRAMEWORK_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - FRAMEWORK_CREATED=$(create_static_framework "libvorbisenc" "libvorbisenc.a" $library_version) - if [[ ${FRAMEWORK_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - FRAMEWORK_CREATED=$(create_static_framework "libvorbis" "libvorbis.a" $library_version) - if [[ ${FRAMEWORK_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - $(cp $(get_external_library_license_path ${library}) "${BASEDIR}"/prebuilt/tvos-universal/libvorbisfile-universal/LICENSE 1>>"${BASEDIR}"/build.log 2>&1) - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - $(cp $(get_external_library_license_path ${library}) "${BASEDIR}"/prebuilt/tvos-universal/libvorbisenc-universal/LICENSE 1>>"${BASEDIR}"/build.log 2>&1) - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - $(cp $(get_external_library_license_path ${library}) "${BASEDIR}"/prebuilt/tvos-universal/libvorbis-universal/LICENSE 1>>"${BASEDIR}"/build.log 2>&1) - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - $(cp $(get_external_library_license_path ${library}) "${BASEDIR}"/prebuilt/tvos-framework/libvorbisfile.framework/LICENSE 1>>"${BASEDIR}"/build.log 2>&1) - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - $(cp $(get_external_library_license_path ${library}) "${BASEDIR}"/prebuilt/tvos-framework/libvorbisenc.framework/LICENSE 1>>"${BASEDIR}"/build.log 2>&1) - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - $(cp $(get_external_library_license_path ${library}) "${BASEDIR}"/prebuilt/tvos-framework/libvorbis.framework/LICENSE 1>>"${BASEDIR}"/build.log 2>&1) - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - elif [[ ${LIBRARY_LIBWEBP} == "$library" ]]; then - - LIBRARY_CREATED=$(create_static_fat_library "libwebpmux.a" "libwebpmux") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - LIBRARY_CREATED=$(create_static_fat_library "libwebpdemux.a" "libwebpdemux") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - LIBRARY_CREATED=$(create_static_fat_library "libwebp.a" "libwebp") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - FRAMEWORK_CREATED=$(create_static_framework "libwebpmux" "libwebpmux.a" $library_version) - if [[ ${FRAMEWORK_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - FRAMEWORK_CREATED=$(create_static_framework "libwebpdemux" "libwebpdemux.a" $library_version) - if [[ ${FRAMEWORK_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - FRAMEWORK_CREATED=$(create_static_framework "libwebp" "libwebp.a" $library_version) - if [[ ${FRAMEWORK_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - $(cp $(get_external_library_license_path ${library}) "${BASEDIR}"/prebuilt/tvos-universal/libwebpmux-universal/LICENSE 1>>"${BASEDIR}"/build.log 2>&1) - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - $(cp $(get_external_library_license_path ${library}) "${BASEDIR}"/prebuilt/tvos-universal/libwebpdemux-universal/LICENSE 1>>"${BASEDIR}"/build.log 2>&1) - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - $(cp $(get_external_library_license_path ${library}) "${BASEDIR}"/prebuilt/tvos-universal/libwebp-universal/LICENSE 1>>"${BASEDIR}"/build.log 2>&1) - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - $(cp $(get_external_library_license_path ${library}) "${BASEDIR}"/prebuilt/tvos-framework/libwebpmux.framework/LICENSE 1>>"${BASEDIR}"/build.log 2>&1) - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - $(cp $(get_external_library_license_path ${library}) "${BASEDIR}"/prebuilt/tvos-framework/libwebpdemux.framework/LICENSE 1>>"${BASEDIR}"/build.log 2>&1) - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - $(cp $(get_external_library_license_path ${library}) "${BASEDIR}"/prebuilt/tvos-framework/libwebp.framework/LICENSE 1>>"${BASEDIR}"/build.log 2>&1) - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - elif - [[ ${LIBRARY_OPENCOREAMR} == "$library" ]] - then - - LIBRARY_CREATED=$(create_static_fat_library "libopencore-amrnb.a" "libopencore-amrnb") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - FRAMEWORK_CREATED=$(create_static_framework "libopencore-amrnb" "libopencore-amrnb.a" $library_version) - if [[ ${FRAMEWORK_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - $(cp $(get_external_library_license_path ${library}) "${BASEDIR}"/prebuilt/tvos-universal/libopencore-amrnb-universal/LICENSE 1>>"${BASEDIR}"/build.log 2>&1) - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - $(cp $(get_external_library_license_path ${library}) "${BASEDIR}"/prebuilt/tvos-framework/libopencore-amrnb.framework/LICENSE 1>>"${BASEDIR}"/build.log 2>&1) - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - elif [[ ${LIBRARY_NETTLE} == "$library" ]]; then - - LIBRARY_CREATED=$(create_static_fat_library "libnettle.a" "libnettle") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - LIBRARY_CREATED=$(create_static_fat_library "libhogweed.a" "libhogweed") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - FRAMEWORK_CREATED=$(create_static_framework "libnettle" "libnettle.a" $library_version) - if [[ ${FRAMEWORK_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - FRAMEWORK_CREATED=$(create_static_framework "libhogweed" "libhogweed.a" $library_version) - if [[ ${FRAMEWORK_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - $(cp $(get_external_library_license_path ${library}) "${BASEDIR}"/prebuilt/tvos-universal/libnettle-universal/LICENSE 1>>"${BASEDIR}"/build.log 2>&1) - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - $(cp $(get_external_library_license_path ${library}) "${BASEDIR}"/prebuilt/tvos-universal/libhogweed-universal/LICENSE 1>>"${BASEDIR}"/build.log 2>&1) - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - $(cp $(get_external_library_license_path ${library}) "${BASEDIR}"/prebuilt/tvos-framework/libnettle.framework/LICENSE 1>>"${BASEDIR}"/build.log 2>&1) - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - $(cp $(get_external_library_license_path ${library}) "${BASEDIR}"/prebuilt/tvos-framework/libhogweed.framework/LICENSE 1>>"${BASEDIR}"/build.log 2>&1) - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - else - - # LIBRARIES WHICH HAVE ONLY ONE LIBRARY FILE ARE CREATED HERE - library_name=$(get_library_name $((library))) - static_archive_name=$(get_static_archive_name $((library))) - LIBRARY_CREATED=$(create_static_fat_library "$static_archive_name" "$library_name") - if [[ ${LIBRARY_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - FRAMEWORK_CREATED=$(create_static_framework "$library_name" "$static_archive_name" "$library_version") - if [[ ${FRAMEWORK_CREATED} -ne 0 ]]; then - echo -e "failed\n" - exit 1 - fi - - $(cp $(get_external_library_license_path ${library}) "${BASEDIR}"/prebuilt/tvos-universal/${library_name}-universal/LICENSE 1>>"${BASEDIR}"/build.log 2>&1) - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - $(cp $(get_external_library_license_path ${library}) "${BASEDIR}"/prebuilt/tvos-framework/${library_name}.framework/LICENSE 1>>"${BASEDIR}"/build.log 2>&1) - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - fi - - fi - done - - # CREATE FFMPEG - - # INITIALIZE UNIVERSAL LIBRARY DIRECTORY - FFMPEG_UNIVERSAL="${BASEDIR}"/prebuilt/tvos-universal/ffmpeg-universal - mkdir -p "${FFMPEG_UNIVERSAL}"/include 1>>"${BASEDIR}"/build.log 2>&1 - mkdir -p "${FFMPEG_UNIVERSAL}"/lib 1>>"${BASEDIR}"/build.log 2>&1 - - # COPY HEADER FILES - cp -r "${BASEDIR}"/prebuilt/tvos-"${TARGET_ARCH_LIST[0]}"-apple-darwin/ffmpeg/include/* "${FFMPEG_UNIVERSAL}"/include 1>>"${BASEDIR}"/build.log 2>&1 - cp "${BASEDIR}"/prebuilt/tvos-"${TARGET_ARCH_LIST[0]}"-apple-darwin/ffmpeg/include/config.h "${FFMPEG_UNIVERSAL}"/include 1>>"${BASEDIR}"/build.log 2>&1 - - for FFMPEG_LIB in ${FFMPEG_LIBS}; do - LIPO_COMMAND="${LIPO} -create" - - for TARGET_ARCH in "${TARGET_ARCH_LIST[@]}"; do - LIPO_COMMAND+=" ${BASEDIR}/prebuilt/tvos-${TARGET_ARCH}-apple-darwin/ffmpeg/lib/${FFMPEG_LIB}.${BUILD_LIBRARY_EXTENSION}" - done - - LIPO_COMMAND+=" -output ${FFMPEG_UNIVERSAL}/lib/${FFMPEG_LIB}.${BUILD_LIBRARY_EXTENSION}" - - # EXECUTE CREATE UNIVERSAL LIBRARY COMMAND - ${LIPO_COMMAND} 1>>"${BASEDIR}"/build.log 2>&1 - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - FFMPEG_LIB_UPPERCASE=$(echo "${FFMPEG_LIB}" | tr '[a-z]' '[A-Z]') - FFMPEG_LIB_CAPITALCASE=$(to_capital_case "${FFMPEG_LIB}") - - # EXTRACT FFMPEG VERSION - FFMPEG_LIB_MAJOR=$(grep "#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MAJOR" "${FFMPEG_UNIVERSAL}"/include/${FFMPEG_LIB}/version.h | sed -e "s/#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MAJOR//g;s/\ //g") - FFMPEG_LIB_MINOR=$(grep "#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MINOR" "${FFMPEG_UNIVERSAL}"/include/${FFMPEG_LIB}/version.h | sed -e "s/#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MINOR//g;s/\ //g") - FFMPEG_LIB_MICRO=$(grep "#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MICRO" "${FFMPEG_UNIVERSAL}"/include/${FFMPEG_LIB}/version.h | sed "s/#define ${FFMPEG_LIB_UPPERCASE}_VERSION_MICRO//g;s/\ //g") - FFMPEG_LIB_VERSION="${FFMPEG_LIB_MAJOR}.${FFMPEG_LIB_MINOR}.${FFMPEG_LIB_MICRO}" - - # INITIALIZE FRAMEWORK DIRECTORY - FFMPEG_LIB_FRAMEWORK_PATH=${BASEDIR}/prebuilt/tvos-framework/${FFMPEG_LIB}.framework - rm -rf "${FFMPEG_LIB_FRAMEWORK_PATH}" 1>>"${BASEDIR}"/build.log 2>&1 - mkdir -p "${FFMPEG_LIB_FRAMEWORK_PATH}"/Headers 1>>"${BASEDIR}"/build.log 2>&1 - - # COPY HEADER FILES - cp -r "${FFMPEG_UNIVERSAL}/include/${FFMPEG_LIB}"/* "${FFMPEG_LIB_FRAMEWORK_PATH}"/Headers 1>>"${BASEDIR}"/build.log 2>&1 - - # COPY LIBRARY FILE - cp "${FFMPEG_UNIVERSAL}/lib/${FFMPEG_LIB}.${BUILD_LIBRARY_EXTENSION}" "${FFMPEG_LIB_FRAMEWORK_PATH}/${FFMPEG_LIB}" 1>>"${BASEDIR}"/build.log 2>&1 - - # COPY FRAMEWORK LICENSES - if [ ${GPL_ENABLED} == "yes" ]; then - cp "${BASEDIR}"/LICENSE.GPLv3 "${FFMPEG_LIB_FRAMEWORK_PATH}"/LICENSE 1>>"${BASEDIR}"/build.log 2>&1 - else - cp "${BASEDIR}"/LICENSE.LGPLv3 "${FFMPEG_LIB_FRAMEWORK_PATH}"/LICENSE 1>>"${BASEDIR}"/build.log 2>&1 - fi - - build_info_plist "${FFMPEG_LIB_FRAMEWORK_PATH}/Info.plist" "${FFMPEG_LIB}" "com.arthenica.ffmpegkit.${FFMPEG_LIB_CAPITALCASE}" "${FFMPEG_LIB_VERSION}" "${FFMPEG_LIB_VERSION}" - - echo -e "Created ${FFMPEG_LIB} framework successfully.\n" 1>>"${BASEDIR}"/build.log 2>&1 - done - - # COPY UNIVERSAL LIBRARY LICENSES - if [ ${GPL_ENABLED} == "yes" ]; then - cp "${BASEDIR}"/LICENSE.GPLv3 "${FFMPEG_UNIVERSAL}"/LICENSE 1>>"${BASEDIR}"/build.log 2>&1 + create_tvos_xcframeworks else - cp "${BASEDIR}"/LICENSE.LGPLv3 "${FFMPEG_UNIVERSAL}"/LICENSE 1>>"${BASEDIR}"/build.log 2>&1 + echo -e -n "\n\nCreating universal libraries and frameworks under prebuilt: " + + create_universal_libraries_for_tvos_default_frameworks + + create_tvos_default_frameworks fi - # FFMPEG KIT - - # INITIALIZE FRAMEWORK AND UNIVERSAL LIBRARY DIRECTORIES - FFMPEG_KIT_VERSION=$(get_ffmpeg_kit_version) - FFMPEG_KIT_UNIVERSAL=${BASEDIR}/prebuilt/tvos-universal/ffmpeg-kit-universal - FFMPEG_KIT_FRAMEWORK_PATH=${BASEDIR}/prebuilt/tvos-framework/ffmpegkit.framework - mkdir -p "${FFMPEG_KIT_UNIVERSAL}"/include 1>>"${BASEDIR}"/build.log 2>&1 - mkdir -p "${FFMPEG_KIT_UNIVERSAL}"/lib 1>>"${BASEDIR}"/build.log 2>&1 - rm -rf "${FFMPEG_KIT_FRAMEWORK_PATH}" 1>>"${BASEDIR}"/build.log 2>&1 - mkdir -p "${FFMPEG_KIT_FRAMEWORK_PATH}"/Headers 1>>"${BASEDIR}"/build.log 2>&1 - mkdir -p "${FFMPEG_KIT_FRAMEWORK_PATH}"/Modules 1>>"${BASEDIR}"/build.log 2>&1 - - LIPO_COMMAND="${LIPO} -create" - for TARGET_ARCH in "${TARGET_ARCH_LIST[@]}"; do - LIPO_COMMAND+=" ${BASEDIR}/prebuilt/tvos-${TARGET_ARCH}-apple-darwin/ffmpeg-kit/lib/libffmpegkit.${BUILD_LIBRARY_EXTENSION}" - done - LIPO_COMMAND+=" -output ${FFMPEG_KIT_UNIVERSAL}/lib/libffmpegkit.${BUILD_LIBRARY_EXTENSION}" - - # EXECUTE CREATE UNIVERSAL LIBRARY COMMAND - ${LIPO_COMMAND} 1>>"${BASEDIR}"/build.log 2>&1 - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - # COPY HEADER FILES - cp -r "${BASEDIR}"/prebuilt/tvos-"${TARGET_ARCH_LIST[0]}"-apple-darwin/ffmpeg-kit/include/* "${FFMPEG_KIT_UNIVERSAL}"/include 1>>"${BASEDIR}"/build.log 2>&1 - cp -r "${FFMPEG_KIT_UNIVERSAL}"/include/* "${FFMPEG_KIT_FRAMEWORK_PATH}/Headers" 1>>"${BASEDIR}"/build.log 2>&1 - - # COPY LIBRARY FILE - cp "${FFMPEG_KIT_UNIVERSAL}"/lib/libffmpegkit.${BUILD_LIBRARY_EXTENSION} "${FFMPEG_KIT_FRAMEWORK_PATH}"/ffmpegkit 1>>"${BASEDIR}"/build.log 2>&1 - - # COPY THE LICENSES - if [ ${GPL_ENABLED} == "yes" ]; then - cp "${BASEDIR}"/LICENSE.GPLv3 "${FFMPEG_KIT_UNIVERSAL}"/LICENSE 1>>"${BASEDIR}"/build.log 2>&1 - cp "${BASEDIR}"/LICENSE.GPLv3 "${FFMPEG_KIT_FRAMEWORK_PATH}"/LICENSE 1>>"${BASEDIR}"/build.log 2>&1 - else - cp "${BASEDIR}"/LICENSE.LGPLv3 "${FFMPEG_KIT_UNIVERSAL}"/LICENSE 1>>"${BASEDIR}"/build.log 2>&1 - cp "${BASEDIR}"/LICENSE.LGPLv3 "${FFMPEG_KIT_FRAMEWORK_PATH}"/LICENSE 1>>"${BASEDIR}"/build.log 2>&1 - fi - - build_info_plist "${FFMPEG_KIT_FRAMEWORK_PATH}/Info.plist" "ffmpegkit" "com.arthenica.ffmpegkit.FFmpegKit" "${FFMPEG_KIT_VERSION}" "${FFMPEG_KIT_VERSION}" - build_modulemap "${FFMPEG_KIT_FRAMEWORK_PATH}/Modules/module.modulemap" - - echo -e "Created ffmpeg-kit.framework and universal library successfully.\n" 1>>"${BASEDIR}"/build.log 2>&1 echo -e "ok\n" fi