From 26c4e0341e48c30e98efcb747f8844858809c131 Mon Sep 17 00:00:00 2001 From: Sughosha Date: Thu, 5 Dec 2024 21:48:20 +0530 Subject: [PATCH] gnu: Add stk. * gnu/packages/music.scm (stk): New variable. * gnu/packages/patches/stk-5.0.1-fix-typo.patch: New file. * gnu/local.mk: Register the patch file. Change-Id: I77d0ae447554eb10cfca3d5825b7f466036fb3e8 --- gnu/local.mk | 1 + gnu/packages/music.scm | 115 +++++++++++++++++- gnu/packages/patches/stk-5.0.1-fix-typo.patch | 8 ++ 3 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/stk-5.0.1-fix-typo.patch diff --git a/gnu/local.mk b/gnu/local.mk index 415be7c4347..4766e7ff09f 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -2079,6 +2079,7 @@ dist_patch_DATA = \ %D%/packages/patches/smalltalk-multiplication-overflow.patch \ %D%/packages/patches/soci-mysql-ddl-types.patch \ %D%/packages/patches/sqlite-hurd.patch \ + %D%/packages/patches/stk-5.0.1-fix-typo.patch \ %D%/packages/patches/strace-readlink-tests.patch \ %D%/packages/patches/sunxi-tools-remove-sys-io.patch \ %D%/packages/patches/p11-kit-hurd.patch \ diff --git a/gnu/packages/music.scm b/gnu/packages/music.scm index b9a783d85c3..677d8005c73 100644 --- a/gnu/packages/music.scm +++ b/gnu/packages/music.scm @@ -45,7 +45,7 @@ ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2021 Thomas Albers Raviola ;;; Copyright © 2021 Maxime Devos -;;; Copyright © 2022, 2023 Sughosha +;;; Copyright © 2022, 2023, 2024 Sughosha ;;; Copyright © 2022, 2025 Remco van 't Veer ;;; Copyright © 2022, 2023, 2025 Maxim Cournoyer ;;; Copyright © 2022 Wamm K. D. @@ -1835,6 +1835,119 @@ listeners answer questions about music quickly and simply.") ;; Software is dual-licensed. (license (list license:bsd-3 license:lgpl3+)))) +(define-public stk + (package + (name "stk") + (version "5.0.1") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/thestk/stk") + (commit version))) + (sha256 + (base32 + "0z16614ljbvqa1ax6wl0nkzpqffaz1y59g4r09ch8x45wmy0xknb")) + (file-name (git-file-name name version)) + (patches + (search-patches "stk-5.0.1-fix-typo.patch")))) + (build-system cmake-build-system) + (arguments + (list #:tests? #f ;no tests + #:modules + '((guix build cmake-build-system) + (guix build utils) + (srfi srfi-26)) + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'patch-paths + (lambda _ + ;; Patch rawwaves path. + (substitute* (find-files "." "(\\.h$|\\.cpp$)") + (("\\.\\./\\.\\./rawwaves") + (string-append #$output "/share/stk/rawwaves")) + (("\"rawwaves") + (string-append "\"" #$output "/share/stk/rawwaves"))) + ;; Patch tk and tcl paths. + (with-directory-excursion "projects" + (for-each (lambda (file) + (substitute* (string-drop-right file 4) + (("wish") (which "wish")) + (("< tcl") (string-append "< " #$output:gui + "/share/stk/tcl")) + (("\\./") (string-append #$output "/bin/")))) + (find-files "." "\\.bat$")) + (substitute* (find-files "share/stk/tcl" "\\.tcl$") + (("tcl/bitmaps") + (string-append #$output:gui "/share/stk/tcl/bitmaps")))))) + (add-after 'install 'install-rawwaves-and-projects + (lambda _ + (let* ((bin (string-append #$output "/bin")) + (data (string-append #$output "/share/stk")) + (rawwaves (string-append data "/rawwaves")) + (scores (string-append data "/scores")) + (gui (string-append #$output:gui "/bin")) + (tcl (string-append #$output:gui "/share/stk/tcl"))) + (mkdir-p data) + ;; Install rawwaves. + (copy-recursively "rawwaves" rawwaves) + ;; Install projects. + (with-directory-excursion "../source/projects" + ;; Install project binaries. + (for-each (cut install-file <> bin) + '("demo/stk-demo" + "effects/effects" + "examples/audioprobe" + "examples/bethree" + "examples/controlbee" + "examples/crtsine" + "examples/duplex" + "examples/foursine" + "examples/grains" + "examples/inetIn" + "examples/inetOut" + "examples/midiprobe" + "examples/play" + "examples/playsmf" + "examples/record" + "examples/rtsine" + "examples/sine" + "examples/sineosc" + "examples/threebees" + "eguitar/eguitar" + "ragamatic/ragamat")) + ;; Install project rawwaves. + (for-each (cut copy-recursively <> rawwaves) + '("examples/rawwaves" + "ragamatic/rawwaves")) + ;; Install project scores. + (for-each (cut copy-recursively <> scores) + '("demo/scores" + "eguitar/scores" + "examples/scores")) + ;; Install GUI scripts. + (for-each (lambda (file) + (install-file (string-drop-right file 4) gui)) + (find-files "." "\\.bat")) + ;; Install TCL files. + (for-each (cut copy-recursively <> tcl) + '("demo/tcl" + "effects/tcl" + "eguitar/tcl" + "ragamatic/tcl"))))))))) + (outputs + '("out" "gui")) + (inputs + (list alsa-lib jack-2 tk)) + (home-page "https://ccrma.stanford.edu/software/stk/") + (synopsis "Audio signal processing and algorithmic synthesis classes") + (description + "Synthesis ToolKit in C++ (STK) is a set of audio signal processing and +algorithmic synthesis classes written in C++. + +This package also provides its demo project, examples, ElectricGuitar, +RagaMatic and Effects.") + (license (license:non-copyleft "file:///LICENSE")))) + (define-public abjad (package (name "abjad") diff --git a/gnu/packages/patches/stk-5.0.1-fix-typo.patch b/gnu/packages/patches/stk-5.0.1-fix-typo.patch new file mode 100644 index 00000000000..b4160dcdc6e --- /dev/null +++ b/gnu/packages/patches/stk-5.0.1-fix-typo.patch @@ -0,0 +1,8 @@ +This patch fixes typo. + +diff -ruN stk-5.0.1-a/projects/eguitar/ElectricGuitar stk-5.0.1-b/projects/eguitar/ElectricGuitar +--- stk-5.0.1-a/projects/eguitar/ElectricGuitar 2024-11-30 15:07:14.267988301 +0530 ++++ stk-5.0.1-b/projects/eguitar/ElectricGuitar 2024-11-30 15:05:40.951986213 +0530 +@@ -1 +1 @@ +-wish < tcl/Eguitar.tcl | ./eguitar -or -ip ++wish < tcl/EGuitar.tcl | ./eguitar -or -ip