-
Notifications
You must be signed in to change notification settings - Fork 171
Add headless Linux build path #1024
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
c253f98
3afae5f
6f720ce
8a582f7
2edf1d4
fb7c56f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| livekit: patch | ||
| --- | ||
|
|
||
| Disable libwebrtc default features in workspace dependency wiring so `livekit --no-default-features -F tokio` no longer re-enables `glib-main-loop` transitively. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| livekit: patch | ||
| webrtc-sys: patch | ||
| libwebrtc: patch | ||
| livekit-ffi: patch | ||
| --- | ||
|
|
||
| Add headless Linux build path - #1024 (@mikefaille) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,17 +16,24 @@ use std::path::Path; | |
| use std::path::PathBuf; | ||
| use std::{env, path, process::Command}; | ||
|
|
||
| fn lk_headless() -> bool { | ||
| env::var("LK_HEADLESS").map(|v| v == "1" || v.eq_ignore_ascii_case("true")).unwrap_or(false) | ||
| } | ||
|
|
||
| fn main() { | ||
| if env::var("DOCS_RS").is_ok() { | ||
| return; | ||
| } | ||
|
|
||
| let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap(); | ||
| let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap(); | ||
| let is_desktop = target_os == "linux" || target_os == "windows" || target_os == "macos"; | ||
| let headless_linux = target_os == "linux" && lk_headless(); | ||
| let is_desktop = | ||
| (target_os == "linux" || target_os == "windows" || target_os == "macos") && !headless_linux; | ||
|
Comment on lines
+31
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When Useful? React with 👍 / 👎. |
||
|
|
||
| println!("cargo:rerun-if-env-changed=LK_DEBUG_WEBRTC"); | ||
| println!("cargo:rerun-if-env-changed=LK_CUSTOM_WEBRTC"); | ||
| println!("cargo:rerun-if-env-changed=LK_HEADLESS"); | ||
|
|
||
| let mut rust_files = vec![ | ||
| "src/peer_connection.rs", | ||
|
|
@@ -168,20 +175,22 @@ fn main() { | |
| println!("cargo:rustc-link-lib=dylib=pthread"); | ||
| println!("cargo:rustc-link-lib=dylib=m"); | ||
|
|
||
| // In order to avoid any ABI mismatches we use the sysroot's headers. | ||
| add_gio_headers(&mut builder); | ||
| if !headless_linux { | ||
| // In order to avoid any ABI mismatches we use the sysroot's headers. | ||
| add_gio_headers(&mut builder); | ||
|
|
||
| for lib_name in ["glib-2.0", "gobject-2.0", "gio-2.0"] { | ||
| pkg_config::probe_library(lib_name).unwrap(); | ||
| } | ||
| for lib_name in ["glib-2.0", "gobject-2.0", "gio-2.0"] { | ||
| pkg_config::probe_library(lib_name).unwrap(); | ||
| } | ||
|
|
||
| add_lazy_load_so( | ||
| &mut builder, | ||
| "desktop_capturer", | ||
| ["drm", "gbm", "X11", "Xfixes", "Xdamage", "Xrandr", "Xcomposite", "Xext"] | ||
| .map(String::from) | ||
| .to_vec(), | ||
| ); | ||
| add_lazy_load_so( | ||
| &mut builder, | ||
| "desktop_capturer", | ||
| ["drm", "gbm", "X11", "Xfixes", "Xdamage", "Xrandr", "Xcomposite", "Xext"] | ||
| .map(String::from) | ||
| .to_vec(), | ||
| ); | ||
| } | ||
|
|
||
| let x86 = target_arch == "x86_64" || target_arch == "i686"; | ||
| let arm = target_arch == "aarch64" || target_arch.contains("arm"); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adds a
glib-main-loopfeature toggle at thelivekitlevel, but thelibwebrtcdependency still uses its own default features, socargo build -p livekit --no-default-features -F tokiowill continue to enablelibwebrtc’s defaultglib-main-looppath. In practice, headless Linux builds still pull GLib transitively unlesslibwebrtcis declared withdefault-features = false, which means the new documented headless flow is not actually enforced by this feature wiring.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in the following commit