Unverified Commit 2d6a3502 authored by Weijia Wang's avatar Weijia Wang Committed by GitHub
Browse files

viber: 23.2.0.3 -> 24.9.0.3 (#438633)

parents cef7b5a1 c54604e2
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -17,6 +17,11 @@ stdenv.mkDerivation (finalAttrs: {
    hash = "sha256-2YJDADh/WCksAEIjngAdji98YGmwjpvxSBZkxAwFc7k=";
  };

  patches = [
    # CMake 4 dropped support of versions lower than 3.5
    ./tslib-1.23-cmake4.patch
  ];

  nativeBuildInputs = [ cmake ];

  passthru.updateScript = nix-update-script { };
+11 −0
Original line number Diff line number Diff line
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,7 @@
 #
 #
 
-cmake_minimum_required(VERSION 3.3)
+cmake_minimum_required(VERSION 3.10)
 
 project(tslib LANGUAGES C)
 
 No newline at end of file
+74 −36
Original line number Diff line number Diff line
{
  fetchurl,
  lib,
  stdenv,
  fetchurl,
  dpkg,
  makeWrapper,
  alsa-lib,
  bintools,
  brotli,
  cairo,
  cups,
  curl,
  dbus,
@@ -13,53 +15,73 @@
  fontconfig,
  freetype,
  glib,
  gsm,
  gst_all_1,
  harfbuzz,
  lcms,
  libbluray,
  libcap,
  libdrm,
  libevent,
  libgbm,
  libGL,
  libGLU,
  libkrb5,
  libmng,
  libopenmpt,
  libopus,
  libpulseaudio,
  librsvg,
  libtheora,
  libtiff,
  libva,
  libvdpau,
  libwebp,
  libxkbcommon,
  libxkbfile,
  libxml2,
  libxslt,
  libwebp,
  libgbm,
  mtdev,
  nspr,
  nss,
  numactl,
  ocl-icd,
  openjpeg,
  openssl,
  snappy,
  systemd,
  speex,
  systemdLibs,
  tslib,
  twolame,
  wavpack,
  wayland,
  xorg,
  xvidcore,
  zlib,
  zstd,
  zvbi,
}:

stdenv.mkDerivation {
stdenv.mkDerivation (finalAttrs: {
  pname = "viber";
  version = "23.2.0.3";
  version = "24.9.0.3";

  src = fetchurl {
    # Taking Internet Archive snapshot of a specific version to avoid breakage
    # on new versions
    url = "https://web.archive.org/web/20240824071651/https://download.cdn.viber.com/cdn/desktop/Linux/viber.deb";
    hash = "sha256-9WHiI2WlsgEhCPkrQoAunmF6lSb2n5RgQJ2+sdnSShM=";
    url = "https://web.archive.org/web/20250830135453/https://download.cdn.viber.com/cdn/desktop/Linux/viber.deb";
    hash = "sha256-i7fG8Sdl/v5QAyTsCh6OKe4BDYnQ0jBJgSdqMOrkLNo=";
  };

  nativeBuildInputs = [ makeWrapper ];

  buildInputs = [ dpkg ];

  dontUnpack = true;
  nativeBuildInputs = [
    dpkg
    makeWrapper
  ];

  libPath = lib.makeLibraryPath [
    alsa-lib
    brotli
    cairo
    cups
    curl
    dbus
@@ -67,37 +89,53 @@ stdenv.mkDerivation {
    fontconfig
    freetype
    glib
    gsm
    gst_all_1.gst-plugins-bad
    gst_all_1.gst-plugins-base
    gst_all_1.gst-plugins-good
    gst_all_1.gstreamer
    harfbuzz
    lcms
    libbluray
    libcap
    libdrm
    libevent
    libGLU
    libgbm
    libGL
    libGLU
    libkrb5
    libmng
    libopenmpt
    libopus
    libpulseaudio
    librsvg
    libtheora
    libtiff
    libva
    libvdpau
    libwebp
    libxkbcommon
    libxkbfile
    libxml2
    libxslt
    libwebp
    libgbm
    mtdev
    nspr
    nss
    numactl
    ocl-icd
    openjpeg
    openssl
    snappy
    speex
    stdenv.cc.cc
    systemd
    systemdLibs
    tslib
    twolame
    wavpack
    wayland
    zlib
    zstd

    xorg.libICE
    xorg.libSM
    xorg.libX11
    xorg.libxcb
    xorg.libXcomposite
    xorg.libXcursor
    xorg.libXdamage
@@ -108,44 +146,45 @@ stdenv.mkDerivation {
    xorg.libXrender
    xorg.libXScrnSaver
    xorg.libXtst
    xorg.libxcb
    xorg.xcbutilimage
    xorg.xcbutilkeysyms
    xorg.xcbutilrenderutil
    xorg.xcbutilwm
    xvidcore
    zlib
    zstd
    zvbi
  ];

  installPhase = ''
    dpkg-deb -x $src $out
    mkdir -p $out/bin
    runHook preInstall

    # Soothe nix-build "suspicions"
    chmod -R g-w $out
    cp -r . $out

    for file in $(find $out -type f \( -perm /0111 -o -name \*.so\* \) ); do
      patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$file" || true
      patchelf --set-rpath $libPath:$out/opt/viber/lib:$out/lib $file || true
      patchelf --set-interpreter ${bintools.dynamicLinker} "$file" || true
      patchelf --set-rpath ${finalAttrs.libPath}:$out/opt/viber/lib $file || true
    done

    mkdir $out/bin
    # qt.conf is not working, so override everything using environment variables
    wrapProgram $out/opt/viber/Viber \
    makeWrapper $out/opt/viber/Viber $out/bin/viber \
      --set QT_QPA_PLATFORM "xcb" \
      --set QT_PLUGIN_PATH "$out/opt/viber/plugins" \
      --set QT_XKB_CONFIG_ROOT "${xorg.xkeyboardconfig}/share/X11/xkb" \
      --set QTCOMPOSE "${xorg.libX11.out}/share/X11/locale" \
      --set QML2_IMPORT_PATH "$out/opt/viber/qml"
    ln -s $out/opt/viber/Viber $out/bin/viber

    mv $out/usr/share $out/share
    rm -rf $out/usr

    # Fix the desktop link
    substituteInPlace $out/share/applications/viber.desktop \
      --replace /opt/viber/Viber $out/opt/viber/Viber \
      --replace /usr/share/ $out/share/

      --replace-fail "/opt/viber/" "$out/opt/viber/"
    # Fix libxml2 breakage. See https://github.com/NixOS/nixpkgs/pull/396195#issuecomment-2881757108
    mkdir -p "$out/lib"
    ln -s "${lib.getLib libxml2}/lib/libxml2.so" "$out/opt/viber/lib/libxml2.so.2"

    runHook postInstall
  '';

  dontStrip = true;
@@ -159,5 +198,4 @@ stdenv.mkDerivation {
    platforms = [ "x86_64-linux" ];
    maintainers = with lib.maintainers; [ jagajaga ];
  };

}
})