2021-07-04 02:40:35 +00:00
|
|
|
{ fetchFromGitHub, stdenv, lib, pkg-config, autoreconfHook
|
2020-04-24 23:36:52 +00:00
|
|
|
, ncurses, gnutls, readline
|
2020-11-19 00:13:47 +00:00
|
|
|
, openssl, perl, sqlite, libjpeg, speex, pcre, libuuid
|
2020-04-24 23:36:52 +00:00
|
|
|
, ldns, libedit, yasm, which, libsndfile, libtiff
|
|
|
|
|
2020-06-18 07:06:33 +00:00
|
|
|
, callPackage
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
, SystemConfiguration
|
|
|
|
|
|
|
|
, modules ? null
|
2020-05-15 21:57:56 +00:00
|
|
|
, nixosTests
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
2020-06-18 07:06:33 +00:00
|
|
|
availableModules = callPackage ./modules.nix { };
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# the default list from v1.8.7, except with applications/mod_signalwire also disabled
|
|
|
|
defaultModules = mods: with mods; [
|
|
|
|
applications.commands
|
|
|
|
applications.conference
|
|
|
|
applications.db
|
|
|
|
applications.dptools
|
|
|
|
applications.enum
|
|
|
|
applications.esf
|
|
|
|
applications.expr
|
|
|
|
applications.fifo
|
|
|
|
applications.fsv
|
|
|
|
applications.hash
|
|
|
|
applications.httapi
|
|
|
|
applications.sms
|
|
|
|
applications.spandsp
|
|
|
|
applications.valet_parking
|
|
|
|
applications.voicemail
|
|
|
|
|
|
|
|
applications.curl
|
|
|
|
|
|
|
|
codecs.amr
|
|
|
|
codecs.b64
|
|
|
|
codecs.g723_1
|
|
|
|
codecs.g729
|
|
|
|
codecs.h26x
|
|
|
|
codecs.opus
|
|
|
|
|
|
|
|
databases.mariadb
|
|
|
|
databases.pgsql
|
|
|
|
|
|
|
|
dialplans.asterisk
|
|
|
|
dialplans.xml
|
|
|
|
|
|
|
|
endpoints.loopback
|
|
|
|
endpoints.rtc
|
|
|
|
endpoints.skinny
|
|
|
|
endpoints.sofia
|
|
|
|
endpoints.verto
|
|
|
|
|
|
|
|
event_handlers.cdr_csv
|
|
|
|
event_handlers.cdr_sqlite
|
|
|
|
event_handlers.event_socket
|
|
|
|
|
|
|
|
formats.local_stream
|
|
|
|
formats.native_file
|
|
|
|
formats.png
|
|
|
|
formats.sndfile
|
|
|
|
formats.tone_stream
|
|
|
|
|
|
|
|
languages.lua
|
|
|
|
|
|
|
|
loggers.console
|
|
|
|
loggers.logfile
|
|
|
|
loggers.syslog
|
|
|
|
|
|
|
|
say.en
|
|
|
|
|
|
|
|
xml_int.cdr
|
|
|
|
xml_int.rpc
|
|
|
|
xml_int.scgi
|
|
|
|
] ++ lib.optionals stdenv.isLinux [ endpoints.gsmopen ];
|
|
|
|
|
|
|
|
enabledModules = (if modules != null then modules else defaultModules) availableModules;
|
|
|
|
|
|
|
|
modulesConf = let
|
|
|
|
lst = builtins.map (mod: mod.path) enabledModules;
|
|
|
|
str = lib.strings.concatStringsSep "\n" lst;
|
|
|
|
in builtins.toFile "modules.conf" str;
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "freeswitch";
|
2021-07-04 02:40:35 +00:00
|
|
|
version = "1.10.6";
|
2020-04-24 23:36:52 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "signalwire";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2021-07-04 02:40:35 +00:00
|
|
|
sha256 = "1i5n06pds3kvzhhzfwvhwxnvcb2p2fcr8k52157aplm2i7prl4q2";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2020-11-19 00:13:47 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postPatch = ''
|
|
|
|
patchShebangs libs/libvpx/build/make/rtcd.pl
|
|
|
|
substituteInPlace libs/libvpx/build/make/configure.sh \
|
|
|
|
--replace AS=\''${AS} AS=yasm
|
2020-06-18 07:06:33 +00:00
|
|
|
|
|
|
|
# Disable advertisement banners
|
|
|
|
for f in src/include/cc.h libs/esl/src/include/cc.h; do
|
|
|
|
{
|
|
|
|
echo 'const char *cc = "";'
|
|
|
|
echo 'const char *cc_s = "";'
|
|
|
|
} > $f
|
|
|
|
done
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-07-04 02:40:35 +00:00
|
|
|
strictDeps = true;
|
|
|
|
nativeBuildInputs = [ pkg-config autoreconfHook perl which yasm ];
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [
|
2021-07-04 02:40:35 +00:00
|
|
|
openssl ncurses gnutls readline libjpeg
|
|
|
|
sqlite pcre speex ldns libedit
|
2020-04-24 23:36:52 +00:00
|
|
|
libsndfile libtiff
|
2020-11-19 00:13:47 +00:00
|
|
|
libuuid
|
2020-04-24 23:36:52 +00:00
|
|
|
]
|
|
|
|
++ lib.unique (lib.concatMap (mod: mod.inputs) enabledModules)
|
|
|
|
++ lib.optionals stdenv.isDarwin [ SystemConfiguration ];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
NIX_CFLAGS_COMPILE = "-Wno-error";
|
|
|
|
|
|
|
|
hardeningDisable = [ "format" ];
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
./bootstrap.sh
|
|
|
|
cp "${modulesConf}" modules.conf
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
# helper for compiling modules... not generally useful; also pulls in perl dependency
|
|
|
|
rm "$out"/bin/fsxs
|
|
|
|
# include configuration templates
|
|
|
|
cp -r conf $out/share/freeswitch/
|
|
|
|
'';
|
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
passthru.tests.freeswitch = nixosTests.freeswitch;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = {
|
|
|
|
description = "Cross-Platform Scalable FREE Multi-Protocol Soft Switch";
|
|
|
|
homepage = "https://freeswitch.org/";
|
2021-01-15 22:18:51 +00:00
|
|
|
license = lib.licenses.mpl11;
|
|
|
|
maintainers = with lib.maintainers; [ misuzu ];
|
|
|
|
platforms = with lib.platforms; unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|