libcef: 121.3.13 -> 135.0.21

This commit is contained in:
emaryn
2025-04-10 03:15:57 +08:00
committed by emaryn
parent 61d4bed1a0
commit 437a1c75d6
2 changed files with 111 additions and 61 deletions

View File

@@ -27,13 +27,15 @@
at-spi2-core,
cups,
libxshmfence,
libGL,
udev,
systemd,
obs-studio,
xorg,
}:
let
gl_rpath = lib.makeLibraryPath [
stdenv.cc.cc
];
gl_rpath = lib.makeLibraryPath [ stdenv.cc.cc ];
rpath = lib.makeLibraryPath [
glib
@@ -60,77 +62,107 @@ let
at-spi2-core
cups
libxshmfence
libGL
udev
systemd
xorg.libxcb
xorg.libX11
xorg.libXcomposite
xorg.libXdamage
xorg.libXext
xorg.libXfixes
xorg.libXrandr
xorg.libxshmfence
];
platforms = {
"aarch64-linux" = {
selectSystem =
attrs:
attrs.${stdenv.hostPlatform.system} or (throw "Unsupported system ${stdenv.hostPlatform.system}");
platformInfo = selectSystem {
aarch64-linux = {
platformStr = "linuxarm64";
projectArch = "arm64";
};
"x86_64-linux" = {
x86_64-linux = {
platformStr = "linux64";
projectArch = "x86_64";
};
};
platforms."aarch64-linux".sha256 = "16sbfk599h96wcsmpbxlwsvq0n1pssmm8dpwmjsqfrn1464dvs68";
platforms."x86_64-linux".sha256 = "1wa4nv28saz96kar9svdarfz6c4rnbcqz0rqxzl9zclnhfzhqdiw";
platformInfo =
platforms.${stdenv.hostPlatform.system}
or (throw "unsupported system ${stdenv.hostPlatform.system}");
in
stdenv.mkDerivation rec {
pname = "cef-binary";
version = "121.3.13";
gitRevision = "5c4a81b";
chromiumVersion = "121.0.6167.184";
stdenv.mkDerivation (finalAttrs: {
pname = "libcef";
version = "135.0.21";
gitRevision = "d008a99";
chromiumVersion = "135.0.7049.96";
buildType = "Release";
srcHash = selectSystem {
aarch64-linux = "sha256-+rQKfNTlRGdkDuxn72vTwZ/13UNDbqF6I5bzHjMuCsE=";
x86_64-linux = "sha256-bnyZfgw6h/mkOfnwCUBKbZrwlKVcQ/i3lYoHp2Rw6To=";
};
src = fetchurl {
url = "https://cef-builds.spotifycdn.com/cef_binary_${version}+g${gitRevision}+chromium-${chromiumVersion}_${platformInfo.platformStr}_minimal.tar.bz2";
inherit (platformInfo) sha256;
url = "https://cef-builds.spotifycdn.com/cef_binary_${finalAttrs.version}+g${finalAttrs.gitRevision}+chromium-${finalAttrs.chromiumVersion}_${platformInfo.platformStr}_minimal.tar.bz2";
hash = finalAttrs.srcHash;
};
nativeBuildInputs = [ cmake ];
cmakeFlags = [ "-DPROJECT_ARCH=${platformInfo.projectArch}" ];
makeFlags = [ "libcef_dll_wrapper" ];
dontStrip = true;
dontPatchELF = true;
installPhase = ''
mkdir -p $out/lib/ $out/share/cef/ $out/libexec/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/
cp ../Release/libvk_swiftshader.so $out/lib/
cp ../Release/libvulkan.so.1 $out/lib/
cp ../Release/chrome-sandbox $out/libexec/cef/
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
patchelf --set-rpath "${gl_rpath}" $out/lib/libvk_swiftshader.so
patchelf --set-rpath "${gl_rpath}" $out/lib/libvulkan.so.1
cp ../Release/*.bin ../Release/*.json $out/share/cef/
cp -r ../Resources/* $out/share/cef/
cp -r ../include $out/
preInstall = ''
patchelf --set-rpath "${rpath}" --set-interpreter "${stdenv.cc.bintools.dynamicLinker}" ../${finalAttrs.buildType}/chrome-sandbox
patchelf --add-needed libudev.so --set-rpath "${rpath}" ../${finalAttrs.buildType}/libcef.so
patchelf --set-rpath "${gl_rpath}" ../${finalAttrs.buildType}/libEGL.so
patchelf --add-needed libGL.so.1 --set-rpath "${gl_rpath}" ../${finalAttrs.buildType}/libGLESv2.so
patchelf --set-rpath "${gl_rpath}" ../${finalAttrs.buildType}/libvk_swiftshader.so
patchelf --set-rpath "${gl_rpath}" ../${finalAttrs.buildType}/libvulkan.so.1
'';
passthru.tests = {
inherit obs-studio; # frequently breaks on CEF updates
};
passthru.updateScript = ./update.sh;
installPhase = ''
runHook preInstall
meta = with lib; {
mkdir -p $out/lib/ $out/share/cef/ $out/libexec/cef/
cp libcef_dll_wrapper/libcef_dll_wrapper.a $out/lib/
cp ../${finalAttrs.buildType}/libcef.so $out/lib/
cp ../${finalAttrs.buildType}/libEGL.so $out/lib/
cp ../${finalAttrs.buildType}/libGLESv2.so $out/lib/
cp ../${finalAttrs.buildType}/libvk_swiftshader.so $out/lib/
cp ../${finalAttrs.buildType}/libvulkan.so.1 $out/lib/
cp ../${finalAttrs.buildType}/chrome-sandbox $out/libexec/cef/
cp ../${finalAttrs.buildType}/*.bin ../${finalAttrs.buildType}/*.json $out/share/cef/
cp -r ../Resources/* $out/share/cef/
cp -r ../include $out/
runHook postInstall
'';
passthru = {
updateScript = ./update.sh;
tests = {
inherit obs-studio; # frequently breaks on CEF updates
};
};
meta = {
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; [
maintainers = with lib.maintainers; [ puffnfresh ];
sourceProvenance = with lib.sourceTypes; [
fromSource
binaryNativeCode
];
license = licenses.bsd3;
license = lib.licenses.bsd3;
platforms = [
"x86_64-linux"
"aarch64-linux"
];
};
}
})

View File

@@ -1,25 +1,43 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl gnused jq
#!nix-shell -i bash -p curl gnused jq common-updater-scripts
set -x -eu -o pipefail
set -euo pipefail
cd $(dirname "${BASH_SOURCE[0]}")
current_version=$(nix-instantiate --eval -E "with import ./. {}; libcef.version or (lib.getVersion libcef)" | tr -d '"')
VERSION_JSON=$(curl --silent https://cef-builds.spotifycdn.com/index.json | jq '[.linux64.versions[] | select (.channel == "stable")][0]')
ROOT="$(dirname "$(realpath "${BASH_SOURCE[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')
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)
echo "Latest version: $cef_version"
echo "Current version: $current_version"
setKV () {
sed -i "s|$1 = \".*\"|$1 = \"${2:-}\"|" ./default.nix
if [[ "$cef_version" == "$current_version" ]]; then
echo "Package is up-to-date"
exit 0
fi
update_nix_value() {
local key="$1"
local value="${2:-}"
sed -i "s|$key = \".*\"|$key = \"$value\"|" $ROOT/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}
update_nix_value version "$cef_version"
update_nix_value gitRevision "$git_revision"
update_nix_value chromiumVersion "$chromium_version"
declare -a platforms=(
"x86_64-linux 64"
"aarch64-linux arm64"
)
for platform in "${platforms[@]}"; do
read -r system arch <<< "$platform"
url="https://cef-builds.spotifycdn.com/cef_binary_${cef_version}+g${git_revision}+chromium-${chromium_version}_linux${arch}_minimal.tar.bz2"
hash=$(nix hash convert --to sri --hash-algo sha256 "$(nix-prefetch-url --quiet "$url")")
update-source-version libcef "$cef_version" "$hash" --system="$system" --ignore-same-version
done