Skip to content

Commit

Permalink
envision: autopatchelf after build
Browse files Browse the repository at this point in the history
  • Loading branch information
Pandapip1 committed Nov 6, 2024
1 parent cfe2415 commit 1497d98
Show file tree
Hide file tree
Showing 2 changed files with 181 additions and 37 deletions.
108 changes: 108 additions & 0 deletions pkgs/by-name/en/envision/autopatchelf.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
diff --git a/src/builders/build_basalt.rs b/src/builders/build_basalt.rs
index 237fc24..3c9c8ec 100644
--- a/src/builders/build_basalt.rs
+++ b/src/builders/build_basalt.rs
@@ -86,6 +86,13 @@ pub fn get_build_basalt_jobs(profile: &Profile, clean_build: bool) -> VecDeque<W
format!("{}/share/basalt/thirdparty", profile.prefix),
]),
));
+ jobs.push_back(WorkerJob::new_cmd(
+ None,
+ "autopatchelf".into(),
+ Some(vec![
+ build_dir.clone()
+ ]),
+ ));

jobs
}
diff --git a/src/builders/build_libsurvive.rs b/src/builders/build_libsurvive.rs
index 8ddd206..587de7f 100644
--- a/src/builders/build_libsurvive.rs
+++ b/src/builders/build_libsurvive.rs
@@ -60,6 +60,13 @@ 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,
+ "autopatchelf".into(),
+ Some(vec![
+ build_dir.clone()
+ ]),
+ ));

jobs
}
diff --git a/src/builders/build_monado.rs b/src/builders/build_monado.rs
index fb049c5..e21a764 100644
--- a/src/builders/build_monado.rs
+++ b/src/builders/build_monado.rs
@@ -68,6 +68,13 @@ 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,
+ "autopatchelf".into(),
+ Some(vec![
+ build_dir.clone()
+ ]),
+ ));

jobs
}
diff --git a/src/builders/build_opencomposite.rs b/src/builders/build_opencomposite.rs
index bf45567..9fe0264 100644
--- a/src/builders/build_opencomposite.rs
+++ b/src/builders/build_opencomposite.rs
@@ -43,6 +43,13 @@ 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,
+ "autopatchelf".into(),
+ Some(vec![
+ build_dir.clone()
+ ]),
+ ));

jobs
}
diff --git a/src/builders/build_openhmd.rs b/src/builders/build_openhmd.rs
index 5fe612c..5211229 100644
--- a/src/builders/build_openhmd.rs
+++ b/src/builders/build_openhmd.rs
@@ -55,6 +55,13 @@ pub fn get_build_openhmd_jobs(profile: &Profile, clean_build: bool) -> VecDeque<
}
jobs.push_back(cmake.get_build_job());
jobs.push_back(cmake.get_install_job());
+ jobs.push_back(WorkerJob::new_cmd(
+ None,
+ "autopatchelf".into(),
+ Some(vec![
+ build_dir.clone()
+ ]),
+ ));

jobs
}
diff --git a/src/builders/build_wivrn.rs b/src/builders/build_wivrn.rs
index 52bfb66..b28ab5c 100644
--- a/src/builders/build_wivrn.rs
+++ b/src/builders/build_wivrn.rs
@@ -52,6 +52,13 @@ 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,
+ "autopatchelf".into(),
+ Some(vec![
+ build_dir.clone()
+ ]),
+ ));

jobs
}
110 changes: 73 additions & 37 deletions pkgs/by-name/en/envision/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,32 @@
envision-unwrapped,
}:

buildFHSEnv {
name = "envision";

extraOutputsToInstall = [ "dev" ];

strictDeps = true;

# TODO: I'm pretty suspicious of this list of additonal required dependencies. Are they all really needed?
targetPkgs =
pkgs:
[ pkgs.envision-unwrapped ]
++ (with pkgs; [
stdenv.cc.libc
gcc
])
++ (
# OpenHMD dependencies
pkgs.openhmd.buildInputs ++ pkgs.openhmd.nativeBuildInputs
)
++ (
# OpenComposite dependencies
pkgs.opencomposite.buildInputs ++ pkgs.opencomposite.nativeBuildInputs
)
++ (
# Monado dependencies
let
runtimeBuildDeps =
pkgs':
with pkgs';
(
(
pkgs.monado.buildInputs
++ pkgs.monado.nativeBuildInputs
++ (with pkgs; [
# OpenHMD dependencies
openhmd.buildInputs ++ openhmd.nativeBuildInputs
)
++ (
# OpenComposite dependencies
opencomposite.buildInputs ++ opencomposite.nativeBuildInputs ++ [ boost ]
)
++ (
# Monado dependencies
monado.buildInputs
++ monado.nativeBuildInputs
++ [
# Additional dependencies required by Monado when built using Envision
mesa
shaderc
mesa # TODO: Does this really need "mesa-common-dev"?
xorg.libX11
xorg.libxcb
xorg.libXrandr
xorg.libXrender
xorg.xorgproto

# Additional dependencies required for Monado WMR support
bc
fmt
Expand All @@ -51,7 +40,17 @@ buildFHSEnv {
lz4.dev
tbb
libxkbcommon
])

# Not required for build, but autopatchelf requires them
glibc
SDL2
bluez
librealsense
onnxruntime
libusb1
libjpeg
libGL
]
)
)
++ (
Expand All @@ -63,13 +62,47 @@ buildFHSEnv {
++ pkgs.wivrn.nativeBuildInputs
++ (with pkgs; [
glib
avahi
cmake
cli11
ffmpeg
git
gst_all_1.gstreamer
gst_all_1.gst-plugins-base
libmd
ninja
])
++ (with pkgs; [
android-tools # For adb installing WiVRn APKs
])
);
nlohmann_json
openxr-loader
pipewire
systemdLibs # udev
vulkan-loader
vulkan-headers
x264
]
)
);
in
buildFHSEnv rec {
name = "envision";

extraOutputsToInstall = [
"dev"
"lib"
];

strictDeps = true;

targetPkgs =
pkgs':
[
(pkgs'.envision-unwrapped.overrideAttrs (oldAttrs: {
patches = (oldAttrs.patches or [ ]) ++ [ ./autopatchelf.patch ]; # Adds an envision build step to run autopatchelf
}))
pkgs'.autopatchelf
pkgs'.gcc
pkgs'.android-tools # For adb installing WiVRn APKs
]
++ (runtimeBuildDeps pkgs');

profile = ''
export CMAKE_LIBRARY_PATH=/usr/lib
Expand All @@ -81,7 +114,10 @@ buildFHSEnv {
ln -s ${envision-unwrapped}/share $out/share
'';

runScript = "envision";
# Putting libgcc.lib in runtimeBuildDeps causes error "ld: cannot find crt1.o: No such file or directory"
runScript = "env libs=${
lib.makeLibraryPath ((runtimeBuildDeps pkgs) ++ [ pkgs.libgcc.lib ])
} envision --skip-dependency-check";

meta = envision-unwrapped.meta // {
description = "${envision-unwrapped.meta.description} (with build environment)";
Expand Down

0 comments on commit 1497d98

Please sign in to comment.