Commit 7469f463 authored by OPNA2608's avatar OPNA2608
Browse files

sofia_sip: Modernise

- rec -> finalAttrs
- src.sha256 -> src.hash
- drop meta-wide "with lib"
- correct license to LGPL 2.1+
- use patch url with full indices, known issue with fetchpatch2
- add pkg-config information + test
- add passthru.updateScript
parent e8611845
Loading
Loading
Loading
Loading
+25 −9
Original line number Diff line number Diff line
@@ -3,6 +3,8 @@
  stdenv,
  fetchFromGitHub,
  fetchpatch2,
  gitUpdater,
  testers,
  autoconf,
  automake,
  check,
@@ -14,23 +16,23 @@
  zlib,
}:

stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
  pname = "sofia-sip";
  version = "1.13.17";

  src = fetchFromGitHub {
    owner = "freeswitch";
    repo = "sofia-sip";
    rev = "v${version}";
    sha256 = "sha256-7QmK2UxEO5lC0KBDWB3bwKTy0Nc7WrdTLjoQYzezoaY=";
    rev = "v${finalAttrs.version}";
    hash = "sha256-7QmK2UxEO5lC0KBDWB3bwKTy0Nc7WrdTLjoQYzezoaY=";
  };

  patches = [
    # Fix build with gcc 14 from https://github.com/freeswitch/sofia-sip/pull/249
    (fetchpatch2 {
      name = "sofia-sip-fix-incompatible-pointer-type.patch";
      url = "https://github.com/freeswitch/sofia-sip/commit/46b02f0655af0a9594e805f09a8ee99278f84777.diff";
      hash = "sha256-4uZVtKnXG+BPW8byjd7tu4uEZo9SYq9EzTEvMwG0Bak=";
      url = "https://github.com/freeswitch/sofia-sip/commit/46b02f0655af0a9594e805f09a8ee99278f84777.patch?full_index=1";
      hash = "sha256-bZzjg7GBxR2wSlPH81krZRCK43OirGLWH/lrLRZ0L0k=";
    })

    # Disable some failing tests
@@ -85,11 +87,25 @@ stdenv.mkDerivation rec {

  doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;

  meta = with lib; {
  passthru = {
    tests.pkg-config = testers.hasPkgConfigModules {
      package = finalAttrs.finalPackage;
      versionCheck = true;
    };
    updateScript = gitUpdater {
      rev-prefix = "v";
    };
  };

  meta = {
    description = "Open-source SIP User-Agent library, compliant with the IETF RFC3261 specification";
    homepage = "https://github.com/freeswitch/sofia-sip";
    platforms = platforms.unix;
    license = licenses.lgpl2;
    platforms = lib.platforms.unix;
    license = lib.licenses.lgpl2Plus;
    teams = [ lib.teams.ngi ];
    pkgConfigModules = [
      "sofia-sip-ua"
      "sofia-sip-ua-glib"
    ];
  };
}
})