asterisk: add support for open-source opus codec

main
Lorenz Brun 2 years ago
parent 2674e1469e
commit b71ff4c656
  1. 33
      pkgs/servers/asterisk/default.nix

@ -1,8 +1,10 @@
{ stdenv, lib, fetchurl, fetchsvn,
{ stdenv, lib, fetchurl, fetchsvn, fetchFromGitHub,
jansson, libedit, libxml2, libxslt, ncurses, openssl, sqlite,
util-linux, dmidecode, libuuid, newt,
lua, speex,
srtp, wget, curl, iksemel, pkg-config
lua, speex, libopus, opusfile, libogg,
srtp, wget, curl, iksemel, pkg-config,
autoconf, libtool, automake,
withOpus ? true,
}:
let
@ -13,8 +15,9 @@ let
buildInputs = [ jansson libedit libxml2 libxslt ncurses openssl sqlite
dmidecode libuuid newt
lua speex
srtp wget curl iksemel ];
nativeBuildInputs = [ util-linux pkg-config ];
srtp wget curl iksemel ]
++ lib.optionals withOpus [ libopus opusfile libogg ];
nativeBuildInputs = [ util-linux pkg-config autoconf libtool automake ];
patches = [
# We want the Makefile to install the default /var skeleton
@ -22,7 +25,7 @@ let
# This patch changes the runtime behavior to look for state
# directories in /var rather than ${out}/var.
./runtime-vardirs.patch
];
] ++ lib.optional withOpus "${asterisk-opus}/asterisk.patch";
postPatch = ''
echo "PJPROJECT_CONFIG_OPTS += --prefix=$out" >> third-party/pjproject/Makefile.rules
@ -49,6 +52,12 @@ let
${lib.optionalString (externals ? "addons/mp3") "bash contrib/scripts/get_mp3_source.sh || true"}
chmod -w externals_cache
${lib.optionalString withOpus ''
cp ${asterisk-opus}/include/asterisk/* ./include/asterisk
cp ${asterisk-opus}/codecs/* ./codecs
cp ${asterisk-opus}/formats/* ./formats
''}
./bootstrap.sh
'';
configureFlags = [
@ -63,6 +72,10 @@ let
${lib.optionalString (externals ? "addons/mp3") ''
substituteInPlace menuselect.makeopts --replace 'format_mp3 ' ""
''}
${lib.optionalString withOpus ''
substituteInPlace menuselect.makeopts --replace 'codec_opus_open_source ' ""
substituteInPlace menuselect.makeopts --replace 'format_ogg_opus_open_source ' ""
''}
'';
postInstall = ''
@ -90,6 +103,14 @@ let
sha256 = "1s9idx2miwk178sa731ig9r4fzx4gy1q8xazfqyd7q4lfd70s1cy";
};
asterisk-opus = fetchFromGitHub {
owner = "traud";
repo = "asterisk-opus";
# No releases, points to master as of 2022-04-06
rev = "a959f072d3f364be983dd27e6e250b038aaef747";
sha256 = "sha256-CASlTvTahOg9D5jccF/IN10LP/U8rRy9BFCSaHGQfCw=";
};
# auto-generated by update.py
versions = lib.mapAttrs (_: {version, sha256}: common {
inherit version sha256;

Loading…
Cancel
Save