add build scripts for linux platform
This commit is contained in:
parent
4cc9408596
commit
be4030ffb3
202
linux.sh
Executable file
202
linux.sh
Executable file
|
@ -0,0 +1,202 @@
|
|||
#!/bin/bash
|
||||
|
||||
# LOAD INITIAL SETTINGS
|
||||
export BASEDIR="$(pwd)"
|
||||
export FFMPEG_KIT_BUILD_TYPE="linux"
|
||||
source "${BASEDIR}"/scripts/variable.sh
|
||||
source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh
|
||||
disabled_libraries=()
|
||||
|
||||
# SET DEFAULTS SETTINGS
|
||||
enable_default_linux_architectures
|
||||
|
||||
echo -e "INFO: Build options: $*\n" 1>>"${BASEDIR}"/build.log 2>&1
|
||||
|
||||
# SET DEFAULT BUILD OPTIONS
|
||||
GPL_ENABLED="no"
|
||||
DISPLAY_HELP=""
|
||||
BUILD_FULL=""
|
||||
BUILD_TYPE_ID=""
|
||||
BUILD_VERSION=$(git describe --tags --always 2>>"${BASEDIR}"/build.log)
|
||||
|
||||
# MAIN BUILDS ENABLED BY DEFAULT
|
||||
enable_main_build
|
||||
|
||||
# PROCESS BUILD OPTIONS
|
||||
while [ ! $# -eq 0 ]; do
|
||||
|
||||
case $1 in
|
||||
-h | --help)
|
||||
DISPLAY_HELP="1"
|
||||
;;
|
||||
-v | --version)
|
||||
display_version
|
||||
exit 0
|
||||
;;
|
||||
--skip-*)
|
||||
SKIP_LIBRARY=$(echo $1 | sed -e 's/^--[A-Za-z]*-//g')
|
||||
|
||||
skip_library "${SKIP_LIBRARY}"
|
||||
;;
|
||||
--no-output-redirection)
|
||||
no_output_redirection
|
||||
;;
|
||||
--no-workspace-cleanup-*)
|
||||
NO_WORKSPACE_CLEANUP_LIBRARY=$(echo $1 | sed -e 's/^--[A-Za-z]*-[A-Za-z]*-[A-Za-z]*-//g')
|
||||
|
||||
no_workspace_cleanup_library "${NO_WORKSPACE_CLEANUP_LIBRARY}"
|
||||
;;
|
||||
--no-link-time-optimization)
|
||||
no_link_time_optimization
|
||||
;;
|
||||
-d | --debug)
|
||||
enable_debug
|
||||
;;
|
||||
-s | --speed)
|
||||
optimize_for_speed
|
||||
;;
|
||||
-l | --lts) ;;
|
||||
-f | --force)
|
||||
export BUILD_FORCE="1"
|
||||
;;
|
||||
--reconf-*)
|
||||
CONF_LIBRARY=$(echo $1 | sed -e 's/^--[A-Za-z]*-//g')
|
||||
|
||||
reconf_library "${CONF_LIBRARY}"
|
||||
;;
|
||||
--rebuild-*)
|
||||
BUILD_LIBRARY=$(echo $1 | sed -e 's/^--[A-Za-z]*-//g')
|
||||
|
||||
rebuild_library "${BUILD_LIBRARY}"
|
||||
;;
|
||||
--redownload-*)
|
||||
DOWNLOAD_LIBRARY=$(echo $1 | sed -e 's/^--[A-Za-z]*-//g')
|
||||
|
||||
redownload_library "${DOWNLOAD_LIBRARY}"
|
||||
;;
|
||||
--full)
|
||||
BUILD_FULL="1"
|
||||
;;
|
||||
--enable-gpl)
|
||||
GPL_ENABLED="yes"
|
||||
;;
|
||||
--enable-custom-library-*)
|
||||
CUSTOM_LIBRARY_OPTION_KEY=$(echo $1 | sed -e 's/^--enable-custom-//g;s/=.*$//g')
|
||||
CUSTOM_LIBRARY_OPTION_VALUE=$(echo $1 | sed -e 's/^--enable-custom-.*=//g')
|
||||
|
||||
echo -e "INFO: Custom library options detected: ${CUSTOM_LIBRARY_OPTION_KEY} ${CUSTOM_LIBRARY_OPTION_VALUE}\n" 1>>"${BASEDIR}"/build.log 2>&1
|
||||
|
||||
generate_custom_library_environment_variables "${CUSTOM_LIBRARY_OPTION_KEY}" "${CUSTOM_LIBRARY_OPTION_VALUE}"
|
||||
;;
|
||||
--enable-*)
|
||||
ENABLED_LIBRARY=$(echo $1 | sed -e 's/^--[A-Za-z]*-//g')
|
||||
|
||||
enable_library "${ENABLED_LIBRARY}"
|
||||
;;
|
||||
--disable-lib-*)
|
||||
DISABLED_LIB=$(echo $1 | sed -e 's/^--[A-Za-z]*-[A-Za-z]*-//g')
|
||||
|
||||
disabled_libraries+=("${DISABLED_LIB}")
|
||||
;;
|
||||
--disable-*)
|
||||
DISABLED_ARCH=$(echo $1 | sed -e 's/^--[A-Za-z]*-//g')
|
||||
|
||||
disable_arch "${DISABLED_ARCH}"
|
||||
;;
|
||||
--api-level=*)
|
||||
API_LEVEL=$(echo $1 | sed -e 's/^--[A-Za-z]*-[A-Za-z]*=//g')
|
||||
|
||||
export API=${API_LEVEL}
|
||||
;;
|
||||
*)
|
||||
print_unknown_option "$1"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [[ -z ${BUILD_VERSION} ]]; then
|
||||
echo -e "\n(*) error: Can not run git commands in this folder. See build.log.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# PROCESS FULL OPTION AS LAST OPTION
|
||||
if [[ -n ${BUILD_FULL} ]]; then
|
||||
for library in {0..92}; do
|
||||
if [ ${GPL_ENABLED} == "yes" ]; then
|
||||
enable_library "$(get_library_name $library)" 1
|
||||
else
|
||||
if [[ $(is_gpl_licensed $library) -eq 1 ]]; then
|
||||
enable_library "$(get_library_name $library)" 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# DISABLE SPECIFIED LIBRARIES
|
||||
for disabled_library in ${disabled_libraries[@]}; do
|
||||
set_library "${disabled_library}" 0
|
||||
done
|
||||
|
||||
# IF HELP DISPLAYED EXIT
|
||||
if [[ -n ${DISPLAY_HELP} ]]; then
|
||||
display_help
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo -e "\nBuilding ffmpeg-kit ${BUILD_TYPE_ID}library for Linux\n"
|
||||
echo -e -n "INFO: Building ffmpeg-kit ${BUILD_VERSION} ${BUILD_TYPE_ID}library for Linux: " 1>>"${BASEDIR}"/build.log 2>&1
|
||||
echo -e "$(date)\n" 1>>"${BASEDIR}"/build.log 2>&1
|
||||
|
||||
# PRINT BUILD SUMMARY
|
||||
print_enabled_architectures
|
||||
print_enabled_libraries
|
||||
print_reconfigure_requested_libraries
|
||||
print_rebuild_requested_libraries
|
||||
print_redownload_requested_libraries
|
||||
print_custom_libraries
|
||||
|
||||
# VALIDATE GPL FLAGS
|
||||
for gpl_library in {$LIBRARY_X264,$LIBRARY_LINUX_XVIDCORE,$LIBRARY_LINUX_X265,$LIBRARY_LINUX_LIBVIDSTAB,$LIBRARY_LINUX_RUBBERBAND}; do
|
||||
if [[ ${ENABLED_LIBRARIES[$gpl_library]} -eq 1 ]]; then
|
||||
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"
|
||||
echo -e "\n(*) Invalid configuration detected. GPL library ${library_name} enabled without --enable-gpl flag.\n" 1>>"${BASEDIR}"/build.log 2>&1
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
echo -n -e "\nDownloading sources: "
|
||||
echo -e "INFO: Downloading the source code of ffmpeg and external libraries.\n" 1>>"${BASEDIR}"/build.log 2>&1
|
||||
|
||||
# DOWNLOAD GNU CONFIG
|
||||
download_gnu_config
|
||||
|
||||
# DOWNLOAD LIBRARY SOURCES
|
||||
downloaded_library_sources "${ENABLED_LIBRARIES[@]}"
|
||||
|
||||
# THIS WILL SAVE ARCHITECTURES TO BUILD
|
||||
TARGET_ARCH_LIST=()
|
||||
|
||||
# BUILD ENABLED LIBRARIES ON ENABLED ARCHITECTURES
|
||||
for run_arch in {0..12}; do
|
||||
if [[ ${ENABLED_ARCHITECTURES[$run_arch]} -eq 1 ]]; then
|
||||
export ARCH=$(get_arch_name "$run_arch")
|
||||
export FULL_ARCH=$(get_full_arch_name "$run_arch")
|
||||
|
||||
# EXECUTE MAIN BUILD SCRIPT
|
||||
. "${BASEDIR}"/scripts/main-linux.sh "${ENABLED_LIBRARIES[@]}"
|
||||
|
||||
TARGET_ARCH_LIST+=("${FULL_ARCH}")
|
||||
|
||||
# CLEAR FLAGS
|
||||
for library in {0..92}; 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
|
|
@ -310,7 +310,7 @@ for library in {0..61}; do
|
|||
# NOTE THAT IDS MUST BE +1 OF THE INDEX VALUE
|
||||
if [[ ${library} -eq ${LIBRARY_SDL} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-sdl2"
|
||||
elif [[ ${library} -eq ${LIBRARY_ANDROID_ZLIB} ]]; then
|
||||
elif [[ ${library} -eq ${LIBRARY_SYSTEM_ZLIB} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-zlib"
|
||||
elif [[ ${library} -eq ${LIBRARY_ANDROID_MEDIA_CODEC} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-mediacodec"
|
||||
|
|
|
@ -383,7 +383,7 @@ for library in {0..61}; do
|
|||
CONFIGURE_POSTFIX+=" --disable-opengl"
|
||||
elif [[ ${library} -eq ${LIBRARY_APPLE_VIDEOTOOLBOX} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-videotoolbox"
|
||||
elif [[ ${library} -eq ${LIBRARY_APPLE_ZLIB} ]]; then
|
||||
elif [[ ${library} -eq ${LIBRARY_SYSTEM_ZLIB} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-zlib"
|
||||
elif [[ ${library} -eq ${LIBRARY_OPENSSL} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-openssl"
|
||||
|
|
427
scripts/function-linux.sh
Executable file
427
scripts/function-linux.sh
Executable file
|
@ -0,0 +1,427 @@
|
|||
#!/bin/bash
|
||||
|
||||
source "${BASEDIR}/scripts/function.sh"
|
||||
|
||||
prepare_inline_sed
|
||||
|
||||
enable_default_linux_architectures() {
|
||||
ENABLED_ARCHITECTURES[ARCH_X86_64]=1
|
||||
}
|
||||
|
||||
get_ffmpeg_kit_version() {
|
||||
local FFMPEG_KIT_VERSION=$(grep '#define FFMPEG_KIT_VERSION' "${BASEDIR}"/linux/src/main/cpp/ffmpegkit.h | grep -Eo '\".*\"' | sed -e 's/\"//g')
|
||||
|
||||
echo "${FFMPEG_KIT_VERSION}"
|
||||
}
|
||||
|
||||
display_help() {
|
||||
local COMMAND=$(echo "$0" | sed -e 's/\.\///g')
|
||||
|
||||
echo -e "\n'$COMMAND' builds FFmpegKit for Linux platform. By default only one Linux architecture \
|
||||
(x86_64) is 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, \
|
||||
libraries are 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 " -l, --lts\t\t\tbuild lts packages to support older devices"
|
||||
display_help_licensing
|
||||
|
||||
echo -e "Architectures:"
|
||||
echo -e " --disable-x86-64\t\tdo not build x86-64 architecture [yes]\n"
|
||||
|
||||
echo -e "Libraries:"
|
||||
echo -e " --full\t\t\tenables all external libraries"
|
||||
echo -e " --enable-linux-alsa\t\tbuild with built-in alsa support [no]"
|
||||
echo -e " --enable-linux-chromaprint\tbuild with built-in chromaprint support [no]"
|
||||
echo -e " --enable-linux-fontconfig\tbuild with built-in fontconfig support [no]"
|
||||
echo -e " --enable-linux-freetype\tbuild with built-in freetype support [no]"
|
||||
echo -e " --enable-linux-fribidi\tbuild with built-in fribidi support [no]"
|
||||
echo -e " --enable-linux-gmp\t\tbuild with built-in gmp support [no]"
|
||||
echo -e " --enable-linux-gnutls\t\tbuild with built-in gnutls support [no]"
|
||||
echo -e " --enable-linux-lame\t\tbuild with built-in lame support [no]"
|
||||
echo -e " --enable-linux-libass\t\tbuild with built-in libass support [no]"
|
||||
echo -e " --enable-linux-libiconv\tbuild with built-in libiconv support [no]"
|
||||
echo -e " --enable-linux-libtheora\tbuild with built-in libtheora support [no]"
|
||||
echo -e " --enable-linux-libvorbis\tbuild with built-in libvorbis support [no]"
|
||||
echo -e " --enable-linux-libvpx\t\tbuild with built-in libvpx support [no]"
|
||||
echo -e " --enable-linux-libwebp\tbuild with built-in libwebp support [no]"
|
||||
echo -e " --enable-linux-libxml2\tbuild with built-in libxml2 support [no]"
|
||||
echo -e " --enable-linux-opencl\t\tbuild with built-in opencl support [no]"
|
||||
echo -e " --enable-linux-opencore-amr\tbuild with built-in opencore-amr support [no]"
|
||||
echo -e " --enable-linux-opus\t\tbuild with built-in opus support [no]"
|
||||
echo -e " --enable-linux-sdl\t\tbuild with built-in sdl support [no]"
|
||||
echo -e " --enable-linux-shine\t\tbuild with built-in shine support [no]"
|
||||
echo -e " --enable-linux-snappy\t\tbuild with built-in snappy support [no]"
|
||||
echo -e " --enable-linux-soxr\t\tbuild with built-in soxr support [no]"
|
||||
echo -e " --enable-linux-speex\t\tbuild with built-in speex support [no]"
|
||||
echo -e " --enable-linux-tesseract\tbuild with built-in tesseract support [no]"
|
||||
echo -e " --enable-linux-twolame\tbuild with built-in twolame support [no]"
|
||||
echo -e " --enable-linux-vaapi\t\tbuild with built-in vaapi support [no]"
|
||||
echo -e " --enable-linux-v4l2\t\tbuild with built-in v4l2 support [no]"
|
||||
echo -e " --enable-linux-vo-amrwbenc\tbuild with built-in vo-amrwbenc support [no]"
|
||||
echo -e " --enable-linux-zlib\t\tbuild with built-in zlib support [no]"
|
||||
echo -e " --enable-dav1d\t\tbuild with dav1d [no]"
|
||||
echo -e " --enable-kvazaar\t\tbuild with kvazaar [no]"
|
||||
echo -e " --enable-libaom\t\tbuild with libaom [no]"
|
||||
echo -e " --enable-libilbc\t\tbuild with libilbc [no]"
|
||||
echo -e " --enable-openh264\t\tbuild with openh264 [no]"
|
||||
echo -e " --enable-openssl\t\tbuild with openssl [no]"
|
||||
echo -e " --enable-srt\t\t\tbuild with srt [no]"
|
||||
echo -e " --enable-zimg\t\t\tbuild with zimg [no]\n"
|
||||
|
||||
echo -e "GPL libraries:"
|
||||
echo -e " --enable-linux-libvidstab\tbuild with built-in libvidstab support [no]"
|
||||
echo -e " --enable-linux-rubberband\tbuild with built-in rubber band support [no]"
|
||||
echo -e " --enable-linux-x265\t\tbuild with built-in x265 support [no]"
|
||||
echo -e " --enable-linux-xvidcore\tbuild with built-in xvidcore support [no]"
|
||||
echo -e " --enable-x264\t\t\tbuild with x264 [no]\n"
|
||||
|
||||
display_help_custom_libraries
|
||||
display_help_advanced_options
|
||||
}
|
||||
|
||||
enable_main_build() {
|
||||
unset FFMPEG_KIT_LTS_BUILD
|
||||
}
|
||||
|
||||
enable_lts_build() {
|
||||
export FFMPEG_KIT_LTS_BUILD="1"
|
||||
}
|
||||
|
||||
get_cmake_system_processor() {
|
||||
case ${ARCH} in
|
||||
x86-64)
|
||||
echo "x86_64"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
get_target_cpu() {
|
||||
case ${ARCH} in
|
||||
x86-64)
|
||||
echo "x86_64"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
get_common_includes() {
|
||||
echo ""
|
||||
}
|
||||
|
||||
get_common_cflags() {
|
||||
if [[ -n ${FFMPEG_KIT_LTS_BUILD} ]]; then
|
||||
local LTS_BUILD__FLAG="-DFFMPEG_KIT_LTS "
|
||||
fi
|
||||
|
||||
echo "-fstrict-aliasing -fPIC -DLINUX ${LTS_BUILD__FLAG} ${LLVM_CONFIG_CFLAGS}"
|
||||
}
|
||||
|
||||
get_arch_specific_cflags() {
|
||||
case ${ARCH} in
|
||||
x86-64)
|
||||
echo "-target $(get_target) -march=x86-64 -msse4.2 -mpopcnt -m64 -DFFMPEG_KIT_X86_64"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
get_size_optimization_cflags() {
|
||||
if [[ -z ${NO_LINK_TIME_OPTIMIZATION} ]]; then
|
||||
local LINK_TIME_OPTIMIZATION_FLAGS="-flto"
|
||||
else
|
||||
local LINK_TIME_OPTIMIZATION_FLAGS=""
|
||||
fi
|
||||
|
||||
local ARCH_OPTIMIZATION=""
|
||||
case ${ARCH} in
|
||||
x86-64)
|
||||
case $1 in
|
||||
ffmpeg)
|
||||
ARCH_OPTIMIZATION="${LINK_TIME_OPTIMIZATION_FLAGS} -Os -ffunction-sections -fdata-sections"
|
||||
;;
|
||||
*)
|
||||
ARCH_OPTIMIZATION="-Os -ffunction-sections -fdata-sections"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
local LIB_OPTIMIZATION=""
|
||||
|
||||
echo "${ARCH_OPTIMIZATION} ${LIB_OPTIMIZATION}"
|
||||
}
|
||||
|
||||
get_app_specific_cflags() {
|
||||
local APP_FLAGS=""
|
||||
case $1 in
|
||||
ffmpeg)
|
||||
APP_FLAGS="-Wno-unused-function -DBIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD"
|
||||
;;
|
||||
kvazaar)
|
||||
APP_FLAGS="-std=gnu99 -Wno-unused-function"
|
||||
;;
|
||||
openh264)
|
||||
APP_FLAGS="-std=gnu99 -Wno-unused-function -fstack-protector-all"
|
||||
;;
|
||||
openssl | srt)
|
||||
APP_FLAGS="-Wno-unused-function"
|
||||
;;
|
||||
*)
|
||||
APP_FLAGS="-std=c99 -Wno-unused-function"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "${APP_FLAGS}"
|
||||
}
|
||||
|
||||
get_cflags() {
|
||||
local ARCH_FLAGS=$(get_arch_specific_cflags)
|
||||
local APP_FLAGS=$(get_app_specific_cflags "$1")
|
||||
local COMMON_FLAGS=$(get_common_cflags)
|
||||
if [[ -z ${FFMPEG_KIT_DEBUG} ]]; then
|
||||
local OPTIMIZATION_FLAGS=$(get_size_optimization_cflags "$1")
|
||||
else
|
||||
local OPTIMIZATION_FLAGS="${FFMPEG_KIT_DEBUG}"
|
||||
fi
|
||||
local COMMON_INCLUDES=$(get_common_includes)
|
||||
|
||||
echo "${ARCH_FLAGS} ${APP_FLAGS} ${COMMON_FLAGS} ${OPTIMIZATION_FLAGS} ${COMMON_INCLUDES}"
|
||||
}
|
||||
|
||||
get_cxxflags() {
|
||||
if [[ -z ${NO_LINK_TIME_OPTIMIZATION} ]]; then
|
||||
local LINK_TIME_OPTIMIZATION_FLAGS="-flto"
|
||||
else
|
||||
local LINK_TIME_OPTIMIZATION_FLAGS=""
|
||||
fi
|
||||
|
||||
if [[ -z ${FFMPEG_KIT_DEBUG} ]]; then
|
||||
local OPTIMIZATION_FLAGS="-Os -ffunction-sections -fdata-sections"
|
||||
else
|
||||
local OPTIMIZATION_FLAGS="${FFMPEG_KIT_DEBUG}"
|
||||
fi
|
||||
|
||||
local COMMON_FLAGS="${LLVM_CONFIG_CXXFLAGS} ${OPTIMIZATION_FLAGS}"
|
||||
|
||||
case $1 in
|
||||
ffmpeg)
|
||||
if [[ -z ${FFMPEG_KIT_DEBUG} ]]; then
|
||||
echo "${LINK_TIME_OPTIMIZATION_FLAGS} ${LLVM_CONFIG_CXXFLAGS} -O2 -ffunction-sections -fdata-sections"
|
||||
else
|
||||
echo "${FFMPEG_KIT_DEBUG} ${LLVM_CONFIG_CXXFLAGS}"
|
||||
fi
|
||||
;;
|
||||
srt | zimg)
|
||||
echo "${COMMON_FLAGS} -fcxx-exceptions -fPIC"
|
||||
;;
|
||||
*)
|
||||
echo "-fno-exceptions -fno-rtti ${COMMON_FLAGS}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
get_common_linked_libraries() {
|
||||
local COMMON_LIBRARY_PATHS=""
|
||||
|
||||
case $1 in
|
||||
ffmpeg)
|
||||
echo "-lc -lm -ldl ${COMMON_LIBRARY_PATHS}"
|
||||
;;
|
||||
srt)
|
||||
echo "-lc -lm -ldl -lstdc++ ${COMMON_LIBRARY_PATHS}"
|
||||
;;
|
||||
*)
|
||||
echo "-lc -lm -ldl ${COMMON_LIBRARY_PATHS}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
get_size_optimization_ldflags() {
|
||||
if [[ -z ${NO_LINK_TIME_OPTIMIZATION} ]]; then
|
||||
local LINK_TIME_OPTIMIZATION_FLAGS="-flto"
|
||||
else
|
||||
local LINK_TIME_OPTIMIZATION_FLAGS=""
|
||||
fi
|
||||
|
||||
case ${ARCH} in
|
||||
x86-64)
|
||||
case $1 in
|
||||
ffmpeg)
|
||||
echo "${LINK_TIME_OPTIMIZATION_FLAGS} -O2 -ffunction-sections -fdata-sections -finline-functions"
|
||||
;;
|
||||
*)
|
||||
echo "-Os -ffunction-sections -fdata-sections"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
get_arch_specific_ldflags() {
|
||||
case ${ARCH} in
|
||||
x86-64)
|
||||
echo "-march=x86-64 -Wl,-z,text"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
get_ldflags() {
|
||||
local ARCH_FLAGS=$(get_arch_specific_ldflags)
|
||||
if [[ -z ${FFMPEG_KIT_DEBUG} ]]; then
|
||||
local OPTIMIZATION_FLAGS="$(get_size_optimization_ldflags "$1")"
|
||||
else
|
||||
local OPTIMIZATION_FLAGS="${FFMPEG_KIT_DEBUG}"
|
||||
fi
|
||||
local COMMON_LINKED_LIBS=$(get_common_linked_libraries "$1")
|
||||
|
||||
echo "${ARCH_FLAGS} ${OPTIMIZATION_FLAGS} ${COMMON_LINKED_LIBS} ${LLVM_CONFIG_LDFLAGS} -Wl,--hash-style=both -fuse-ld=lld"
|
||||
}
|
||||
|
||||
create_mason_cross_file() {
|
||||
cat >"$1" <<EOF
|
||||
[binaries]
|
||||
c = '$CC'
|
||||
cpp = '$CXX'
|
||||
ar = '$AR'
|
||||
strip = '$STRIP'
|
||||
pkgconfig = 'pkg-config'
|
||||
|
||||
[properties]
|
||||
has_function_printf = true
|
||||
|
||||
[host_machine]
|
||||
system = '$(get_meson_target_host_family)'
|
||||
cpu_family = '$(get_meson_target_cpu_family)'
|
||||
cpu = '$(get_cmake_system_processor)'
|
||||
endian = 'little'
|
||||
|
||||
[built-in options]
|
||||
default_library = 'static'
|
||||
prefix = '${LIB_INSTALL_PREFIX}'
|
||||
EOF
|
||||
}
|
||||
|
||||
create_libaom_package_config() {
|
||||
local AOM_VERSION="$1"
|
||||
|
||||
cat >"${INSTALL_PKG_CONFIG_DIR}/aom.pc" <<EOF
|
||||
prefix="${LIB_INSTALL_BASE}"/libaom
|
||||
exec_prefix=\${prefix}
|
||||
libdir=\${prefix}/lib
|
||||
includedir=\${prefix}/include
|
||||
|
||||
Name: aom
|
||||
Description: AV1 codec library v${AOM_VERSION}.
|
||||
Version: ${AOM_VERSION}
|
||||
|
||||
Requires:
|
||||
Libs: -L\${libdir} -laom -lm
|
||||
Cflags: -I\${includedir}
|
||||
EOF
|
||||
}
|
||||
|
||||
create_srt_package_config() {
|
||||
local SRT_VERSION="$1"
|
||||
|
||||
cat >"${INSTALL_PKG_CONFIG_DIR}/srt.pc" <<EOF
|
||||
prefix=${LIB_INSTALL_BASE}/srt
|
||||
exec_prefix=\${prefix}
|
||||
libdir=\${exec_prefix}/lib
|
||||
includedir=\${prefix}/include
|
||||
|
||||
Name: srt
|
||||
Description: SRT library set
|
||||
Version: ${SRT_VERSION}
|
||||
|
||||
Libs: -L\${libdir} -lsrt
|
||||
Libs.private: -lc -lm -ldl -lstdc++
|
||||
Cflags: -I\${includedir} -I\${includedir}/srt
|
||||
Requires: openssl libcrypto
|
||||
EOF
|
||||
}
|
||||
|
||||
create_zimg_package_config() {
|
||||
local ZIMG_VERSION="$1"
|
||||
|
||||
cat >"${INSTALL_PKG_CONFIG_DIR}/zimg.pc" <<EOF
|
||||
prefix=${LIB_INSTALL_BASE}/zimg
|
||||
exec_prefix=\${prefix}
|
||||
libdir=\${exec_prefix}/lib
|
||||
includedir=\${prefix}/include
|
||||
|
||||
Name: zimg
|
||||
Description: Scaling, colorspace conversion, and dithering library
|
||||
Version: ${ZIMG_VERSION}
|
||||
|
||||
Libs: -L\${libdir} -lzimg -lstdc++
|
||||
Cflags: -I\${includedir}
|
||||
EOF
|
||||
}
|
||||
|
||||
get_build_directory() {
|
||||
local LTS_POSTFIX=""
|
||||
if [[ -n ${FFMPEG_KIT_LTS_BUILD} ]]; then
|
||||
LTS_POSTFIX="-lts"
|
||||
fi
|
||||
|
||||
echo "linux-$(get_target_cpu)${LTS_POSTFIX}"
|
||||
}
|
||||
|
||||
detect_clang_version() {
|
||||
if [[ -n ${FFMPEG_KIT_LTS_BUILD} ]]; then
|
||||
for clang_version in 6 .. 10; do
|
||||
if [[ $(command_exists "clang-$clang_version") -eq 0 ]]; then
|
||||
echo "$clang_version"
|
||||
return
|
||||
elif [[ $(command_exists "clang-$clang_version.0") -eq 0 ]]; then
|
||||
echo "$clang_version.0"
|
||||
return
|
||||
fi
|
||||
done
|
||||
echo "none"
|
||||
else
|
||||
for clang_version in 11 .. 20; do
|
||||
if [[ $(command_exists "clang-$clang_version") -eq 0 ]]; then
|
||||
echo "$clang_version"
|
||||
return
|
||||
elif [[ $(command_exists "clang-$clang_version.0") -eq 0 ]]; then
|
||||
echo "$clang_version.0"
|
||||
return
|
||||
fi
|
||||
done
|
||||
echo "none"
|
||||
fi
|
||||
}
|
||||
|
||||
set_toolchain_paths() {
|
||||
HOST=$(get_host)
|
||||
CLANG_VERSION=$(detect_clang_version)
|
||||
|
||||
if [[ $CLANG_VERSION != "none" ]]; then
|
||||
local CLANG_POSTFIX="-$CLANG_VERSION"
|
||||
export LLVM_CONFIG_CFLAGS=$(llvm-config-$CLANG_VERSION --cflags 2>>"${BASEDIR}"/build.log)
|
||||
export LLVM_CONFIG_CXXFLAGS=$(llvm-config-$CLANG_VERSION --cxxflags 2>>"${BASEDIR}"/build.log)
|
||||
export LLVM_CONFIG_LDFLAGS=$(llvm-config-$CLANG_VERSION --ldflags 2>>"${BASEDIR}"/build.log)
|
||||
else
|
||||
local CLANG_POSTFIX=""
|
||||
export LLVM_CONFIG_CFLAGS=$(llvm-config --cflags 2>>"${BASEDIR}"/build.log)
|
||||
export LLVM_CONFIG_CXXFLAGS=$(llvm-config --cxxflags 2>>"${BASEDIR}"/build.log)
|
||||
export LLVM_CONFIG_LDFLAGS=$(llvm-config --ldflags 2>>"${BASEDIR}"/build.log)
|
||||
fi
|
||||
|
||||
export CC=$(command -v "clang$CLANG_POSTFIX")
|
||||
export CXX=$(command -v "clang++$CLANG_POSTFIX")
|
||||
export AS=$(command -v "llvm-as$CLANG_POSTFIX")
|
||||
export AR=$(command -v "llvm-ar$CLANG_POSTFIX")
|
||||
export LD=$(command -v "ld.lld$CLANG_POSTFIX")
|
||||
export RANLIB=$(command -v "llvm-ranlib$CLANG_POSTFIX")
|
||||
export STRIP=$(command -v "llvm-strip$CLANG_POSTFIX")
|
||||
export NM=$(command -v "llvm-nm$CLANG_POSTFIX")
|
||||
export INSTALL_PKG_CONFIG_DIR="${BASEDIR}"/prebuilt/$(get_build_directory)/pkgconfig
|
||||
export ZLIB_PACKAGE_CONFIG_PATH="${INSTALL_PKG_CONFIG_DIR}/zlib.pc"
|
||||
|
||||
if [ ! -d "${INSTALL_PKG_CONFIG_DIR}" ]; then
|
||||
mkdir -p "${INSTALL_PKG_CONFIG_DIR}" 1>>"${BASEDIR}"/build.log 2>&1
|
||||
fi
|
||||
}
|
|
@ -13,7 +13,7 @@ get_arch_name() {
|
|||
6) echo "arm64e" ;; # ios
|
||||
7) echo "i386" ;; # ios
|
||||
8) echo "x86" ;; # android
|
||||
9) echo "x86-64" ;; # android, ios, macos, tvos
|
||||
9) echo "x86-64" ;; # android, ios, linux, macos, tvos
|
||||
10) echo "x86-64-mac-catalyst" ;; # ios
|
||||
11) echo "arm64-mac-catalyst" ;; # ios
|
||||
12) echo "arm64-simulator" ;; # ios, tvos
|
||||
|
@ -39,7 +39,7 @@ from_arch_name() {
|
|||
arm64e) echo 6 ;; # ios
|
||||
i386) echo 7 ;; # ios
|
||||
x86) echo 8 ;; # android
|
||||
x86-64) echo 9 ;; # android, ios, macos, tvos
|
||||
x86-64) echo 9 ;; # android, ios, linux, macos, tvos
|
||||
x86-64-mac-catalyst) echo 10 ;; # ios
|
||||
arm64-mac-catalyst) echo 11 ;; # ios
|
||||
arm64-simulator) echo 12 ;; # ios
|
||||
|
@ -98,17 +98,21 @@ get_library_name() {
|
|||
47) echo "libsamplerate" ;;
|
||||
48) echo "harfbuzz" ;;
|
||||
49) echo "cpu-features" ;;
|
||||
50) echo "android-zlib" ;;
|
||||
51) echo "android-media-codec" ;;
|
||||
52)
|
||||
if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]]; then
|
||||
50)
|
||||
if [[ ${FFMPEG_KIT_BUILD_TYPE} == "android" ]]; then
|
||||
echo "android-zlib"
|
||||
elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]]; then
|
||||
echo "ios-zlib"
|
||||
elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "linux" ]]; then
|
||||
echo "linux-zlib"
|
||||
elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]]; then
|
||||
echo "macos-zlib"
|
||||
elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then
|
||||
echo "tvos-zlib"
|
||||
fi
|
||||
;;
|
||||
51) echo "linux-alsa" ;;
|
||||
52) echo "android-media-codec" ;;
|
||||
53)
|
||||
if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]]; then
|
||||
echo "ios-audiotoolbox"
|
||||
|
@ -176,6 +180,37 @@ get_library_name() {
|
|||
echo "macos-opengl"
|
||||
fi
|
||||
;;
|
||||
62) echo "linux-fontconfig" ;;
|
||||
63) echo "linux-freetype" ;;
|
||||
64) echo "linux-fribidi" ;;
|
||||
65) echo "linux-gmp" ;;
|
||||
66) echo "linux-gnutls" ;;
|
||||
67) echo "linux-lame" ;;
|
||||
68) echo "linux-libass" ;;
|
||||
69) echo "linux-libiconv" ;;
|
||||
70) echo "linux-libtheora" ;;
|
||||
71) echo "linux-libvorbis" ;;
|
||||
72) echo "linux-libvpx" ;;
|
||||
73) echo "linux-libwebp" ;;
|
||||
74) echo "linux-libxml2" ;;
|
||||
75) echo "linux-opencore-amr" ;;
|
||||
76) echo "linux-shine" ;;
|
||||
77) echo "linux-speex" ;;
|
||||
78) echo "linux-opencl" ;;
|
||||
79) echo "linux-xvidcore" ;;
|
||||
80) echo "linux-x265" ;;
|
||||
81) echo "linux-libvidstab" ;;
|
||||
82) echo "linux-rubberband" ;;
|
||||
83) echo "linux-v4l2" ;;
|
||||
84) echo "linux-opus" ;;
|
||||
85) echo "linux-snappy" ;;
|
||||
86) echo "linux-soxr" ;;
|
||||
87) echo "linux-chromaprint" ;;
|
||||
88) echo "linux-twolame" ;;
|
||||
89) echo "linux-sdl" ;;
|
||||
90) echo "linux-tesseract" ;;
|
||||
91) echo "linux-vaapi" ;;
|
||||
92) echo "linux-vo-amrwbenc" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
@ -231,9 +266,9 @@ from_library_name() {
|
|||
libsamplerate) echo 47 ;;
|
||||
harfbuzz) echo 48 ;;
|
||||
cpu-features) echo 49 ;;
|
||||
android-zlib) echo 50 ;;
|
||||
android-media-codec) echo 51 ;;
|
||||
ios-zlib | macos-zlib | tvos-zlib) echo 52 ;;
|
||||
android-zlib | ios-zlib | linux-zlib | macos-zlib | tvos-zlib) echo 50 ;;
|
||||
linux-alsa) echo 51 ;;
|
||||
android-media-codec) echo 52 ;;
|
||||
ios-audiotoolbox | macos-audiotoolbox | tvos-audiotoolbox) echo 53 ;;
|
||||
ios-bzip2 | macos-bzip2 | tvos-bzip2) echo 54 ;;
|
||||
ios-videotoolbox | macos-videotoolbox | tvos-videotoolbox) echo 55 ;;
|
||||
|
@ -243,6 +278,37 @@ from_library_name() {
|
|||
macos-coreimage) echo 59 ;;
|
||||
macos-opencl) echo 60 ;;
|
||||
macos-opengl) echo 61 ;;
|
||||
linux-fontconfig) echo 62 ;;
|
||||
linux-freetype) echo 63 ;;
|
||||
linux-fribidi) echo 64 ;;
|
||||
linux-gmp) echo 65 ;;
|
||||
linux-gnutls) echo 66 ;;
|
||||
linux-lame) echo 67 ;;
|
||||
linux-libass) echo 68 ;;
|
||||
linux-libiconv) echo 69 ;;
|
||||
linux-libtheora) echo 70 ;;
|
||||
linux-libvorbis) echo 71 ;;
|
||||
linux-libvpx) echo 72 ;;
|
||||
linux-libwebp) echo 73 ;;
|
||||
linux-libxml2) echo 74 ;;
|
||||
linux-opencore-amr) echo 75 ;;
|
||||
linux-shine) echo 76 ;;
|
||||
linux-speex) echo 77 ;;
|
||||
linux-opencl) echo 78 ;;
|
||||
linux-xvidcore) echo 79 ;;
|
||||
linux-x265) echo 80 ;;
|
||||
linux-libvidstab) echo 81 ;;
|
||||
linux-rubberband) echo 82 ;;
|
||||
linux-v4l2) echo 83 ;;
|
||||
linux-opus) echo 84 ;;
|
||||
linux-snappy) echo 85 ;;
|
||||
linux-soxr) echo 86 ;;
|
||||
linux-chromaprint) echo 87 ;;
|
||||
linux-twolame) echo 88 ;;
|
||||
linux-sdl) echo 89 ;;
|
||||
linux-tesseract) echo 90 ;;
|
||||
linux-vaapi) echo 91 ;;
|
||||
linux-vo-amrwbenc) echo 92 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
@ -252,18 +318,22 @@ from_library_name() {
|
|||
is_library_supported_on_platform() {
|
||||
local library_index=$(from_library_name "$1")
|
||||
case ${library_index} in
|
||||
0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20)
|
||||
echo "0"
|
||||
;;
|
||||
21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40)
|
||||
echo "0"
|
||||
;;
|
||||
42 | 43 | 44 | 45 | 46 | 47 | 48)
|
||||
# ALL
|
||||
16 | 17 | 18 | 23 | 27 | 32 | 34 | 35 | 36)
|
||||
echo "0"
|
||||
;;
|
||||
|
||||
# ALL EXCEPT LINUX
|
||||
0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 19 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 31 | 33 | 37 | 38 | 39 | 40 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 50)
|
||||
if [[ ${FFMPEG_KIT_BUILD_TYPE} == "linux" ]]; then
|
||||
echo "1"
|
||||
else
|
||||
echo "0"
|
||||
fi
|
||||
;;
|
||||
|
||||
# ANDROID
|
||||
7 | 41 | 49 | 50 | 51)
|
||||
7 | 41 | 49 | 52)
|
||||
if [[ ${FFMPEG_KIT_BUILD_TYPE} == "android" ]]; then
|
||||
echo "0"
|
||||
else
|
||||
|
@ -271,6 +341,15 @@ is_library_supported_on_platform() {
|
|||
fi
|
||||
;;
|
||||
|
||||
# ONLY LINUX
|
||||
51)
|
||||
if [[ ${FFMPEG_KIT_BUILD_TYPE} == "linux" ]]; then
|
||||
echo "0"
|
||||
else
|
||||
echo "1"
|
||||
fi
|
||||
;;
|
||||
|
||||
# ONLY IOS AND MACOS
|
||||
56)
|
||||
if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]] && [[ $1 == "ios-avfoundation" ]]; then
|
||||
|
@ -283,7 +362,7 @@ is_library_supported_on_platform() {
|
|||
;;
|
||||
|
||||
# IOS, MACOS AND TVOS
|
||||
52 | 53 | 54 | 55 | 57 | 58)
|
||||
53 | 54 | 55 | 57 | 58)
|
||||
if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]]; then
|
||||
echo "0"
|
||||
else
|
||||
|
@ -299,6 +378,15 @@ is_library_supported_on_platform() {
|
|||
echo "1"
|
||||
fi
|
||||
;;
|
||||
|
||||
# ONLY LINUX
|
||||
62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92)
|
||||
if [[ ${FFMPEG_KIT_BUILD_TYPE} == "linux" ]]; then
|
||||
echo "0"
|
||||
else
|
||||
echo "1"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "1"
|
||||
;;
|
||||
|
@ -306,7 +394,7 @@ is_library_supported_on_platform() {
|
|||
}
|
||||
|
||||
#
|
||||
# 1. <library name>
|
||||
# 1. <arch name>
|
||||
#
|
||||
is_arch_supported_on_platform() {
|
||||
local arch_index=$(from_arch_name "$1")
|
||||
|
@ -344,7 +432,7 @@ is_arch_supported_on_platform() {
|
|||
|
||||
# IOS, MACOS OR TVOS
|
||||
$ARCH_ARM64)
|
||||
if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]]; then
|
||||
if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then
|
||||
echo 1
|
||||
else
|
||||
echo 0
|
||||
|
@ -385,6 +473,9 @@ get_meson_target_host_family() {
|
|||
android)
|
||||
echo "android"
|
||||
;;
|
||||
linux)
|
||||
echo "linux"
|
||||
;;
|
||||
*)
|
||||
echo "darwin"
|
||||
;;
|
||||
|
@ -440,6 +531,8 @@ get_target() {
|
|||
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} == "linux" ]]; then
|
||||
echo "$(get_target_cpu)-linux-gnu"
|
||||
elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]]; then
|
||||
echo "$(get_target_cpu)-apple-darwin$(get_min_sdk_version)"
|
||||
elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then
|
||||
|
@ -487,6 +580,8 @@ get_host() {
|
|||
echo "x86_64-linux-android"
|
||||
elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]]; then
|
||||
echo "$(get_target_cpu)-ios-darwin"
|
||||
elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "linux" ]]; then
|
||||
echo "$(get_target_cpu)-linux-gnu"
|
||||
elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]]; then
|
||||
echo "$(get_target_cpu)-apple-darwin"
|
||||
elif [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then
|
||||
|
@ -950,15 +1045,15 @@ set_library() {
|
|||
fi
|
||||
|
||||
case $1 in
|
||||
android-zlib)
|
||||
ENABLED_LIBRARIES[LIBRARY_ANDROID_ZLIB]=$2
|
||||
android-zlib | ios-zlib | linux-zlib | macos-zlib | tvos-zlib)
|
||||
ENABLED_LIBRARIES[LIBRARY_SYSTEM_ZLIB]=$2
|
||||
;;
|
||||
linux-alsa)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_ALSA]=$2
|
||||
;;
|
||||
android-media-codec)
|
||||
ENABLED_LIBRARIES[LIBRARY_ANDROID_MEDIA_CODEC]=$2
|
||||
;;
|
||||
ios-zlib | macos-zlib | tvos-zlib)
|
||||
ENABLED_LIBRARIES[LIBRARY_APPLE_ZLIB]=$2
|
||||
;;
|
||||
ios-audiotoolbox | macos-audiotoolbox | tvos-audiotoolbox)
|
||||
ENABLED_LIBRARIES[LIBRARY_APPLE_AUDIOTOOLBOX]=$2
|
||||
;;
|
||||
|
@ -1161,6 +1256,116 @@ set_library() {
|
|||
ENABLED_LIBRARIES[LIBRARY_TIFF]=$2
|
||||
ENABLED_LIBRARIES[LIBRARY_JPEG]=$2
|
||||
;;
|
||||
linux-chromaprint)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_CHROMAPRINT]=$2
|
||||
;;
|
||||
linux-fontconfig)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_FONTCONFIG]=$2
|
||||
set_library "linux-libiconv" $2
|
||||
set_library "linux-freetype" $2
|
||||
;;
|
||||
linux-freetype)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_FREETYPE]=$2
|
||||
set_virtual_library "zlib" $2
|
||||
;;
|
||||
linux-fribidi)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_FRIBIDI]=$2
|
||||
;;
|
||||
linux-gmp)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_GMP]=$2
|
||||
;;
|
||||
linux-gnutls)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_GNUTLS]=$2
|
||||
set_virtual_library "zlib" $2
|
||||
set_library "linux-gmp" $2
|
||||
set_library "linux-libiconv" $2
|
||||
;;
|
||||
linux-lame)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_LAME]=$2
|
||||
set_library "linux-libiconv" $2
|
||||
;;
|
||||
linux-libass)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_LIBASS]=$2
|
||||
set_library "linux-freetype" $2
|
||||
set_library "linux-fribidi" $2
|
||||
set_library "linux-fontconfig" $2
|
||||
set_library "linux-libiconv" $2
|
||||
;;
|
||||
linux-libiconv)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_LIBICONV]=$2
|
||||
;;
|
||||
linux-libtheora)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_LIBTHEORA]=$2
|
||||
set_library "linux-libvorbis" $2
|
||||
;;
|
||||
linux-libvidstab)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_LIBVIDSTAB]=$2
|
||||
;;
|
||||
linux-libvorbis)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_LIBVORBIS]=$2
|
||||
;;
|
||||
linux-libvpx)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_LIBVPX]=$2
|
||||
;;
|
||||
linux-libwebp)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_LIBWEBP]=$2
|
||||
set_virtual_library "zlib" $2
|
||||
;;
|
||||
linux-libxml2)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_LIBXML2]=$2
|
||||
set_library "linux-libiconv" $2
|
||||
;;
|
||||
linux-vaapi)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_VAAPI]=$2
|
||||
;;
|
||||
linux-opencl)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_OPENCL]=$2
|
||||
;;
|
||||
linux-opencore-amr)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_OPENCOREAMR]=$2
|
||||
;;
|
||||
linux-opus)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_OPUS]=$2
|
||||
;;
|
||||
linux-rubberband)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_RUBBERBAND]=$2
|
||||
;;
|
||||
linux-sdl)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_SDL]=$2
|
||||
;;
|
||||
linux-shine)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_SHINE]=$2
|
||||
;;
|
||||
linux-snappy)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_SNAPPY]=$2
|
||||
set_virtual_library "zlib" $2
|
||||
;;
|
||||
linux-soxr)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_SOXR]=$2
|
||||
;;
|
||||
linux-speex)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_SPEEX]=$2
|
||||
;;
|
||||
linux-tesseract)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_TESSERACT]=$2
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_LIBWEBP]=$2
|
||||
set_virtual_library "zlib" $2
|
||||
;;
|
||||
linux-twolame)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_TWOLAME]=$2
|
||||
;;
|
||||
linux-v4l2)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_V4L2]=$2
|
||||
;;
|
||||
linux-vo-amrwbenc)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_VO_AMRWBENC]=$2
|
||||
;;
|
||||
linux-x265)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_X265]=$2
|
||||
;;
|
||||
linux-xvidcore)
|
||||
ENABLED_LIBRARIES[LIBRARY_LINUX_XVIDCORE]=$2
|
||||
;;
|
||||
*)
|
||||
print_unknown_library $1
|
||||
;;
|
||||
|
@ -1190,11 +1395,7 @@ set_virtual_library() {
|
|||
fi
|
||||
;;
|
||||
zlib)
|
||||
if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "apple" ]]; then
|
||||
ENABLED_LIBRARIES[LIBRARY_APPLE_ZLIB]=$2
|
||||
else
|
||||
ENABLED_LIBRARIES[LIBRARY_ANDROID_ZLIB]=$2
|
||||
fi
|
||||
ENABLED_LIBRARIES[LIBRARY_SYSTEM_ZLIB]=$2
|
||||
;;
|
||||
*)
|
||||
print_unknown_virtual_library $1
|
||||
|
@ -1403,7 +1604,7 @@ print_enabled_libraries() {
|
|||
let enabled=0
|
||||
|
||||
# SUPPLEMENTARY LIBRARIES NOT PRINTED
|
||||
for library in {50..57} {59..61} {0..36}; do
|
||||
for library in {50..57} {59..92} {0..36}; do
|
||||
if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then
|
||||
if [[ ${enabled} -ge 1 ]]; then
|
||||
echo -n ", "
|
||||
|
@ -1822,7 +2023,7 @@ clone_git_repository_with_tag() {
|
|||
# 1. library index
|
||||
#
|
||||
is_gpl_licensed() {
|
||||
for gpl_library in {$LIBRARY_X264,$LIBRARY_XVIDCORE,$LIBRARY_X265,$LIBRARY_LIBVIDSTAB,$LIBRARY_RUBBERBAND}; do
|
||||
for gpl_library in {$LIBRARY_X264,$LIBRARY_XVIDCORE,$LIBRARY_X265,$LIBRARY_LIBVIDSTAB,$LIBRARY_RUBBERBAND,$LIBRARY_LINUX_XVIDCORE,$LIBRARY_LINUX_X265,$LIBRARY_LINUX_LIBVIDSTAB,$LIBRARY_LINUX_RUBBERBAND}; do
|
||||
if [[ $gpl_library -eq $1 ]]; then
|
||||
echo 0
|
||||
return
|
||||
|
@ -2099,8 +2300,8 @@ library_is_installed() {
|
|||
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
|
||||
if [ ! -d "${INSTALL_PATH}/${LIB_NAME}/lib" ] && [ ! -d "${INSTALL_PATH}/${LIB_NAME}/lib64" ]; then
|
||||
echo -e "INFO: ${INSTALL_PATH}/${LIB_NAME}/lib{lib64} directory not found\n" 1>>"${BASEDIR}"/build.log 2>&1
|
||||
echo 0
|
||||
return
|
||||
fi
|
||||
|
@ -2112,7 +2313,7 @@ library_is_installed() {
|
|||
fi
|
||||
|
||||
HEADER_COUNT=$(ls -l "${INSTALL_PATH}"/"${LIB_NAME}"/include | wc -l)
|
||||
LIB_COUNT=$(ls -l ${INSTALL_PATH}/${LIB_NAME}/lib | wc -l)
|
||||
LIB_COUNT=$(ls -l ${INSTALL_PATH}/${LIB_NAME}/lib* | wc -l)
|
||||
|
||||
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
|
||||
|
@ -2121,7 +2322,7 @@ library_is_installed() {
|
|||
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 -e "INFO: No libraries found under ${INSTALL_PATH}/${LIB_NAME}/lib{lib64}\n" 1>>"${BASEDIR}"/build.log 2>&1
|
||||
echo 0
|
||||
return
|
||||
fi
|
||||
|
@ -2189,3 +2390,15 @@ compare_versions() {
|
|||
echo "0"
|
||||
return;
|
||||
}
|
||||
|
||||
#
|
||||
# 1. command
|
||||
#
|
||||
command_exists() {
|
||||
local COMMAND=$1
|
||||
if [[ -n "$(command -v $COMMAND)" ]]; then
|
||||
echo 0
|
||||
else
|
||||
echo 1
|
||||
fi
|
||||
}
|
||||
|
|
27
scripts/linux/dav1d.sh
Executable file
27
scripts/linux/dav1d.sh
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
|
||||
# SET BUILD FLAGS
|
||||
CROSS_FILE="${BASEDIR}"/src/"${LIB_NAME}"/package/crossfiles/$ARCH-$FFMPEG_KIT_BUILD_TYPE.meson
|
||||
|
||||
create_mason_cross_file "$CROSS_FILE" || return 1
|
||||
|
||||
# ALWAYS CLEAN THE PREVIOUS BUILD
|
||||
rm -rf "${BUILD_DIR}" || return 1
|
||||
|
||||
meson "${BUILD_DIR}" \
|
||||
--cross-file="$CROSS_FILE" \
|
||||
-Db_lto=true \
|
||||
-Db_ndebug=false \
|
||||
-Denable_asm=true \
|
||||
-Denable_tools=false \
|
||||
-Denable_examples=false \
|
||||
-Denable_tests=false || return 1
|
||||
|
||||
cd "${BUILD_DIR}" || return 1
|
||||
|
||||
ninja -j$(get_cpu_count) || return 1
|
||||
|
||||
ninja install || return 1
|
||||
|
||||
# MANUALLY COPY PKG-CONFIG FILES
|
||||
cp "${BUILD_DIR}"/meson-private/dav1d.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1
|
73
scripts/linux/ffmpeg-kit.sh
Executable file
73
scripts/linux/ffmpeg-kit.sh
Executable file
|
@ -0,0 +1,73 @@
|
|||
#!/bin/bash
|
||||
|
||||
# ENABLE COMMON FUNCTIONS
|
||||
source "${BASEDIR}"/scripts/function-"${FFMPEG_KIT_BUILD_TYPE}".sh 1>>"${BASEDIR}"/build.log 2>&1 || return 1
|
||||
|
||||
LIB_NAME="ffmpeg-kit"
|
||||
|
||||
echo -e "----------------------------------------------------------------" 1>>"${BASEDIR}"/build.log 2>&1
|
||||
echo -e "\nINFO: Building ${LIB_NAME} for ${HOST} 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 -lavdevice"
|
||||
export PKG_CONFIG_LIBDIR="${INSTALL_PKG_CONFIG_DIR}"
|
||||
|
||||
cd "${BASEDIR}"/linux 1>>"${BASEDIR}"/build.log 2>&1 || return 1
|
||||
|
||||
# ALWAYS BUILD SHARED LIBRARIES
|
||||
BUILD_LIBRARY_OPTIONS="--enable-shared --disable-static"
|
||||
|
||||
echo -n -e "\n${LIB_NAME}: "
|
||||
|
||||
make distclean 2>/dev/null 1>/dev/null
|
||||
|
||||
rm -f "${BASEDIR}"/linux/src/libffmpegkit* 1>>"${BASEDIR}"/build.log 2>&1
|
||||
|
||||
# ALWAYS REGENERATE BUILD FILES - NECESSARY TO APPLY THE WORKAROUNDS
|
||||
autoreconf_library "${LIB_NAME}" 1>>"${BASEDIR}"/build.log 2>&1 || return 1
|
||||
|
||||
./configure \
|
||||
--prefix="${FFMPEG_KIT_LIBRARY_PATH}" \
|
||||
--with-pic \
|
||||
${BUILD_LIBRARY_OPTIONS} \
|
||||
--disable-fast-install \
|
||||
--disable-maintainer-mode \
|
||||
--host="${HOST}" 1>>"${BASEDIR}"/build.log 2>&1
|
||||
|
||||
# WORKAROUND FOR clang: warning: using sysroot for 'MacOSX' but targeting 'iPhone'
|
||||
## ${SED_INLINE} "s|allow_undefined_flag -o|allow_undefined_flag -target $(get_target) -o|g" libtool 1>>"${BASEDIR}"/build.log 2>&1
|
||||
## ${SED_INLINE} 's|\$rpath/\\$soname|@rpath/ffmpegkit.framework/ffmpegkit|g' libtool 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 || return 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
|
481
scripts/linux/ffmpeg.sh
Executable file
481
scripts/linux/ffmpeg.sh
Executable file
|
@ -0,0 +1,481 @@
|
|||
#!/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
|
||||
|
||||
LIB_NAME="ffmpeg"
|
||||
|
||||
echo -e "----------------------------------------------------------------" 1>>"${BASEDIR}"/build.log 2>&1
|
||||
echo -e "\nINFO: Building ${LIB_NAME} for ${HOST} 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_PATH="${INSTALL_PKG_CONFIG_DIR}:$(pkg-config --variable pc_path pkg-config)"
|
||||
|
||||
echo -e "\nINFO: Using PKG_CONFIG_PATH: ${PKG_CONFIG_PATH}\n" 1>>"${BASEDIR}"/build.log 2>&1
|
||||
|
||||
cd "${BASEDIR}"/src/"${LIB_NAME}" 1>>"${BASEDIR}"/build.log 2>&1 || return 1
|
||||
|
||||
# SET BUILD OPTIONS
|
||||
TARGET_CPU=""
|
||||
TARGET_ARCH=""
|
||||
ASM_OPTIONS=""
|
||||
case ${ARCH} in
|
||||
x86-64)
|
||||
TARGET_CPU="x86_64"
|
||||
TARGET_ARCH="x86_64"
|
||||
ASM_OPTIONS=" --disable-neon --enable-asm --enable-inline-asm"
|
||||
;;
|
||||
esac
|
||||
|
||||
CONFIGURE_POSTFIX=""
|
||||
HIGH_PRIORITY_INCLUDES=""
|
||||
|
||||
# SET CONFIGURE OPTIONS
|
||||
for library in {0..92}; do
|
||||
if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then
|
||||
ENABLED_LIBRARY=$(get_library_name ${library})
|
||||
|
||||
echo -e "INFO: Enabling library ${ENABLED_LIBRARY}\n" 1>>"${BASEDIR}"/build.log 2>&1
|
||||
|
||||
case ${ENABLED_LIBRARY} in
|
||||
linux-alsa)
|
||||
CONFIGURE_POSTFIX+=" --enable-alsa"
|
||||
;;
|
||||
linux-chromaprint)
|
||||
CONFIGURE_POSTFIX+=" --enable-chromaprint"
|
||||
;;
|
||||
linux-fontconfig)
|
||||
CONFIGURE_POSTFIX+=" --enable-libfontconfig"
|
||||
;;
|
||||
linux-freetype)
|
||||
CONFIGURE_POSTFIX+=" --enable-libfreetype"
|
||||
;;
|
||||
linux-fribidi)
|
||||
CONFIGURE_POSTFIX+=" --enable-libfribidi"
|
||||
;;
|
||||
linux-gmp)
|
||||
CONFIGURE_POSTFIX+=" --enable-gmp"
|
||||
;;
|
||||
linux-gnutls)
|
||||
CONFIGURE_POSTFIX+=" --enable-gnutls"
|
||||
;;
|
||||
linux-lame)
|
||||
CONFIGURE_POSTFIX+=" --enable-libmp3lame"
|
||||
;;
|
||||
linux-libass)
|
||||
CONFIGURE_POSTFIX+=" --enable-libass"
|
||||
;;
|
||||
linux-libiconv)
|
||||
CONFIGURE_POSTFIX+=" --enable-iconv"
|
||||
;;
|
||||
linux-libtheora)
|
||||
CONFIGURE_POSTFIX+=" --enable-libtheora"
|
||||
;;
|
||||
linux-libvidstab)
|
||||
CONFIGURE_POSTFIX+=" --enable-libvidstab"
|
||||
;;
|
||||
linux-libvorbis)
|
||||
CONFIGURE_POSTFIX+=" --enable-libvorbis"
|
||||
;;
|
||||
linux-libvpx)
|
||||
CONFIGURE_POSTFIX+=" --enable-libvpx"
|
||||
;;
|
||||
linux-libwebp)
|
||||
CONFIGURE_POSTFIX+=" --enable-libwebp"
|
||||
;;
|
||||
linux-libxml2)
|
||||
CONFIGURE_POSTFIX+=" --enable-libxml2"
|
||||
;;
|
||||
linux-opencl)
|
||||
CONFIGURE_POSTFIX+=" --enable-opencl"
|
||||
;;
|
||||
linux-opencore-amr)
|
||||
CONFIGURE_POSTFIX+=" --enable-libopencore-amrnb"
|
||||
;;
|
||||
linux-opus)
|
||||
CONFIGURE_POSTFIX+=" --enable-libopus"
|
||||
;;
|
||||
linux-rubberband)
|
||||
CONFIGURE_POSTFIX+=" --enable-librubberband"
|
||||
;;
|
||||
linux-sdl)
|
||||
CONFIGURE_POSTFIX+=" --enable-sdl2"
|
||||
;;
|
||||
linux-shine)
|
||||
CONFIGURE_POSTFIX+=" --enable-libshine"
|
||||
;;
|
||||
linux-snappy)
|
||||
CONFIGURE_POSTFIX+=" --enable-libsnappy"
|
||||
;;
|
||||
linux-soxr)
|
||||
CONFIGURE_POSTFIX+=" --enable-libsoxr"
|
||||
;;
|
||||
linux-speex)
|
||||
CONFIGURE_POSTFIX+=" --enable-libspeex"
|
||||
;;
|
||||
linux-tesseract)
|
||||
CONFIGURE_POSTFIX+=" --enable-libtesseract"
|
||||
;;
|
||||
linux-twolame)
|
||||
CONFIGURE_POSTFIX+=" --enable-libtwolame"
|
||||
;;
|
||||
linux-vaapi)
|
||||
CONFIGURE_POSTFIX+=" --enable-vaapi"
|
||||
;;
|
||||
linux-vo-amrwbenc)
|
||||
CONFIGURE_POSTFIX+=" --enable-libvo-amrwbenc"
|
||||
;;
|
||||
linux-v4l2)
|
||||
CONFIGURE_POSTFIX+=" --enable-libv4l2"
|
||||
;;
|
||||
linux-x265)
|
||||
CONFIGURE_POSTFIX+=" --enable-libx265"
|
||||
;;
|
||||
linux-xvidcore)
|
||||
CONFIGURE_POSTFIX+=" --enable-libxvid"
|
||||
;;
|
||||
linux-zlib)
|
||||
CONFIGURE_POSTFIX+=" --enable-zlib"
|
||||
;;
|
||||
dav1d)
|
||||
CFLAGS+=" $(pkg-config --cflags dav1d 2>>"${BASEDIR}"/build.log)"
|
||||
LDFLAGS+=" $(pkg-config --libs --static dav1d 2>>"${BASEDIR}"/build.log)"
|
||||
CONFIGURE_POSTFIX+=" --enable-libdav1d"
|
||||
;;
|
||||
kvazaar)
|
||||
CFLAGS+=" $(pkg-config --cflags kvazaar 2>>"${BASEDIR}"/build.log)"
|
||||
LDFLAGS+=" $(pkg-config --libs --static kvazaar 2>>"${BASEDIR}"/build.log)"
|
||||
CONFIGURE_POSTFIX+=" --enable-libkvazaar"
|
||||
;;
|
||||
libilbc)
|
||||
CFLAGS+=" $(pkg-config --cflags libilbc 2>>"${BASEDIR}"/build.log)"
|
||||
LDFLAGS+=" $(pkg-config --libs --static libilbc 2>>"${BASEDIR}"/build.log)"
|
||||
CONFIGURE_POSTFIX+=" --enable-libilbc"
|
||||
;;
|
||||
libaom)
|
||||
CFLAGS+=" $(pkg-config --cflags aom 2>>"${BASEDIR}"/build.log)"
|
||||
LDFLAGS+=" $(pkg-config --libs --static aom 2>>"${BASEDIR}"/build.log)"
|
||||
CONFIGURE_POSTFIX+=" --enable-libaom"
|
||||
;;
|
||||
openh264)
|
||||
CFLAGS+=" $(pkg-config --cflags openh264 2>>"${BASEDIR}"/build.log)"
|
||||
LDFLAGS+=" $(pkg-config --libs --static openh264 2>>"${BASEDIR}"/build.log)"
|
||||
CONFIGURE_POSTFIX+=" --enable-libopenh264"
|
||||
;;
|
||||
openssl)
|
||||
CFLAGS+=" $(pkg-config --cflags openssl 2>>"${BASEDIR}"/build.log)"
|
||||
LDFLAGS+=" $(pkg-config --libs --static openssl 2>>"${BASEDIR}"/build.log)"
|
||||
CONFIGURE_POSTFIX+=" --enable-openssl"
|
||||
;;
|
||||
srt)
|
||||
CFLAGS+=" $(pkg-config --cflags srt 2>>"${BASEDIR}"/build.log)"
|
||||
LDFLAGS+=" $(pkg-config --libs --static srt 2>>"${BASEDIR}"/build.log)"
|
||||
CONFIGURE_POSTFIX+=" --enable-libsrt"
|
||||
;;
|
||||
x264)
|
||||
CFLAGS+=" $(pkg-config --cflags x264 2>>"${BASEDIR}"/build.log)"
|
||||
LDFLAGS+=" $(pkg-config --libs --static x264 2>>"${BASEDIR}"/build.log)"
|
||||
CONFIGURE_POSTFIX+=" --enable-libx264"
|
||||
;;
|
||||
zimg)
|
||||
CFLAGS+=" $(pkg-config --cflags zimg 2>>"${BASEDIR}"/build.log)"
|
||||
LDFLAGS+=" $(pkg-config --libs --static zimg 2>>"${BASEDIR}"/build.log)"
|
||||
CONFIGURE_POSTFIX+=" --enable-libzimg"
|
||||
;;
|
||||
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_LINUX_ALSA} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-alsa"
|
||||
elif [[ ${library} -eq ${LIBRARY_LINUX_CHROMAPRINT} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-chromaprint"
|
||||
elif [[ ${library} -eq ${LIBRARY_LINUX_FONTCONFIG} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libfontconfig"
|
||||
elif [[ ${library} -eq ${LIBRARY_LINUX_FREETYPE} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libfreetype"
|
||||
elif [[ ${library} -eq ${LIBRARY_LINUX_FRIBIDI} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libfribidi"
|
||||
elif [[ ${library} -eq ${LIBRARY_LINUX_GMP} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-gmp"
|
||||
elif [[ ${library} -eq ${LIBRARY_LINUX_GNUTLS} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-gnutls"
|
||||
elif [[ ${library} -eq ${LIBRARY_LINUX_LAME} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libmp3lame"
|
||||
elif [[ ${library} -eq ${LIBRARY_LINUX_LIBASS} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libass"
|
||||
elif [[ ${library} -eq ${LIBRARY_LINUX_LIBICONV} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-iconv"
|
||||
elif [[ ${library} -eq ${LIBRARY_LINUX_LIBTHEORA} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libtheora"
|
||||
elif [[ ${library} -eq ${LIBRARY_LINUX_LIBVIDSTAB} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libvidstab"
|
||||
elif [[ ${library} -eq ${LIBRARY_LINUX_LIBVORBIS} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libvorbis"
|
||||
elif [[ ${library} -eq ${LIBRARY_LINUX_LIBVPX} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libvpx"
|
||||
elif [[ ${library} -eq ${LIBRARY_LINUX_LIBWEBP} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libwebp"
|
||||
elif [[ ${library} -eq ${LIBRARY_LINUX_LIBXML2} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libxml2"
|
||||
elif [[ ${library} -eq ${LIBRARY_LINUX_OPENCOREAMR} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libopencore-amrnb"
|
||||
elif [[ ${library} -eq ${LIBRARY_LINUX_OPUS} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libopus"
|
||||
elif [[ ${library} -eq ${LIBRARY_LINUX_RUBBERBAND} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-librubberband"
|
||||
elif [[ ${library} -eq ${LIBRARY_LINUX_SDL} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-sdl2"
|
||||
elif [[ ${library} -eq ${LIBRARY_LINUX_SHINE} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libshine"
|
||||
elif [[ ${library} -eq ${LIBRARY_LINUX_SNAPPY} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libsnappy"
|
||||
elif [[ ${library} -eq ${LIBRARY_LINUX_SOXR} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libsoxr"
|
||||
elif [[ ${library} -eq ${LIBRARY_LINUX_SPEEX} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libspeex"
|
||||
elif [[ ${library} -eq ${LIBRARY_LINUX_TESSERACT} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libtesseract"
|
||||
elif [[ ${library} -eq ${LIBRARY_LINUX_TWOLAME} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libtwolame"
|
||||
elif [[ ${library} -eq ${LIBRARY_LINUX_VO_AMRWBENC} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libvo-amrwbenc"
|
||||
elif [[ ${library} -eq ${LIBRARY_LINUX_X265} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libx265"
|
||||
elif [[ ${library} -eq ${LIBRARY_LINUX_XVIDCORE} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libxvid"
|
||||
elif [[ ${library} -eq ${LIBRARY_SYSTEM_ZLIB} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-zlib"
|
||||
elif [[ ${library} -eq ${LIBRARY_DAV1D} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libdav1d"
|
||||
elif [[ ${library} -eq ${LIBRARY_KVAZAAR} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libkvazaar"
|
||||
elif [[ ${library} -eq ${LIBRARY_LIBILBC} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libilbc"
|
||||
elif [[ ${library} -eq ${LIBRARY_LIBAOM} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libaom"
|
||||
elif [[ ${library} -eq ${LIBRARY_OPENH264} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libopenh264"
|
||||
elif [[ ${library} -eq ${LIBRARY_OPENSSL} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-openssl"
|
||||
elif [[ ${library} -eq ${LIBRARY_SRT} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libsrt"
|
||||
elif [[ ${library} -eq ${LIBRARY_X264} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libx264"
|
||||
elif [[ ${library} -eq ${LIBRARY_ZIMG} ]]; then
|
||||
CONFIGURE_POSTFIX+=" --disable-libzimg"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# SET CONFIGURE OPTIONS FOR CUSTOM LIBRARIES
|
||||
for custom_library_index in "${CUSTOM_LIBRARIES[@]}"; do
|
||||
library_name="CUSTOM_LIBRARY_${custom_library_index}_NAME"
|
||||
pc_file_name="CUSTOM_LIBRARY_${custom_library_index}_PACKAGE_CONFIG_FILE_NAME"
|
||||
ffmpeg_flag_name="CUSTOM_LIBRARY_${custom_library_index}_FFMPEG_ENABLE_FLAG"
|
||||
|
||||
echo -e "INFO: Enabling custom library ${!library_name}\n" 1>>"${BASEDIR}"/build.log 2>&1
|
||||
|
||||
CFLAGS+=" $(pkg-config --cflags ${!pc_file_name} 2>>"${BASEDIR}"/build.log)"
|
||||
LDFLAGS+=" $(pkg-config --libs --static ${!pc_file_name} 2>>"${BASEDIR}"/build.log)"
|
||||
CONFIGURE_POSTFIX+=" --enable-${!ffmpeg_flag_name}"
|
||||
done
|
||||
|
||||
# SET ENABLE GPL FLAG WHEN REQUESTED
|
||||
if [ "$GPL_ENABLED" == "yes" ]; then
|
||||
CONFIGURE_POSTFIX+=" --enable-gpl"
|
||||
fi
|
||||
|
||||
# ALWAYS BUILD SHARED LIBRARIES
|
||||
BUILD_LIBRARY_OPTIONS="--disable-static --enable-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
|
||||
|
||||
# SET LTO FLAGS
|
||||
if [[ -z ${NO_LINK_TIME_OPTIMIZATION} ]]; then
|
||||
DEBUG_OPTIONS="--disable-debug --enable-lto"
|
||||
else
|
||||
DEBUG_OPTIONS="--disable-debug --disable-lto"
|
||||
fi
|
||||
else
|
||||
DEBUG_OPTIONS="--enable-debug --disable-stripping"
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
# DELETE SHARED FRAMEWORK WORKAROUNDS
|
||||
git checkout "${BASEDIR}/src/ffmpeg/ffbuild" 1>>"${BASEDIR}"/build.log 2>&1
|
||||
fi
|
||||
|
||||
# USE HIGHER LIMITS FOR FFMPEG LINKING
|
||||
ulimit -n 2048 1>>"${BASEDIR}"/build.log 2>&1
|
||||
|
||||
########################### CUSTOMIZATIONS #######################
|
||||
cd "${BASEDIR}"/src/"${LIB_NAME}" 1>>"${BASEDIR}"/build.log 2>&1 || return 1
|
||||
git checkout libavformat/file.c 1>>"${BASEDIR}"/build.log 2>&1
|
||||
git checkout libavformat/protocols.c 1>>"${BASEDIR}"/build.log 2>&1
|
||||
git checkout libavutil 1>>"${BASEDIR}"/build.log 2>&1
|
||||
|
||||
# 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 || return 1
|
||||
|
||||
# 2. Set friendly ffmpeg version
|
||||
FFMPEG_VERSION="v$(get_user_friendly_ffmpeg_version)"
|
||||
${SED_INLINE} "s/\$version/$FFMPEG_VERSION/g" "${BASEDIR}"/src/"${LIB_NAME}"/ffbuild/version.sh 1>>"${BASEDIR}"/build.log 2>&1 || return 1
|
||||
|
||||
###################################################################
|
||||
|
||||
./configure \
|
||||
--cross-prefix="${HOST}-" \
|
||||
--prefix="${FFMPEG_LIBRARY_PATH}" \
|
||||
--pkg-config="${HOST_PKG_CONFIG_PATH}" \
|
||||
--enable-version3 \
|
||||
--arch="${TARGET_ARCH}" \
|
||||
--cpu="${TARGET_CPU}" \
|
||||
--target-os=linux \
|
||||
${ASM_OPTIONS} \
|
||||
--ar="${AR}" \
|
||||
--cc="${CC}" \
|
||||
--cxx="${CXX}" \
|
||||
--ranlib="${RANLIB}" \
|
||||
--strip="${STRIP}" \
|
||||
--nm="${NM}" \
|
||||
--disable-autodetect \
|
||||
--enable-cross-compile \
|
||||
--enable-pic \
|
||||
--enable-optimizations \
|
||||
--enable-swscale \
|
||||
${BUILD_LIBRARY_OPTIONS} \
|
||||
--enable-pthreads \
|
||||
--enable-v4l2-m2m \
|
||||
--disable-outdev=fbdev \
|
||||
--disable-indev=fbdev \
|
||||
${SIZE_OPTIONS} \
|
||||
--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-videotoolbox \
|
||||
--disable-audiotoolbox \
|
||||
--disable-appkit \
|
||||
--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 || return 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
|
28
scripts/linux/kvazaar.sh
Executable file
28
scripts/linux/kvazaar.sh
Executable file
|
@ -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_kvazaar} -eq 1 ]]; then
|
||||
autoreconf_library "${LIB_NAME}" 1>>"${BASEDIR}"/build.log 2>&1 || return 1
|
||||
fi
|
||||
|
||||
# WORKAROUND TO DISABLE LINKING TO -lrt
|
||||
## ${SED_INLINE} 's/\-lrt//g' "${BASEDIR}"/src/"${LIB_NAME}"/configure || return 1
|
||||
|
||||
./configure \
|
||||
--prefix="${LIB_INSTALL_PREFIX}" \
|
||||
--with-pic \
|
||||
--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}" || return 1
|
45
scripts/linux/libaom.sh
Executable file
45
scripts/linux/libaom.sh
Executable file
|
@ -0,0 +1,45 @@
|
|||
#!/bin/bash
|
||||
|
||||
# DISABLE ASM WORKAROUNDS BEFORE APPLYING THEM AGAIN
|
||||
git checkout ${BASEDIR}/src/${LIB_NAME}/aom_ports 1>>"${BASEDIR}"/build.log 2>&1
|
||||
|
||||
# SET BUILD OPTIONS
|
||||
ASM_OPTIONS=""
|
||||
case ${ARCH} in
|
||||
x86-64)
|
||||
ASM_OPTIONS="-DENABLE_SSE4_2=1 -DHAVE_SSE4_2=1"
|
||||
;;
|
||||
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_BUILD_TYPE=Release \
|
||||
-DCMAKE_SYSTEM_NAME=Linux \
|
||||
-DCMAKE_INSTALL_PREFIX="${LIB_INSTALL_PREFIX}" \
|
||||
-DCMAKE_CXX_COMPILER="$CXX" \
|
||||
-DCMAKE_C_COMPILER="$CC" \
|
||||
-DCMAKE_LINKER="$LD" \
|
||||
-DCMAKE_AR="$AR" \
|
||||
-DCMAKE_AS="$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) || return 1
|
||||
|
||||
make install || return 1
|
||||
|
||||
# CREATE PACKAGE CONFIG MANUALLY
|
||||
create_libaom_package_config "3.2.0" || return 1
|
24
scripts/linux/libilbc.sh
Executable file
24
scripts/linux/libilbc.sh
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/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}" 1>>"${BASEDIR}"/build.log 2>&1 || return 1
|
||||
fi
|
||||
|
||||
./configure \
|
||||
--prefix="${LIB_INSTALL_PREFIX}" \
|
||||
--with-pic \
|
||||
--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
|
32
scripts/linux/openh264.sh
Executable file
32
scripts/linux/openh264.sh
Executable file
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
|
||||
# SET BUILD OPTIONS
|
||||
case ${ARCH} in
|
||||
x86-64)
|
||||
ASM_OPTIONS=x86
|
||||
CFLAGS+=" -DHAVE_AVX2"
|
||||
;;
|
||||
esac
|
||||
|
||||
# ALWAYS CLEAN THE PREVIOUS BUILD
|
||||
make clean 2>/dev/null 1>/dev/null
|
||||
|
||||
# DISCARD APPLE WORKAROUNDS
|
||||
git checkout "${BASEDIR}"/src/"${LIB_NAME}"/build || return 1
|
||||
git checkout "${BASEDIR}"/src/"${LIB_NAME}"/codec || return 1
|
||||
|
||||
make -j$(get_cpu_count) \
|
||||
ARCH="$(get_target_cpu)" \
|
||||
AR="${AR}" \
|
||||
CC="${CC}" \
|
||||
CFLAGS="$CFLAGS" \
|
||||
CXX="${CXX}" \
|
||||
CXXFLAGS="${CXXFLAGS}" \
|
||||
LDFLAGS="${LDFLAGS}" \
|
||||
OS=linux \
|
||||
PREFIX="${LIB_INSTALL_PREFIX}" \
|
||||
ASM_OPTIONS=${ASM_OPTIONS} \
|
||||
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
|
38
scripts/linux/openssl.sh
Executable file
38
scripts/linux/openssl.sh
Executable file
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
|
||||
# SET BUILD OPTIONS
|
||||
ASM_OPTIONS=""
|
||||
case ${ARCH} in
|
||||
x86-64)
|
||||
ASM_OPTIONS="linux-x86_64 enable-ec_nistp_64_gcc_128"
|
||||
;;
|
||||
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_openssl} -eq 1 ]]; then
|
||||
autoreconf_library "${LIB_NAME}" 1>>"${BASEDIR}"/build.log 2>&1 || return 1
|
||||
fi
|
||||
|
||||
INT128_AVAILABLE=$($CC -dM -E - </dev/null 2>>"${BASEDIR}"/build.log | grep __SIZEOF_INT128__)
|
||||
|
||||
echo -e "INFO: __uint128_t detection output: $INT128_AVAILABLE\n" 1>>"${BASEDIR}"/build.log 2>&1
|
||||
|
||||
./Configure \
|
||||
--prefix="${LIB_INSTALL_PREFIX}" \
|
||||
zlib \
|
||||
no-shared \
|
||||
no-engine \
|
||||
no-dso \
|
||||
no-legacy \
|
||||
${ASM_OPTIONS} \
|
||||
no-tests || return 1
|
||||
|
||||
make -j$(get_cpu_count) build_sw || return 1
|
||||
|
||||
make install_sw install_ssldirs || return 1
|
||||
|
||||
# MANUALLY COPY PKG-CONFIG FILES
|
||||
cp ./*.pc "${INSTALL_PKG_CONFIG_DIR}" || return 1
|
49
scripts/linux/srt.sh
Executable file
49
scripts/linux/srt.sh
Executable file
|
@ -0,0 +1,49 @@
|
|||
#!/bin/bash
|
||||
|
||||
# ALWAYS CLEAN THE PREVIOUS BUILD
|
||||
git clean -dfx 2>/dev/null 1>/dev/null
|
||||
|
||||
# OVERRIDE SYSTEM PROCESSOR
|
||||
SYSTEM_PROCESSOR=""
|
||||
case ${ARCH} in
|
||||
x86-64)
|
||||
SYSTEM_PROCESSOR="x86_64"
|
||||
;;
|
||||
esac
|
||||
|
||||
# WORKAROUND TO GENERATE BASE BUILD FILES
|
||||
./configure || echo "" 2>/dev/null 1>/dev/null
|
||||
|
||||
cmake -Wno-dev \
|
||||
-DUSE_ENCLIB=openssl \
|
||||
-DCMAKE_VERBOSE_MAKEFILE=0 \
|
||||
-DCMAKE_C_FLAGS="${CFLAGS}" \
|
||||
-DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX="${LIB_INSTALL_PREFIX}" \
|
||||
-DCMAKE_SYSTEM_NAME=Linux \
|
||||
-DCMAKE_CXX_COMPILER="$CXX" \
|
||||
-DCMAKE_C_COMPILER="$CC" \
|
||||
-DCMAKE_LINKER="$LD" \
|
||||
-DCMAKE_AR="$AR" \
|
||||
-DCMAKE_AS="$AS" \
|
||||
-DCMAKE_SYSTEM_LOADED=1 \
|
||||
-DCMAKE_SYSTEM_PROCESSOR="${SYSTEM_PROCESSOR}" \
|
||||
-DENABLE_STDCXX_SYNC=1 \
|
||||
-DENABLE_MONOTONIC_CLOCK=1 \
|
||||
-DENABLE_STDCXX_SYNC=1 \
|
||||
-DENABLE_CXX11=1 \
|
||||
-DUSE_OPENSSL_PC=1 \
|
||||
-DENABLE_DEBUG=0 \
|
||||
-DENABLE_LOGGING=0 \
|
||||
-DENABLE_HEAVY_LOGGING=0 \
|
||||
-DENABLE_APPS=0 \
|
||||
-DENABLE_SHARED=0 "${BASEDIR}"/src/"${LIB_NAME}" || return 1
|
||||
|
||||
make -j$(get_cpu_count) || return 1
|
||||
|
||||
make install || return 1
|
||||
|
||||
# CREATE PACKAGE CONFIG MANUALLY
|
||||
create_srt_package_config "1.4.4" || return 1
|
42
scripts/linux/x264.sh
Executable file
42
scripts/linux/x264.sh
Executable file
|
@ -0,0 +1,42 @@
|
|||
#!/bin/bash
|
||||
|
||||
# SET BUILD OPTIONS
|
||||
ASM_OPTIONS=""
|
||||
DEBUG_OPTIONS=""
|
||||
case ${ARCH} in
|
||||
x86-64)
|
||||
if ! [ -x "$(command -v nasm)" ]; then
|
||||
echo -e "\n(*) nasm command not found\n"
|
||||
return 1
|
||||
fi
|
||||
|
||||
export AS="$(command -v nasm)"
|
||||
;;
|
||||
esac
|
||||
if [[ -n ${FFMPEG_KIT_DEBUG} ]]; then
|
||||
DEBUG_OPTIONS="--enable-debug"
|
||||
fi
|
||||
|
||||
# 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}" 1>>"${BASEDIR}"/build.log 2>&1 || return 1
|
||||
fi
|
||||
|
||||
./configure \
|
||||
--prefix="${LIB_INSTALL_PREFIX}" \
|
||||
--enable-pic \
|
||||
--enable-static \
|
||||
--disable-cli \
|
||||
${ASM_OPTIONS} \
|
||||
${DEBUG_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
|
24
scripts/linux/zimg.sh
Executable file
24
scripts/linux/zimg.sh
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/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_zimg} -eq 1 ]]; then
|
||||
autoreconf_library "${LIB_NAME}" 1>>"${BASEDIR}"/build.log 2>&1 || return 1
|
||||
fi
|
||||
|
||||
./configure \
|
||||
--prefix="${LIB_INSTALL_PREFIX}" \
|
||||
--with-pic \
|
||||
--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_zimg_package_config "3.0.3" || return 1
|
168
scripts/main-linux.sh
Executable file
168
scripts/main-linux.sh
Executable file
|
@ -0,0 +1,168 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ -z ${ARCH} ]]; then
|
||||
echo -e "\n(*) ARCH not defined\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z ${BASEDIR} ]]; then
|
||||
echo -e "\n(*) BASEDIR not defined\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
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
|
||||
export LIB_INSTALL_BASE="${BASEDIR}/prebuilt/$(get_build_directory)"
|
||||
|
||||
# CREATE PACKAGE CONFIG DIRECTORY FOR THIS ARCHITECTURE
|
||||
PKG_CONFIG_DIRECTORY="${LIB_INSTALL_BASE}/pkgconfig"
|
||||
if [ ! -d "${PKG_CONFIG_DIRECTORY}" ]; then
|
||||
mkdir -p "${PKG_CONFIG_DIRECTORY}" || return 1
|
||||
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..50}; do
|
||||
if [[ ${!library} -eq 1 ]]; then
|
||||
ENABLED_LIBRARY=$(get_library_name $((library - 1)))
|
||||
enabled_library_list+=(${ENABLED_LIBRARY})
|
||||
|
||||
echo -e "INFO: Enabled library ${ENABLED_LIBRARY} will be built\n" 1>>"${BASEDIR}"/build.log 2>&1
|
||||
fi
|
||||
done
|
||||
|
||||
# BUILD ENABLED LIBRARIES AND THEIR DEPENDENCIES
|
||||
let completed=0
|
||||
while [ ${#enabled_library_list[@]} -gt $completed ]; do
|
||||
for library in "${enabled_library_list[@]}"; do
|
||||
let run=0
|
||||
case $library in
|
||||
srt)
|
||||
if [[ $OK_openssl -eq 1 ]]; then
|
||||
run=1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
run=1
|
||||
;;
|
||||
esac
|
||||
|
||||
# DEFINE SOME FLAGS TO MANAGE DEPENDENCIES AND REBUILD OPTIONS
|
||||
BUILD_COMPLETED_FLAG=$(echo "OK_${library}" | sed "s/\-/\_/g")
|
||||
REBUILD_FLAG=$(echo "REBUILD_${library}" | sed "s/\-/\_/g")
|
||||
DEPENDENCY_REBUILT_FLAG=$(echo "DEPENDENCY_REBUILT_${library}" | sed "s/\-/\_/g")
|
||||
|
||||
if [[ $run -eq 1 ]] && [[ "${!BUILD_COMPLETED_FLAG}" != "1" ]]; then
|
||||
LIBRARY_IS_INSTALLED=$(library_is_installed "${LIB_INSTALL_BASE}" "${library}")
|
||||
|
||||
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 1 ]] || [[ ${!REBUILD_FLAG} -eq 1 ]] || [[ ${!DEPENDENCY_REBUILT_FLAG} -eq 1 ]]; then
|
||||
|
||||
echo -n "${library}: "
|
||||
|
||||
"${BASEDIR}"/scripts/run-linux.sh "${library}" 1>>"${BASEDIR}"/build.log 2>&1
|
||||
|
||||
RC=$?
|
||||
|
||||
# SET SOME FLAGS AFTER THE BUILD
|
||||
if [ $RC -eq 0 ]; then
|
||||
((completed += 1))
|
||||
declare "$BUILD_COMPLETED_FLAG=1"
|
||||
check_if_dependency_rebuilt "${library}"
|
||||
echo "ok"
|
||||
elif [ $RC -eq 200 ]; then
|
||||
echo -e "not supported\n\nSee build.log for details\n"
|
||||
exit 1
|
||||
else
|
||||
echo -e "failed\n\nSee build.log for details\n"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
((completed += 1))
|
||||
declare "$BUILD_COMPLETED_FLAG=1"
|
||||
echo "${library}: already built"
|
||||
fi
|
||||
else
|
||||
echo -e "INFO: Skipping $library, dependencies built=$run, already built=${!BUILD_COMPLETED_FLAG}\n" 1>>"${BASEDIR}"/build.log 2>&1
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
# BUILD CUSTOM LIBRARIES
|
||||
for custom_library_index in "${CUSTOM_LIBRARIES[@]}"; do
|
||||
library_name="CUSTOM_LIBRARY_${custom_library_index}_NAME"
|
||||
|
||||
echo -e "\nDEBUG: Custom library ${!library_name} will be built\n" 1>>"${BASEDIR}"/build.log 2>&1
|
||||
|
||||
# DEFINE SOME FLAGS TO REBUILD OPTIONS
|
||||
REBUILD_FLAG=$(echo "REBUILD_${!library_name}" | sed "s/\-/\_/g")
|
||||
LIBRARY_IS_INSTALLED=$(library_is_installed "${LIB_INSTALL_BASE}" "${!library_name}")
|
||||
|
||||
echo -e "INFO: Flags detected for custom library ${!library_name}: already installed=${LIBRARY_IS_INSTALLED}, rebuild requested by user=${!REBUILD_FLAG}\n" 1>>"${BASEDIR}"/build.log 2>&1
|
||||
|
||||
if [[ ${LIBRARY_IS_INSTALLED} -ne 1 ]] || [[ ${!REBUILD_FLAG} -eq 1 ]]; then
|
||||
|
||||
echo -n "${!library_name}: "
|
||||
|
||||
"${BASEDIR}"/scripts/run-linux.sh "${!library_name}" 1>>"${BASEDIR}"/build.log 2>&1
|
||||
|
||||
RC=$?
|
||||
|
||||
# SET SOME FLAGS AFTER THE BUILD
|
||||
if [ $RC -eq 0 ]; then
|
||||
echo "ok"
|
||||
elif [ $RC -eq 200 ]; then
|
||||
echo -e "not supported\n\nSee build.log for details\n"
|
||||
exit 1
|
||||
else
|
||||
echo -e "failed\n\nSee build.log for details\n"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "${!library_name}: already built"
|
||||
fi
|
||||
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 || return 1
|
||||
|
||||
LIB_INSTALL_PREFIX="${LIB_INSTALL_BASE}/${LIB_NAME}"
|
||||
|
||||
# BUILD FFMPEG
|
||||
source "${BASEDIR}"/scripts/linux/ffmpeg.sh
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo -e "\nffmpeg: skipped"
|
||||
fi
|
||||
|
||||
# SKIP TO SPEED UP THE BUILD
|
||||
if [[ ${SKIP_ffmpeg_kit} -ne 1 ]]; then
|
||||
|
||||
# BUILD FFMPEG KIT
|
||||
. "${BASEDIR}"/scripts/linux/ffmpeg-kit.sh "$@" || return 1
|
||||
else
|
||||
echo -e "\nffmpeg-kit: skipped"
|
||||
fi
|
||||
|
||||
echo -e "\nINFO: Completed build for ${ARCH} at $(date)\n" 1>>"${BASEDIR}"/build.log 2>&1
|
42
scripts/run-linux.sh
Executable file
42
scripts/run-linux.sh
Executable file
|
@ -0,0 +1,42 @@
|
|||
#!/bin/bash
|
||||
|
||||
# ENABLE COMMON FUNCTIONS
|
||||
source "${BASEDIR}"/scripts/function-"${FFMPEG_KIT_BUILD_TYPE}".sh || return 1
|
||||
|
||||
LIB_NAME=$1
|
||||
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/linux/${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)
|
||||
|
||||
echo -e "----------------------------------------------------------------"
|
||||
echo -e "\nINFO: Building ${LIB_NAME} for ${HOST} 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"
|
||||
|
||||
rm -rf "${LIB_INSTALL_PREFIX}" || return 1
|
||||
rm -rf "${BUILD_DIR}" || return 1
|
||||
|
||||
# EXECUTE BUILD SCRIPT OF EACH ENABLED LIBRARY
|
||||
source "${SCRIPT_PATH}"
|
|
@ -10,7 +10,7 @@ ENABLED_ARCHITECTURES=(0 0 0 0 0 0 0 0 0 0 0 0 0)
|
|||
ENABLED_ARCHITECTURE_VARIANTS=(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 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 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=()
|
||||
|
@ -34,7 +34,7 @@ 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=9 # android, ios, linux, macos, tvos
|
||||
ARCH_X86_64_MAC_CATALYST=10 # ios
|
||||
ARCH_ARM64_MAC_CATALYST=11 # ios
|
||||
ARCH_ARM64_SIMULATOR=12 # ios
|
||||
|
@ -100,9 +100,9 @@ LIBRARY_LEPTONICA=46
|
|||
LIBRARY_LIBSAMPLERATE=47
|
||||
LIBRARY_HARFBUZZ=48
|
||||
LIBRARY_CPU_FEATURES=49
|
||||
LIBRARY_ANDROID_ZLIB=50
|
||||
LIBRARY_ANDROID_MEDIA_CODEC=51
|
||||
LIBRARY_APPLE_ZLIB=52
|
||||
LIBRARY_SYSTEM_ZLIB=50
|
||||
LIBRARY_LINUX_ALSA=51
|
||||
LIBRARY_ANDROID_MEDIA_CODEC=52
|
||||
LIBRARY_APPLE_AUDIOTOOLBOX=53
|
||||
LIBRARY_APPLE_BZIP2=54
|
||||
LIBRARY_APPLE_VIDEOTOOLBOX=55
|
||||
|
@ -112,3 +112,34 @@ LIBRARY_APPLE_LIBUUID=58
|
|||
LIBRARY_APPLE_COREIMAGE=59
|
||||
LIBRARY_APPLE_OPENCL=60
|
||||
LIBRARY_APPLE_OPENGL=61
|
||||
LIBRARY_LINUX_FONTCONFIG=62
|
||||
LIBRARY_LINUX_FREETYPE=63
|
||||
LIBRARY_LINUX_FRIBIDI=64
|
||||
LIBRARY_LINUX_GMP=65
|
||||
LIBRARY_LINUX_GNUTLS=66
|
||||
LIBRARY_LINUX_LAME=67
|
||||
LIBRARY_LINUX_LIBASS=68
|
||||
LIBRARY_LINUX_LIBICONV=69
|
||||
LIBRARY_LINUX_LIBTHEORA=70
|
||||
LIBRARY_LINUX_LIBVORBIS=71
|
||||
LIBRARY_LINUX_LIBVPX=72
|
||||
LIBRARY_LINUX_LIBWEBP=73
|
||||
LIBRARY_LINUX_LIBXML2=74
|
||||
LIBRARY_LINUX_OPENCOREAMR=75
|
||||
LIBRARY_LINUX_SHINE=76
|
||||
LIBRARY_LINUX_SPEEX=77
|
||||
LIBRARY_LINUX_OPENCL=78
|
||||
LIBRARY_LINUX_XVIDCORE=79
|
||||
LIBRARY_LINUX_X265=80
|
||||
LIBRARY_LINUX_LIBVIDSTAB=81
|
||||
LIBRARY_LINUX_RUBBERBAND=82
|
||||
LIBRARY_LINUX_V4L2=83
|
||||
LIBRARY_LINUX_OPUS=84
|
||||
LIBRARY_LINUX_SNAPPY=85
|
||||
LIBRARY_LINUX_SOXR=86
|
||||
LIBRARY_LINUX_CHROMAPRINT=87
|
||||
LIBRARY_LINUX_TWOLAME=88
|
||||
LIBRARY_LINUX_SDL=89
|
||||
LIBRARY_LINUX_TESSERACT=90
|
||||
LIBRARY_LINUX_VAAPI=91
|
||||
LIBRARY_LINUX_VO_AMRWBENC=92
|
||||
|
|
Loading…
Reference in New Issue
Block a user