3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #163935 from Sohalt/sonic-pi-3.3.1

sonic-pi: 3.2.2 -> 3.3.1
This commit is contained in:
Lassulus 2022-03-23 00:11:53 +01:00 committed by GitHub
commit 9e5d59a17a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,7 +4,11 @@
, fetchFromGitHub
, fftwSinglePrec
, ruby
, erlang
, aubio
, alsa-lib
, rtmidi
, libsndfile
, cmake
, pkg-config
, boost
@ -12,25 +16,43 @@
, jack2
, supercollider
, qwt
, osmid
}:
let
supercollider_single_prec = supercollider.override { fftw = fftwSinglePrec; };
pname = "sonic-pi";
version = "3.3.1";
src = fetchFromGitHub {
owner = "sonic-pi-net";
repo = "sonic-pi";
rev = "v${version}";
sha256 = "sha256-AE7iuSNnW1SAtBMplReGzXKcqD4GG23i10MIAWnlcPo=";
};
# sonic pi uses it's own aubioonset with hardcoded parameters but will compile a whole aubio for it
# let's just build the aubioonset instead and link against aubio from nixpkgs
aubioonset = mkDerivation {
name = "aubioonset";
src = src;
sourceRoot = "source/app/external/aubio/examples";
buildInputs = [jack2 aubio libsndfile];
patchPhase = ''
sed -i "s@<aubio.h>@<aubio/aubio.h>@" jackio.c utils.h
'';
buildPhase = ''
gcc -o aubioonset -laubio jackio.c utils.c aubioonset.c
'';
installPhase = ''
install -D aubioonset $out/aubioonset
'';
};
in
mkDerivation rec {
version = "3.2.2";
pname = "sonic-pi";
src = fetchFromGitHub {
owner = "samaaron";
repo = "sonic-pi";
rev = "v${version}";
sha256 = "1nlkpkpg9iz2hvf5pymvk6lqhpdpjbdrvr0hrnkc3ymj7llvf1cm";
};
inherit pname version src;
buildInputs = [
bash
@ -42,42 +64,36 @@ mkDerivation rec {
aubio
supercollider_single_prec
boost
erlang
alsa-lib
rtmidi
];
dontUseCmakeConfigure = true;
preConfigure = ''
patchShebangs .
substituteInPlace app/gui/qt/mainwindow.cpp \
--subst-var-by ruby "${ruby}/bin/ruby" \
--subst-var out
prePatch = ''
sed -i '/aubio/d' app/external/linux_build_externals.sh
sed -i '/aubio/d' app/linux-prebuild.sh
patchShebangs app
'';
configurePhase = ''
runHook preConfigure
./app/linux-prebuild.sh
./app/linux-config.sh
runHook postConfigure
'';
buildPhase = ''
export SONIC_PI_HOME=$TMPDIR
export AUBIO_LIB=${aubio}/lib/libaubio.so
export OSMID_DIR=app/server/native/osmid
runHook preBuild
mkdir -p $OSMID_DIR
cp ${osmid}/bin/{m2o,o2m} $OSMID_DIR
pushd app/server/ruby/bin
./compile-extensions.rb
./i18n-tool.rb -t
pushd app/build
cmake --build . --config Release
popd
pushd app/gui/qt
cp -f utils/ruby_help.tmpl utils/ruby_help.h
../../server/ruby/bin/qt-doc.rb -o utils/ruby_help.h
lrelease lang/*.ts
mkdir build
pushd build
cmake -G "Unix Makefiles" ..
make
popd
popd
runHook postBuild
'';
installPhase = ''
@ -90,10 +106,14 @@ mkDerivation rec {
mkdir -p $out/app
cp -r app/server $out/app/
# We didn't build this during linux-prebuild.sh so copy from the separate derivation
cp ${aubioonset}/aubioonset $out/app/server/native/
# Copy only necessary files for the gui app.
mkdir -p $out/app/gui/qt/build
mkdir -p $out/app/gui/qt
cp -r app/gui/qt/{book,fonts,help,html,images,image_source,info,lang,theme} $out/app/gui/qt/
cp app/gui/qt/build/sonic-pi $out/app/gui/qt/build/sonic-pi
mkdir -p $out/app/build/gui/qt
cp app/build/gui/qt/sonic-pi $out/app/build/gui/qt/sonic-pi
runHook postInstall
'';
@ -102,20 +122,18 @@ mkDerivation rec {
dontWrapQtApps = true;
preFixup = ''
wrapQtApp "$out/bin/sonic-pi" \
--prefix PATH : ${lib.makeBinPath [ bash jack2 ruby supercollider ] } \
--set AUBIO_LIB "${aubio}/lib/libaubio.so"
--prefix PATH : ${lib.makeBinPath [ bash jack2 ruby supercollider erlang] }
makeWrapper \
$out/app/server/ruby/bin/sonic-pi-server.rb \
$out/bin/sonic-pi-server \
--prefix PATH : ${lib.makeBinPath [ bash jack2 ruby supercollider ] } \
--set AUBIO_LIB "${aubio}/lib/libaubio.so"
--prefix PATH : ${lib.makeBinPath [ bash jack2 ruby supercollider erlang ] }
'';
meta = {
homepage = "https://sonic-pi.net/";
description = "Free live coding synth for everyone originally designed to support computing and music lessons within schools";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ Phlogistique kamilchm c0deaddict ];
maintainers = with lib.maintainers; [ Phlogistique kamilchm c0deaddict sohalt ];
platforms = lib.platforms.linux;
};
}