Skip to content

configure: improve Rust compatibility with AppleTVOS

The main point of this MR is the addition of the --with-rust-std parameter to make the build compatible with AppleTVOS.

The parameter is forwarded to Cargo to handle re-compiling the standard library. This is required when targetting tier 3 targets like aarch64-apple-tvos, where the standard library is not shipped with the compiler binaries.

Initial design used --with-cargo-build-std which only triggered rebuild of the std in cargo, but this new design for the option allows more specification about what needs to be built, can be extended to support --extern crate later when the std makes it easy to do so, and I felt it was clearer to read the option, though finding it is a bit less easy.

Example:

--with-rust-std=build-std=std,panic_abort

Typical configuration change to enable the platform:

commit 204a8f87205f12304125ee64851e7b74312528fd
Author: Alexandre Janniaux <ajanni@videolabs.io>
Date:   Mon Aug 26 21:29:11 2024 +0200

    package: apple: enable rust on all darwin platforms

diff --git a/extras/package/apple/build.conf b/extras/package/apple/build.conf
index c57c8a0e49..f32610903c 100644
--- a/extras/package/apple/build.conf
+++ b/extras/package/apple/build.conf
@@ -137,6 +137,7 @@ export VLC_CONTRIB_OPTIONS_WATCHOS=(
 
 # Base configure options for VLC
 export VLC_CONFIG_OPTIONS_BASE=(
+    --enable-rust
     --disable-sse
     --disable-a52
     --disable-vcd
@@ -176,7 +177,9 @@ export VLC_CONFIG_OPTIONS_MACOSX=()
 export VLC_CONFIG_OPTIONS_IOS=()
 
 # Additional configure options for tvOS
-export VLC_CONFIG_OPTIONS_TVOS=()
+export VLC_CONFIG_OPTIONS_TVOS=(
+    --with-rust-std=build-std=std,panic_abort
+)
 
 # Additional configure options for xrOS
 export VLC_CONFIG_OPTIONS_XROS=()

Merge request reports

Loading