mirror of https://github.com/materusPL/Nixerus.git
obs-studio: change libcef to custom, remove swiftshader
This commit is contained in:
parent
672cac4c06
commit
ec4bffe6e5
|
@ -31,7 +31,6 @@
|
|||
, alsa-lib
|
||||
, pulseaudioSupport ? config.pulseaudio or stdenv.isLinux
|
||||
, libpulseaudio
|
||||
, libcef
|
||||
, pciutils
|
||||
, pipewireSupport ? stdenv.isLinux
|
||||
, pipewire
|
||||
|
@ -48,7 +47,9 @@
|
|||
, amf-headers
|
||||
, libGL
|
||||
, vulkan-loader
|
||||
, swiftshader
|
||||
, decklinkSupport ? false
|
||||
, blackmagic-desktop-video
|
||||
, libcef
|
||||
}:
|
||||
|
||||
let
|
||||
|
@ -109,7 +110,6 @@ stdenv.mkDerivation rec {
|
|||
libva
|
||||
srt
|
||||
qtwayland
|
||||
swiftshader
|
||||
]
|
||||
++ optionals scriptingSupport [ luajit python3 ]
|
||||
++ optional alsaSupport alsa-lib
|
||||
|
@ -118,22 +118,13 @@ stdenv.mkDerivation rec {
|
|||
|
||||
# Copied from the obs-linuxbrowser
|
||||
postUnpack = ''
|
||||
mkdir -p cef/Release cef/Resources cef/libcef_dll_wrapper/
|
||||
for i in ${libcef}/share/cef/*; do
|
||||
ln -s $i cef/Release/
|
||||
ln -s $i cef/Resources/
|
||||
done
|
||||
ln -s ${swiftshader}/lib/libvk_swiftshader.so cef/Release/
|
||||
ln -s ${libcef}/lib/libcef.so cef/Release/
|
||||
ln -s ${libcef}/lib/libcef_dll_wrapper.a cef/libcef_dll_wrapper/
|
||||
ln -s ${libcef}/include cef/
|
||||
cp -rs ${libcef}/share/cef cef
|
||||
'';
|
||||
|
||||
# obs attempts to dlopen libobs-opengl, it fails unless we make sure
|
||||
# DL_OPENGL is an explicit path. Not sure if there's a better way
|
||||
# to handle this.
|
||||
cmakeFlags = [
|
||||
#"-DCMAKE_CXX_FLAGS=-DDL_OPENGL=\\\"$(out)/lib/libobs-opengl.so\\\""
|
||||
"-DOBS_VERSION_OVERRIDE=${version}"
|
||||
"-Wno-dev" # kill dev warnings that are useless for packaging
|
||||
# Add support for browser source
|
||||
|
@ -144,14 +135,22 @@ stdenv.mkDerivation rec {
|
|||
|
||||
dontWrapGApps = true;
|
||||
|
||||
preFixup = ''
|
||||
rm $out/lib/obs-plugins/libcef.so
|
||||
rm $out/lib/obs-plugins/libvk_swiftshader.so
|
||||
|
||||
preFixup = let
|
||||
wrapperLibraries = [
|
||||
xorg.libX11
|
||||
libvlc
|
||||
] ++ optionals decklinkSupport [
|
||||
blackmagic-desktop-video
|
||||
];
|
||||
in
|
||||
''
|
||||
#Remove libs from libcef, they are symlinks and can't be patchelfed
|
||||
rm $out/lib/obs-plugins/libcef.so $out/lib/obs-plugins/libEGL.so $out/lib/obs-plugins/libGLESv2.so $out/lib/obs-plugins/libvk_swiftshader.so
|
||||
|
||||
#Suffix on libgl and vulkan-loader so it can be overriden by helper scripts from amdgpu-pro
|
||||
qtWrapperArgs+=(
|
||||
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ xorg.libX11 libvlc ]}"
|
||||
--prefix LD_LIBRARY_PATH : "$out/lib:${lib.makeLibraryPath wrapperLibraries}"
|
||||
--suffix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ libGL vulkan-loader ]}"
|
||||
--prefix LD_LIBRARY_PATH : "$out/lib"
|
||||
''${gappsWrapperArgs[@]}
|
||||
)
|
||||
'';
|
||||
|
@ -159,9 +158,16 @@ stdenv.mkDerivation rec {
|
|||
postFixup = lib.optionalString stdenv.isLinux ''
|
||||
addOpenGLRunpath $out/lib/lib*.so
|
||||
addOpenGLRunpath $out/lib/obs-plugins/*.so
|
||||
|
||||
##Symlink libcef related things after patchelfing
|
||||
ln -s ${libcef}/share/cef/Release/libcef.so $out/lib/obs-plugins/libcef.so
|
||||
|
||||
ln -s ${swiftshader}/lib/libvk_swiftshader.so $out/lib/obs-plugins/libvk_swiftshader.so
|
||||
ln -s ${libcef}/lib/libcef.so $out/lib/obs-plugins/libcef.so
|
||||
#OBS seems to need those to be from libcef for hardware acceleration (at least on AMD card)
|
||||
ln -s ${libcef}/share/cef/Release/libEGL.so $out/lib/obs-plugins/libEGL.so
|
||||
ln -s ${libcef}/share/cef/Release/libGLESv2.so $out/lib/obs-plugins/libGLESv2.so
|
||||
|
||||
#Doesn't seem needed but added anyway
|
||||
ln -s ${libcef}/share/cef/Release/libvk_swiftshader.so $out/lib/obs-plugins/libvk_swiftshader.so
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
|
|
|
@ -15,7 +15,7 @@ rec {
|
|||
VideoDecodeAcceleration VideoToolbox;
|
||||
};
|
||||
|
||||
obs-amf = pkgs.qt6Packages.callPackage ./apps/obs { ffmpeg = ffmpeg6-amf-full; inherit swiftshader;};
|
||||
obs-amf = pkgs.qt6Packages.callPackage ./apps/obs { ffmpeg = ffmpeg6-amf-full; inherit libcef;};
|
||||
|
||||
polymc = pkgs.qt6Packages.callPackage ./apps/games/polymc {};
|
||||
|
||||
|
@ -23,7 +23,7 @@ rec {
|
|||
|
||||
fbset = callPackage ./apps/fbset.nix {};
|
||||
|
||||
swiftshader = callPackage ./libs/swiftshader.nix {};
|
||||
libcef = callPackage ./libs/libcef.nix {};
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,130 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, fetchurl
|
||||
, cmake
|
||||
, glib
|
||||
, nss
|
||||
, nspr
|
||||
, atk
|
||||
, at-spi2-atk
|
||||
, libdrm
|
||||
, expat
|
||||
, mesa
|
||||
, gtk3
|
||||
, pango
|
||||
, cairo
|
||||
, alsa-lib
|
||||
, dbus
|
||||
, at-spi2-core
|
||||
, cups
|
||||
, libcef
|
||||
, libxkbcommon
|
||||
, xorg
|
||||
, zlib
|
||||
, openssl
|
||||
, wayland
|
||||
, systemd
|
||||
, pkgs
|
||||
}:
|
||||
|
||||
let
|
||||
vk_rpath = lib.makeLibraryPath [
|
||||
stdenv.cc.cc.lib
|
||||
xorg.libX11
|
||||
];
|
||||
gl_rpath = lib.makeLibraryPath [
|
||||
stdenv.cc.cc.lib
|
||||
];
|
||||
rpath = lib.makeLibraryPath [
|
||||
glib
|
||||
nss
|
||||
nspr
|
||||
atk
|
||||
at-spi2-atk
|
||||
libdrm
|
||||
expat
|
||||
xorg.libxcb
|
||||
libxkbcommon
|
||||
xorg.libX11
|
||||
xorg.libXcomposite
|
||||
xorg.libXdamage
|
||||
xorg.libXext
|
||||
xorg.libXfixes
|
||||
xorg.libXrandr
|
||||
mesa
|
||||
gtk3
|
||||
pango
|
||||
cairo
|
||||
alsa-lib
|
||||
dbus
|
||||
at-spi2-core
|
||||
cups
|
||||
xorg.libxshmfence
|
||||
];
|
||||
platforms = {
|
||||
"aarch64-linux" = {
|
||||
platformStr = "linuxarm64";
|
||||
projectArch = "arm64";
|
||||
};
|
||||
"x86_64-linux" = {
|
||||
platformStr = "linux64";
|
||||
projectArch = "x86_64";
|
||||
};
|
||||
};
|
||||
platforms."aarch64-linux".sha256 = "0c034h0hcsff4qmibizjn2ik5pq1jb4p6f0a4k6nrkank9m0x7ap";
|
||||
platforms."x86_64-linux".sha256 = "02pj4dgfswpaglxkmbd9970znixlv82wna4xxhwjh7i5ps24a0n6";
|
||||
|
||||
platformInfo = builtins.getAttr stdenv.targetPlatform.system platforms;
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "cef-binary";
|
||||
version = pkgs.libcef.version;
|
||||
src = pkgs.libcef.src;
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
cmakeFlags = [ "-DPROJECT_ARCH=${platformInfo.projectArch}" ];
|
||||
makeFlags = [ "libcef_dll_wrapper" ];
|
||||
dontStrip = true;
|
||||
dontPatchELF = true;
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/lib/ $out/share/cef/ $out/bin/
|
||||
cp -r ../Release $out/share/cef/
|
||||
cp -r ../Resources $out/share/cef/
|
||||
cp -r ../include $out/share/cef/
|
||||
|
||||
cp -r libcef_dll_wrapper $out/share/cef/
|
||||
|
||||
patchelf --set-rpath "$out/share/cef/Release/:${rpath}" $out/share/cef/Release/libcef.so
|
||||
patchelf --set-rpath "$out/share/cef/Release/:${gl_rpath}" $out/share/cef/Release/libEGL.so
|
||||
patchelf --set-rpath "$out/share/cef/Release/:${gl_rpath}" $out/share/cef/Release/libGLESv2.so
|
||||
patchelf --set-rpath "$out/share/cef/Release/:${vk_rpath}" $out/share/cef/Release/libvulkan.so.1
|
||||
patchelf --set-rpath "$out/share/cef/Release/:${vk_rpath}" $out/share/cef/Release/libvk_swiftshader.so
|
||||
|
||||
patchelf --set-rpath "$out/share/cef/Release/:${vk_rpath}" --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/share/cef/Release/chrome-sandbox
|
||||
|
||||
ln -s $out/share/cef/Release/chrome-sandbox $out/bin
|
||||
ln -s $out/share/cef/Release/libcef.so $out/lib
|
||||
ln -s $out/share/cef/libcef_dll_wrapper/libcef_dll_wrapper.a $out/lib/
|
||||
ln -s $out/share/cef/include $out/
|
||||
|
||||
sed -i "s#./libvk_swiftshader.so#$out/share/cef/Release/libvk_swiftshader.so#" $out/share/cef/Release/vk_swiftshader_icd.json
|
||||
|
||||
|
||||
|
||||
|
||||
'';
|
||||
passthru.updateScript = ./update.sh;
|
||||
|
||||
meta = with lib; {
|
||||
description = "Simple framework for embedding Chromium-based browsers in other applications";
|
||||
homepage = "https://cef-builds.spotifycdn.com/index.html";
|
||||
maintainers = with maintainers; [];
|
||||
sourceProvenance = with sourceTypes; [
|
||||
fromSource
|
||||
binaryNativeCode
|
||||
];
|
||||
license = licenses.bsd3;
|
||||
platforms = [ "x86_64-linux" "aarch64-linux" ];
|
||||
};
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
{ pkgs, lib, stdenv, fetchFromGitHub, cmake, python3 }:
|
||||
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "swiftshader";
|
||||
version = "03102023";
|
||||
src = fetchFromGitHub {
|
||||
owner = "google";
|
||||
repo = "SwiftShader";
|
||||
rev = "400ac3a175a658d8157f8a363271ae7ab013c2ee";
|
||||
sha256 = "sha256-t3XjGPY6CutpyIKolUjvprOkJjKCEfDmU7+x1Hmzpfg=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
buildInputs = [ cmake python3 ];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/lib
|
||||
mkdir -p $out/share/vulkan/icd.d
|
||||
install -Dm755 libvk_swiftshader.so $out/lib
|
||||
install -Dm644 Linux/vk_swiftshader_icd.json $out/share/vulkan/icd.d
|
||||
|
||||
sed -i "s#./libvk_swiftshader.so#$out/lib/libvk_swiftshader.so#" $out/share/vulkan/icd.d/vk_swiftshader_icd.json
|
||||
'';
|
||||
|
||||
|
||||
meta = with lib; {
|
||||
description = "SwiftShader is a high-performance CPU-based implementation of the Vulkan 1.3 graphics API";
|
||||
homepage = "https://swiftshader.googlesource.com/SwiftShader";
|
||||
license = licenses.asl20;
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue