create linux bundles under the prebuilt directory

pull/541/head
Taner Sener 3 years ago
parent ba2b668c84
commit e4e97f59ce
  1. 14
      linux.sh
  2. 2
      linux/configure
  3. 2
      linux/configure.ac
  4. 2
      linux/src/FFmpegKit.cpp
  5. 26
      linux/src/FFmpegKitConfig.cpp
  6. 17
      scripts/function-apple.sh
  7. 87
      scripts/function-linux.sh
  8. 21
      scripts/function.sh
  9. 3
      scripts/linux/ffmpeg-kit.sh
  10. 9
      scripts/linux/ffmpeg.sh

@ -203,3 +203,17 @@ for run_arch in {0..12}; do
done done
fi fi
done done
# BUILD FFMPEG-KIT BUNDLE
if [[ -n ${TARGET_ARCH_LIST[0]} ]]; then
echo -e -n "\nCreating the bundle under prebuilt: "
echo -e "DEBUG: Creating the bundle directory\n" 1>>"${BASEDIR}"/build.log 2>&1
initialize_folder "${BASEDIR}/prebuilt/$(get_bundle_directory)"
create_linux_bundle
echo -e "ok\n"
fi

2
linux/configure vendored

@ -6220,7 +6220,7 @@ CFLAGS="$cflags_bckup"
FFMPEG_LIBS="-lavcodec -lavfilter -lavformat -lavutil -lswscale -lswresample" FFMPEG_LIBS="-lavcodec -lavfilter -lavformat -lavutil -lswscale -lswresample"
VERSION_INFO="5:5:1" VERSION_INFO="9:1:5"
case `pwd` in case `pwd` in

@ -27,7 +27,7 @@ CFLAGS="$cflags_bckup"
FFMPEG_LIBS="-lavcodec -lavfilter -lavformat -lavutil -lswscale -lswresample" FFMPEG_LIBS="-lavcodec -lavfilter -lavformat -lavutil -lswscale -lswresample"
AC_SUBST(FFMPEG_LIBS) AC_SUBST(FFMPEG_LIBS)
VERSION_INFO="5:5:1" VERSION_INFO="9:1:5"
AC_SUBST(VERSION_INFO) AC_SUBST(VERSION_INFO)
LT_INIT LT_INIT

@ -17,7 +17,9 @@
* along with FFmpegKit. If not, see <http://www.gnu.org/licenses/>. * along with FFmpegKit. If not, see <http://www.gnu.org/licenses/>.
*/ */
extern "C" {
#include "fftools_ffmpeg.h" #include "fftools_ffmpeg.h"
}
#include "ArchDetect.h" #include "ArchDetect.h"
#include "FFmpegKit.h" #include "FFmpegKit.h"
#include "FFmpegKitConfig.h" #include "FFmpegKitConfig.h"

@ -19,9 +19,11 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
extern "C" {
#include "libavutil/ffversion.h" #include "libavutil/ffversion.h"
#include "libavutil/bprint.h" #include "libavutil/bprint.h"
#include "fftools_ffmpeg.h" #include "fftools_ffmpeg.h"
}
#include "ArchDetect.h" #include "ArchDetect.h"
#include "FFmpegKit.h" #include "FFmpegKit.h"
#include "FFmpegKitConfig.h" #include "FFmpegKitConfig.h"
@ -91,12 +93,22 @@ __thread volatile long globalSessionId = 0;
/** Holds the default log level */ /** Holds the default log level */
int configuredLogLevel = ffmpegkit::LevelAVLogInfo; int configuredLogLevel = ffmpegkit::LevelAVLogInfo;
#ifdef __cplusplus
extern "C" {
#endif
/** Forward declaration for function defined in fftools_ffmpeg.c */ /** Forward declaration for function defined in fftools_ffmpeg.c */
int ffmpeg_execute(int argc, char **argv); int ffmpeg_execute(int argc, char **argv);
/** Forward declaration for function defined in fftools_ffprobe.c */ /** Forward declaration for function defined in fftools_ffprobe.c */
int ffprobe_execute(int argc, char **argv); int ffprobe_execute(int argc, char **argv);
void ffmpegkit_log_callback_function(void *ptr, int level, const char* format, va_list vargs);
#ifdef __cplusplus
}
#endif
static std::once_flag ffmpegKitInitializerFlag; static std::once_flag ffmpegKitInitializerFlag;
void* ffmpegKitInitialize(); void* ffmpegKitInitialize();
@ -391,12 +403,16 @@ static void removeSession(long sessionId) {
std::atomic_store(&sessionMap[sessionId % SESSION_MAP_SIZE], 0); std::atomic_store(&sessionMap[sessionId % SESSION_MAP_SIZE], 0);
} }
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* Adds a cancel session request to the session map. * Adds a cancel session request to the session map.
* *
* @param sessionId session id * @param sessionId session id
*/ */
static void cancelSession(long sessionId) { void cancelSession(long sessionId) {
std::atomic_store(&sessionMap[sessionId % SESSION_MAP_SIZE], 2); std::atomic_store(&sessionMap[sessionId % SESSION_MAP_SIZE], 2);
} }
@ -406,7 +422,7 @@ static void cancelSession(long sessionId) {
* @param sessionId session id * @param sessionId session id
* @return 1 if exists, false otherwise * @return 1 if exists, false otherwise
*/ */
static int cancelRequested(long sessionId) { int cancelRequested(long sessionId) {
if (std::atomic_load(&sessionMap[sessionId % SESSION_MAP_SIZE]) == 2) { if (std::atomic_load(&sessionMap[sessionId % SESSION_MAP_SIZE]) == 2) {
return 1; return 1;
} else { } else {
@ -414,6 +430,10 @@ static int cancelRequested(long sessionId) {
} }
} }
#ifdef __cplusplus
}
#endif
/** /**
* Resets the number of messages in transmit for this session. * Resets the number of messages in transmit for this session.
* *
@ -1182,6 +1202,8 @@ std::shared_ptr<ffmpegkit::Session> ffmpegkit::FFmpegKitConfig::getLastCompleted
return session; return session;
} }
} }
return nullptr;
} }
std::shared_ptr<std::list<std::shared_ptr<ffmpegkit::Session>>> ffmpegkit::FFmpegKitConfig::getSessions() { std::shared_ptr<std::list<std::shared_ptr<ffmpegkit::Session>>> ffmpegkit::FFmpegKitConfig::getSessions() {

@ -182,23 +182,6 @@ is_apple_architecture_variant_supported() {
echo "${SUPPORTED}" echo "${SUPPORTED}"
} }
#
# 1. folder path
#
initialize_folder() {
rm -rf "$1" 1>>"${BASEDIR}"/build.log 2>&1
if [[ $? -ne 0 ]]; then
return 1
fi
mkdir -p "$1" 1>>"${BASEDIR}"/build.log 2>&1
if [[ $? -ne 0 ]]; then
return 1
fi
return 0
}
# #
# 1. architecture variant # 1. architecture variant
# #

@ -9,7 +9,7 @@ enable_default_linux_architectures() {
} }
get_ffmpeg_kit_version() { 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') local FFMPEG_KIT_VERSION=$(grep -Eo 'FFmpegKitVersion = .*' "${BASEDIR}/linux/src/FFmpegKitConfig.h" 2>>"${BASEDIR}"/build.log | grep -Eo ' \".*' | tr -d '"; ')
echo "${FFMPEG_KIT_VERSION}" echo "${FFMPEG_KIT_VERSION}"
} }
@ -90,6 +90,72 @@ enable_lts_build() {
export FFMPEG_KIT_LTS_BUILD="1" export FFMPEG_KIT_LTS_BUILD="1"
} }
install_pkg_config_file() {
local FILE_NAME="$1"
local SOURCE="${INSTALL_PKG_CONFIG_DIR}/${FILE_NAME}"
local DESTINATION="${FFMPEG_KIT_BUNDLE_PKG_CONFIG_DIRECTORY}/${FILE_NAME}"
# DELETE OLD FILE
rm -f "$DESTINATION" 2>>"${BASEDIR}"/build.log
if [[ $? -ne 0 ]]; then
echo -e "failed\n\nSee build.log for details\n"
exit 1
fi
# INSTALL THE NEW FILE
cp "$SOURCE" "$DESTINATION" 2>>"${BASEDIR}"/build.log
if [[ $? -ne 0 ]]; then
echo -e "failed\n\nSee build.log for details\n"
exit 1
fi
# UPDATE PATHS
${SED_INLINE} "s|${LIB_INSTALL_BASE}/ffmpeg-kit|${BASEDIR}/prebuilt/$(get_bundle_directory)/ffmpeg-kit|g" "$DESTINATION" 1>>"${BASEDIR}"/build.log 2>&1 || return 1
${SED_INLINE} "s|${LIB_INSTALL_BASE}/ffmpeg|${BASEDIR}/prebuilt/$(get_bundle_directory)/ffmpeg-kit|g" "$DESTINATION" 1>>"${BASEDIR}"/build.log 2>&1 || return 1
}
get_bundle_directory() {
local LTS_POSTFIX=""
if [[ -n ${FFMPEG_KIT_LTS_BUILD} ]]; then
LTS_POSTFIX="-lts"
fi
echo "bundle-linux${LTS_POSTFIX}"
}
create_linux_bundle() {
set_toolchain_paths ""
local FFMPEG_KIT_VERSION=$(get_ffmpeg_kit_version)
local FFMPEG_KIT_BUNDLE_DIRECTORY="${BASEDIR}/prebuilt/$(get_bundle_directory)/ffmpeg-kit"
local FFMPEG_KIT_BUNDLE_INCLUDE_DIRECTORY="${BASEDIR}/prebuilt/$(get_bundle_directory)/ffmpeg-kit/include"
local FFMPEG_KIT_BUNDLE_LIB_DIRECTORY="${BASEDIR}/prebuilt/$(get_bundle_directory)/ffmpeg-kit/lib"
local FFMPEG_KIT_BUNDLE_PKG_CONFIG_DIRECTORY="${BASEDIR}/prebuilt/$(get_bundle_directory)/ffmpeg-kit/pkgconfig"
initialize_folder "${FFMPEG_KIT_BUNDLE_INCLUDE_DIRECTORY}"
initialize_folder "${FFMPEG_KIT_BUNDLE_LIB_DIRECTORY}"
initialize_folder "${FFMPEG_KIT_BUNDLE_PKG_CONFIG_DIRECTORY}"
# COPY HEADERS
cp -r -P "${LIB_INSTALL_BASE}"/ffmpeg-kit/include/* "${BASEDIR}/prebuilt/$(get_bundle_directory)/ffmpeg-kit/include" 2>>"${BASEDIR}"/build.log
cp -r -P "${LIB_INSTALL_BASE}"/ffmpeg/include/* "${BASEDIR}/prebuilt/$(get_bundle_directory)/ffmpeg-kit/include" 2>>"${BASEDIR}"/build.log
cp -r -P ${FFMPEG_KIT_TMPDIR}/source/rapidjson/include/rapidjson "${BASEDIR}/prebuilt/$(get_bundle_directory)/ffmpeg-kit/include" 2>>"${BASEDIR}"/build.log
# COPY LIBS
cp -P "${LIB_INSTALL_BASE}"/ffmpeg-kit/lib/* "${BASEDIR}/prebuilt/$(get_bundle_directory)/ffmpeg-kit/lib" 2>>"${BASEDIR}"/build.log
cp -P "${LIB_INSTALL_BASE}"/ffmpeg/lib/* "${BASEDIR}/prebuilt/$(get_bundle_directory)/ffmpeg-kit/lib" 2>>"${BASEDIR}"/build.log
install_pkg_config_file "libavformat.pc"
install_pkg_config_file "libswresample.pc"
install_pkg_config_file "libswscale.pc"
install_pkg_config_file "libavdevice.pc"
install_pkg_config_file "libavfilter.pc"
install_pkg_config_file "libavcodec.pc"
install_pkg_config_file "libavutil.pc"
install_pkg_config_file "ffmpeg-kit.pc"
}
get_cmake_system_processor() { get_cmake_system_processor() {
case ${ARCH} in case ${ARCH} in
x86-64) x86-64)
@ -309,6 +375,25 @@ prefix = '${LIB_INSTALL_PREFIX}'
EOF EOF
} }
create_ffmpegkit_package_config() {
local FFMPEGKIT_VERSION="$1"
cat >"${INSTALL_PKG_CONFIG_DIR}/ffmpeg-kit.pc" <<EOF
prefix=${LIB_INSTALL_BASE}/ffmpeg-kit
exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib
includedir=\${prefix}/include
Name: ffmpeg-kit
Description: FFmpeg for applications
Version: ${FFMPEGKIT_VERSION}
Libs: -L\${libdir} -lstdc++ -lffmpegkit -lavutil
Requires: libavfilter, libswscale, libavformat, libavcodec, libswresample, libavutil
Cflags: -I\${includedir}
EOF
}
create_libaom_package_config() { create_libaom_package_config() {
local AOM_VERSION="$1" local AOM_VERSION="$1"

@ -2384,8 +2384,8 @@ to_capital_case() {
# 2. destination file # 2. destination file
# #
overwrite_file() { overwrite_file() {
rm -f "$2" rm -f "$2" 2>>"${BASEDIR}"/build.log
cp "$1" "$2" cp "$1" "$2" 2>>"${BASEDIR}"/build.log
} }
# #
@ -2438,3 +2438,20 @@ command_exists() {
echo 1 echo 1
fi fi
} }
#
# 1. folder path
#
initialize_folder() {
rm -rf "$1" 1>>"${BASEDIR}"/build.log 2>&1
if [[ $? -ne 0 ]]; then
return 1
fi
mkdir -p "$1" 1>>"${BASEDIR}"/build.log 2>&1
if [[ $? -ne 0 ]]; then
return 1
fi
return 0
}

@ -61,6 +61,9 @@ make -j$(get_cpu_count) 1>>"${BASEDIR}"/build.log 2>&1
make install 1>>"${BASEDIR}"/build.log 2>&1 make install 1>>"${BASEDIR}"/build.log 2>&1
# CREATE PACKAGE CONFIG MANUALLY
create_ffmpegkit_package_config "$(get_ffmpeg_kit_version)" || return 1
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "ok" echo "ok"
else else

@ -449,6 +449,15 @@ if [[ $? -ne 0 ]]; then
exit 1 exit 1
fi fi
# MANUALLY COPY PKG-CONFIG FILES
overwrite_file "${FFMPEG_LIBRARY_PATH}"/lib/pkgconfig/libavformat.pc "${INSTALL_PKG_CONFIG_DIR}/libavformat.pc" || return 1
overwrite_file "${FFMPEG_LIBRARY_PATH}"/lib/pkgconfig/libswresample.pc "${INSTALL_PKG_CONFIG_DIR}/libswresample.pc" || return 1
overwrite_file "${FFMPEG_LIBRARY_PATH}"/lib/pkgconfig/libswscale.pc "${INSTALL_PKG_CONFIG_DIR}/libswscale.pc" || return 1
overwrite_file "${FFMPEG_LIBRARY_PATH}"/lib/pkgconfig/libavdevice.pc "${INSTALL_PKG_CONFIG_DIR}/libavdevice.pc" || return 1
overwrite_file "${FFMPEG_LIBRARY_PATH}"/lib/pkgconfig/libavfilter.pc "${INSTALL_PKG_CONFIG_DIR}/libavfilter.pc" || return 1
overwrite_file "${FFMPEG_LIBRARY_PATH}"/lib/pkgconfig/libavcodec.pc "${INSTALL_PKG_CONFIG_DIR}/libavcodec.pc" || return 1
overwrite_file "${FFMPEG_LIBRARY_PATH}"/lib/pkgconfig/libavutil.pc "${INSTALL_PKG_CONFIG_DIR}/libavutil.pc" || return 1
# MANUALLY ADD REQUIRED HEADERS # 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/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/arm 1>>"${BASEDIR}"/build.log 2>&1

Loading…
Cancel
Save