mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-10-14 08:31:40 +03:00
pjsip: add darwin support (#220884)
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
This commit is contained in:
parent
d84f153212
commit
27e8a2b86c
@ -7,10 +7,13 @@
|
|||||||
, swig
|
, swig
|
||||||
, alsa-lib
|
, alsa-lib
|
||||||
, AppKit
|
, AppKit
|
||||||
|
, CoreFoundation
|
||||||
|
, Security
|
||||||
, python3
|
, python3
|
||||||
, pythonSupport ? true
|
, pythonSupport ? true
|
||||||
|
, pjsip
|
||||||
|
, runCommand
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "pjsip";
|
pname = "pjsip";
|
||||||
version = "2.13";
|
version = "2.13";
|
||||||
@ -41,21 +44,23 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
buildInputs = [ openssl libsamplerate ]
|
buildInputs = [ openssl libsamplerate ]
|
||||||
++ lib.optional stdenv.isLinux alsa-lib
|
++ lib.optional stdenv.isLinux alsa-lib
|
||||||
++ lib.optional stdenv.isDarwin AppKit;
|
++ lib.optionals stdenv.isDarwin [ AppKit CoreFoundation Security ];
|
||||||
|
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
export LD=$CC
|
export LD=$CC
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
NIX_CFLAGS_LINK = lib.optionalString stdenv.isDarwin "-headerpad_max_install_names";
|
||||||
|
|
||||||
postBuild = lib.optionalString pythonSupport ''
|
postBuild = lib.optionalString pythonSupport ''
|
||||||
make -C pjsip-apps/src/swig/python
|
make -C pjsip-apps/src/swig/python
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
configureFlags = [ "--enable-shared" ];
|
||||||
|
|
||||||
outputs = [ "out" ]
|
outputs = [ "out" ]
|
||||||
++ lib.optional pythonSupport "py";
|
++ lib.optional pythonSupport "py";
|
||||||
|
|
||||||
configureFlags = [ "--enable-shared" ];
|
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
cp pjsip-apps/bin/pjsua-* $out/bin/pjsua
|
cp pjsip-apps/bin/pjsua-* $out/bin/pjsua
|
||||||
@ -65,13 +70,44 @@ stdenv.mkDerivation rec {
|
|||||||
(cd pjsip-apps/src/swig/python && \
|
(cd pjsip-apps/src/swig/python && \
|
||||||
python setup.py install --prefix=$py
|
python setup.py install --prefix=$py
|
||||||
)
|
)
|
||||||
|
'' + lib.optionalString stdenv.isDarwin ''
|
||||||
|
# On MacOS relative paths are used to refer to libraries. All libraries use
|
||||||
|
# a relative path like ../lib/*.dylib or ../../lib/*.dylib. We need to
|
||||||
|
# rewrite these to use absolute ones.
|
||||||
|
|
||||||
|
# First, find all libraries (and their symlinks) in our outputs to define
|
||||||
|
# the install_name_tool -change arguments we should pass.
|
||||||
|
readarray -t libraries < <(
|
||||||
|
for outputName in $(getAllOutputNames); do
|
||||||
|
find "''${!outputName}" \( -name '*.dylib*' -o -name '*.so*' \)
|
||||||
|
done
|
||||||
|
)
|
||||||
|
|
||||||
|
# Determine the install_name_tool -change arguments that are going to be
|
||||||
|
# applied to all libraries.
|
||||||
|
change_args=()
|
||||||
|
for lib in "''${libraries[@]}"; do
|
||||||
|
lib_name="$(basename $lib)"
|
||||||
|
change_args+=(-change ../lib/$lib_name $lib)
|
||||||
|
change_args+=(-change ../../lib/$lib_name $lib)
|
||||||
|
done
|
||||||
|
|
||||||
|
# Rewrite id and library refences for all non-symlinked libraries.
|
||||||
|
for lib in "''${libraries[@]}"; do
|
||||||
|
if [ -f "$lib" ]; then
|
||||||
|
install_name_tool -id $lib "''${change_args[@]}" $lib
|
||||||
|
fi
|
||||||
|
done
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# We need the libgcc_s.so.1 loadable (for pthread_cancel to work)
|
# We need the libgcc_s.so.1 loadable (for pthread_cancel to work)
|
||||||
dontPatchELF = true;
|
dontPatchELF = true;
|
||||||
|
|
||||||
|
passthru.tests.python-pjsua2 = runCommand "python-pjsua2" { } ''
|
||||||
|
${(python3.withPackages (pkgs: [ pkgs.pjsua2 ])).interpreter} -c "import pjsua2" > $out
|
||||||
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
broken = stdenv.isDarwin;
|
|
||||||
description = "A multimedia communication library written in C, implementing standard based protocols such as SIP, SDP, RTP, STUN, TURN, and ICE";
|
description = "A multimedia communication library written in C, implementing standard based protocols such as SIP, SDP, RTP, STUN, TURN, and ICE";
|
||||||
homepage = "https://pjsip.org/";
|
homepage = "https://pjsip.org/";
|
||||||
license = licenses.gpl2Plus;
|
license = licenses.gpl2Plus;
|
||||||
|
@ -38568,8 +38568,8 @@ with pkgs;
|
|||||||
|
|
||||||
physlock = callPackage ../misc/screensavers/physlock { };
|
physlock = callPackage ../misc/screensavers/physlock { };
|
||||||
|
|
||||||
pjsip = callPackage ../applications/networking/pjsip {
|
pjsip = darwin.apple_sdk_11_0.callPackage ../applications/networking/pjsip {
|
||||||
inherit (darwin.apple_sdk.frameworks) AppKit;
|
inherit (darwin.apple_sdk_11_0.frameworks) AppKit CoreFoundation Security;
|
||||||
};
|
};
|
||||||
|
|
||||||
pounce = callPackage ../servers/pounce { };
|
pounce = callPackage ../servers/pounce { };
|
||||||
|
Loading…
Reference in New Issue
Block a user