Skip to content

Commit

Permalink
drop hard-coded lts release specific rules in build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
tanersener committed Nov 18, 2024
1 parent 3a752ba commit 8fdb367
Show file tree
Hide file tree
Showing 38 changed files with 285 additions and 544 deletions.
18 changes: 9 additions & 9 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ Steps to reproduce the behaviour.
If applicable, add screenshots to help explain your problem.

**Logs**
Post logs here or paste them to [Ghostbin](https://ghostbin.co) and insert the link here.
Post logs here or paste them to [Ghostbin](https://ghostbin.site) and insert the link here.

**Environment**

- Platform: `Android`/`Flutter`/`iOS`/`Linux`/`macOS`/`ReactNative`/`tvOS`
- Architecture: `arm-v7a`, `arm-v7a-neon`, `arm64-v8a`, `x86`, `x86_64`, `armv7`, `armv7s`, `arm64`, `arm64-mac-catalyst`, `arm64-simulator`, `arm64e`, `i386`, `x86-64`, `x86-64-mac-catalyst`
- Version: `v5.1`/`v5.1.LTS`
- Source branch: `main`, `development`
- Xcode version: `13.4.1`
- Cocoapods version: `1.10.3`
- Android Studio version: `4.0`
- Android NDK version: `r25b`
- flutter doctor: ` `
- react-native info: ` `
- Version: ``
- Source branch: ``
- Xcode version: ``
- Cocoapods version: ``
- Android Studio version: ``
- Android NDK version: ``
- flutter doctor: ``
- react-native info: ``

**Other**
Add any other context about the problem here.
12 changes: 6 additions & 6 deletions .github/workflows/android-build-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ jobs:
- name: print ffbuild logs
if: ${{ failure() }}
run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log'
build-lts-on-linux:
name: android lts on linux
build-api-16-on-linux:
name: android api 16 on linux
runs-on: ubuntu-22.04
strategy:
matrix:
Expand All @@ -80,7 +80,7 @@ jobs:
unzip -q -o ndk.zip -d .ndk
echo "ANDROID_NDK_ROOT=$PWD/.ndk/$(ls .ndk)" >> $GITHUB_ENV
- name: run the build script
run: ./android.sh -d --lts --enable-android-media-codec --enable-android-zlib
run: ./android.sh -d --api-level=16 --enable-android-media-codec --enable-android-zlib
- name: print build logs
if: ${{ always() }}
run: cat build.log
Expand Down Expand Up @@ -116,8 +116,8 @@ jobs:
- name: print ffbuild logs
if: ${{ failure() }}
run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log'
build-lts-on-macos:
name: android lts on macos
build-api-16-on-macos:
name: android api 16 on macos
runs-on: macos-12
strategy:
matrix:
Expand All @@ -138,7 +138,7 @@ jobs:
unzip -q -o ndk.zip -d .ndk
echo "ANDROID_NDK_ROOT=$PWD/.ndk/$(ls .ndk)" >> $GITHUB_ENV
- name: run the build script
run: ./android.sh -d --lts --enable-android-media-codec --enable-android-zlib
run: ./android.sh -d --api-level=16 --enable-android-media-codec --enable-android-zlib
- name: print build logs
if: ${{ always() }}
run: cat build.log
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ios-build-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ jobs:
- name: print ffbuild logs
if: ${{ failure() }}
run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log'
build-lts-on-macos-monterey:
name: ios lts on monterey
build-min-sdk-10-on-macos-monterey:
name: ios min sdk 10 on monterey
runs-on: macos-12
strategy:
matrix:
Expand All @@ -89,7 +89,7 @@ jobs:
- name: set up xcode
run: echo "export DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer" > ~/.xcode.for.ffmpeg.kit.sh
- name: run the build script
run: ./ios.sh --lts --enable-ios-audiotoolbox --enable-ios-bzip2 --enable-ios-libiconv --enable-ios-zlib
run: ./ios.sh --target=10 --enable-ios-audiotoolbox --enable-ios-bzip2 --enable-ios-libiconv --enable-ios-zlib
- name: print build logs
if: ${{ always() }}
run: cat build.log
Expand Down
36 changes: 0 additions & 36 deletions .github/workflows/linux-build-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,6 @@ jobs:
- name: print ffbuild logs
if: ${{ failure() }}
run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log'
build-lts-on-ubuntu-2204:
name: linux lts on ubuntu 22.04
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: prerequisites
run: sudo apt-get install clang llvm lld libclang-14-dev libstdc++6 nasm autoconf automake libtool pkg-config curl git doxygen rapidjson-dev
- name: run the build script
run: ./linux.sh -d --lts
- name: print build logs
if: ${{ always() }}
run: cat build.log
- name: print ffbuild logs
if: ${{ failure() }}
run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log'
build-main-on-ubuntu-2004:
name: linux main on ubuntu-20.04
runs-on: ubuntu-20.04
Expand All @@ -77,21 +59,3 @@ jobs:
- name: print ffbuild logs
if: ${{ failure() }}
run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log'
build-lts-on-ubuntu-2004:
name: linux lts on ubuntu 20.04
runs-on: ubuntu-20.04
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: prerequisites
run: sudo apt-get install clang llvm lld libclang-11-dev libstdc++6 nasm autoconf automake libtool pkg-config curl git doxygen rapidjson-dev
- name: run the build script
run: ./linux.sh -d --lts
- name: print build logs
if: ${{ always() }}
run: cat build.log
- name: print ffbuild logs
if: ${{ failure() }}
run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log'
6 changes: 3 additions & 3 deletions .github/workflows/macos-build-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ jobs:
- name: print ffbuild logs
if: ${{ failure() }}
run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log'
build-lts-on-macos-monterey:
name: macos lts on monterey
build-min-sdk-1012-on-macos-monterey:
name: macos min sdk 10.12 on monterey
runs-on: macos-12
strategy:
matrix:
Expand All @@ -89,7 +89,7 @@ jobs:
- name: set up xcode
run: echo "export DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer" > ~/.xcode.for.ffmpeg.kit.sh
- name: run the build script
run: ./macos.sh --lts --enable-macos-audiotoolbox --enable-macos-bzip2 --enable-macos-coreimage --enable-macos-libiconv --enable-macos-opencl --enable-macos-opengl --enable-macos-videotoolbox --enable-macos-zlib
run: ./macos.sh --target=10.12 --enable-macos-audiotoolbox --enable-macos-bzip2 --enable-macos-coreimage --enable-macos-libiconv --enable-macos-opencl --enable-macos-opengl --enable-macos-videotoolbox --enable-macos-zlib
- name: print build logs
if: ${{ always() }}
run: cat build.log
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/periodic-builds-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ jobs:
- name: print ffbuild logs
if: ${{ failure() }}
run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log'
build-android-lts-on-linux:
name: android lts on linux
build-android-api-16-on-linux:
name: android api 16 on linux
runs-on: ubuntu-22.04
strategy:
matrix:
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
unzip -q -o ndk.zip -d .ndk
echo "ANDROID_NDK_ROOT=$PWD/.ndk/$(ls .ndk)" >> $GITHUB_ENV
- name: run the build script
run: ./android.sh -l --full --enable-gpl --disable-lib-srt
run: ./android.sh --api-level=16 --full --enable-gpl --disable-lib-srt
- name: print build logs
if: ${{ always() }}
run: cat build.log
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/periodic-builds-apple.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ jobs:
- name: print ffbuild logs
if: ${{ failure() }}
run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log'
build-ios-lts-on-macos-monterey:
name: ios lts on monterey
build-ios-min-sdk-10-on-macos-monterey:
name: ios min sdk 10 on monterey
runs-on: macos-12
strategy:
matrix:
Expand All @@ -50,7 +50,7 @@ jobs:
- name: set up xcode
run: echo "export DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer" > ~/.xcode.for.ffmpeg.kit.sh
- name: run the build script
run: PATH="/usr/local/opt/bison/bin:$PATH" XML_CATALOG_FILES="/usr/local/etc/xml/catalog" ./ios.sh -l --full --enable-gpl --disable-lib-srt --disable-lib-gnutls --disable-armv7s --disable-arm64e --disable-i386
run: PATH="/usr/local/opt/bison/bin:$PATH" XML_CATALOG_FILES="/usr/local/etc/xml/catalog" ./ios.sh --target=10 --full --enable-gpl --disable-lib-srt --disable-lib-gnutls --disable-armv7s --disable-arm64e --disable-i386
- name: print build logs
if: ${{ always() }}
run: cat build.log
Expand Down Expand Up @@ -83,8 +83,8 @@ jobs:
- name: print ffbuild logs
if: ${{ failure() }}
run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log'
build-macos-lts-on-macos-monterey:
name: macos lts on monterey
build-macos-min-sdk-1012-on-macos-monterey:
name: macos min sdk 10.12 on monterey
runs-on: macos-12
strategy:
matrix:
Expand All @@ -102,7 +102,7 @@ jobs:
- name: set up xcode
run: echo "export DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer" > ~/.xcode.for.ffmpeg.kit.sh
- name: run the build script
run: PATH="/usr/local/opt/bison/bin:$PATH" XML_CATALOG_FILES="/usr/local/etc/xml/catalog" ./macos.sh -l --full --enable-gpl --disable-lib-srt --disable-lib-gnutls
run: PATH="/usr/local/opt/bison/bin:$PATH" XML_CATALOG_FILES="/usr/local/etc/xml/catalog" ./macos.sh --target=10.12 --full --enable-gpl --disable-lib-srt --disable-lib-gnutls
- name: print build logs
if: ${{ always() }}
run: cat build.log
Expand Down Expand Up @@ -135,8 +135,8 @@ jobs:
- name: print ffbuild logs
if: ${{ failure() }}
run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log'
build-tvos-lts-on-macos-monterey:
name: tvos lts on monterey
build-tvos-min-sdk-100-on-macos-monterey:
name: tvos min sdk 10.0 on monterey
runs-on: macos-12
strategy:
matrix:
Expand All @@ -154,7 +154,7 @@ jobs:
- name: set up xcode
run: echo "export DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer" > ~/.xcode.for.ffmpeg.kit.sh
- name: run the build script
run: PATH="/usr/local/opt/bison/bin:$PATH" XML_CATALOG_FILES="/usr/local/etc/xml/catalog" ./tvos.sh -l --full --enable-gpl --disable-lib-srt --disable-lib-gnutls
run: PATH="/usr/local/opt/bison/bin:$PATH" XML_CATALOG_FILES="/usr/local/etc/xml/catalog" ./tvos.sh --target=10.0 --full --enable-gpl --disable-lib-srt --disable-lib-gnutls
- name: print build logs
if: ${{ always() }}
run: cat build.log
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tvos-build-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ jobs:
- name: print ffbuild logs
if: ${{ failure() }}
run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log'
build-lts-on-macos-monterey:
name: tvos lts on monterey
build-min-sdk-100-on-macos-monterey:
name: tvos min sdk 10.0 on monterey
runs-on: macos-12
strategy:
matrix:
Expand All @@ -89,7 +89,7 @@ jobs:
- name: set up xcode
run: echo "export DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer" > ~/.xcode.for.ffmpeg.kit.sh
- name: run the build script
run: ./tvos.sh --lts --enable-tvos-bzip2 --enable-tvos-audiotoolbox --enable-tvos-libiconv --enable-tvos-zlib
run: ./tvos.sh --target=10.0 --enable-tvos-bzip2 --enable-tvos-audiotoolbox --enable-tvos-libiconv --enable-tvos-zlib
- name: print build logs
if: ${{ always() }}
run: cat build.log
Expand Down
29 changes: 10 additions & 19 deletions android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ source "${BASEDIR}"/scripts/variable.sh
source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh
disabled_libraries=()

# SET DEFAULTS SETTINGS
# SET DEFAULT SETTINGS
enable_default_android_architectures
enable_default_android_libraries
enable_main_build
Expand All @@ -34,18 +34,6 @@ BUILD_FULL=""
BUILD_TYPE_ID=""
BUILD_VERSION=$(git describe --tags --always 2>>"${BASEDIR}"/build.log)

# PROCESS LTS BUILD OPTION FIRST AND SET BUILD TYPE: MAIN OR LTS
rm -f "${BASEDIR}"/android/ffmpeg-kit-android-lib/build.gradle 1>>"${BASEDIR}"/build.log 2>&1
cp "${BASEDIR}"/tools/android/build.gradle "${BASEDIR}"/android/ffmpeg-kit-android-lib/build.gradle 1>>"${BASEDIR}"/build.log 2>&1
for argument in "$@"; do
if [[ "$argument" == "-l" ]] || [[ "$argument" == "--lts" ]]; then
enable_lts_build
BUILD_TYPE_ID+="LTS "
rm -f "${BASEDIR}"/android/ffmpeg-kit-android-lib/build.gradle 1>>"${BASEDIR}"/build.log 2>&1
cp "${BASEDIR}"/tools/android/build.lts.gradle "${BASEDIR}"/android/ffmpeg-kit-android-lib/build.gradle 1>>"${BASEDIR}"/build.log 2>&1
fi
done

# PROCESS BUILD OPTIONS
while [ ! $# -eq 0 ]; do

Expand Down Expand Up @@ -82,7 +70,6 @@ while [ ! $# -eq 0 ]; do
-s | --speed)
optimize_for_speed
;;
-l | --lts) ;;
-f | --force)
export BUILD_FORCE="1"
;;
Expand Down Expand Up @@ -209,7 +196,7 @@ if [[ -n ${DISPLAY_HELP} ]]; then
fi

# SET API LEVEL IN build.gradle
${SED_INLINE} "s/minSdkVersion .*/minSdkVersion ${API}/g" "${BASEDIR}"/android/ffmpeg-kit-android-lib/build.gradle 1>>"${BASEDIR}"/build.log 2>&1
${SED_INLINE} "s/minSdk .*/minSdk ${API}/g" "${BASEDIR}"/android/ffmpeg-kit-android-lib/build.gradle 1>>"${BASEDIR}"/build.log 2>&1
${SED_INLINE} "s/versionCode ..0/versionCode ${API}0/g" "${BASEDIR}"/android/ffmpeg-kit-android-lib/build.gradle 1>>"${BASEDIR}"/build.log 2>&1

echo -e "\nBuilding ffmpeg-kit ${BUILD_TYPE_ID}library for Android\n"
Expand Down Expand Up @@ -305,11 +292,15 @@ fi
if [[ ${ENABLED_ARCHITECTURES[ARCH_X86_64]} -eq 1 ]]; then
ANDROID_ARCHITECTURES+="$(get_android_arch 4) "
fi
if [[ ! -z ${FFMPEG_KIT_LTS_BUILD} ]]; then
mkdir -p "${BASEDIR}"/android/build 1>>"${BASEDIR}"/build.log 2>&1
append_file "${BASEDIR}"/android/jni/build.mk "LTS_POSTFIX := -lts"
append_file "${BASEDIR}"/android/jni/build.mk "ARMV7_BUILD_PATH := android-arm-${API}"
append_file "${BASEDIR}"/android/jni/build.mk "ARMV7_NEON_BUILD_PATH := android-arm-neon-${API}"
append_file "${BASEDIR}"/android/jni/build.mk "X86_BUILD_PATH := android-x86-${API}"
if [[ $(compare_versions "$API" "21") -lt 0 ]]; then
append_file "${BASEDIR}"/android/jni/build.mk "ARM64_BUILD_PATH := android-arm64-21"
append_file "${BASEDIR}"/android/jni/build.mk "X86_64_BUILD_PATH := android-x86_64-21"
else
append_file "${BASEDIR}"/android/jni/build.mk "LTS_POSTFIX := "
append_file "${BASEDIR}"/android/jni/build.mk "ARM64_BUILD_PATH := android-arm64-${API}"
append_file "${BASEDIR}"/android/jni/build.mk "X86_64_BUILD_PATH := android-x86_64-${API}"
fi

# BUILD FFMPEG-KIT
Expand Down
1 change: 0 additions & 1 deletion android/ffmpeg-kit-android-lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ android {
namespace 'com.arthenica.ffmpegkit'
}
compileSdk 34
ndkVersion "25.2.9519653"

defaultConfig {
minSdk 24
Expand Down
7 changes: 6 additions & 1 deletion android/ffmpeg-kit-android-lib/src/main/cpp/ffmpegkit.c
Original file line number Diff line number Diff line change
Expand Up @@ -902,8 +902,13 @@ Java_com_arthenica_ffmpegkit_FFmpegKitConfig_getNativeVersion(JNIEnv *env,
JNIEXPORT jstring JNICALL
Java_com_arthenica_ffmpegkit_FFmpegKitConfig_getNativePackageName(
JNIEnv *env, jclass object) {

#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
#define FFMPEG_KIT_PACKAGE_STR TOSTRING(FFMPEG_KIT_PACKAGE)

#ifdef FFMPEG_KIT_PACKAGE
return (*env)->NewStringUTF(env, FFMPEG_KIT_PACKAGE);
return (*env)->NewStringUTF(env, FFMPEG_KIT_PACKAGE_STR);
#else
return (*env)->NewStringUTF(env, "");
#endif
Expand Down
28 changes: 26 additions & 2 deletions android/ffmpeg-kit-android-lib/src/main/cpp/ffmpegkit_abidetect.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ JNINativeMethod abiDetectMethods[] = {
{"isNativeLTSBuild", "()Z",
(void *)Java_com_arthenica_ffmpegkit_AbiDetect_isNativeLTSBuild},
{"getNativeBuildConf", "()Ljava/lang/String;",
(void *)Java_com_arthenica_ffmpegkit_AbiDetect_getNativeBuildConf}};
(void *)Java_com_arthenica_ffmpegkit_AbiDetect_getNativeBuildConf},
{"getNativeMinSdk", "()Ljava/lang/String;",
(void *)Java_com_arthenica_ffmpegkit_AbiDetect_getNativeMinSdk}};

/**
* Called when 'abidetect' native library is loaded.
Expand All @@ -55,7 +57,7 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved) {
return JNI_FALSE;
}

if ((*env)->RegisterNatives(env, abiDetectClass, abiDetectMethods, 4) < 0) {
if ((*env)->RegisterNatives(env, abiDetectClass, abiDetectMethods, 5) < 0) {
LOGE("OnLoad failed to RegisterNatives for class %s.\n",
abiDetectClassName);
return JNI_FALSE;
Expand Down Expand Up @@ -152,3 +154,25 @@ Java_com_arthenica_ffmpegkit_AbiDetect_getNativeBuildConf(JNIEnv *env,
jclass object) {
return (*env)->NewStringUTF(env, FFMPEG_CONFIGURATION);
}

/**
* Returns the minimum Android API level required to run this native library.
*
* @param env pointer to native method interface
* @param object reference to the class on which this method is invoked
* @return the minimum Android API level required to run this native library
*/
JNIEXPORT jstring JNICALL
Java_com_arthenica_ffmpegkit_AbiDetect_getNativeMinSdk(
JNIEnv *env, jclass object) {

#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
#define FFMPEG_KIT_MIN_SDK_STR TOSTRING(FFMPEG_KIT_MIN_SDK)

#ifdef FFMPEG_KIT_MIN_SDK
return (*env)->NewStringUTF(env, FFMPEG_KIT_MIN_SDK_STR);
#else
return (*env)->NewStringUTF(env, "");
#endif
}
Loading

0 comments on commit 8fdb367

Please sign in to comment.