-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
envision: autopatchelf after build (#359156)
- Loading branch information
Showing
4 changed files
with
321 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# OpenXR in NixOS | ||
|
||
OpenXR is a standard for eXtended Reality (XR) applications and drivers (providers). | ||
|
||
OpenXR runtime providers must ensure that the library path of the runtime's shared library can be loaded by Nix applications. If your OpenXR runtime provider runs in an FHSEnv, this means you may have to use `auto-patchelf` to link dependencies to the Nix store. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,205 @@ | ||
diff --git a/src/builders/build_basalt.rs b/src/builders/build_basalt.rs | ||
index e67e081..9ae1966 100644 | ||
--- a/src/builders/build_basalt.rs | ||
+++ b/src/builders/build_basalt.rs | ||
@@ -6,6 +6,7 @@ use crate::{ | ||
util::file_utils::rm_rf, | ||
}; | ||
use std::collections::{HashMap, VecDeque}; | ||
+use std::env; | ||
|
||
pub fn get_build_basalt_jobs(profile: &Profile, clean_build: bool) -> VecDeque<WorkerJob> { | ||
let mut jobs = VecDeque::<WorkerJob>::new(); | ||
@@ -101,6 +102,21 @@ pub fn get_build_basalt_jobs(profile: &Profile, clean_build: bool) -> VecDeque<W | ||
.to_string(), | ||
]), | ||
)); | ||
+ jobs.push_back(WorkerJob::new_cmd( | ||
+ None, | ||
+ "auto-patchelf".into(), | ||
+ Some( | ||
+ [ | ||
+ vec![ | ||
+ "--ignore-existing", | ||
+ "--paths".into(), | ||
+ build_dir.into_os_string().into_string().unwrap(), | ||
+ "--libs".into(), | ||
+ ], | ||
+ env::var("libs").unwrap_or_default().split(":").map(|s| s.to_string()).collect(), | ||
+ ].concat() | ||
+ ), | ||
+ )); | ||
|
||
jobs | ||
} | ||
diff --git a/src/builders/build_libsurvive.rs b/src/builders/build_libsurvive.rs | ||
index b4b0dc3..69871d4 100644 | ||
--- a/src/builders/build_libsurvive.rs | ||
+++ b/src/builders/build_libsurvive.rs | ||
@@ -9,6 +9,7 @@ use std::{ | ||
collections::{HashMap, VecDeque}, | ||
path::Path, | ||
}; | ||
+use std::env; | ||
|
||
pub fn get_build_libsurvive_jobs(profile: &Profile, clean_build: bool) -> VecDeque<WorkerJob> { | ||
let mut jobs = VecDeque::<WorkerJob>::new(); | ||
@@ -71,6 +72,21 @@ pub fn get_build_libsurvive_jobs(profile: &Profile, clean_build: bool) -> VecDeq | ||
} | ||
jobs.push_back(cmake.get_build_job()); | ||
jobs.push_back(cmake.get_install_job()); | ||
+ jobs.push_back(WorkerJob::new_cmd( | ||
+ None, | ||
+ "auto-patchelf".into(), | ||
+ Some( | ||
+ [ | ||
+ vec![ | ||
+ "--ignore-existing", | ||
+ "--paths".into(), | ||
+ build_dir.into_os_string().into_string().unwrap(), | ||
+ "--libs".into(), | ||
+ ], | ||
+ env::var("libs").unwrap_or_default().split(":").map(|s| s.to_string()).collect(), | ||
+ ].concat() | ||
+ ), | ||
+ )); | ||
|
||
jobs | ||
} | ||
diff --git a/src/builders/build_monado.rs b/src/builders/build_monado.rs | ||
index f379d6f..5710add 100644 | ||
--- a/src/builders/build_monado.rs | ||
+++ b/src/builders/build_monado.rs | ||
@@ -9,6 +9,7 @@ use std::{ | ||
collections::{HashMap, VecDeque}, | ||
path::Path, | ||
}; | ||
+use std::env; | ||
|
||
pub fn get_build_monado_jobs(profile: &Profile, clean_build: bool) -> VecDeque<WorkerJob> { | ||
let mut jobs = VecDeque::<WorkerJob>::new(); | ||
@@ -83,6 +84,21 @@ pub fn get_build_monado_jobs(profile: &Profile, clean_build: bool) -> VecDeque<W | ||
} | ||
jobs.push_back(cmake.get_build_job()); | ||
jobs.push_back(cmake.get_install_job()); | ||
+ jobs.push_back(WorkerJob::new_cmd( | ||
+ None, | ||
+ "auto-patchelf".into(), | ||
+ Some( | ||
+ [ | ||
+ vec![ | ||
+ "--ignore-existing", | ||
+ "--paths".into(), | ||
+ build_dir.into_os_string().into_string().unwrap(), | ||
+ "--libs".into(), | ||
+ ], | ||
+ env::var("libs").unwrap_or_default().split(":").map(|s| s.to_string()).collect(), | ||
+ ].concat() | ||
+ ), | ||
+ )); | ||
|
||
jobs | ||
} | ||
diff --git a/src/builders/build_opencomposite.rs b/src/builders/build_opencomposite.rs | ||
index 631b69f..72e8a73 100644 | ||
--- a/src/builders/build_opencomposite.rs | ||
+++ b/src/builders/build_opencomposite.rs | ||
@@ -9,6 +9,7 @@ use std::{ | ||
collections::{HashMap, VecDeque}, | ||
path::Path, | ||
}; | ||
+use std::env; | ||
|
||
pub fn get_build_opencomposite_jobs(profile: &Profile, clean_build: bool) -> VecDeque<WorkerJob> { | ||
let mut jobs = VecDeque::<WorkerJob>::new(); | ||
@@ -48,6 +49,21 @@ pub fn get_build_opencomposite_jobs(profile: &Profile, clean_build: bool) -> Vec | ||
jobs.push_back(cmake.get_prepare_job()); | ||
} | ||
jobs.push_back(cmake.get_build_job()); | ||
+ jobs.push_back(WorkerJob::new_cmd( | ||
+ None, | ||
+ "auto-patchelf".into(), | ||
+ Some( | ||
+ [ | ||
+ vec![ | ||
+ "--ignore-existing", | ||
+ "--paths".into(), | ||
+ build_dir.into_os_string().into_string().unwrap(), | ||
+ "--libs".into(), | ||
+ ], | ||
+ env::var("libs").unwrap_or_default().split(":").map(|s| s.to_string()).collect(), | ||
+ ].concat() | ||
+ ), | ||
+ )); | ||
|
||
jobs | ||
} | ||
diff --git a/src/builders/build_openhmd.rs b/src/builders/build_openhmd.rs | ||
index 1157eca..534a895 100644 | ||
--- a/src/builders/build_openhmd.rs | ||
+++ b/src/builders/build_openhmd.rs | ||
@@ -3,6 +3,7 @@ use crate::{ | ||
util::file_utils::rm_rf, | ||
}; | ||
use std::{collections::VecDeque, path::Path}; | ||
+use std::env; | ||
|
||
pub fn get_build_openhmd_jobs(profile: &Profile, clean_build: bool) -> VecDeque<WorkerJob> { | ||
let mut jobs = VecDeque::<WorkerJob>::new(); | ||
@@ -80,6 +81,22 @@ pub fn get_build_openhmd_jobs(profile: &Profile, clean_build: bool) -> VecDeque< | ||
"install".into(), | ||
]), | ||
)); | ||
+ // autopatchelf job | ||
+ jobs.push_back(WorkerJob::new_cmd( | ||
+ None, | ||
+ "auto-patchelf".into(), | ||
+ Some( | ||
+ [ | ||
+ vec![ | ||
+ "--ignore-existing", | ||
+ "--paths".into(), | ||
+ build_dir.into_os_string().into_string().unwrap(), | ||
+ "--libs".into(), | ||
+ ], | ||
+ env::var("libs").unwrap_or_default().split(":").map(|s| s.to_string()).collect(), | ||
+ ].concat() | ||
+ ), | ||
+ )); | ||
|
||
jobs | ||
} | ||
diff --git a/src/builders/build_wivrn.rs b/src/builders/build_wivrn.rs | ||
index f2a415d..a160186 100644 | ||
--- a/src/builders/build_wivrn.rs | ||
+++ b/src/builders/build_wivrn.rs | ||
@@ -9,6 +9,7 @@ use std::{ | ||
collections::{HashMap, VecDeque}, | ||
path::Path, | ||
}; | ||
+use std::env; | ||
|
||
pub fn get_build_wivrn_jobs(profile: &Profile, clean_build: bool) -> VecDeque<WorkerJob> { | ||
let mut jobs = VecDeque::<WorkerJob>::new(); | ||
@@ -60,6 +61,21 @@ pub fn get_build_wivrn_jobs(profile: &Profile, clean_build: bool) -> VecDeque<Wo | ||
} | ||
jobs.push_back(cmake.get_build_job()); | ||
jobs.push_back(cmake.get_install_job()); | ||
+ jobs.push_back(WorkerJob::new_cmd( | ||
+ None, | ||
+ "auto-patchelf".into(), | ||
+ Some( | ||
+ [ | ||
+ vec![ | ||
+ "--no-add-existing", | ||
+ "--paths".into(), | ||
+ build_dir.into_os_string().into_string().unwrap(), | ||
+ "--libs".into(), | ||
+ ], | ||
+ env::var("libs").unwrap_or_default().split(":").map(|s| s.to_string()).collect(), | ||
+ ].concat() | ||
+ ), | ||
+ )); | ||
|
||
jobs | ||
} |
Oops, something went wrong.