Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom build of ultraschall and it's dependencies #18

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5cefabf
ultraschall: Add vst-sdk sources
britter Jan 4, 2024
1f2b5f8
WIP: trying to get a custom baresip build working
britter Jan 4, 2024
a7a9c0e
Use appropriate custom version of libre to build baresip
britter Jan 11, 2024
d3b2bc2
Prefix studio-link specific builds
britter Jan 11, 2024
e60aea9
Pass custom versions of baresip and libre to overlay-vst
britter Jan 11, 2024
3d382f6
Build custom version of librem to match version required by studio-li…
britter Jan 11, 2024
faebc53
Tinkering with makeflags to pass the appropriate list of modules
britter Jan 12, 2024
9da49b7
Link custom Studio-Link modules into baresip codebase
britter Jan 12, 2024
0dd020e
Build opus and add it as additional build input to studio-link-baresip
britter Jan 14, 2024
c4a489d
Fix building of webapp module by adding webui header files
britter Jan 14, 2024
7542b36
studio-link-baresip build finally working!
britter Jan 14, 2024
001aea2
Add baresip header to include dir in output
britter Jan 14, 2024
be63bcc
Remove unused build parameters.
britter Jan 15, 2024
1ac3c98
Reformat NIX_CFLAGS_COMPILE
britter Jan 15, 2024
38d58ef
use finalAttrs parameter instead of rec
britter Jan 15, 2024
f329294
Use patch files from fetched studio-link-app sources
britter Jan 15, 2024
b20a8f4
Generate libbaresip.a and add it to output
britter Jan 15, 2024
bce6ce5
Making progress on building overlay-vst
britter Jan 15, 2024
ef8ad0b
Build studio-link overlay-vst using Nix
britter Jan 15, 2024
1fad190
Start building studio-link-onair plugin
britter Jan 15, 2024
eabf4fc
Get overlay-onair-lv2 build working
britter Jan 20, 2024
a4aeac1
Build baresip flavors and pass them to the right place
britter Jan 21, 2024
4e87bca
WIP: trying to get ultraschall-soundboard working
britter Jan 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 34 additions & 5 deletions packages/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
{pkgs, ...}:
with pkgs; {
gh-get = callPackage ./gh-get {};
groovy-language-server = callPackage ./groovy-language-server {};
}
{pkgs, ...}: let
baresip = import ./studio-link-baresip;
in
with pkgs; rec {
gh-get = callPackage ./gh-get {};
groovy-language-server = callPackage ./groovy-language-server {};
opus = callPackage ./opus {};
overlay-onair-lv2 = callPackage ./overlay-onair-lv2 {
inherit opus;
baresip = studio-link-baresip-effectonair-plugin;
libre = studio-link-libre;
};
overlay-vst = callPackage ./overlay-vst {
inherit vst-sdk opus;
baresip = studio-link-baresip-effect-plugin;
libre = studio-link-libre;
};
studio-link-baresip-effect-plugin =
callPackage baresip.effect-plugin
{
inherit opus;
libre = studio-link-libre;
librem = studio-link-librem;
};
studio-link-baresip-effectonair-plugin = callPackage baresip.effectonair-plugin {
inherit opus;
libre = studio-link-libre;
librem = studio-link-librem;
};
studio-link-libre = callPackage ./studio-link-libre {};
studio-link-librem = callPackage ./studio-link-librem {libre = studio-link-libre;};
ultraschall-soundboard = callPackage ./ultraschall-soundboard {};
vst-sdk = callPackage ./vst-sdk {};
}
27 changes: 27 additions & 0 deletions packages/opus/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
lib,
stdenv,
fetchzip,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "opus";
version = "1.3.1";

# https://github.com/Studio-Link/3rdparty/blob/v21.04.0/dist/build.sh#L147
src = fetchzip {
url = "https://archive.mozilla.org/pub/opus/opus-${finalAttrs.version}.tar.gz";
sha256 = "sha256-VyHmKoRXCJ0shVfUn6cX13b0fAXIQk0Z5NLZIfy8Gh4=";
};

configureFlags = [
# https://github.com/Studio-Link/3rdparty/blob/v21.04.0/dist/build.sh#L163
"--with-pic"
# required to output libopus.a used in overlay-onair-lv2
"--enable-static"
];

makeFlags =
["PREFIX=$(out)"]
++ lib.optional (stdenv.cc.cc != null) "SYSROOT_ALT=${stdenv.cc.cc}"
++ lib.optional (stdenv.cc.libc != null) "SYSROOT=${lib.getDev stdenv.cc.libc}";
})
49 changes: 49 additions & 0 deletions packages/overlay-onair-lv2/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
baresip,
libre,
libxcrypt,
lv2,
opus,
openssl,
zlib,
stdenv,
fetchFromGitHub,
}:
stdenv.mkDerivation {
pname = "studio-link-onair-plugin";
version = "latest";
src = fetchFromGitHub {
owner = "Studio-Link";
repo = "overlay-onair-lv2";
rev = "d58f3035208672f3a6f3e21bb6d0232c06cbab2d";
sha256 = "sha256-bU1WdAqj7ZRTfwZPoajEtIeqUF0cM6IF4ektaCL6vew=";
};

postPatch = ''
substituteInPlace build.sh \
--replace "../my_include/libbaresip_onair.a" "${baresip}/lib/libbaresip.a" \
--replace "../re/libre.a" "${libre}/lib/libre.a" \
--replace "../rem/librem.a" "" \
--replace "../3rdparty/lib/libopus.a" "${opus}/lib/libopus.a"
'';

buildInputs = [
baresip
libre
libxcrypt
lv2
openssl
zlib
];

buildPhase = ''
patchShebangs --build build.sh
./build.sh
'';

installPhase = ''
mkdir -p $out/lib
cp studio-link-onair.so $out/lib/
cp *.ttl $out/lib/
'';
}
41 changes: 41 additions & 0 deletions packages/overlay-vst/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
baresip,
libre,
stdenv,
fetchFromGitHub,
vst-sdk,
openssl,
opus,
}:
stdenv.mkDerivation {
pname = "studio-link-plugin";
version = "latest";
src = fetchFromGitHub {
owner = "Studio-Link";
repo = "overlay-vst";
rev = "8efd287cb86ee601fda8054456da038f1128808a";
sha256 = "sha256-xP99uqdr4LmCQEydiVX3SHVYizHo+2pmjOLNVz62kGg=";
};

postPatch = ''
rm Makefile
mv Makefile.linux Makefile
substituteInPlace Makefile \
--replace "vstsdk2.4" "${vst-sdk}/include" \
--replace "../baresip/libbaresip.a" "${baresip}/lib/libbaresip.a" \
--replace "../re/libre.a" "${libre}/lib/libre.a" \
--replace "../rem/librem.a" ""
'';

buildInputs = [
baresip
libre
openssl
opus
];

installPhase = ''
mkdir -p $out/lib
cp studio-link.so $out/lib/
'';
}
156 changes: 156 additions & 0 deletions packages/studio-link-baresip/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
rec {
flavor = {modules}: {
lib,
stdenv,
fetchzip,
fetchFromGitHub,
zlib,
openssl,
libre,
librem,
pkg-config,
gst_all_1,
cairo,
mpg123,
alsa-lib,
SDL2,
libv4l,
celt,
libsndfile,
srtp,
ffmpeg,
gsm,
speex,
portaudio,
spandsp3,
libuuid,
libvpx,
opus,
flac,
}: let
studio-link-app = fetchFromGitHub {
owner = "Studio-Link";
repo = "app";
rev = "v21.07.0-stable";
sha256 = "sha256-BjMZQDweQMM2TZuYoAGWE9eC/Vy8UnwDkkieY9TKpyg=";
};
# See https://github.com/Studio-Link/app/blob/v21.07.0-stable/dist/lib/functions.sh#L37-L43
studio-link-webui = fetchzip {
url = "https://download.studio.link/devel/v21.xx.x/v21.12.0-beta-3bb3eaf/webui.zip";
sha256 = "sha256-7SkMQ8WM7vgFuiKS8+BFat4M/a9VNrWQKLMynKE4sEU=";
};
in
stdenv.mkDerivation (finalAttrs: {
pname = "baresip-studio-link";
version = "1.0.0";
src = fetchzip {
url = "https://github.com/baresip/baresip/archive/v${finalAttrs.version}.tar.gz";
sha256 = "sha256-HCnLidhuLP1QzFJ93jTk/+N86S+qZKnvtFHUAyUXPRM=";
};

# Link custom modules, see https://github.com/Studio-Link/app/blob/v21.07.0-stable/dist/lib/functions.sh#L123-L131
postUnpack = ''
rm -rf $sourceRoot/modules/g722
ln -s ${studio-link-app}/src/modules/g722 $sourceRoot/modules/g722
ln -s ${studio-link-app}/src/modules/slogging $sourceRoot/modules/slogging
ln -s ${studio-link-app}/src/modules/effect $sourceRoot/modules/effect
ln -s ${studio-link-app}/src/modules/effectonair $sourceRoot/modules/effectonair
ln -s ${studio-link-app}/src/modules/apponair $sourceRoot/modules/apponair
ln -s ${studio-link-app}/src/modules/slaudio $sourceRoot/modules/slaudio

mkdir -p $sourceRoot/modules/webapp/assets
cp -r ${studio-link-app}/src/modules/webapp/* $sourceRoot/modules/webapp/
cp ${studio-link-webui}/headers/* $sourceRoot/modules/webapp/assets/
'';

# Patches are defined here: https://github.com/Studio-Link/app/blob/v21.07.0-stable/dist/lib/functions.sh#L110-L115
patches = [
"${studio-link-app}/dist/patches/config.patch"
"${studio-link-app}/dist/patches/fix_check_telev_and_pthread.patch"
"${studio-link-app}/dist/patches/dtls_aes256.patch"
"${studio-link-app}/dist/patches/rtcp_mux_softphone.patch"
"${studio-link-app}/dist/patches/fallback_dns.patch"
"${studio-link-app}/dist/patches/baresip_audio_rtp_discard.patch"
];

nativeBuildInputs = [pkg-config];

buildInputs =
[
zlib
openssl
libre
librem
cairo
mpg123
alsa-lib
SDL2
libv4l
celt
libsndfile
srtp
ffmpeg
gsm
speex
portaudio
spandsp3
libuuid
libvpx
opus
flac
]
++ (with gst_all_1; [gstreamer gst-libav gst-plugins-base gst-plugins-bad gst-plugins-good]);

# https://github.com/Studio-Link/app/blob/v21.07.0-stable/dist/build.sh#L123C18-L123C97
preBuild = ''
makeFlagsArray+=(MODULES="opus stdio ice g711 turn stun uuid auloop g722 slogging dtls_srtp ${modules}")
'';

makeFlags =
[
"LIBRE_MK=${libre}/share/re/re.mk"
"LIBRE_INC=${libre}/include/re"
"LIBRE_SO=${libre}/lib"
"LIBREM_PATH=${librem}"
"PREFIX=$(out)"
"USE_VIDEO=1"
"CCACHE_DISABLE=1"

# https://github.com/Studio-Link/app/blob/v21.07.0-stable/dist/build.sh#L122
"STATIC=1"
# https://github.com/Studio-Link/app/blob/v21.07.0-stable/dist/build.sh#L125
"libbaresip.a"
]
++ lib.optional (stdenv.cc.cc != null) "SYSROOT_ALT=${stdenv.cc.cc}"
++ lib.optional (stdenv.cc.libc != null) "SYSROOT=${stdenv.cc.libc}";

# -DSLPLUGIN coming from https://github.com/Studio-Link/app/blob/v21.07.0-stable/dist/build.sh#L124C40-L124C50
# Include of webapp coming from https://github.com/Studio-Link/app/blob/v21.07.0-stable/dist/lib/functions.sh#L136
NIX_CFLAGS_COMPILE = ''
-I${librem}/include/rem
-I${gsm}/include/gsm
-I${studio-link-app}/src/modules/webapp
-DHAVE_INTTYPES_H
-D__GLIBC__
-D__need_timeval
-D__need_timespec
-D__need_time_t
-DSLPLUGIN
'';

postInstall = ''
mkdir -p $out/include
cp include/* $out/include/

mkdir -p $out/lib
cp libbaresip.a $out/lib
'';
});

effect-plugin = flavor {
modules = "webapp effect";
};
effectonair-plugin = flavor {
modules = "apponair effectonair";
};
}
40 changes: 40 additions & 0 deletions packages/studio-link-libre/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
lib,
stdenv,
fetchzip,
fetchpatch,
openssl,
zlib,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "studio-link-libre";
version = "1.1.0";
src = fetchzip {
url = "https://github.com/baresip/re/archive/v${finalAttrs.version}.tar.gz";
sha256 = "sha256-LZ45aS9uVN8j2jkmVkDv406iDYqtpuXni8H1bCCrmVw=";
};

# see https://github.com/Studio-Link/app/blob/v21.07.0-stable/dist/lib/functions.sh#L80-L83
patches = [
(fetchpatch {
url = "https://raw.githubusercontent.com/Studio-Link/app/v21.07.0-stable/dist/patches/bluetooth_conflict.patch";
sha256 = "sha256-QuMst4avD18UeZJi5v0XI0Um8JMMR6f2/tNXD8IXrCA=";
})
(fetchpatch {
url = "https://raw.githubusercontent.com/Studio-Link/app/v21.07.0-stable/dist/patches/re_fix_authorization.patch";
sha256 = "sha256-rZxsaRFnH0JSxiRIjHPmNx5q8rqRMKeXT8Grnua9hrU=";
})
(fetchpatch {
url = "https://raw.githubusercontent.com/Studio-Link/app/v21.07.0-stable/dist/patches/re_pull_66.diff";
sha256 = "sha256-ksgmb00F4jfIG/qFEtiEK4nuENGUcAP9D22zPipMWmE=";
})
];

patchFlags = ["--ignore-whitespace" "-p1"];

buildInputs = [zlib openssl];
makeFlags =
["USE_ZLIB=1" "USE_OPENSSL=1" "PREFIX=$(out)"]
++ lib.optional (stdenv.cc.cc != null) "SYSROOT_ALT=${stdenv.cc.cc}"
++ lib.optional (stdenv.cc.libc != null) "SYSROOT=${lib.getDev stdenv.cc.libc}";
})
25 changes: 25 additions & 0 deletions packages/studio-link-librem/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
lib,
stdenv,
fetchurl,
zlib,
openssl,
libre,
}:
stdenv.mkDerivation (finalAttrs: {
version = "0.6.0";
pname = "studio-link-librem";
src = fetchurl {
url = "https://github.com/creytiv/rem/archive/v${finalAttrs.version}.tar.gz";
sha256 = "0b17wma5w9acizk02isk5k83vv47vf1cf9zkmsc1ail677d20xj1";
};
buildInputs = [zlib openssl libre];
makeFlags =
[
"LIBRE_MK=${libre}/share/re/re.mk"
"LIBRE_INC=${libre}/include/re"
"PREFIX=$(out)"
]
++ lib.optional (stdenv.cc.cc != null) "SYSROOT_ALT=${lib.getDev stdenv.cc.cc}"
++ lib.optional (stdenv.cc.libc != null) "SYSROOT=${lib.getDev stdenv.cc.libc}";
})
Loading