1{ lib
2, stdenv
3, fetchurl
4, cmake
5, glib
6, nss
7, nspr
8, atk
9, at-spi2-atk
10, libdrm
11, expat
12, libxcb
13, libxkbcommon
14, libX11
15, libXcomposite
16, libXdamage
17, libXext
18, libXfixes
19, libXrandr
20, mesa
21, gtk3
22, pango
23, cairo
24, alsa-lib
25, dbus
26, at-spi2-core
27, cups
28, libxshmfence
29, obs-studio
30}:
31
32let
33 rpath = lib.makeLibraryPath [
34 glib
35 nss
36 nspr
37 atk
38 at-spi2-atk
39 libdrm
40 expat
41 libxcb
42 libxkbcommon
43 libX11
44 libXcomposite
45 libXdamage
46 libXext
47 libXfixes
48 libXrandr
49 mesa
50 gtk3
51 pango
52 cairo
53 alsa-lib
54 dbus
55 at-spi2-core
56 cups
57 libxshmfence
58 ];
59 platforms = {
60 "aarch64-linux" = {
61 platformStr = "linuxarm64";
62 projectArch = "arm64";
63 };
64 "x86_64-linux" = {
65 platformStr = "linux64";
66 projectArch = "x86_64";
67 };
68 };
69 platforms."aarch64-linux".sha256 = "0qn412iv3sl843vwx38c5wc9nwf0sx34a4x78qkdn17wjbrfjj79";
70 platforms."x86_64-linux".sha256 = "02vipzdcmq5cvpmra44r82z8y9d53yqpnymsc2mfk98fvkvgz2j9";
71
72 platformInfo = builtins.getAttr stdenv.targetPlatform.system platforms;
73in
74stdenv.mkDerivation rec {
75 pname = "cef-binary";
76 version = "112.3.0";
77 gitRevision = "b09c4ca";
78 chromiumVersion = "112.0.5615.165";
79
80 src = fetchurl {
81 url = "https://cef-builds.spotifycdn.com/cef_binary_${version}+g${gitRevision}+chromium-${chromiumVersion}_${platformInfo.platformStr}_minimal.tar.bz2";
82 inherit (platformInfo) sha256;
83 };
84
85 nativeBuildInputs = [ cmake ];
86 cmakeFlags = [ "-DPROJECT_ARCH=${platformInfo.projectArch}" ];
87 makeFlags = [ "libcef_dll_wrapper" ];
88 dontStrip = true;
89 dontPatchELF = true;
90
91 installPhase = ''
92 mkdir -p $out/lib/ $out/share/cef/
93 cp libcef_dll_wrapper/libcef_dll_wrapper.a $out/lib/
94 cp ../Release/libcef.so $out/lib/
95 patchelf --set-rpath "${rpath}" $out/lib/libcef.so
96 cp ../Release/*.bin $out/share/cef/
97 cp -r ../Resources/* $out/share/cef/
98 cp -r ../include $out/
99 '';
100
101 passthru.tests = {
102 inherit obs-studio; # frequently breaks on CEF updates
103 };
104 passthru.updateScript = ./update.sh;
105
106 meta = with lib; {
107 description = "Simple framework for embedding Chromium-based browsers in other applications";
108 homepage = "https://cef-builds.spotifycdn.com/index.html";
109 maintainers = with maintainers; [ puffnfresh ];
110 sourceProvenance = with sourceTypes; [
111 fromSource
112 binaryNativeCode
113 ];
114 license = licenses.bsd3;
115 platforms = [ "x86_64-linux" "aarch64-linux" ];
116 };
117}