at master 3.9 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 cmake, 6 glib, 7 nss, 8 nspr, 9 atk, 10 at-spi2-atk, 11 libdrm, 12 expat, 13 libxcb, 14 libxkbcommon, 15 libX11, 16 libXcomposite, 17 libXdamage, 18 libXext, 19 libXfixes, 20 libXrandr, 21 libgbm, 22 gtk3, 23 pango, 24 cairo, 25 alsa-lib, 26 dbus, 27 at-spi2-core, 28 cups, 29 libxshmfence, 30 libGL, 31 udev, 32 systemd, 33 obs-studio, 34 xorg, 35}: 36 37let 38 gl_rpath = lib.makeLibraryPath [ stdenv.cc.cc ]; 39 40 rpath = lib.makeLibraryPath [ 41 glib 42 nss 43 nspr 44 atk 45 at-spi2-atk 46 libdrm 47 expat 48 libxcb 49 libxkbcommon 50 libX11 51 libXcomposite 52 libXdamage 53 libXext 54 libXfixes 55 libXrandr 56 libgbm 57 gtk3 58 pango 59 cairo 60 alsa-lib 61 dbus 62 at-spi2-core 63 cups 64 libxshmfence 65 libGL 66 udev 67 systemd 68 xorg.libxcb 69 xorg.libX11 70 xorg.libXcomposite 71 xorg.libXdamage 72 xorg.libXext 73 xorg.libXfixes 74 xorg.libXrandr 75 xorg.libxshmfence 76 ]; 77 78 selectSystem = 79 attrs: 80 attrs.${stdenv.hostPlatform.system} or (throw "Unsupported system ${stdenv.hostPlatform.system}"); 81 82 platformInfo = selectSystem { 83 aarch64-linux = { 84 platformStr = "linuxarm64"; 85 projectArch = "arm64"; 86 }; 87 x86_64-linux = { 88 platformStr = "linux64"; 89 projectArch = "x86_64"; 90 }; 91 }; 92in 93stdenv.mkDerivation (finalAttrs: { 94 pname = "libcef"; 95 version = "140.1.14"; 96 gitRevision = "eb1c06e"; 97 chromiumVersion = "140.0.7339.185"; 98 buildType = "Release"; 99 100 srcHash = selectSystem { 101 aarch64-linux = "sha256-psgs+RcEYWKN4NneU4eVIaV2b7y+doxdPs9QWsN8dTA="; 102 x86_64-linux = "sha256-CDVzU+GIAU6hEutot90GMlAS8xEqD3uNLppgGq9d4mE="; 103 }; 104 105 src = fetchurl { 106 url = "https://cef-builds.spotifycdn.com/cef_binary_${finalAttrs.version}+g${finalAttrs.gitRevision}+chromium-${finalAttrs.chromiumVersion}_${platformInfo.platformStr}_minimal.tar.bz2"; 107 hash = finalAttrs.srcHash; 108 }; 109 110 nativeBuildInputs = [ cmake ]; 111 112 cmakeFlags = [ "-DPROJECT_ARCH=${platformInfo.projectArch}" ]; 113 114 makeFlags = [ "libcef_dll_wrapper" ]; 115 116 dontStrip = true; 117 118 dontPatchELF = true; 119 120 preInstall = '' 121 patchelf --set-rpath "${rpath}" --set-interpreter "${stdenv.cc.bintools.dynamicLinker}" ../${finalAttrs.buildType}/chrome-sandbox 122 patchelf --add-needed libudev.so --set-rpath "${rpath}" ../${finalAttrs.buildType}/libcef.so 123 patchelf --set-rpath "${gl_rpath}" ../${finalAttrs.buildType}/libEGL.so 124 patchelf --add-needed libGL.so.1 --set-rpath "${gl_rpath}" ../${finalAttrs.buildType}/libGLESv2.so 125 patchelf --set-rpath "${gl_rpath}" ../${finalAttrs.buildType}/libvk_swiftshader.so 126 patchelf --set-rpath "${gl_rpath}" ../${finalAttrs.buildType}/libvulkan.so.1 127 ''; 128 129 installPhase = '' 130 runHook preInstall 131 132 mkdir -p $out/lib/ $out/share/cef/ $out/libexec/cef/ 133 cp libcef_dll_wrapper/libcef_dll_wrapper.a $out/lib/ 134 cp ../${finalAttrs.buildType}/libcef.so $out/lib/ 135 cp ../${finalAttrs.buildType}/libEGL.so $out/lib/ 136 cp ../${finalAttrs.buildType}/libGLESv2.so $out/lib/ 137 cp ../${finalAttrs.buildType}/libvk_swiftshader.so $out/lib/ 138 cp ../${finalAttrs.buildType}/libvulkan.so.1 $out/lib/ 139 cp ../${finalAttrs.buildType}/chrome-sandbox $out/libexec/cef/ 140 cp ../${finalAttrs.buildType}/*.bin ../${finalAttrs.buildType}/*.json $out/share/cef/ 141 cp -r ../Resources/* $out/share/cef/ 142 cp -r ../include $out/ 143 144 runHook postInstall 145 ''; 146 147 passthru = { 148 updateScript = ./update.sh; 149 tests = { 150 inherit obs-studio; # frequently breaks on CEF updates 151 }; 152 }; 153 154 meta = { 155 description = "Simple framework for embedding Chromium-based browsers in other applications"; 156 homepage = "https://cef-builds.spotifycdn.com/index.html"; 157 maintainers = with lib.maintainers; [ puffnfresh ]; 158 sourceProvenance = with lib.sourceTypes; [ 159 fromSource 160 binaryNativeCode 161 ]; 162 license = lib.licenses.bsd3; 163 platforms = [ 164 "x86_64-linux" 165 "aarch64-linux" 166 ]; 167 }; 168})