From dfc19f2052f4e8217253ff74acccac5e6ca20b77 Mon Sep 17 00:00:00 2001 From: NORALDM Date: Mon, 26 May 2025 17:25:44 +0000 Subject: [PATCH 1/4] addpkg(main/libskiasharp): 3.116.1.20241024 --- .../libskiasharp/DEPS-speed-up-build.patch | 53 +++++++++ .../SkDebugf-do-not-use-system-log.patch | 35 ++++++ packages/libskiasharp/build.sh | 109 ++++++++++++++++++ packages/libskiasharp/fix-gn-build.patch | 35 ++++++ .../src_codec_SkJpegCodec.cpp.patch | 58 ++++++++++ 5 files changed, 290 insertions(+) create mode 100644 packages/libskiasharp/DEPS-speed-up-build.patch create mode 100644 packages/libskiasharp/SkDebugf-do-not-use-system-log.patch create mode 100644 packages/libskiasharp/build.sh create mode 100644 packages/libskiasharp/fix-gn-build.patch create mode 100644 packages/libskiasharp/src_codec_SkJpegCodec.cpp.patch diff --git a/packages/libskiasharp/DEPS-speed-up-build.patch b/packages/libskiasharp/DEPS-speed-up-build.patch new file mode 100644 index 00000000000..016735b4c7b --- /dev/null +++ b/packages/libskiasharp/DEPS-speed-up-build.patch @@ -0,0 +1,53 @@ +--- a/DEPS ++++ b/DEPS +@@ -19,50 +19,16 @@ vars = { + # ./tools/git-sync-deps + deps = { +- "buildtools" : "https://chromium.googlesource.com/chromium/src/buildtools.git@b138e6ce86ae843c42a1a08f37903207bebcca75", +- "third_party/externals/angle2" : "https://chromium.googlesource.com/angle/angle.git@84379a5294073b0f702fa0bbe909c93805cc870a", +- "third_party/externals/brotli" : "https://skia.googlesource.com/external/github.com/google/brotli.git@6d03dfbedda1615c4cba1211f8d81735575209c8", +- "third_party/externals/d3d12allocator" : "https://skia.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator.git@169895d529dfce00390a20e69c2f516066fe7a3b", + # Dawn requires jinja2 and markupsafe for the code generator, tint for SPIRV compilation, and abseil for string formatting. + # When the Dawn revision is updated these should be updated from the Dawn DEPS as well. + # "third_party/externals/dawn" : "https://dawn.googlesource.com/dawn.git@0d5e76a2427f1c629a0d709ee0833da43bf79e84", + # "third_party/externals/jinja2" : "https://chromium.googlesource.com/chromium/src/third_party/jinja2@ee69aa00ee8536f61db6a451f3858745cf587de6", +- "third_party/externals/markupsafe" : "https://chromium.googlesource.com/chromium/src/third_party/markupsafe@0944e71f4b2cb9a871bcbe353f95e889b64a611a", +- "third_party/externals/abseil-cpp" : "https://skia.googlesource.com/external/github.com/abseil/abseil-cpp.git@cb436cf0142b4cbe47aae94223443df7f82e2920", +- "third_party/externals/dng_sdk" : "https://android.googlesource.com/platform/external/dng_sdk.git@c8d0c9b1d16bfda56f15165d39e0ffa360a11123", +- "third_party/externals/egl-registry" : "https://skia.googlesource.com/external/github.com/KhronosGroup/EGL-Registry@a0bca08de07c7d7651047bedc0b653cfaaa4f2ae", + # "third_party/externals/emsdk" : "https://skia.googlesource.com/external/github.com/emscripten-core/emsdk.git@4a48a752e6a8bef6f222622f2b4926d5eb3bdeb3", +- "third_party/externals/expat" : "https://chromium.googlesource.com/external/github.com/libexpat/libexpat.git@624da0f593bb8d7e146b9f42b06d8e6c80d032a3", +- "third_party/externals/freetype" : "https://chromium.googlesource.com/chromium/src/third_party/freetype2.git@d857bd535b6c7e877f262a9b61ed21ee11b35dab", + "third_party/externals/harfbuzz" : "https://github.com/harfbuzz/harfbuzz.git@894a1f72ee93a1fd8dc1d9218cb3fd8f048be29a", +- "third_party/externals/highway" : "https://chromium.googlesource.com/external/github.com/google/highway.git@424360251cdcfc314cfc528f53c872ecd63af0f0", +- "third_party/externals/icu" : "https://chromium.googlesource.com/chromium/deps/icu.git@a0718d4f121727e30b8d52c7a189ebf5ab52421f", +- "third_party/externals/imgui" : "https://skia.googlesource.com/external/github.com/ocornut/imgui.git@55d35d8387c15bf0cfd71861df67af8cfbda7456", +- "third_party/externals/libavif" : "https://github.com/AOMediaCodec/libavif.git@f49462dc93784bf34148715eee36ab6697ca0b35", +- "third_party/externals/libgav1" : "https://chromium.googlesource.com/codecs/libgav1.git@0fb779c1e169fe6c229cd1fa9cc6ea6feeb441da", +- "third_party/externals/libjpeg-turbo" : "https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git@9b894306ec3b28cea46e84c32b56773a98c483da", +- "third_party/externals/libjxl" : "https://chromium.googlesource.com/external/gitlab.com/wg1/jpeg-xl.git@a205468bc5d3a353fb15dae2398a101dff52f2d3", +- "third_party/externals/libpng" : "https://skia.googlesource.com/third_party/libpng.git@f135775ad4e5d4408d2e12ffcc71bb36e6b48551", +- "third_party/externals/libwebp" : "https://github.com/webmproject/libwebp.git@ca332209cb5567c9b249c86788cb2dbf8847e760", +- "third_party/externals/libyuv" : "https://chromium.googlesource.com/libyuv/libyuv.git@d248929c059ff7629a85333699717d7a677d8d96", +- "third_party/externals/microhttpd" : "https://android.googlesource.com/platform/external/libmicrohttpd@748945ec6f1c67b7efc934ab0808e1d32f2fb98d", +- "third_party/externals/oboe" : "https://chromium.googlesource.com/external/github.com/google/oboe.git@b02a12d1dd821118763debec6b83d00a8a0ee419", +- "third_party/externals/opengl-registry" : "https://skia.googlesource.com/external/github.com/KhronosGroup/OpenGL-Registry@14b80ebeab022b2c78f84a573f01028c96075553", + # "third_party/externals/perfetto" : "https://android.googlesource.com/platform/external/perfetto@93885509be1c9240bc55fa515ceb34811e54a394", +- "third_party/externals/piex" : "https://android.googlesource.com/platform/external/piex.git@bb217acdca1cc0c16b704669dd6f91a1b509c406", +- "third_party/externals/sfntly" : "https://chromium.googlesource.com/external/github.com/googlei18n/sfntly.git@b55ff303ea2f9e26702b514cf6a3196a2e3e2974", + # "third_party/externals/swiftshader" : "https://swiftshader.googlesource.com/SwiftShader@ae667fe96db9b7f76edea242015d61f293c7210e", +- "third_party/externals/vulkanmemoryallocator" : "https://chromium.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator@7de5cc00de50e71a3aab22dea52fbb7ff4efceb6", + # vulkan-deps is a meta-repo containing several interdependent Khronos Vulkan repositories. + # When the vulkan-deps revision is updated, those repos (spirv-*, vulkan-*) should be updated as well. +- "third_party/externals/vulkan-deps" : "https://chromium.googlesource.com/vulkan-deps@90577eb35eea01011e237747e92ee1fbe199d4c3", +- "third_party/externals/spirv-cross" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/SPIRV-Cross@2d3a152081ca6e6bea7093940d0f81088fe4d01c", +- "third_party/externals/spirv-headers" : "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Headers.git@6e09e44cd88a5297433411b2ee52f4cf9f50fa90", +- "third_party/externals/spirv-tools" : "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Tools.git@a63ac9f73d29cd27cdb6e3388d98d1d934e512bb", +- "third_party/externals/vello" : "https://skia.googlesource.com/external/github.com/linebender/vello.git@ef2630ad9c647b90863cb0915701d54725733968", +- "third_party/externals/vulkan-headers" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Headers@c1a8560c5cf5e7bd6dbc71fe69b1a317411c36b8", +- "third_party/externals/vulkan-tools" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Tools@ca8bb4ee3cc9afdeca4b49c5ef758bad7cce2c72", + #"third_party/externals/v8" : "https://chromium.googlesource.com/v8/v8.git@5f1ae66d5634e43563b2d25ea652dfb94c31a3b4", +- "third_party/externals/wuffs" : "https://skia.googlesource.com/external/github.com/google/wuffs-mirror-release-c.git@a0041ac0310b3156b963e2f2bea09245f25ec073", + "third_party/externals/zlib" : "https://chromium.googlesource.com/chromium/src/third_party/zlib@3ca9f16f02950edffa391ec19cea856090158e9e", + + 'bin': { diff --git a/packages/libskiasharp/SkDebugf-do-not-use-system-log.patch b/packages/libskiasharp/SkDebugf-do-not-use-system-log.patch new file mode 100644 index 00000000000..d976781630e --- /dev/null +++ b/packages/libskiasharp/SkDebugf-do-not-use-system-log.patch @@ -0,0 +1,35 @@ +--- a/src/ports/SkDebug_android.cpp ++++ b/src/ports/SkDebug_android.cpp +@@ -6,7 +6,7 @@ + */ + + #include "include/core/SkTypes.h" +-#if defined(SK_BUILD_FOR_ANDROID) ++#if defined(SK_BUILD_FOR_ANDROID) && !defined(__TERMUX__) + + #include + +@@ -36,4 +36,4 @@ void SkDebugf(const char format[], ...) { + va_end(args1); + } + +-#endif//defined(SK_BUILD_FOR_ANDROID) ++#endif//defined(SK_BUILD_FOR_ANDROID) && !defined(__TERMUX__) +--- a/src/ports/SkDebug_stdio.cpp ++++ b/src/ports/SkDebug_stdio.cpp +@@ -8,7 +8,8 @@ + #include "include/private/base/SkFeatures.h" + #include "include/private/base/SkLoadUserConfig.h" ++#include + +-#if !defined(SK_BUILD_FOR_WIN) && !defined(SK_BUILD_FOR_ANDROID) ++#if (!defined(SK_BUILD_FOR_WIN) && !defined(SK_BUILD_FOR_ANDROID)) || defined(__TERMUX__) + + #include + #include +@@ -22,4 +23,4 @@ void SkDebugf(const char format[], ...) { + #pragma GCC diagnostic pop + va_end(args); + } +-#endif//!defined(SK_BUILD_FOR_WIN) && !defined(SK_BUILD_FOR_ANDROID) ++#endif//(!defined(SK_BUILD_FOR_WIN) && !defined(SK_BUILD_FOR_ANDROID)) || defined(__TERMUX__) diff --git a/packages/libskiasharp/build.sh b/packages/libskiasharp/build.sh new file mode 100644 index 00000000000..f81a4b6a4d4 --- /dev/null +++ b/packages/libskiasharp/build.sh @@ -0,0 +1,109 @@ +TERMUX_PKG_HOMEPAGE="https://github.com/mono/SkiaSharp" +TERMUX_PKG_DESCRIPTION="SkiaSharp is a cross-platform 2D graphics API for .NET platforms" +TERMUX_PKG_LICENSE="BSD 3-Clause" +TERMUX_PKG_MAINTAINER="@termux" +_COMMIT=c16e913577083761d847146db7a04b8d3b3bf755 +_COMMIT_DATE=20241024 +TERMUX_PKG_VERSION="3.116.1.${_COMMIT_DATE}" +TERMUX_PKG_SRCURL="https://github.com/mono/skia/archive/${_COMMIT}.tar.gz" +TERMUX_PKG_SHA256=3fd17a42cca9a7dbde68ab016969b70ab7dd4833403ac1a192e1aa51aed4617b +TERMUX_PKG_DEPENDS="libc++, libexpat, libglvnd, libpng, libwebp, freetype, zlib, libjpeg-turbo" +TERMUX_PKG_EXCLUDED_ARCHES="arm" + +termux_step_make() { + termux_setup_gn + local _target_cpu="" + case "$TERMUX_ARCH" in + aarch64) _target_cpu="arm64" ;; +# arm) _target_cpu="arm" ;; + x86_64) _target_cpu="x64" ;; + i686) _target_cpu="x86" ;; + *) termux_error_exit "Unsupported arch: $TERMUX_ARCH" + esac + + pushd "$TERMUX_PKG_SRCDIR" + ./tools/git-sync-deps + + local LIBS_CFLAGS="$(pkg-config --cflags freetype2 libpng libwebp expat opengl egl)" + local LIBS_LDFLAGS="$(pkg-config --libs freetype2 libpng libwebp expat opengl egl)" + local _flag _GN_CFLAGS _GN_LDFLAGS _GN_CPPFLAGS _GN_LIBS + for _flag in CFLAGS LDFLAGS CPPFLAGS LIBS_CFLAGS LIBS_LDFLAGS; do + # converts xFLAGS into GN form + # For example: CFLAGS="-O3 -fno-vectorize" + # becomes _GN_CFLAGS='"-O3", "-fno-vectorize"' + declare _GN_"${_flag}"="$(eval printf '%s' "\"\$${_flag}\"" | awk '{for (i=1;idimensions().width(); + dinfo.image_height = this->dimensions().height(); + dinfo.global_state = fReadyState; + calc_output_dimensions(&dinfo, num, denom); ++ SkISize outputDimensions = SkISize::Make(dinfo.output_width, dinfo.output_height); ++ jpeg_destroy_decompress(&dinfo); + +- // Return the calculated output dimensions for the given scale +- return SkISize::Make(dinfo.output_width, dinfo.output_height); ++ return outputDimensions; + } + + bool SkJpegCodec::onRewind() { +@@ -534,9 +537,11 @@ bool SkJpegCodec::onDimensionsSupported(const SkISize& + const unsigned int dstHeight = size.height(); + + // Set up a fake decompress struct in order to use libjpeg to calculate output dimensions ++ // This isn't conventional use of libjpeg-turbo but initializing the decompress struct with ++ // jpeg_create_decompress allows for less violation of the API regardless of the version. + // FIXME: Why is this necessary? + jpeg_decompress_struct dinfo; +- sk_bzero(&dinfo, sizeof(dinfo)); ++ jpeg_create_decompress(&dinfo); + dinfo.image_width = this->dimensions().width(); + dinfo.image_height = this->dimensions().height(); + dinfo.global_state = fReadyState; +@@ -549,6 +554,7 @@ bool SkJpegCodec::onDimensionsSupported(const SkISize& + + // Return a failure if we have tried all of the possible scales + if (1 == num || dstWidth > dinfo.output_width || dstHeight > dinfo.output_height) { ++ jpeg_destroy_decompress(&dinfo); + return false; + } + +@@ -556,6 +562,7 @@ bool SkJpegCodec::onDimensionsSupported(const SkISize& + num -= 1; + calc_output_dimensions(&dinfo, num, denom); + } ++ jpeg_destroy_decompress(&dinfo); + + fDecoderMgr->dinfo()->scale_num = num; + fDecoderMgr->dinfo()->scale_denom = denom; From fd7aed86a0794d126156c3a9a57a80b668cb3096 Mon Sep 17 00:00:00 2001 From: NORALDM Date: Tue, 27 May 2025 06:20:53 +0000 Subject: [PATCH 2/4] addpkg(main/libesqlite3): 3.49.1.20250307 --- packages/libesqlite3/build.sh | 31 ++++++++++++++++++++++++++++ packages/libesqlite3/fixtmpdir.patch | 14 +++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 packages/libesqlite3/build.sh create mode 100644 packages/libesqlite3/fixtmpdir.patch diff --git a/packages/libesqlite3/build.sh b/packages/libesqlite3/build.sh new file mode 100644 index 00000000000..b45af979795 --- /dev/null +++ b/packages/libesqlite3/build.sh @@ -0,0 +1,31 @@ +TERMUX_PKG_HOMEPAGE="https://github.com/ericsink/SQLitePCL.raw" +TERMUX_PKG_DESCRIPTION="SQLitePCLRaw is a Portable Class Library for low-level access to SQLite (native library)" +TERMUX_PKG_LICENSE="Apache-2.0" +TERMUX_PKG_MAINTAINER="@termux" +_COMMIT="cd2922b8867e4360f0976601414bd24a3ad613d8" +_COMMIT_DATE="20250307" +TERMUX_PKG_VERSION="3.49.1.$_COMMIT_DATE" +TERMUX_PKG_SRCURL="https://github.com/ericsink/cb/archive/${_COMMIT}.tar.gz" +TERMUX_PKG_SHA256=4893433d7ff2e12e7ac35095a80710004f496fa4ec2527a3b188fad3d8a6f7e2 +TERMUX_PKG_EXCLUDED_ARCHES="arm" + +termux_step_make() { + termux_setup_dotnet + local _target_cpu="" + case "$TERMUX_ARCH" in + aarch64) _target_cpu="arm64" ;; + arm) _target_cpu="armhf" ;; + x86_64) _target_cpu="x64" ;; + i686) _target_cpu="x86" ;; + *) termux_error_exit "Unsupported arch: $TERMUX_ARCH" + esac + + printf "Building libe_sqlite3.so\n" + ( cd "${TERMUX_PKG_SRCDIR}/bld" && dotnet run && "$CC" $CFLAGS @linux_e_sqlite3_"${_target_cpu}".gccargs -lm -ldl ) + termux_dotnet_kill + cp "${TERMUX_PKG_SRCDIR}/bld/bin/e_sqlite3/linux/${_target_cpu}/libe_sqlite3.so" "$TERMUX_PKG_BUILDDIR" +} + +termux_step_make_install() { + install -Dm600 -t "${TERMUX_PREFIX}/lib" "${TERMUX_PKG_BUILDDIR}/libe_sqlite3.so" +} diff --git a/packages/libesqlite3/fixtmpdir.patch b/packages/libesqlite3/fixtmpdir.patch new file mode 100644 index 00000000000..e4224e2501b --- /dev/null +++ b/packages/libesqlite3/fixtmpdir.patch @@ -0,0 +1,14 @@ +index 37b534a..274c07b 100644 +--- a/sqlite3/sqlite3.c ++++ b/sqlite3/sqlite3.c +@@ -44558,9 +44558,7 @@ static int fillInUnixFile( + static const char *azTempDirs[] = { + 0, + 0, +- "/var/tmp", +- "/usr/tmp", +- "/tmp", ++ "@TERMUX_PREFIX@/tmp", + "." + }; + From 8bf0dc1de9e78c34d3e8b0dda9c4d275dc834e6c Mon Sep 17 00:00:00 2001 From: NORALDM Date: Thu, 4 Dec 2025 06:04:59 +0000 Subject: [PATCH 3/4] check --- scripts/utils/termux_reuse_pr_build_artifacts.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/scripts/utils/termux_reuse_pr_build_artifacts.sh b/scripts/utils/termux_reuse_pr_build_artifacts.sh index 3dc630618d7..7daa43b732d 100755 --- a/scripts/utils/termux_reuse_pr_build_artifacts.sh +++ b/scripts/utils/termux_reuse_pr_build_artifacts.sh @@ -38,7 +38,7 @@ ci_artifact_url() { curl --silent \ -H "Authorization: token ${GITHUB_TOKEN}" \ -H "Accept: application/vnd.github.v3+json" \ - "https://api.github.com/repos/termux/termux-packages/actions/runs/${1}/artifacts" \ + "https://api.github.com/repos/NORALDM/termux-packages/actions/runs/${1}/artifacts" \ | jq -r '[.artifacts[]? | select(.name | startswith("debs-'"${TARGET_ARCH}"'")) | .archive_download_url][0] // error' \ || return $? } @@ -92,7 +92,7 @@ readarray -t COMMITS < <(git rev-list --no-merges "$OLD_COMMIT..$HEAD_COMMIT" || # We should obtain data about all commits in this push to check that they are from the same PR if any RELATED_PRS_QUERY=" query { - repository(owner: \"termux\", name: \"termux-packages\") { + repository(owner: \"NORALDM\", name: \"termux-packages\") { $( for commit in "${COMMITS[@]}"; do # Add a query for this commit with the shorthash as the label @@ -124,7 +124,7 @@ readarray -t COMMITS < <(git rev-list --no-merges "$OLD_COMMIT..$HEAD_COMMIT" || .edges[0].node.body)' <<< "$RESPONSE" || :) [[ -n "${PR_HEAD_COMMIT:-}" ]] || infoexit "failed to read associated PR head commit, not performing CI fast path" - echo "::group::Detected PR #${PRS[0]}: ${PR_COMMIT_TITLE} — https://github.com/termux/termux-packages/pull/${PRS[0]}" + echo "::group::Detected PR #${PRS[0]}: ${PR_COMMIT_TITLE} — https://github.com/NORALDM/termux-packages/pull/${PRS[0]}" echo "${PR_COMMIT_BODY}" echo "::endgroup::" @@ -206,7 +206,7 @@ readarray -t COMMITS < <(git rev-list --no-merges "$OLD_COMMIT..$HEAD_COMMIT" || # The same commit can be used in more than one PR or even push WORKFLOW_PR_QUERY=" query { - repository(owner: \"termux\", name: \"termux-packages\") { + repository(owner: \"NORALDM\", name: \"termux-packages\") { object(oid: \"$PR_HEAD_COMMIT\") { ...workflowRun } } } @@ -228,7 +228,7 @@ readarray -t COMMITS < <(git rev-list --no-merges "$OLD_COMMIT..$HEAD_COMMIT" || | .workflowRun.databaseId][0] // empty' <<< "$RESPONSE" || : )" if [[ -n "${WORKFLOW_ID}" ]]; then - echo "We can safely reuse CI artifacts from https://github.com/termux/termux-packages/actions/runs/${WORKFLOW_ID}" + echo "We can safely reuse CI artifacts from https://github.com/NORALDM/termux-packages/actions/runs/${WORKFLOW_ID}" if download_ci_artifacts "${WORKFLOW_ID}"; then # Notify CI about skipping packages building because we reuse PR artifact. echo "skip-building=true" >> "${GITHUB_OUTPUT:-/dev/null}" @@ -253,7 +253,7 @@ readarray -t COMMITS < <(git rev-list --no-merges "$OLD_COMMIT..$HEAD_COMMIT" || # to allow CI reuse artifacts of other PRs in the case if current PR diverged from another PR branch. WORKFLOW_COMMITS_QUERY=" query { - repository(owner: \"termux\", name: \"termux-packages\") { + repository(owner: \"NORALDM\", name: \"termux-packages\") { $( for commit in "${COMMITS[@]}"; do # Add a query for this commit with the shorthash as the label @@ -281,11 +281,13 @@ readarray -t COMMITS < <(git rev-list --no-merges "$OLD_COMMIT..$HEAD_COMMIT" || .status == "COMPLETED" ) | .workflowRun.databaseId][0] // empty' <<< "$RESPONSE" )" + printf "%s\n" "${COMMITS[@]}" + printf "%s\n" "$RESPONSE" # No need to go on if we found a match. [[ -z "${WORKFLOW_ID:-}" ]] || break done if [[ -n "${WORKFLOW_ID}" ]]; then - echo "We can safely reuse CI artifacts from https://github.com/termux/termux-packages/actions/runs/${WORKFLOW_ID}" + echo "We can safely reuse CI artifacts from https://github.com/NORALDM/termux-packages/actions/runs/${WORKFLOW_ID}" echo "CI artifact URL is $(ci_artifact_url "${WORKFLOW_ID}" || infoexit "Failed to get CI artifact URL")" else echo "We can not reuse CI artifacts since no relevant CI runs were found" From 790a6b390d8708510242290d2f67fab1f460e924 Mon Sep 17 00:00:00 2001 From: NORALDM Date: Wed, 4 Jun 2025 20:51:29 +0000 Subject: [PATCH 4/4] addpkg(main/jellyfin-server): 10.11.4 --- packages/jellyfin-server/build.sh | 133 ++++++++++++++++++ .../jellyfin-server/ffmpeg-configure.patch | 16 +++ .../jellyfin-server/ffmpeg-configureopts.sh | 48 +++++++ .../ffmpeg-libavcodec-allcodecs.c.patch | 18 +++ .../ffmpeg-libavutil-file_open.c.patch | 20 +++ .../jellyfin-server/jellyfin-defaults.patch | 111 +++++++++++++++ .../jellyfin-ffmpeg.subpackage.sh | 4 + 7 files changed, 350 insertions(+) create mode 100644 packages/jellyfin-server/build.sh create mode 100644 packages/jellyfin-server/ffmpeg-configure.patch create mode 100755 packages/jellyfin-server/ffmpeg-configureopts.sh create mode 100644 packages/jellyfin-server/ffmpeg-libavcodec-allcodecs.c.patch create mode 100644 packages/jellyfin-server/ffmpeg-libavutil-file_open.c.patch create mode 100644 packages/jellyfin-server/jellyfin-defaults.patch create mode 100644 packages/jellyfin-server/jellyfin-ffmpeg.subpackage.sh diff --git a/packages/jellyfin-server/build.sh b/packages/jellyfin-server/build.sh new file mode 100644 index 00000000000..c7e1e810ad4 --- /dev/null +++ b/packages/jellyfin-server/build.sh @@ -0,0 +1,133 @@ +TERMUX_PKG_HOMEPAGE="https://jellyfin.org" +TERMUX_PKG_DESCRIPTION="A free media system for organizing and streaming media (server)" +TERMUX_PKG_LICENSE="GPL-2.0" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=( + 10.11.4 + 7.1.2.4 +) +TERMUX_PKG_SRCURL=( + "https://github.com/jellyfin/jellyfin/archive/refs/tags/v${TERMUX_PKG_VERSION[0]}.tar.gz" + "https://github.com/jellyfin/jellyfin-web/archive/refs/tags/v${TERMUX_PKG_VERSION[0]}.zip" + "https://github.com/jellyfin/jellyfin-ffmpeg/archive/refs/tags/v${TERMUX_PKG_VERSION[1]%.*}-${TERMUX_PKG_VERSION[1]##*.}.tar.gz" +) +TERMUX_PKG_SHA256=( + 2701e396ca79f30597c9f44704f65c5c5ef451c9709f17e30f4328a23bfd3cfe + 8f183ff655942bdb7b392c731ef0a684301819bddf658e6d27dfa3c064f48a13 + 51377d573eff0fe6b15028b350406de2ad4696960781620ef1791c19bea41c3b +) +TERMUX_PKG_BUILD_DEPENDS="aspnetcore-targeting-pack-9.0, dotnet-targeting-pack-9.0, libcairo, pango, libjpeg-turbo, giflib, librsvg" +TERMUX_PKG_DEPENDS="libc++, aspnetcore-runtime-9.0, dotnet-host, dotnet-runtime-9.0, libskiasharp, libesqlite3, jellyfin-ffmpeg" +TERMUX_PKG_SERVICE_SCRIPT=( + "jellyfin" + "exec ${TERMUX_PREFIX}/bin/jellyfin 2>&1" +) +TERMUX_PKG_EXCLUDED_ARCHES="arm" +TERMUX_PKG_RM_AFTER_INSTALL=" +opt/jellyfin/include +opt/jellyfin/lib/pkgconfig +opt/jellyfin/share +" +termux_step_post_get_source() { + pushd jellyfin-ffmpeg-"${TERMUX_PKG_VERSION[1]%.*}-${TERMUX_PKG_VERSION[1]##*.}" + # If quilt is added to termux-build-helper: + # if [[ -f "debian/patches/series" ]]; then + # quilt push -a + # fi + local _patch; + for _patch in $( configure.sh +sed -i 's/set -xe/set -e/' configure.sh +sed -i 's/docker/:/' configure.sh + +cat <<'EOF' >>configure.sh +printf '%s\n' "./configure --prefix='\${_FFMPEG_PREFIX}' +--arch='\${_ARCH}' +--as='\$AS' +--cc='\$CC' +--cxx='\$CXX' +--nm='\$NM' +--ar='\$AR' +--ranlib=llvm-ranlib +--pkg-config='\$PKG_CONFIG' +--strip='\$STRIP' +--enable-cross-compile +--extra-version='Jellyfin' +--extra-cflags='$FF_CFLAGS' +--extra-cxxflags='$FF_CXXFLAGS' +--extra-ldflags='$FF_LDFLAGS' +--extra-ldexeflags='$FF_LDEXEFLAGS' +--extra-libs='$FF_LIBS -landroid-glob' +--target-os=android +--disable-static +--enable-shared +$FF_CONFIGURE +\${_EXTRA_CONFIGURE_FLAGS} +--disable-vulkan" | sed "s/'/\"/g;$ ! s/$/ \\\\/" +EOF +# disable unused and unneeded options +rm -rf scripts.d/*{rkrga,vulkan,rkmpp,fdk-aac,zvbi,amf,vaapi,ffnvcodec,libvpl,shaderc}* +bash ./configure.sh "$@" diff --git a/packages/jellyfin-server/ffmpeg-libavcodec-allcodecs.c.patch b/packages/jellyfin-server/ffmpeg-libavcodec-allcodecs.c.patch new file mode 100644 index 00000000000..c4f3483cef3 --- /dev/null +++ b/packages/jellyfin-server/ffmpeg-libavcodec-allcodecs.c.patch @@ -0,0 +1,18 @@ +--- a/jellyfin-ffmpeg-7.1.2-4/libavcodec/allcodecs.c ++++ b/jellyfin-ffmpeg-7.1.2-4/libavcodec/allcodecs.c +@@ -150,7 +150,6 @@ extern const FFCodec ff_h263_rkmpp_decoder; + extern const FFCodec ff_h264_decoder; + extern const FFCodec ff_h264_v4l2m2m_decoder; + extern const FFCodec ff_h264_mediacodec_decoder; +-extern const FFCodec ff_h264_mediacodec_encoder; + extern const FFCodec ff_h264_mmal_decoder; + extern const FFCodec ff_h264_qsv_decoder; + extern const FFCodec ff_h264_rkmpp_decoder; +@@ -861,6 +861,7 @@ extern const FFCodec ff_h264_videotoolbox_encoder; + extern const FFCodec ff_hevc_amf_encoder; + extern const FFCodec ff_hevc_cuvid_decoder; + extern const FFCodec ff_hevc_d3d12va_encoder; ++extern const FFCodec ff_h264_mediacodec_encoder; + extern const FFCodec ff_hevc_mediacodec_decoder; + extern const FFCodec ff_hevc_mediacodec_encoder; + extern const FFCodec ff_hevc_mf_encoder; diff --git a/packages/jellyfin-server/ffmpeg-libavutil-file_open.c.patch b/packages/jellyfin-server/ffmpeg-libavutil-file_open.c.patch new file mode 100644 index 00000000000..5088eb96b71 --- /dev/null +++ b/packages/jellyfin-server/ffmpeg-libavutil-file_open.c.patch @@ -0,0 +1,20 @@ +--- a/jellyfin-ffmpeg-7.1.2-4/libavutil/file_open.c ++++ b/jellyfin-ffmpeg-7.1.2-4/libavutil/file_open.c +@@ -113,7 +113,7 @@ int avpriv_tempfile(const char *prefix, char **filename, int log_offset, void *l + FileLogContext file_log_ctx = { &file_log_ctx_class, log_offset, log_ctx }; + int fd = -1; + #if HAVE_MKSTEMP +- size_t len = strlen(prefix) + 12; /* room for "/tmp/" and "XXXXXX\0" */ ++ size_t len = strlen(prefix) + strlen("@TERMUX_PREFIX@/tmp/") + 7; /* room for "@TERMUX_PREFIX@/tmp/" and "XXXXXX\0" */ + *filename = av_malloc(len); + #elif HAVE_TEMPNAM + void *ptr= tempnam(NULL, prefix); +@@ -139,7 +139,7 @@ int avpriv_tempfile(const char *prefix, char **filename, int log_offset, void *l + # endif + fd = open(*filename, O_RDWR | O_BINARY | O_CREAT | O_EXCL, 0600); + #else +- snprintf(*filename, len, "/tmp/%sXXXXXX", prefix); ++ snprintf(*filename, len, "@TERMUX_PREFIX@/tmp/%sXXXXXX", prefix); + fd = mkstemp(*filename); + #if defined(_WIN32) || defined (__ANDROID__) || defined(__DJGPP__) + if (fd < 0) { diff --git a/packages/jellyfin-server/jellyfin-defaults.patch b/packages/jellyfin-server/jellyfin-defaults.patch new file mode 100644 index 00000000000..09801f24085 --- /dev/null +++ b/packages/jellyfin-server/jellyfin-defaults.patch @@ -0,0 +1,111 @@ +nonetchange is pretty much mandatory on Android, so we enable it by default +We also make Jellyfin try to use jellyfin-ffmpeg by default, if available + +--- a/Emby.Server.Implementations/ConfigurationOptions.cs ++++ b/Emby.Server.Implementations/ConfigurationOptions.cs +@@ -21,7 +21,7 @@ namespace Emby.Server.Implementations + { SqliteCacheSizeKey, "20000" }, + { FfmpegSkipValidationKey, bool.FalseString }, + { FfmpegImgExtractPerfTradeoffKey, bool.FalseString }, +- { DetectNetworkChangeKey, bool.TrueString } ++ { DetectNetworkChangeKey, bool.FalseString } + }; + } + } +--- a/Jellyfin.Server/StartupOptions.cs ++++ b/Jellyfin.Server/StartupOptions.cs +@@ -68,10 +68,10 @@ namespace Jellyfin.Server + public string? PublishedServerUrl { get; set; } + + /// +- /// Gets or sets a value indicating whether the server should not detect network status change. ++ /// Gets or sets a value indicating whether the server should detect network status change. + /// +- [Option("nonetchange", Required = false, HelpText = "Indicates that the server should not detect network status change.")] +- public bool NoDetectNetworkChange { get; set; } ++ [Option("netchange", Required = false, HelpText = "Indicates that the server should detect network status change.")] ++ public bool DetectNetworkChange { get; set; } + + /// + /// Gets or sets the path to an jellyfin backup archive to restore the application to. +@@ -102,9 +102,9 @@ namespace Jellyfin.Server + config.Add(FfmpegPathKey, FFmpegPath); + } + +- if (NoDetectNetworkChange) ++ if (DetectNetworkChange) + { +- config.Add(DetectNetworkChangeKey, bool.FalseString); ++ config.Add(DetectNetworkChangeKey, bool.TrueString); + } + + return config; +--- a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs ++++ b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs +@@ -217,7 +217,7 @@ namespace MediaBrowser.MediaEncoding.Encoder + [GeneratedRegex(@"((?lib\w+)\s+(?[0-9]+)\.\s*(?[0-9]+))", RegexOptions.Multiline)] + private static partial Regex LibraryRegex(); + +- public bool ValidateVersion() ++ public bool ValidateVersion(bool noerr = false) + { + string output; + try +@@ -226,13 +226,17 @@ namespace MediaBrowser.MediaEncoding.Encoder + } + catch (Exception ex) + { +- _logger.LogError(ex, "Error validating encoder"); ++ if (!noerr) { ++ _logger.LogError(ex, "Error validating encoder"); ++ } + return false; + } + + if (string.IsNullOrWhiteSpace(output)) + { +- _logger.LogError("FFmpeg validation: The process returned no result"); ++ if (!noerr) { ++ _logger.LogError("FFmpeg validation: The process returned no result"); ++ } + return false; + } + +--- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs ++++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +@@ -199,7 +199,10 @@ namespace MediaBrowser.MediaEncoding.Encoder + } + } + +- if (!ValidatePath(ffmpegPath)) ++ if (ffmpegPathSetMethodText == "system $PATH" && !ValidatePath("@TERMUX_PREFIX@/opt/jellyfin/bin/ffmpeg", true)) { ++ _ffmpegPath = null; ++ } ++ if (string.IsNullOrEmpty(_ffmpegPath) && !ValidatePath(ffmpegPath)) + { + _ffmpegPath = null; + _logger.LogError("FFmpeg: Path set by {FfmpegPathSetMethodText} is invalid", ffmpegPathSetMethodText); +@@ -287,17 +290,20 @@ namespace MediaBrowser.MediaEncoding.Encoder + /// + /// FQPN to test. ++ /// If set to true, logger is not used + /// true if the version validation succeeded; otherwise, false. +- private bool ValidatePath(string path) ++ private bool ValidatePath(string path, bool noerr = false) + { + if (string.IsNullOrEmpty(path)) + { + return false; + } + +- bool rc = new EncoderValidator(_logger, path).ValidateVersion(); ++ bool rc = new EncoderValidator(_logger, path).ValidateVersion(noerr); + if (!rc) + { +- _logger.LogError("FFmpeg: Failed version check: {Path}", path); ++ if (!noerr) { ++ _logger.LogError("FFmpeg: Failed version check: {Path}", path); ++ } + return false; + } + diff --git a/packages/jellyfin-server/jellyfin-ffmpeg.subpackage.sh b/packages/jellyfin-server/jellyfin-ffmpeg.subpackage.sh new file mode 100644 index 00000000000..40ee01db302 --- /dev/null +++ b/packages/jellyfin-server/jellyfin-ffmpeg.subpackage.sh @@ -0,0 +1,4 @@ +TERMUX_SUBPKG_DESCRIPTION="FFmpeg for Jellyfin with custom extensions and enhancements" +TERMUX_SUBPKG_DEPENDS="libchromaprint, fontconfig, freetype, fribidi, harfbuzz, libandroid-glob, libandroid-stub, libass, libbluray, libbz2, libdav1d, libgmp, libiconv, liblzma, libmp3lame, libopenmpt, libopus, libsrt, libtheora, libvorbis, libvpx, libwebp, libx264, libx265, libxml2, libzimg, ocl-icd, openssl, svt-av1, zlib" +TERMUX_SUBPKG_DEPEND_ON_PARENT=false +TERMUX_SUBPKG_INCLUDE="opt/jellyfin"