depot/third_party/nixpkgs/pkgs/servers/sunshine/libcbs.nix
Default email 83405b6dd2 Project import generated by Copybara.
GitOrigin-RevId: ac718d02867a84b42522a0ece52d841188208f2c
2023-03-15 17:39:30 +01:00

48 lines
1.4 KiB
Nix

{ stdenv
, fetchFromGitHub
, cmake
, nasm
}:
stdenv.mkDerivation {
pname = "libcbs";
version = "unstable-2022-02-07";
src = fetchFromGitHub {
owner = "LizardByte";
repo = "build-deps";
# repo is not versioned -- used latest commit combined with sunshine release
rev = "d6e889188ca10118d769ee1ee3cddf9cf485642b";
fetchSubmodules = true;
sha256 = "sha256-6xQDJey5JrZXyZxS/yhUBvFi6UD5MsQ3uVtUFrG09Vc=";
};
nativeBuildInputs = [
cmake
nasm
];
# modify paths to allow patches to be applied directly by derivation
prePatch = ''
substituteInPlace ffmpeg_patches/cbs/* \
--replace 'a/libavcodec' 'a/ffmpeg_sources/ffmpeg/libavcodec' \
--replace 'b/libavcodec' 'b/ffmpeg_sources/ffmpeg/libavcodec' \
--replace 'a/libavutil' 'a/ffmpeg_sources/ffmpeg/libavutil' \
--replace 'b/libavutil' 'b/ffmpeg_sources/ffmpeg/libavutil'
substituteInPlace cmake/ffmpeg_cbs.cmake \
--replace '--enable-static' '--enable-shared --enable-pic' \
--replace 'add_library(cbs' 'add_library(cbs SHARED' \
--replace 'libcbs.a' 'libcbs.so'
'';
patches = [
"ffmpeg_patches/cbs/01-explicit-intmath.patch"
"ffmpeg_patches/cbs/02-include-cbs-config.patch"
"ffmpeg_patches/cbs/03-remove-register.patch"
"ffmpeg_patches/cbs/04-size-specifier.patch"
];
CFLAGS = [
"-Wno-format-security"
];
}