Merge pull request #329823 from ExpidusOS/fix/pkgsllvm/elfutils
[NixPkgs.git] / pkgs / by-name / op / openvr / package.nix
blob7d309065df9ee5ed256bd9048be9bfbf587d23d3
1 { AppKit
2 , cmake
3 , fetchFromGitHub
4 , fetchpatch2
5 , Foundation
6 , jsoncpp
7 , lib
8 , libGL
9 , stdenv
10 , nix-update-script
13 stdenv.mkDerivation (finalAttrs: {
14   pname = "openvr";
15   version = "2.5.1";
17   src = fetchFromGitHub {
18     owner = "ValveSoftware";
19     repo = "openvr";
20     rev = "v${finalAttrs.version}";
21     hash = "sha256-bIKjZ7DvJVmDK386WgXaAFQrS0E1TNEUMhfQp7FNnvk=";
22   };
24   patches = [
25     # https://github.com/ValveSoftware/openvr/pull/594
26     (fetchpatch2 {
27       name = "use-correct-CPP11-definition-for-vsprintf_s.patch";
28       url = "https://github.com/ValveSoftware/openvr/commit/0fa21ba17748efcca1816536e27bdca70141b074.patch";
29       hash = "sha256-0sPNDx5qKqCzN35FfArbgJ0cTztQp+SMLsXICxneLx4=";
30     })
31     # https://github.com/ValveSoftware/openvr/pull/1716
32     (fetchpatch2 {
33       name = "add-ability-to-build-with-system-installed-jsoncpp.patch";
34       url = "https://github.com/ValveSoftware/openvr/commit/54a58e479f4d63e62e9118637cd92a2013a4fb95.patch";
35       hash = "sha256-aMojjbNjLvsGev0JaBx5sWuMv01sy2tG/S++I1NUi7U=";
36     })
37   ];
39   postUnpack = ''
40     # Move in-tree jsoncpp out to complement the patch above
41     # fetchpatch2 is not able to handle these renames
42     mkdir source/thirdparty
43     mv source/src/json source/thirdparty/jsoncpp
44   '';
46   nativeBuildInputs = [
47     cmake
48   ];
50   buildInputs = [
51     jsoncpp
52     libGL
53   ] ++ lib.optionals stdenv.isDarwin [
54     AppKit
55     Foundation
56   ];
58   cmakeFlags = [ "-DUSE_SYSTEM_JSONCPP=ON" "-DBUILD_SHARED=1" ];
60   passthru.updateScript = nix-update-script { };
62   meta = {
63     broken = stdenv.isDarwin;
64     description = "API and runtime that allows access to VR hardware from multiple vendors without requiring that applications have specific knowledge of the hardware they are targeting";
65     homepage = "https://github.com/ValveSoftware/openvr";
66     license = lib.licenses.bsd3;
67     maintainers = with lib.maintainers; [ Scrumplex ];
68     platforms = lib.platforms.unix;
69   };