homebrew-core/Formula/abcmidi.rb

61 lines
2.1 KiB
Ruby

class Abcmidi < Formula
desc "Converts abc music notation files to MIDI files"
homepage "https://ifdo.ca/~seymour/runabc/top.html"
url "https://ifdo.ca/~seymour/runabc/abcMIDI-2020.11.01.zip"
sha256 "37140d78dbf4329f4374c4ea36d6286f5e0fb4812fccdef3782fd98c753235e7"
license "GPL-2.0-or-later"
livecheck do
url :homepage
regex(/href=.*?abcMIDI[._-]v?(\d{4}(?:\.\d+)+)\.zip/i)
end
bottle do
cellar :any_skip_relocation
sha256 "65561d7449e8ddbb172a5def4a5ff56e74bf39b2dc7e60caf610ae3061bdcfd4" => :catalina
sha256 "66de62a0862dd7ed33fad053e84aa4291bbb8537341a6cfb6c3c0b86681af40a" => :mojave
sha256 "9b0110ff1521e9b2aea3b467680572129788c9fcea5dc392eec4fde29c26dd93" => :high_sierra
end
def install
# configure creates a "Makefile" file. A "makefile" file already exist in
# the tarball. On case-sensitive file-systems, the "makefile" file won't
# be overridden and will be chosen over the "Makefile" file.
rm "makefile"
# Fix the build issue (remove in the next release)
inreplace "drawtune.c", "printtext(left, v->place->item, &textfont);",
"printtext(left, v->place->item.voidptr, &textfont);"
inreplace "drawtune.c", "printtext(centre, v->place->item, &textfont);",
"printtext(centre, v->place->item.voidptr, &textfont);"
system "./configure", "--disable-debug",
"--prefix=#{prefix}",
"--mandir=#{man}"
system "make", "install"
end
test do
(testpath/"balk.abc").write <<~EOS
X: 1
T: Abdala
F: https://www.youtube.com/watch?v=YMf8yXaQDiQ
L: 1/8
M: 2/4
K:Cm
Q:1/4=180
%%MIDI bassprog 32 % 32 Acoustic Bass
%%MIDI program 23 % 23 Tango Accordian
%%MIDI bassvol 69
%%MIDI gchord fzfz
|:"G"FDEC|D2C=B,|C2=B,2 |C2D2 |\
FDEC |D2C=B,|C2=B,2 |A,2G,2 :|
|:=B,CDE |D2C=B,|C2=B,2 |C2D2 |\
=B,CDE |D2C=B,|C2=B,2 |A,2G,2 :|
|:C2=B,2 |A,2G,2| C2=B,2|A,2G,2 :|
EOS
system "#{bin}/abc2midi", (testpath/"balk.abc")
end
end