about summary refs log tree commit diff
path: root/pkgs/applications/networking
diff options
context:
space:
mode:
authorBob van der Linden <bobvanderlinden@gmail.com>2023-02-01 15:38:11 +0100
committerBob van der Linden <bobvanderlinden@gmail.com>2023-02-11 21:42:55 +0100
commitcbff2010dec85ec733dd243b077a25b9f09ab20e (patch)
treeb0691b2fb4b76b1a3e6817da7e6180795aac6658 /pkgs/applications/networking
parentfab09085df1b60d6a0870c8a89ce26d5a4a708c2 (diff)
pjsip: add pythonSupport option
Diffstat (limited to 'pkgs/applications/networking')
-rw-r--r--pkgs/applications/networking/pjsip/default.nix17
1 files changed, 17 insertions, 0 deletions
diff --git a/pkgs/applications/networking/pjsip/default.nix b/pkgs/applications/networking/pjsip/default.nix
index eae9a8a3d87a0..781b8462a3927 100644
--- a/pkgs/applications/networking/pjsip/default.nix
+++ b/pkgs/applications/networking/pjsip/default.nix
@@ -4,8 +4,11 @@
 , fetchpatch
 , openssl
 , libsamplerate
+, swig
 , alsa-lib
 , AppKit
+, python3
+, pythonSupport ? true
 }:
 
 stdenv.mkDerivation rec {
@@ -33,6 +36,9 @@ stdenv.mkDerivation rec {
     })
   ];
 
+  nativeBuildInputs =
+    lib.optionals pythonSupport [ swig python3 ];
+
   buildInputs = [ openssl libsamplerate ]
     ++ lib.optional stdenv.isLinux alsa-lib
     ++ lib.optional stdenv.isDarwin AppKit;
@@ -41,11 +47,22 @@ stdenv.mkDerivation rec {
     export LD=$CC
   '';
 
+  postBuild = lib.optionalString pythonSupport ''
+    make -C pjsip-apps/src/swig/python
+  '';
+
+  outputs = [ "out" ]
+    ++ lib.optional pythonSupport "py";
+
   postInstall = ''
     mkdir -p $out/bin
     cp pjsip-apps/bin/pjsua-* $out/bin/pjsua
     mkdir -p $out/share/${pname}-${version}/samples
     cp pjsip-apps/bin/samples/*/* $out/share/${pname}-${version}/samples
+  '' + lib.optionalString pythonSupport ''
+    (cd pjsip-apps/src/swig/python && \
+      python setup.py install --prefix=$py
+    )
   '';
 
   # We need the libgcc_s.so.1 loadable (for pthread_cancel to work)