diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/libcef')
-rw-r--r-- | nixpkgs/pkgs/development/libraries/libcef/default.nix | 125 | ||||
-rwxr-xr-x | nixpkgs/pkgs/development/libraries/libcef/update.sh | 25 |
2 files changed, 150 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/libcef/default.nix b/nixpkgs/pkgs/development/libraries/libcef/default.nix new file mode 100644 index 000000000000..d0a9092f6898 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/libcef/default.nix @@ -0,0 +1,125 @@ +{ lib +, stdenv +, fetchurl +, cmake +, glib +, nss +, nspr +, atk +, at-spi2-atk +, libdrm +, expat +, libxcb +, libxkbcommon +, libX11 +, libXcomposite +, libXdamage +, libXext +, libXfixes +, libXrandr +, mesa +, gtk3 +, pango +, cairo +, alsa-lib +, dbus +, at-spi2-core +, cups +, libxshmfence +, obs-studio +}: + +let + gl_rpath = lib.makeLibraryPath [ + stdenv.cc.cc.lib + ]; + + rpath = lib.makeLibraryPath [ + glib + nss + nspr + atk + at-spi2-atk + libdrm + expat + libxcb + libxkbcommon + libX11 + libXcomposite + libXdamage + libXext + libXfixes + libXrandr + mesa + gtk3 + pango + cairo + alsa-lib + dbus + at-spi2-core + cups + libxshmfence + ]; + platforms = { + "aarch64-linux" = { + platformStr = "linuxarm64"; + projectArch = "arm64"; + }; + "x86_64-linux" = { + platformStr = "linux64"; + projectArch = "x86_64"; + }; + }; + platforms."aarch64-linux".sha256 = "12sp58nxa3nv800badv62vpvc30hyb0ykywdaxgv9y8pswp9lq0z"; + platforms."x86_64-linux".sha256 = "0vzzwq1k6bv9d209yg3samvfnfwj7s58y9r3p3pd98wxa9iyzf4j"; + + platformInfo = builtins.getAttr stdenv.hostPlatform.system platforms; +in +stdenv.mkDerivation rec { + pname = "cef-binary"; + version = "117.2.4"; + gitRevision = "5053a95"; + chromiumVersion = "117.0.5938.150"; + + src = fetchurl { + url = "https://cef-builds.spotifycdn.com/cef_binary_${version}+g${gitRevision}+chromium-${chromiumVersion}_${platformInfo.platformStr}_minimal.tar.bz2"; + inherit (platformInfo) sha256; + }; + + nativeBuildInputs = [ cmake ]; + cmakeFlags = [ "-DPROJECT_ARCH=${platformInfo.projectArch}" ]; + makeFlags = [ "libcef_dll_wrapper" ]; + dontStrip = true; + dontPatchELF = true; + + installPhase = '' + mkdir -p $out/lib/ $out/share/cef/ + cp libcef_dll_wrapper/libcef_dll_wrapper.a $out/lib/ + cp ../Release/libcef.so $out/lib/ + cp ../Release/libEGL.so $out/lib/ + cp ../Release/libGLESv2.so $out/lib/ + patchelf --set-rpath "${rpath}" $out/lib/libcef.so + patchelf --set-rpath "${gl_rpath}" $out/lib/libEGL.so + patchelf --set-rpath "${gl_rpath}" $out/lib/libGLESv2.so + cp ../Release/*.bin $out/share/cef/ + cp -r ../Resources/* $out/share/cef/ + cp -r ../include $out/ + ''; + + passthru.tests = { + inherit obs-studio; # frequently breaks on CEF updates + }; + 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; [ puffnfresh ]; + sourceProvenance = with sourceTypes; [ + fromSource + binaryNativeCode + ]; + license = licenses.bsd3; + platforms = [ "x86_64-linux" "aarch64-linux" ]; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/libcef/update.sh b/nixpkgs/pkgs/development/libraries/libcef/update.sh new file mode 100755 index 000000000000..d11fd7193d6e --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/libcef/update.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p curl gnused jq + +set -x -eu -o pipefail + +cd $(dirname "${BASH_SOURCE[0]}") + +VERSION_JSON=$(curl --silent https://cef-builds.spotifycdn.com/index.json | jq '[.linux64.versions[] | select (.channel == "stable")][0]') + +CEF_VERSION=$(echo ${VERSION_JSON} | jq -r '.cef_version' | cut -d'+' -f1) +GIT_REVISION=$(echo ${VERSION_JSON} | jq -r '.cef_version' | cut -d'+' -f2 | cut -c 2-) +CHROMIUM_VERSION=$(echo ${VERSION_JSON} | jq -r '.chromium_version') + +SHA256_LINUX64=$(nix-prefetch-url --quiet https://cef-builds.spotifycdn.com/cef_binary_${CEF_VERSION}+g${GIT_REVISION}+chromium-${CHROMIUM_VERSION}_linux64_minimal.tar.bz2) +SHA256_LINUXARM64=$(nix-prefetch-url --quiet https://cef-builds.spotifycdn.com/cef_binary_${CEF_VERSION}+g${GIT_REVISION}+chromium-${CHROMIUM_VERSION}_linuxarm64_minimal.tar.bz2) + +setKV () { + sed -i "s|$1 = \".*\"|$1 = \"${2:-}\"|" ./default.nix +} + +setKV version ${CEF_VERSION} +setKV gitRevision ${GIT_REVISION} +setKV chromiumVersion ${CHROMIUM_VERSION} +setKV 'platforms."aarch64-linux".sha256' ${SHA256_LINUXARM64} +setKV 'platforms."x86_64-linux".sha256' ${SHA256_LINUX64} |