Unverified Commit 649265f5 authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

Merge pull request #216456 from linsui/jami

parents 1a4efa07 efe1c91c
Loading
Loading
Loading
Loading
+0 −77
Original line number Diff line number Diff line
{ version
, src
, jami-meta
, lib
, stdenv
, pkg-config
, cmake
, networkmanager # for libnm
, python3
, qttools # for translations
, wrapQtAppsHook
, ffmpeg_5
, jami-daemon
, libnotify
, qt5compat
, qtbase
, qtdeclarative
, qrencode
, qtmultimedia
, qtnetworkauth
, qtsvg
, qtwebengine
, qtwebchannel
, withWebengine ? true
}:

stdenv.mkDerivation {
  pname = "jami-client";
  inherit version src;

  sourceRoot = "source/client-qt";

  preConfigure = ''
    echo 'const char VERSION_STRING[] = "${version}";' > src/app/version.h
  '';

  nativeBuildInputs = [
    wrapQtAppsHook
    pkg-config
    cmake
    python3
    qttools
  ];

  buildInputs = [
    ffmpeg_5
    jami-daemon
    libnotify
    networkmanager
    qtbase
    qt5compat
    qrencode
    qtnetworkauth
    qtdeclarative
    qtmultimedia
    qtsvg
    qtwebchannel
  ] ++ lib.optionals withWebengine [
    qtwebengine
  ];

  cmakeFlags = [
    "-DLIBJAMI_INCLUDE_DIR=${jami-daemon}/include/jami"
    "-DLIBJAMI_XML_INTERFACES_DIR=${jami-daemon}/share/dbus-1/interfaces"
  ] ++ lib.optionals (!withWebengine) [
    "-DWITH_WEBENGINE=false"
  ];

  qtWrapperArgs = [
    # With wayland the titlebar is not themed and the wmclass is wrong.
    "--set-default QT_QPA_PLATFORM xcb"
  ];

  meta = jami-meta // {
    description = "The client based on QT" + jami-meta.description;
  };
}
+0 −89
Original line number Diff line number Diff line
{ src
, version
, jami-meta
, stdenv
, autoreconfHook
, pkg-config
, perl # for pod2man
, alsa-lib
, asio
, dbus
, dbus_cplusplus
, ffmpeg_5
, fmt
, gmp
, gnutls
, http-parser
, jack
, jsoncpp
, libarchive
, libgit2
, libnatpmp
, libpulseaudio
, libupnp
, yaml-cpp
, msgpack
, opendht-jami
, openssl
, pjsip-jami
, restinio
, secp256k1
, speex
, udev
, webrtc-audio-processing
, zlib
}:

stdenv.mkDerivation {
  pname = "jami-daemon";
  inherit src version;
  sourceRoot = "source/daemon";

  nativeBuildInputs = [
    autoreconfHook
    pkg-config
    perl
  ];

  buildInputs = [
    alsa-lib
    asio
    dbus
    dbus_cplusplus
    fmt
    ffmpeg_5
    gmp
    gnutls
    http-parser
    jack
    jsoncpp
    libarchive
    libgit2
    libnatpmp
    libpulseaudio
    libupnp
    yaml-cpp
    msgpack
    opendht-jami
    openssl
    pjsip-jami
    restinio
    secp256k1
    speex
    udev
    webrtc-audio-processing
    zlib
  ];

  doCheck = false; # The tests fail to compile due to missing headers.

  enableParallelBuilding = true;

  passthru = {
    updateScript = ./update.sh;
  };

  meta = jami-meta // {
    description = "The daemon" + jami-meta.description;
  };
}
+167 −51
Original line number Diff line number Diff line
{ stdenv
, lib
, callPackage
, pkg-config
, fetchFromGitLab
, gitUpdater
, ffmpeg_5

# for daemon
, autoreconfHook
, perl # for pod2man
, alsa-lib
, asio
, dbus
, dbus_cplusplus
, fmt
, gmp
, gnutls
, http-parser
, jack
, jsoncpp
, libarchive
, libgit2
, libnatpmp
, libpulseaudio
, libupnp
, yaml-cpp
, msgpack
, openssl
, restinio
, secp256k1
, speex
, udev
, webrtc-audio-processing
, zlib

# for client
, cmake
, networkmanager # for libnm
, python3
, qttools # for translations
, wrapQtAppsHook
, libnotify
, qt5compat
, qtbase
, qtdeclarative
, qrencode
, qtmultimedia
, qtnetworkauth
, qtsvg
, qtwebengine
, qtwebchannel
, withWebengine ? true

# for pjsip
, fetchFromGitHub
, fetchzip
, fetchpatch
, pjsip

# for opendht
, opendht
, jack
, udev
, qt6Packages
}:

let
  version = "20221220.0956.79e1207";

  src = fetchzip {
    url = "https://dl.jami.net/release/tarballs/jami_${version}.tar.gz";
    hash = "sha256-AQgz2GqueFG+yK42zJ9MzvP4BddGt0BFb+cIoA6Fif8=";

    stripRoot = false;
    postFetch = ''
      cd $out
      mv jami-project/daemon ./
      mv jami-project/client-qt ./
      mv jami-project/COPYING ./
      rm -r jami-project.rst jami-project
      rm daemon/contrib/tarballs/*
    '';
  };
  readLinesToList = with builtins; file: filter (s: isString s && stringLength s > 0) (split "\n" (readFile file));
in
stdenv.mkDerivation rec {
  pname = "jami";
  version = "20230206.0";

  jami-meta = with lib; {
    homepage = "https://jami.net/";
    description = " for Jami, the free and universal communication platform that respects the privacy and freedoms of its users";
    license = licenses.gpl3Plus;
    platforms = platforms.linux;
    maintainers = [ maintainers.linsui ];
  src = fetchFromGitLab {
    domain = "git.jami.net";
    owner = "savoirfairelinux";
    repo = "jami-client-qt";
    rev = "stable/${version}";
    hash = "sha256-MQ28UJUvgJoPk65neUgMrG+SxOcfnUl803urEFQ7468=";
    fetchSubmodules = true;
  };

  readLinesToList = with builtins; file: filter (s: isString s && stringLength s > 0) (split "\n" (readFile file));
in
rec {
  pjsip-jami = pjsip.overrideAttrs (old:
    let
      patch-src = src + "/daemon/contrib/src/pjproject/";
    in
    rec {
      version = "eae25732568e600d248aa8c226271ff6b81df170";
      version = "3b78ef1c48732d238ba284cdccb04dc6de79c54f";

      src = fetchFromGitHub {
        owner = "savoirfairelinux";
        repo = "pjproject";
        rev = version;
        sha256 = "sha256-N7jn4qen+PgFiVkTFi2HSWhx2QPHwAYMtnrpE/ptDVc=";
        hash = "sha256-hrm5tDM2jknU/gWMeO6/FhqOvay8bajFid39OiEtAAQ=";
      };

      patches = (map (x: patch-src + x) (readLinesToList ./config/pjsip_patches)) ++ [
        (fetchpatch {
          name = "CVE-2022-23537.patch";
          url = "https://github.com/pjsip/pjproject/commit/d8440f4d711a654b511f50f79c0445b26f9dd1e1.patch";
          sha256 = "sha256-7ueQCHIiJ7MLaWtR4+GmBc/oKaP+jmEajVnEYqiwLRA=";
        })
        (fetchpatch {
          name = "CVE-2022-23547.patch";
          url = "https://github.com/pjsip/pjproject/commit/bc4812d31a67d5e2f973fbfaf950d6118226cf36.patch";
          sha256 = "sha256-bpc8e8VAQpfyl5PX96G++6fzkFpw3Or1PJKNPKl7N5k=";
        })
      ];

      patchFlags = [ "-p1" "-l" ];
      patches = (map (x: patch-src + x) (readLinesToList ./config/pjsip_patches));

      configureFlags = (readLinesToList ./config/pjsip_args_common)
        ++ lib.optionals stdenv.isLinux (readLinesToList ./config/pjsip_args_linux);
@@ -78,11 +100,105 @@ rec {
    enablePushNotifications = true;
  };

  jami-daemon = callPackage ./daemon.nix {
    inherit version src udev jack jami-meta pjsip-jami opendht-jami;
  daemon = stdenv.mkDerivation {
    pname = "jami-daemon";
    inherit src version meta;
    sourceRoot = "source/daemon";

    nativeBuildInputs = [
      autoreconfHook
      pkg-config
      perl
    ];

    buildInputs = [
      alsa-lib
      asio
      dbus
      dbus_cplusplus
      fmt
      ffmpeg_5
      gmp
      gnutls
      http-parser
      jack
      jsoncpp
      libarchive
      libgit2
      libnatpmp
      libpulseaudio
      libupnp
      yaml-cpp
      msgpack
      opendht-jami
      openssl
      pjsip-jami
      restinio
      secp256k1
      speex
      udev
      webrtc-audio-processing
      zlib
    ];

    enableParallelBuilding = true;
  };

  preConfigure = ''
    echo 'const char VERSION_STRING[] = "${version}";' > src/app/version.h
  '';

  nativeBuildInputs = [
    wrapQtAppsHook
    pkg-config
    cmake
    python3
    qttools
  ];

  buildInputs = [
    daemon
    ffmpeg_5
    libnotify
    networkmanager
    qtbase
    qt5compat
    qrencode
    qtnetworkauth
    qtdeclarative
    qtmultimedia
    qtsvg
    qtwebchannel
  ] ++ lib.optionals withWebengine [
    qtwebengine
  ];

  cmakeFlags = [
    "-DLIBJAMI_INCLUDE_DIR=${daemon}/include/jami"
    "-DLIBJAMI_XML_INTERFACES_DIR=${daemon}/share/dbus-1/interfaces"
  ] ++ lib.optionals (!withWebengine) [
    "-DWITH_WEBENGINE=false"
  ];

  qtWrapperArgs = [
    # With wayland the titlebar is not themed and the wmclass is wrong.
    "--set-default QT_QPA_PLATFORM xcb"
  ];

  postInstall = ''
    # Make the jamid d-bus services available
    ln -s ${daemon}/share/dbus-1 $out/share
  '';

  passthru.updateScript = gitUpdater {
    rev-prefix = "stable/";
  };

  jami-client = qt6Packages.callPackage ./client.nix {
    inherit version src jami-meta;
  meta = with lib; {
    homepage = "https://jami.net/";
    description = "The free and universal communication platform that respects the privacy and freedoms of its users";
    license = licenses.gpl3Plus;
    platforms = platforms.linux;
    maintainers = [ maintainers.linsui ];
  };
}
+0 −61
Original line number Diff line number Diff line
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p coreutils curl gnused common-updater-scripts nix-prefetch

set -e

jami_dir=$(readlink -e $(dirname "${BASH_SOURCE[0]}"))

cd $jami_dir/../../../../..

# Update src version and hash
version=$(curl -s 'https://dl.jami.net/release/tarballs/?C=M;O=D' | sed -n -E 's/^.*jami_([0-9.a-f]+)\.tar\.gz.*$/\1/p' | head -n 1)
echo "Latest version: ${version}"

update-source-version jami-daemon "$version" --file=$jami_dir/default.nix

src=$(nix-build --no-out-link -A jami-daemon.src)

config_dir="$jami_dir/config"
mkdir -p $config_dir

ffmpeg_rules="${src}/daemon/contrib/src/ffmpeg/rules.mak"

# Update FFmpeg patches
ffmpeg_patches=$(sed -n '/^ffmpeg:/,/^$/p' ${ffmpeg_rules} | sed -n -E 's/.*ffmpeg\/(.*patch).*/\1/p')
echo -e "Patches for FFmpeg:\n${ffmpeg_patches}\n"
echo "${ffmpeg_patches}" > "$config_dir/ffmpeg_patches"

# Update FFmpeg args
ffmpeg_args_common=$(sed -n '/#disable everything/,/#platform specific options/p' ${ffmpeg_rules} | sed -n -E 's/.*(--[0-9a-z=_-]+).*/\1/p')
echo -e "Common args for FFmpeg:\n${ffmpeg_args_common}\n"
echo "${ffmpeg_args_common}" > "$config_dir/ffmpeg_args_common"

ffmpeg_args_linux1=$(sed -n '/ifdef HAVE_LINUX/,/ifdef HAVE_ANDROID/p' ${ffmpeg_rules} | sed -n -E 's/.*(--[0-9a-z=_-]+).*/\1/p')
ffmpeg_args_linux2=$(sed -n '/# Desktop Linux/,/i386 x86_64/p' ${ffmpeg_rules} | sed -n -E 's/.*(--[0-9a-z=_-]+).*/\1/p')
echo -e "Linux args for FFmpeg:\n${ffmpeg_args_linux1}\n${ffmpeg_args_linux2}\n"
echo "${ffmpeg_args_linux1}" > "$config_dir/ffmpeg_args_linux"
echo "${ffmpeg_args_linux2}" >> "$config_dir/ffmpeg_args_linux"

ffmpeg_args_x86=$(sed -n '/i386 x86_64/,/# End Desktop Linux:/p' ${ffmpeg_rules} | sed -n -E 's/.*(--[0-9a-z=_-]+).*/\1/p')
echo -e "x86 args for FFmpeg:\n${ffmpeg_args_x86}\n"
echo "${ffmpeg_args_x86}" > "$config_dir/ffmpeg_args_x86"

# Update pjsip patches
pjsip_patches=$(sed -n '/UNPACK/,/HAVE_ANDROID/p' ${src}/daemon/contrib/src/pjproject/rules.mak | sed -n -E 's/.*pjproject\/(00.*patch).*/\1/p')
echo -e "Patches for pjsip:\n${pjsip_patches}\n"
echo "${pjsip_patches}" > "$config_dir/pjsip_patches"

# Update pjsip version
pjsip_version=$(sed -n -E 's/.*PJPROJECT_VERSION := ([0-9a-f]+).*/\1/p' ${src}/daemon/contrib/src/pjproject/rules.mak)
update-source-version jami.pjsip-jami "$pjsip_version" --file=$jami_dir/default.nix

pjsip_rules="${src}/daemon/contrib/src/pjproject/rules.mak"

# Update pjsip args
pjsip_args_common=$(sed -n '/PJPROJECT_OPTIONS :=/,/with-gnutls/p' ${pjsip_rules} | sed -n -E 's/.*(--[0-9a-z=_-]+).*\\/\1/p')
echo -e "Common args for pjsip:\n${pjsip_args_common}\n"
echo "${pjsip_args_common}" > "$config_dir/pjsip_args_common"

pjsip_args_linux=$(sed -n '/HAVE_LINUX/,/endif/p' ${pjsip_rules} | sed -n -E 's/.*(--[0-9a-z=_-]+).*/\1/p')
echo -e "Linux args for pjsip:\n${pjsip_args_linux}\n"
echo "${pjsip_args_linux}" > "$config_dir/pjsip_args_linux"
+2 −0
Original line number Diff line number Diff line
@@ -695,6 +695,8 @@ mapAliases ({
  jack2Full = jack2; # moved from top-level 2021-03-14
  jami-client-gnome = throw "jami-client-gnome has been removed: abandoned upstream"; # Added 2022-05-15
  jami-client-qt = jami-client; # Added 2022-11-06
  jami-client = jami; # Added 2023-02-10
  jami-daemon = jami.daemon; # Added 2023-02-10
  jami-libclient = throw "jami-libclient has been removed: moved into jami-qt"; # Added 2022-07-29
  jamomacore = throw "jamomacore has been removed: abandoned upstream"; # Added 2020-11-21
  jbidwatcher = throw "jbidwatcher was discontinued in march 2021"; # Added 2021-03-15
Loading