diff options
author | Lorenz Brun <lorenz@brun.one> | 2022-04-06 20:28:12 +0200 |
---|---|---|
committer | Lorenz Brun <lorenz@brun.one> | 2022-04-08 13:23:11 +0200 |
commit | b71ff4c656321c2a771b0453a21418ddc0d6d8f2 (patch) | |
tree | 858772fb5878f722e7a9431f0c50c829988b3ed2 /pkgs/servers/asterisk | |
parent | 2674e1469e1bd4e4b70d34e813ea7200dc446df5 (diff) |
asterisk: add support for open-source opus codec
Diffstat (limited to 'pkgs/servers/asterisk')
-rw-r--r-- | pkgs/servers/asterisk/default.nix | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/pkgs/servers/asterisk/default.nix b/pkgs/servers/asterisk/default.nix index ab309612788f8..eb8560a98b354 100644 --- a/pkgs/servers/asterisk/default.nix +++ b/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; |