Skip to content

Commit

Permalink
bump(main/libx265): 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Biswa96 committed Dec 11, 2024
1 parent 9a3cd38 commit f947ded
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 52 deletions.
48 changes: 5 additions & 43 deletions packages/libx265/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,24 @@ TERMUX_PKG_HOMEPAGE=http://x265.org/
TERMUX_PKG_DESCRIPTION="H.265/HEVC video stream encoder library"
TERMUX_PKG_LICENSE="GPL-2.0"
TERMUX_PKG_MAINTAINER="@termux"
_COMMIT=38cf1c379b5af08856bb2fdd65f65a1f99384886
_COMMIT_DATE=20230222
TERMUX_PKG_VERSION=3.5-p${_COMMIT_DATE}
#TERMUX_PKG_SRCURL=https://bitbucket.org/multicoreware/x265_git/downloads/x265_$TERMUX_PKG_VERSION.tar.gz
TERMUX_PKG_SRCURL=git+https://bitbucket.org/multicoreware/x265_git
TERMUX_PKG_SHA256=5a8c54fb41b449538c160d3b48f439fa1c079b77f1c165c7b6967f5cb480ffd7
TERMUX_PKG_GIT_BRANCH=master
TERMUX_PKG_VERSION="4.0"
TERMUX_PKG_SRCURL=https://bitbucket.org/multicoreware/x265_git/downloads/x265_${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=75b4d05629e365913de3100b38a459b04e2a217a8f30efaa91b572d8e6d71282
TERMUX_PKG_DEPENDS="libandroid-posix-semaphore, libc++"
TERMUX_PKG_BREAKS="libx265-dev"
TERMUX_PKG_REPLACES="libx265-dev"

termux_step_post_get_source() {
git fetch --unshallow
git checkout $_COMMIT

local pdate="p$(git log -1 --format=%cs | sed 's/-//g')"
if [[ "$TERMUX_PKG_VERSION" != *"${pdate}" ]]; then
echo -n "ERROR: The version string \"$TERMUX_PKG_VERSION\" is"
echo -n " different from what is expected to be; should end"
echo " with \"${pdate}\"."
return 1
fi

local s=$(find . -type f ! -path '*/.git/*' -print0 | xargs -0 sha256sum | LC_ALL=C sort | sha256sum)
if [[ "${s}" != "${TERMUX_PKG_SHA256} "* ]]; then
termux_error_exit "Checksum mismatch for source files."
fi

termux_step_pre_configure() {
# Do not forget to bump revision of reverse dependencies and rebuild them
# after SOVERSION is changed.
local _SOVERSION=207
local _SOVERSION=212

local v=$(sed -En 's/^.*set\(X265_BUILD ([0-9]+).*$/\1/p' \
source/CMakeLists.txt)
if [ "${v}" != "${_SOVERSION}" ]; then
termux_error_exit "SOVERSION guard check failed."
fi

if [ -d .git ]; then
local _libx265_base_version="3.5"
local _libx265_base_commit="f0c1022b6be121a753ff02853fbe33da71988656"
if [ "${TERMUX_PKG_VERSION%-*}" != "${_libx265_base_version}" ]; then
termux_error_exit "Base version mismatch; expected to be ${_libx265_base_version}."
fi
cat > x265Version.txt <<-EOF
repositorychangeset: $(git log --pretty=format:%h -n 1)
releasetagdistance: $(git rev-list ${_libx265_base_commit}.. --count --first-parent)
releasetag: ${_libx265_base_version}
EOF

# To install shared lib
rm -rf .git
fi
}

termux_step_pre_configure() {
local _TERMUX_CLANG_TARGET=

# Not sure if this is necessary for on-device build
Expand Down
23 changes: 14 additions & 9 deletions packages/libx265/source-CMakeLists.txt.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index a407271b4..6ecfda3ee 100755
index 37b83f9..286628b 100755
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -44,7 +44,7 @@ else()
@@ -46,7 +46,7 @@ else()
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" SYSPROC)
endif()
set(X86_ALIASES x86 i386 i686 x86_64 amd64)
Expand All @@ -11,7 +11,7 @@ index a407271b4..6ecfda3ee 100755
set(ARM64_ALIASES arm64 arm64e aarch64)
list(FIND X86_ALIASES "${SYSPROC}" X86MATCH)
list(FIND ARM_ALIASES "${SYSPROC}" ARMMATCH)
@@ -251,16 +251,12 @@ if(GCC)
@@ -255,13 +255,9 @@ if(GCC)
message(STATUS "cross compile arm")
set(ARM_ARGS -march=armv6 -mfloat-abi=soft -mfpu=vfp -marm -fPIC)
elseif(ARM)
Expand All @@ -26,9 +26,14 @@ index a407271b4..6ecfda3ee 100755
+ set(ARM_ARGS @TERMUX_CLANG_TARGET_ARM@ -march=armv7-a -mfpu=neon -mfloat-abi=softfp -mthumb -fPIC)
+ add_definitions(-DHAVE_NEON)
endif()
if(ARM64 OR CROSS_COMPILE_ARM64)
- set(ARM_ARGS -fPIC -flax-vector-conversions)
+ set(ARM_ARGS @TERMUX_CLANG_TARGET_AARCH64@ -fPIC -flax-vector-conversions)
find_package(Neon)
if(CPU_HAS_NEON)
add_definitions(-DHAVE_NEON)
if(ARM64)
message(STATUS "Found Neon")
@@ -334,7 +330,7 @@ if(GCC)
set(ARM_ARGS -O3 -march=armv9-a+i8mm+sve2)
add_definitions(-DHAVE_SVE2=1)
endif()
- set(ARM_ARGS ${ARM_ARGS} -fPIC)
+ set(ARM_ARGS @TERMUX_CLANG_TARGET_AARCH64@ -fPIC)
# Do not allow implicit vector type conversions in Clang builds (this
# is already the default in GCC builds).
check_cxx_compiler_flag(-flax-vector-conversions=none CC_HAS_FLAX_VEC_CONV_NONE)

0 comments on commit f947ded

Please sign in to comment.