public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "James Le Cuirot" <chewi@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: net-misc/sunshine/, net-misc/sunshine/files/
Date: Fri,  1 Mar 2024 23:31:58 +0000 (UTC)	[thread overview]
Message-ID: <1709335889.c7915a37767f37dc8256568f440355d9e1e33e53.chewi@gentoo> (raw)

commit:     c7915a37767f37dc8256568f440355d9e1e33e53
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Fri Mar  1 23:21:39 2024 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Fri Mar  1 23:31:29 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c7915a37

net-misc/sunshine: Fix cross-compiling with patch

Upstream say they will merge this in time for the next release.

Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 net-misc/sunshine/files/sunshine-cross-cbs.patch | 59 ++++++++++++++++++++++++
 net-misc/sunshine/sunshine-0.21.0.ebuild         |  6 ++-
 net-misc/sunshine/sunshine-9999.ebuild           |  6 ++-
 3 files changed, 67 insertions(+), 4 deletions(-)

diff --git a/net-misc/sunshine/files/sunshine-cross-cbs.patch b/net-misc/sunshine/files/sunshine-cross-cbs.patch
new file mode 100644
index 000000000000..e6173597e476
--- /dev/null
+++ b/net-misc/sunshine/files/sunshine-cross-cbs.patch
@@ -0,0 +1,59 @@
+From 40654399bd090dda20750b184eb6b15bc615a5dc Mon Sep 17 00:00:00 2001
+From: James Le Cuirot <chewi@gentoo.org>
+Date: Sun, 25 Feb 2024 16:24:25 +0000
+Subject: [PATCH] Fix cross-compiling and don't treat x86 as the default case
+
+If you set arch-specific CFLAGS, then ffmpeg's configure script may
+fail when it tries to use these flags against the build host's compiler.
+
+Also use CMAKE_SYSTEM_PROCESSOR to set up cross-compiling without
+relying on any custom variables. ffmpeg normalises its --arch option and
+will accept just about any string that you'll likely throw at it.
+
+diff --git a/cmake/ffmpeg_cbs.cmake b/cmake/ffmpeg_cbs.cmake
+index 573bec0..4a75e1a 100644
+--- a/cmake/ffmpeg_cbs.cmake
++++ b/cmake/ffmpeg_cbs.cmake
+@@ -30,23 +30,30 @@ if (WIN32)
+     set(LEADING_SH_COMMAND sh)
+ endif ()
+ 
+-if (CROSS_COMPILE_ARM)
+-    set(FFMPEG_EXTRA_CONFIGURE
+-            --arch=aarch64
+-            --enable-cross-compile)
++string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} arch)
++
++if (${arch} STREQUAL "aarch64" OR ${arch} STREQUAL "arm64")
+     set(CBS_ARCH_PATH arm)
+-elseif (CROSS_COMPILE_PPC)
+-    set(FFMPEG_EXTRA_CONFIGURE
+-            --arch=powerpc64le
+-            --enable-cross-compile)
++elseif (${arch} STREQUAL "ppc64le")
+     set(CBS_ARCH_PATH ppc)
+-else ()
++elseif (${arch} STREQUAL "amd64" OR ${arch} STREQUAL "x86_64")
+     set(CBS_ARCH_PATH x86)
++else ()
++    message(FATAL_ERROR "Unsupported system processor:" ${CMAKE_SYSTEM_PROCESSOR})
++endif ()
++
++if (CMAKE_CROSSCOMPILING)
++    set(FFMPEG_EXTRA_CONFIGURE --arch=${arch} --enable-cross-compile)
+ endif ()
+ 
+ # The generated config.h needs to have `CONFIG_CBS_` flags enabled (from `--enable-bsfs`)
+ execute_process(
+         COMMAND ${LEADING_SH_COMMAND} ./configure
++            --cc=${CMAKE_C_COMPILER}
++            --cxx=${CMAKE_CXX_COMPILER}
++            --ar=${CMAKE_AR}
++            --ranlib=${CMAKE_RANLIB}
++            --optflags=${CMAKE_C_FLAGS}
+             --disable-all
+             --disable-autodetect
+             --disable-iconv
+-- 
+2.43.2
+

diff --git a/net-misc/sunshine/sunshine-0.21.0.ebuild b/net-misc/sunshine/sunshine-0.21.0.ebuild
index 22cf946e4348..1c21649b7929 100644
--- a/net-misc/sunshine/sunshine-0.21.0.ebuild
+++ b/net-misc/sunshine/sunshine-0.21.0.ebuild
@@ -237,6 +237,10 @@ src_unpack() {
 }
 
 src_prepare() {
+	# Apply CBS patch.
+	cd "${WORKDIR}"/build-deps || die
+	eapply "${FILESDIR}"/${PN}-cross-cbs.patch
+
 	# Apply general ffmpeg patches.
 	cd "${WORKDIR}"/build-deps/ffmpeg_sources/ffmpeg || die
 	eapply "${WORKDIR}"/build-deps/ffmpeg_patches/ffmpeg/*.patch
@@ -329,8 +333,6 @@ src_configure() {
 	local mycmakeargs=(
 		-DBUILD_SHARED_LIBS=no
 		-DCMAKE_INSTALL_PREFIX="${S}"/third-party/ffmpeg
-		$(usex arm64 -DCROSS_COMPILE_ARM=yes "")
-		$(usex ppc64 -DCROSS_COMPILE_PPC=yes "")
 	)
 	CMAKE_USE_DIR="${WORKDIR}/build-deps" cmake_src_configure
 

diff --git a/net-misc/sunshine/sunshine-9999.ebuild b/net-misc/sunshine/sunshine-9999.ebuild
index c88478b1a500..641289cdc732 100644
--- a/net-misc/sunshine/sunshine-9999.ebuild
+++ b/net-misc/sunshine/sunshine-9999.ebuild
@@ -235,6 +235,10 @@ src_unpack() {
 }
 
 src_prepare() {
+	# Apply CBS patch.
+	cd "${WORKDIR}"/build-deps || die
+	eapply "${FILESDIR}"/${PN}-cross-cbs.patch
+
 	# Apply general ffmpeg patches.
 	cd "${WORKDIR}"/build-deps/ffmpeg_sources/ffmpeg || die
 	eapply "${WORKDIR}"/build-deps/ffmpeg_patches/ffmpeg/*.patch
@@ -327,8 +331,6 @@ src_configure() {
 	local mycmakeargs=(
 		-DBUILD_SHARED_LIBS=no
 		-DCMAKE_INSTALL_PREFIX="${S}"/third-party/ffmpeg
-		$(usex arm64 -DCROSS_COMPILE_ARM=yes "")
-		$(usex ppc64 -DCROSS_COMPILE_PPC=yes "")
 	)
 	CMAKE_USE_DIR="${WORKDIR}/build-deps" cmake_src_configure
 


             reply	other threads:[~2024-03-01 23:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-01 23:31 James Le Cuirot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-07-18 21:07 [gentoo-commits] repo/gentoo:master commit in: net-misc/sunshine/, net-misc/sunshine/files/ James Le Cuirot
2025-07-02 21:07 James Le Cuirot
2025-07-02 21:07 James Le Cuirot
2025-06-17 22:53 James Le Cuirot
2025-03-14 22:18 James Le Cuirot
2024-12-28 23:26 James Le Cuirot
2024-05-13 21:04 James Le Cuirot
2024-03-09 15:02 James Le Cuirot
2024-02-27  8:59 James Le Cuirot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1709335889.c7915a37767f37dc8256568f440355d9e1e33e53.chewi@gentoo \
    --to=chewi@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox