parent
4cc9408596
commit
be4030ffb3
@ -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 |
@ -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 |
||||||
|
} |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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}" |
Loading…
Reference in new issue