diff options
author | James Le Cuirot <chewi@gentoo.org> | 2024-03-01 23:21:39 +0000 |
---|---|---|
committer | James Le Cuirot <chewi@gentoo.org> | 2024-03-01 23:31:29 +0000 |
commit | c7915a37767f37dc8256568f440355d9e1e33e53 (patch) | |
tree | 16f99b522564b69a2dd392e5968d3c406fb0612e /net-misc | |
parent | dev-util/diffoscope: add 259 (diff) | |
download | gentoo-c7915a37767f37dc8256568f440355d9e1e33e53.tar.gz gentoo-c7915a37767f37dc8256568f440355d9e1e33e53.tar.bz2 gentoo-c7915a37767f37dc8256568f440355d9e1e33e53.zip |
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@gentoo.org>
Diffstat (limited to 'net-misc')
-rw-r--r-- | net-misc/sunshine/files/sunshine-cross-cbs.patch | 59 | ||||
-rw-r--r-- | net-misc/sunshine/sunshine-0.21.0.ebuild | 6 | ||||
-rw-r--r-- | 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 |