Skip to content

Commit

Permalink
[x264] Update to 0.164.3108, use official upstream (#39460)
Browse files Browse the repository at this point in the history
  • Loading branch information
dg0yt committed Jun 26, 2024
1 parent 2e7fd31 commit 467f9a6
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 52 deletions.
10 changes: 0 additions & 10 deletions ports/x264/configure-as.patch

This file was deleted.

40 changes: 40 additions & 0 deletions ports/x264/configure.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
diff --git a/configure b/configure
index e242e73c..e0d1df76 100755
--- a/configure
+++ b/configure
@@ -1,4 +1,7 @@
-#!/bin/bash
+#!/usr/bin/env bash
+
+export CFLAGS="${CPPFLAGS} ${CFLAGS}"
+test "${AS:-:}" = ":" && unset AS

if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
cat <<EOF
@@ -837,6 +840,7 @@ case $host_cpu in
AS="${AS-${SRCPATH}/tools/gas-preprocessor.pl -arch aarch64 -as-type armasm -- armasm64 -nologo}"
else
AS="${AS-${CC}}"
+ test "${AS}" = "${CC}" && ASFLAGS="${CPPFLAGS} ${ASFLAGS}"
fi
;;
arm*)
@@ -855,6 +859,7 @@ case $host_cpu in
AS="${AS-${SRCPATH}/tools/gas-preprocessor.pl -arch arm -as-type clang -force-thumb -- ${CC} -mimplicit-it=always}"
else
AS="${AS-${CC}}"
+ test "${AS}" = "${CC}" && ASFLAGS="${CPPFLAGS} ${ASFLAGS}"
fi
;;
s390|s390x)
@@ -1354,8 +1359,10 @@ if [ $SYS = WINDOWS -a $ARCH = X86 -a $compiler = GNU ] ; then
fi

if cc_check "stdio.h" "" "fseeko(stdin,0,0);" ; then
+ if cc_check "" "" "#if defined(__ANDROID_API__) && __ANDROID_API__ < 24\n#error\n#endif\n" ; then
define fseek fseeko
define ftell ftello
+ fi
elif cc_check "stdio.h" "" "fseeko64(stdin,0,0);" ; then
define fseek fseeko64
define ftell ftello64
43 changes: 22 additions & 21 deletions ports/x264/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
vcpkg_from_github(
# The latest ref in branch stable
set(ref 31e19f92f00c7003fa115047ce50978bc98c3a0d)

# Note on x264 versioning:
# The pc file exports "0.164.<N>" where is the number of commits.
# The binary releases on https://artifacts.videolan.org/x264/ are named x264-r<N>-<COMMIT>.
# With a git clone, this can be determined by running `versions.sh`.
# With vcpkg_from_gitlab, we modify `versions.sh` accordingly.
# For --editable mode, use configured patch instead of vcpkg_replace_string.
string(REGEX MATCH "^......." short_ref "${ref}")
string(REGEX MATCH "[0-9]+\$" revision "${VERSION}")
configure_file("${CURRENT_PORT_DIR}/version.diff.in" "${CURRENT_BUILDTREES_DIR}/src/version-${VERSION}.diff" @ONLY)

vcpkg_from_gitlab(
GITLAB_URL https://code.videolan.org/
OUT_SOURCE_PATH SOURCE_PATH
REPO mirror/x264
REF eaa68fad9e5d201d42fde51665f2d137ae96baf0 # 0.164.3107 in pc file, to be updated below
SHA512 9181b222e7f8bbde4331141ff399e1ef20d3e2e7a8f939b373fbe08df6f3caa99b992afb0e559cc19f78c96f0105b88b2eb4e4b935484e25b2c15da7903d179b
HEAD_REF stable
REPO videolan/x264
REF "${ref}"
SHA512 707ff486677a1b5502d6d8faa588e7a03b0dee45491c5cba89341be4be23d3f2e48272c3b11d54cfc7be1b8bf4a3dfc3c3bb6d9643a6b5a2ed77539c85ecf294
HEAD_REF master
PATCHES
"${CURRENT_BUILDTREES_DIR}/src/version-${VERSION}.diff"
uwp-cflags.patch
parallel-install.patch
allow-clang-cl.patch
configure-as.patch # Ignore ':' from `vcpkg_configure_make`
configure.patch
)

vcpkg_replace_string("${SOURCE_PATH}/configure" [[/bin/bash]] [[/usr/bin/env bash]])

# Note on x264 versioning:
# The pc file exports "0.164.<N>" where is the number of commits.
# This must be fixed here because vcpkg uses a GH tarball instead of cloning the source.
# (The binary releases on https://artifacts.videolan.org/x264/ are named x264-r<N>-<COMMIT>.)
vcpkg_replace_string("${SOURCE_PATH}/version.sh" [[ver="x"]] [[ver="3095"]])

# Ensure that 'ENV{PATH}' leads to tool 'name' exactly at 'filepath'.
function(ensure_tool_in_path name filepath)
unset(program_found CACHE)
Expand Down Expand Up @@ -47,9 +54,6 @@ transform_path_no_space(VCPKG_DETECTED_CMAKE_C_COMPILER)
set(ENV{CC} "${VCPKG_DETECTED_CMAKE_C_COMPILER}")

vcpkg_list(SET OPTIONS)
if(VCPKG_DETECTED_CMAKE_C_COMPILER MATCHES "([^\/]*-)gcc$")
vcpkg_list(APPEND OPTIONS "--cross-prefix=${CMAKE_MATCH_1}")
endif()

vcpkg_list(SET EXTRA_ARGS)
set(nasm_archs x86 x64)
Expand Down Expand Up @@ -89,17 +93,14 @@ if(VCPKG_TARGET_IS_UWP)
list(APPEND OPTIONS --extra-cflags=-D_WIN32_WINNT=0x0A00)
endif()

if(VCPKG_TARGET_IS_LINUX)
list(APPEND OPTIONS --enable-pic)
endif()

vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
NO_ADDITIONAL_PATHS
DETERMINE_BUILD_TRIPLET
${EXTRA_ARGS}
OPTIONS
${OPTIONS}
--enable-pic
--disable-lavf
--disable-swscale
--disable-avs
Expand Down
27 changes: 10 additions & 17 deletions ports/x264/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "x264",
"version": "0.164.3107",
"port-version": 1,
"version": "0.164.3108",
"description": "x264 is a free software library and application for encoding video streams into the H.264/MPEG-4 AVC compression format",
"homepage": "https://www.videolan.org/developers/x264.html",
"license": "GPL-2.0-or-later",
Expand All @@ -13,29 +12,23 @@
}
],
"default-features": [
"default-features"
{
"name": "asm",
"platform": "!(arm32 & windows)"
},
{
"name": "gpl",
"platform": "!(arm32 & windows)"
}
],
"features": {
"asm": {
"description": "Enable platform-specific assembly optimizations",
"supports": "x86 | x64 | (arm & !windows) | arm64"
"supports": "!(arm32 & windows)"
},
"chroma-format-all": {
"description": "Output all chroma formats"
},
"default-features": {
"description": "Default set of features",
"dependencies": [
{
"name": "x264",
"features": [
"asm",
"gpl"
],
"platform": "x86 | x64 | (arm & !windows) | arm64"
}
]
},
"gpl": {
"description": "Allow use of GPL code, the resulting libs and binaries will be under GPL"
},
Expand Down
15 changes: 15 additions & 0 deletions ports/x264/version.diff.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/version.sh b/version.sh
index 178fc952..06728796 100755
--- a/version.sh
+++ b/version.sh
@@ -3,8 +3,8 @@
cd "$(dirname "$0")" >/dev/null && [ -f x264.h ] || exit 1

api="$(grep '#define X264_BUILD' < x264.h | sed 's/^.* \([1-9][0-9]*\).*$/\1/')"
-ver="x"
-version=""
+ver="@revision@ @short_ref@"
+version=" r${ver} vcpkg"

if [ -d .git ] && command -v git >/dev/null 2>&1 ; then
localver="$(($(git rev-list HEAD | wc -l)))"
2 changes: 0 additions & 2 deletions scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1235,8 +1235,6 @@ workflow:x64-uwp=fail
wpilib:arm-neon-android=fail # requires full c++20 support
wpilib:arm64-android=fail # requires full c++20 support
wpilib:x64-android=fail # requires full c++20 support
x264:arm-neon-android=fail
x264:arm64-android=fail
# No xorg-macros available on osx
xbitmaps:arm-neon-android=fail
xbitmaps:arm64-android=fail
Expand Down
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -9477,8 +9477,8 @@
"port-version": 0
},
"x264": {
"baseline": "0.164.3107",
"port-version": 1
"baseline": "0.164.3108",
"port-version": 0
},
"x265": {
"baseline": "3.6",
Expand Down
5 changes: 5 additions & 0 deletions versions/x-/x264.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "1e1d8374cc8a7fe139d82433d27e64e972365517",
"version": "0.164.3108",
"port-version": 0
},
{
"git-tree": "d6d192464ad7d9b953f43c13b7edcc618ce6e690",
"version": "0.164.3107",
Expand Down

0 comments on commit 467f9a6

Please sign in to comment.