From 5811e98c252d28390cfddf339341f43dff5d3127 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Mon, 30 Mar 2020 05:43:44 -0400
Subject: [PATCH 18/18] gnu: packages: linphone: Add linphone

* gnu/packages/linphone.scm (linphone): New variable.
---
 gnu/packages/linphone.scm | 107 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 106 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/linphone.scm b/gnu/packages/linphone.scm
index 9e113b531d..e2cd6de2f6 100644
--- a/gnu/packages/linphone.scm
+++ b/gnu/packages/linphone.scm
@@ -21,19 +21,25 @@
   #:use-module (gnu packages)
   #:use-module (gnu packages admin)
   #:use-module (gnu packages audio)
+  #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages documentation)
+  #:use-module (gnu packages gettext)
   #:use-module (gnu packages gl)
+  #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages graphviz)
+  #:use-module (gnu packages gtk)
   #:use-module (gnu packages image)
   #:use-module (gnu packages java)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages linux)
-  #:use-module (gnu packages pulseaudio)
+  #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages pth)
+  #:use-module (gnu packages pulseaudio)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages sqlite)
   #:use-module (gnu packages telephony)
   #:use-module (gnu packages tls)
@@ -492,3 +498,102 @@ transaction and dialog layers.  It is written in C, with an object-oriented
 API.  It also comprises a simple HTTP/HTTPS client implementation.")
  (home-page "https://gitlab.linphone.org/BC/public/belle-sip")
  (license license:gpl2+)))
+
+(define-public linphone
+ (package
+  (name "linphone")
+   (version "3.12.0")
+   (source
+    (origin
+     (method url-fetch)
+     (uri
+      (string-append "https://www.linphone.org/releases/sources/" name
+                     "/" name "-" version ".tar.gz"))
+     (sha256
+      (base32 "0phhkx55xdyg28d4wn8l8q4yvsmdgzmjiw584d4s190sq1azm91x"))
+     (patches
+      (list
+       ;; For csharp-wrapper's syntactical error.
+       (origin
+        (method url-fetch)
+        (uri
+         (string-append "https://gitlab.linphone.org/BC/public/liblinphone/commit/"
+                        "cb84ac9a36e1771b7e5112164355c939b858c353.diff"))
+        (file-name "csharp-wrapper.patch")
+        (sha256
+         (base32 "1iimwws2j5hcidj82kwzzp6v9nhmq8m5bbycl4szhm5ddlsl8lqf")))))))
+ (build-system cmake-build-system)
+ (arguments
+  `(#:tests? #f ; No test target
+    #:configure-flags
+     (list
+      (string-append "-DGTK2_GDKCONFIG_INCLUDE_DIR="
+       (string-append (assoc-ref %build-inputs "gtk2") "/lib/gtk-2.0/include"))
+      (string-append "-DGTK2_GLIBCONFIG_INCLUDE_DIR="
+       (string-append (assoc-ref %build-inputs "glib") "/lib/glib-2.0/include"))
+      "-DENABLE_SHARED=YES"
+      "-DENABLE_STATIC=YES"
+      "-DENABLE_CONSOLE_UI=YES"
+      "-DENABLE_DATE=YES"
+      "-DENABLE_DAEMON=YES"
+      "-DENABLE_DOC=YES"
+      "-DENABLE_JAVADOC=NO" ; Translation errors
+      "-DENABLE_GTK_UI=YES"
+      "-DENABLE_LDAP=YES"
+      "-DENABLE_SQLITE_STORAGE=YES"
+      "-DENABLE_LIME=YES"
+      "-DENABLE_NOTIFY=YES"
+      "-DENABLE_RELATIVE_PREFIX=YES"
+      "-DENABLE_STRICT=NO" ; -Werror=unused-but-set-variable
+      "-DENABLE_TOOLS=YES"
+      "-DENABLE_TUNNEL=NO" ; Not available
+      "-DENABLE_TUTORIALS=YES"
+      "-DENABLE_UNIT_TESTS=YES"
+      "-DENABLE_UPDATE_CHECK=YES"
+      "-DENABLE_VIDEO=YES"
+      "-DENABLE_ASSISTANT=YES"
+      "-DENABLE_DEBUG_LOGS=YES"
+      "-DENABLE_NLS=YES"
+      "-DENABLE_VCARD=YES"
+      "-DENABLE_ROOTCA_DOWNLOAD=YES"
+      "-DENABLE_CXX_WRAPPER=YES"
+      "-DENABLE_CSHARP_WRAPPER=ON")
+    #:phases
+     (modify-phases %standard-phases
+      (add-after 'unpack 'patch
+       (lambda _
+        (substitute* "gtk/main.c"
+         (("#include \"liblinphone_gitversion.h\"")
+          ""))
+        #t)))))
+ (native-inputs
+  `(("dot" ,graphviz)
+    ("doxygen" ,doxygen)
+    ("gettext" ,gettext-minimal)
+    ("iconv" ,libiconv)
+    ("intl" ,intltool)
+    ("python" ,python)
+    ("xml2" ,libxml2)
+    ("zlib" ,zlib)))
+ (inputs
+  `(("gtk2" ,gtk+-2)
+    ("glib" ,glib)
+    ("java" ,icedtea "jdk")
+    ("notify" ,libnotify)
+    ("pystache" ,python-pystache)
+    ("six" ,python-six)
+    ("sqlite" ,sqlite)
+    ("udev" ,eudev)))
+ (propagated-inputs
+  `(("bctoolbox" ,bctoolbox)
+    ("belcard" ,belcard)
+    ("bellesip" ,belle-sip)
+    ("bzrtp", bzrtp)
+    ("mediastreamer2" ,mediastreamer)
+    ("ortp" ,ortp)))
+ (synopsis "Belledonne Communications Softphone")
+ (description "Linphone is a softphone for voice and video over IP calling
+and instant messaging.  It is fully SIP-based, for all calling, presence
+and IM features.")
+ (home-page "https://linphone.org")
+ (license license:gpl2+)))
-- 
2.26.0

