Adding sonic-pi 3.1.0 from AUR... shibumi made me do it.

This commit is contained in:
David Runge 2018-04-10 21:45:40 +00:00
commit 5397846824
3 changed files with 311 additions and 0 deletions

153
PKGBUILD Normal file
View file

@ -0,0 +1,153 @@
# Maintainer: David Runge <dave@sleepmap.de>
pkgname=sonic-pi
pkgver=3.1.0
pkgrel=2
pkgdesc="The Live Coding Music Synth for Everyone"
arch=('x86_64')
url="https://sonic-pi.net/"
license=('MIT')
groups=('pro-audio')
depends=('aubio' 'boost-libs' 'erlang-nox' 'libffi' 'http-parser' 'osmid' 'qscintilla-qt5' 'qwt' 'ruby' 'sc3-plugins' 'supercollider')
makedepends=('boost' 'cmake' 'lua' 'qt5-tools' 'wkhtmltopdf')
checkdepends=('ruby-rake')
source=("$pkgname-$pkgver.tar.gz::https://github.com/samaaron/${pkgname}/archive/v${pkgver}.tar.gz"
"fix-paths-in-gui.diff"
"fix-ruby-paths.diff")
sha512sums=('45373d3e673bc2f45bf5ccea31f6cf5e2003c9bdfc4645dec4b9fec391cb28b9e0b0823a98e9690928e116b8c40f96596bd1c8f5aefbf4f3e43e6c30ab76d41f'
'ef3dfe52d05f085f230ee02f84b20ee615a98a0be5ec60edba28075b93a7edbd37668ebbcc30f695126515eb614ebd27cee77ab3145d06ee7ba1c10ffced2471'
'1c0238a2cda782de97504c81c47db71b940d89987b7fa6aad1a00c8a095a5627b2d82809d81f48f0e2bee290ad1bbeded634827511d63eed5635bd94806fcccb')
prepare() {
cd "$pkgname-$pkgver"
sed -e 's/lqt5scintilla2/lqscintilla2_qt5/g' -i app/gui/qt/SonicPi.pro
rm -rvf app/server/native
# TODO: patch app/gui/qt/mainwindow.cpp to set path to external components in /usr/{lib,share}/sonic-pi
patch -Np1 -i ../fix-paths-in-gui.diff
}
build() {
cd "$pkgname-$pkgver"
# OSC and pi_server
cd app/server/erlang
erlc {osc,pi_server}.erl
cd "${srcdir}/$pkgname-$pkgver"
# ruby extensions
cd app/gui/qt/
../../server/ruby/bin/compile-extensions.rb
../../server/ruby/bin/i18n-tool.rb -t
# help template
cp -vf ruby_help.{tmpl,h}
../../server/ruby/bin/qt-doc.rb -o ruby_help.h
# GUI
lrelease SonicPi.pro
qmake-qt5 SonicPi.pro
make
cd "${srcdir}/$pkgname-$pkgver"
# TODO: patch app/server/ruby/lib/sonicpi/util.rb to set proper paths to external components
patch -Np1 -i ../fix-ruby-paths.diff
}
## tests fail: https://github.com/samaaron/sonic-pi/issues/1865
#check() {
# cd "$pkgname-$pkgver"
# cd app/server/ruby/test
# rake test
#}
package() {
cd "$pkgname-$pkgver"
# GUI executable
install -vDm 755 "app/gui/qt/${pkgname}" "${pkgdir}/usr/bin/${pkgname}"
# book
install -vDm 644 app/gui/qt/book/*.html \
-t "${pkgdir}/usr/share/${pkgname}/book"
# i18n
install -vDm 644 app/gui/qt/lang/*.qm \
-t "${pkgdir}/usr/share/${pkgname}/lang"
# help
install -vDm 644 app/gui/qt/help/*.html \
-t "${pkgdir}/usr/share/${pkgname}/help"
# html
install -vDm 644 app/gui/qt/html/*.html \
-t "${pkgdir}/usr/share/${pkgname}/html"
# images
install -vDm 644 app/gui/qt/images/*.png \
-t "${pkgdir}/usr/share/${pkgname}/images"
install -vDm 644 app/gui/qt/images/coreteam/*.png \
-t "${pkgdir}/usr/share/${pkgname}/images/coreteam"
install -vDm 644 app/gui/qt/images/toolbar/default/*.png \
-t "${pkgdir}/usr/share/${pkgname}/images/toolbar/default"
install -vDm 644 app/gui/qt/images/toolbar/pro/*.png \
-t "${pkgdir}/usr/share/${pkgname}/images/toolbar/pro"
install -vDm 644 etc/doc/images/tutorial/*.png \
-t "${pkgdir}/usr/share/${pkgname}/images/tutorial"
# theme
install -vDm 644 app/gui/qt/theme/app.qss \
-t "${pkgdir}/usr/share/${pkgname}/theme/"
install -vDm 644 app/gui/qt/theme/dark/doc-styles.css \
-t "${pkgdir}/usr/share/${pkgname}/theme/dark"
install -vDm 644 app/gui/qt/theme/light/doc-styles.css \
-t "${pkgdir}/usr/share/${pkgname}/theme/light"
# samples
install -vDm 644 etc/samples/*.{flac,md} \
-t "${pkgdir}/usr/share/${pkgname}/samples"
# snippets
install -vDm 644 etc/snippets/fx/*.sps \
-t "${pkgdir}/usr/share/${pkgname}/snippets/fx"
install -vDm 644 etc/snippets/live_loop/*.sps \
-t "${pkgdir}/usr/share/${pkgname}/snippets/live_loop"
install -vDm 644 etc/snippets/syntax/*.sps \
-t "${pkgdir}/usr/share/${pkgname}/snippets/syntax"
# synthdefs
install -vDm 644 etc/synthdefs/compiled/*.scsyndef \
-t "${pkgdir}/usr/share/${pkgname}/synthdefs/compiled"
install -vDm 644 etc/synthdefs/designs/sonic_pi/synths/*.clj\
-t "${pkgdir}/usr/share/${pkgname}/synthdefs/designs/sonic_pi/synths"
# buffers
install -vDm 644 etc/buffers/rand-stream.wav \
-t "${pkgdir}/usr/share/${pkgname}/buffers"
# docs
install -vDm 644 etc/doc/cheatsheets/*.md \
-t "${pkgdir}/usr/share/doc/${pkgname}/cheatsheets"
# pdfs
install -vDm 644 etc/synthdefs/graphviz/pdf/*.pdf \
-t "${pkgdir}/usr/share/doc/${pkgname}/synthdefs"
# tutorial
install -vDm 644 etc/doc/tutorial/*.md \
-t "${pkgdir}/usr/share/doc/${pkgname}/tutorial"
# examples
install -vDm 644 etc/examples/algomancer/*.rb \
-t "${pkgdir}/usr/share/doc/${pkgname}/examples/algomancer"
install -vDm 644 etc/examples/apprentice/*.rb \
-t "${pkgdir}/usr/share/doc/${pkgname}/examples/apprentice"
install -vDm 644 etc/examples/illusionist/*.rb \
-t "${pkgdir}/usr/share/doc/${pkgname}/examples/illusionist"
install -vDm 644 etc/examples/incubation/*.rb \
-t "${pkgdir}/usr/share/doc/${pkgname}/examples/incubation"
install -vDm 644 etc/examples/magician/*.rb \
-t "${pkgdir}/usr/share/doc/${pkgname}/examples/magician"
install -vDm 644 etc/examples/sorcerer/*.rb \
-t "${pkgdir}/usr/share/doc/${pkgname}/examples/sorcerer"
install -vDm 644 etc/examples/wizard/*.rb \
-t "${pkgdir}/usr/share/doc/${pkgname}/examples/wizard"
# erlang
install -vDm 755 app/server/erlang/*.beam \
-t "${pkgdir}/usr/lib/${pkgname}"
# ruby
install -vdm 755 "${pkgdir}/usr/share/${pkgname}"
cp -av app/server/ruby "${pkgdir}/usr/share/${pkgname}/server"
# license
install -vDm 644 LICENSE.md "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

62
fix-paths-in-gui.diff Normal file
View file

@ -0,0 +1,62 @@
diff -ruN sonic-pi-3.1.0-a/app/gui/qt/mainwindow.cpp sonic-pi-3.1.0-b/app/gui/qt/mainwindow.cpp
--- sonic-pi-3.1.0-a/app/gui/qt/mainwindow.cpp 2018-01-22 23:00:13.000000000 +0100
+++ sonic-pi-3.1.0-b/app/gui/qt/mainwindow.cpp 2018-04-10 21:56:32.907704553 +0200
@@ -127,7 +127,7 @@
#elif defined(Q_OS_MAC)
ruby_path = root_path + "/app/server/native/ruby/bin/ruby";
#else
- ruby_path = root_path + "/app/server/native/ruby/bin/ruby";
+ ruby_path = root_path + "/usr/bin/ruby";
#endif
QFile file(ruby_path);
@@ -136,9 +136,9 @@
ruby_path = "ruby";
}
- ruby_server_path = QDir::toNativeSeparators(root_path + "/app/server/ruby/bin/sonic-pi-server.rb");
- port_discovery_path = QDir::toNativeSeparators(root_path + "/app/server/ruby/bin/port-discovery.rb");
- sample_path = QDir::toNativeSeparators(root_path + "/etc/samples");
+ ruby_server_path = QDir::toNativeSeparators(root_path + "/usr/share/sonic-pi/server/bin/sonic-pi-server.rb");
+ port_discovery_path = QDir::toNativeSeparators(root_path + "/usr/share/sonic-pi/server/bin/port-discovery.rb");
+ sample_path = QDir::toNativeSeparators(root_path + "/usr/share/sonic-pi/samples");
sp_user_path = QDir::toNativeSeparators(sonicPiHomePath() + "/.sonic-pi");
sp_user_tmp_path = QDir::toNativeSeparators(sp_user_path + "/.writableTesterPath");
@@ -149,13 +149,13 @@
process_log_path = QDir::toNativeSeparators(log_path + "/processes.log");
scsynth_log_path = QDir::toNativeSeparators(log_path + QDir::separator() + "scsynth.log");
- init_script_path = QDir::toNativeSeparators(root_path + "/app/server/ruby/bin/init-script.rb");
- exit_script_path = QDir::toNativeSeparators(root_path + "/app/server/ruby/bin/exit-script.rb");
+ init_script_path = QDir::toNativeSeparators(root_path + "/usr/share/sonic-pi/server/bin/init-script.rb");
+ exit_script_path = QDir::toNativeSeparators(root_path + "/usr/share/sonic-pi/server/bin/exit-script.rb");
- qt_app_theme_path = QDir::toNativeSeparators(root_path + "/app/gui/qt/theme/app.qss");
+ qt_app_theme_path = QDir::toNativeSeparators(root_path + "/usr/share/sonic-pi/theme/app.qss");
- qt_browser_dark_css = QDir::toNativeSeparators(root_path + "/app/gui/qt/theme/dark/doc-styles.css");
- qt_browser_light_css = QDir::toNativeSeparators(root_path + "/app/gui/qt/theme/light/doc-styles.css");
+ qt_browser_dark_css = QDir::toNativeSeparators(root_path + "/usr/share/sonic-pi/theme/dark/doc-styles.css");
+ qt_browser_light_css = QDir::toNativeSeparators(root_path + "/usr/share/sonic-pi/theme/light/doc-styles.css");
QDir logDir(log_path);
logDir.mkpath(logDir.absolutePath());
@@ -1020,7 +1020,7 @@
#elif defined(Q_OS_WIN)
return QCoreApplication::applicationDirPath() + "/../../../..";
#else
- return QCoreApplication::applicationDirPath() + "/../../..";
+ return QCoreApplication::applicationDirPath() + "/../..";
#endif
}
@@ -1059,7 +1059,7 @@
// Register server pid for potential zombie clearing
QStringList regServerArgs;
#if QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)
- regServerArgs << QDir::toNativeSeparators(rootPath() + "/app/server/ruby/bin/task-register.rb")<< QString::number(serverProcess->processId());
+ regServerArgs << QDir::toNativeSeparators(rootPath() + "/usr/share/sonic-pi/server/bin/task-register.rb")<< QString::number(serverProcess->processId());
#endif
QProcess *regServerProcess = new QProcess();
regServerProcess->start(ruby_path, regServerArgs);

96
fix-ruby-paths.diff Normal file
View file

@ -0,0 +1,96 @@
diff -ruN sonic-pi-3.1.0-a/app/server/ruby/core.rb sonic-pi-3.1.0-c/app/server/ruby/core.rb
--- sonic-pi-3.1.0-a/app/server/ruby/core.rb 2018-01-22 23:00:13.000000000 +0100
+++ sonic-pi-3.1.0-c/app/server/ruby/core.rb 2018-04-10 23:10:47.329683107 +0200
@@ -147,7 +147,7 @@
module Core
module SPRand
# Read in same random numbers as server for random stream sync
- @@random_numbers = ::WaveFile::Reader.new(File.expand_path("../../../../etc/buffers/rand-stream.wav", __FILE__), ::WaveFile::Format.new(:mono, :float, 44100)).read(441000).samples.freeze
+ @@random_numbers = ::WaveFile::Reader.new(File.expand_path("../../buffers/rand-stream.wav", __FILE__), ::WaveFile::Format.new(:mono, :float, 44100)).read(441000).samples.freeze
def self.tl_seed_map(seed, idx=0)
{:sonic_pi_spider_random_gen_seed => seed,
diff -ruN sonic-pi-3.1.0-a/app/server/ruby/lib/sonicpi/util.rb sonic-pi-3.1.0-c/app/server/ruby/lib/sonicpi/util.rb
--- sonic-pi-3.1.0-a/app/server/ruby/lib/sonicpi/util.rb 2018-01-22 23:00:13.000000000 +0100
+++ sonic-pi-3.1.0-c/app/server/ruby/lib/sonicpi/util.rb 2018-04-10 23:28:08.120969596 +0200
@@ -216,11 +216,11 @@
end
def root_path
- File.absolute_path("#{File.dirname(__FILE__)}/../../../../../")
+ File.absolute_path("/usr/share/sonic-pi")
end
def etc_path
- File.absolute_path("#{root_path}/etc")
+ File.absolute_path("#{root_path}")
end
def snippets_path
@@ -228,7 +228,7 @@
end
def doc_path
- File.absolute_path("#{etc_path}/doc")
+ File.absolute_path("/usr/share/doc/sonic-pi")
end
def cheatsheets_path
@@ -240,7 +240,7 @@
end
def tmp_path
- File.absolute_path("#{root_path}/tmp")
+ File.absolute_path("/tmp")
end
def synthdef_path
@@ -256,7 +256,7 @@
end
def app_path
- File.absolute_path("#{root_path}/app")
+ File.absolute_path("#{root_path}")
end
def html_public_path
@@ -268,7 +268,7 @@
end
def examples_path
- File.absolute_path("#{etc_path}/examples")
+ File.absolute_path("#{doc_path}/examples")
end
def server_path
@@ -276,7 +276,7 @@
end
def server_bin_path
- File.absolute_path("#{server_path}/ruby/bin")
+ File.absolute_path("#{server_path}/bin")
end
def native_path
diff -ruN sonic-pi-3.1.0-a/app/server/ruby/util.rb sonic-pi-3.1.0-c/app/server/ruby/util.rb
--- sonic-pi-3.1.0-a/app/server/ruby/util.rb 2018-01-22 23:00:13.000000000 +0100
+++ sonic-pi-3.1.0-c/app/server/ruby/util.rb 2018-04-10 22:16:26.994368179 +0200
@@ -12,15 +12,15 @@
#++
def sp_sonic_pi_path()
- File.absolute_path("#{File.dirname(__FILE__)}/../../")
+ File.absolute_path("#{File.dirname(__FILE__)}/..")
end
def sp_scripts_path()
- File.absolute_path("#{sp_sonic_pi_path}/app/scripts")
+ File.absolute_path("#{sp_sonic_pi_path}/scripts")
end
def sp_synthdefs_path()
- File.absolute_path("#{sp_sonic_pi_path}/app/etc/synthdefs/compiled")
+ File.absolute_path("#{sp_sonic_pi_path}/synthdefs/compiled")
end
def spider_log(message)