nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 SDL2,
3 alsa-lib,
4 cairo,
5 celt,
6 cmake,
7 fetchFromGitHub,
8 ffmpeg,
9 glib,
10 gsm,
11 gst_all_1,
12 gtk3,
13 lib,
14 libre,
15 librem,
16 libsndfile,
17 libuuid,
18 libv4l,
19 libvpx,
20 mpg123,
21 openssl,
22 pipewire,
23 pkg-config,
24 portaudio,
25 spandsp3,
26 speex,
27 srtp,
28 stdenv,
29 zlib,
30 dbusSupport ? true,
31}:
32
33stdenv.mkDerivation (finalAttrs: {
34 version = "4.4.0";
35 pname = "baresip";
36
37 src = fetchFromGitHub {
38 owner = "baresip";
39 repo = "baresip";
40 rev = "v${finalAttrs.version}";
41 hash = "sha256-/4XFuOKE/VCIkue9QGwNK/MxkeBU8XoyfLPZd6WAuNg=";
42 };
43
44 patches = [
45 ./fix-modules-path.patch
46 ];
47
48 prePatch = ''
49 substituteInPlace cmake/FindGTK3.cmake --replace-fail GTK3_CFLAGS_OTHER ""
50 ''
51 + lib.optionalString (!dbusSupport) ''
52 substituteInPlace cmake/modules.cmake --replace-fail 'list(APPEND MODULES ctrl_dbus)' ""
53 '';
54
55 nativeBuildInputs = [
56 cmake
57 pkg-config
58 ];
59 buildInputs = [
60 SDL2
61 alsa-lib
62 cairo
63 celt
64 ffmpeg
65 gsm
66 gtk3
67 libre
68 librem
69 libsndfile
70 libuuid
71 libv4l
72 libvpx
73 mpg123
74 openssl
75 pipewire
76 portaudio
77 spandsp3
78 speex
79 srtp
80 zlib
81 ]
82 ++ (with gst_all_1; [
83 gstreamer
84 gst-libav
85 gst-plugins-base
86 gst-plugins-bad
87 gst-plugins-good
88 ]);
89
90 cmakeFlags = [
91 "-DCMAKE_SKIP_BUILD_RPATH=ON"
92 "-Dre_DIR=${libre}/include/re"
93 "-DGL_INCLUDE_DIRS=${lib.getDev glib}/include/glib-2.0"
94 "-DGLIB_INCLUDE_DIRS=${glib.out}/lib/glib-2.0/include"
95 "-DGST_INCLUDE_DIRS=${lib.getDev gst_all_1.gstreamer}/include/gstreamer-1.0"
96 ];
97
98 makeFlags = [
99 "PREFIX=$(out)"
100 "CCACHE_DISABLE=1"
101 ]
102 ++ lib.optional (stdenv.cc.cc != null) "SYSROOT_ALT=${stdenv.cc.cc}"
103 ++ lib.optional (stdenv.cc.libc != null) "SYSROOT=${stdenv.cc.libc}";
104
105 enableParallelBuilding = true;
106
107 env.NIX_CFLAGS_COMPILE = ''
108 -I${librem}/include/rem -I${gsm}/include/gsm
109 -DHAVE_INTTYPES_H -D__GLIBC__
110 -D__need_timeval -D__need_timespec -D__need_time_t
111 '';
112
113 # CMake feature detection is prone to breakage between upgrades:
114 # spot-check that the optional modules we care about were compiled
115 installCheckPhase = ''
116 runHook preInstallCheck
117 ${lib.concatMapStringsSep "\n" (m: "test -x $out/lib/baresip/modules/${m}.so") [
118 "account"
119 "alsa"
120 "aubridge"
121 "auconv"
122 "aufile"
123 "auresamp"
124 "ausine"
125 "avcodec"
126 "avfilter"
127 "avformat"
128 "cons"
129 "contact"
130 "ctrl_dbus"
131 "ctrl_tcp"
132 "debug_cmd"
133 "dtls_srtp"
134 "ebuacip"
135 "echo"
136 "evdev"
137 "fakevideo"
138 "g711"
139 "g722"
140 "g726"
141 "gst"
142 "gtk"
143 "httpd"
144 "httpreq"
145 "ice"
146 "l16"
147 "menu"
148 "mixausrc"
149 "mixminus"
150 "multicast"
151 "mwi"
152 "natpmp"
153 "netroam"
154 "pcp"
155 "pipewire"
156 "plc"
157 "portaudio"
158 "presence"
159 "rtcpsummary"
160 "sdl"
161 "selfview"
162 "serreg"
163 "snapshot"
164 "sndfile"
165 "srtp"
166 "stdio"
167 "stun"
168 "swscale"
169 "syslog"
170 "turn"
171 "uuid"
172 "v4l2"
173 "vidbridge"
174 "vidinfo"
175 "vp8"
176 "vp9"
177 "vumeter"
178 "x11"
179 ]}
180 runHook postInstallCheck
181 '';
182
183 meta = {
184 description = "Modular SIP User-Agent with audio and video support";
185 homepage = "https://github.com/baresip/baresip";
186 maintainers = with lib.maintainers; [
187 raskin
188 rnhmjoj
189 ];
190 mainProgram = "baresip";
191 license = lib.licenses.bsd3;
192 platforms = lib.platforms.unix;
193 };
194})