-
-
Notifications
You must be signed in to change notification settings - Fork 12.6k
/
Copy pathfluid-synth.rb
111 lines (100 loc) · 3.91 KB
/
fluid-synth.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
class FluidSynth < Formula
desc "Real-time software synthesizer based on the SoundFont 2 specs"
homepage "https://www.fluidsynth.org"
url "https://github.com/FluidSynth/fluidsynth/archive/refs/tags/v2.3.4.tar.gz"
sha256 "1529ef5bc3b9ef3adc2a7964505912f7305103e269e50cc0316f500b22053ac9"
license "LGPL-2.1-or-later"
head "https://github.com/FluidSynth/fluidsynth.git", branch: "master"
bottle do
rebuild 1
sha256 cellar: :any, arm64_sonoma: "eb5b92efe4db87de731240de9e564a366147833ea6be304cef69ffe6aa3883f6"
sha256 cellar: :any, arm64_ventura: "3056b2d1d3c5e7aeac387d932842c26725a1d7e164e6e9b96437c2d7d7f35942"
sha256 cellar: :any, arm64_monterey: "c0cc616c2b5c697bee492f1c381afe537c5ed333105a8e78dd79c71dafb06172"
sha256 cellar: :any, sonoma: "2d81640079d0881771c927a3940a7696af4a7ca7d195dcb11720fc670b5b4fa5"
sha256 cellar: :any, ventura: "47162296f6ab760740525f63627c39c2a60a20a77b6c53a4739b2628c169a3aa"
sha256 cellar: :any, monterey: "ebe07a9607d56956128d0fdb27ca832c4f43e8104ba9670169775b8ecd091e89"
sha256 cellar: :any_skip_relocation, x86_64_linux: "b181d4d1881d63d6ce88f4cc82b835545fde6e06dbf582cc1b91330bdff50f57"
end
depends_on "cmake" => :build
depends_on "pkg-config" => [:build, :test]
depends_on "glib"
depends_on "libsndfile"
depends_on "portaudio"
depends_on "readline"
on_macos do
depends_on "gettext"
end
on_linux do
depends_on "alsa-lib"
depends_on "jack"
depends_on "systemd"
end
resource "homebrew-test" do
url "https://upload.wikimedia.org/wikipedia/commons/6/61/Drum_sample.mid"
sha256 "a1259360c48adc81f2c5b822f221044595632bd1a76302db1f9d983c44f45a30"
end
def install
args = %W[
-Denable-alsa=#{OS.linux?}
-Denable-aufile=ON
-Denable-coverage=OFF
-Denable-coreaudio=#{OS.mac?}
-Denable-coremidi=#{OS.mac?}
-Denable-dart=OFF
-Denable-dbus=OFF
-Denable-dsound=OFF
-Denable-floats=OFF
-Denable-fpe-check=OFF
-Denable-framework=OFF
-Denable-ipv6=ON
-Denable-jack=#{OS.linux?}
-Denable-ladspa=OFF
-Denable-lash=OFF
-Denable-libinstpatch=OFF
-Denable-libsndfile=ON
-Denable-midishare=OFF
-Denable-network=ON
-Denable-opensles=OFF
-Denable-oboe=OFF
-Denable-openmp=OFF
-Denable-oss=OFF
-Denable-pipewire=OFF
-Denable-portaudio=ON
-Denable-profiling=OFF
-Denable-pulseaudio=OFF
-Denable-readline=ON
-Denable-sdl2=OFF
-Denable-systemd=#{OS.linux?}
-Denable-trap-on-fpe=OFF
-Denable-threads=ON
-Denable-ubsan=OFF
-Denable-wasapi=OFF
-Denable-waveout=OFF
-Denable-winmidi=OFF
]
system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args
# On macOS, readline is keg-only so use the absolute path to its pc file
# uses_from_macos "readline" produces another error
# Related error: Package 'readline', required by 'fluidsynth', not found
if OS.mac?
inreplace "build/fluidsynth.pc",
"readline",
"#{Formula["readline"].opt_lib}/pkgconfig/readline.pc"
end
system "cmake", "--build", "build"
system "cmake", "--install", "build"
pkgshare.install "sf2"
system "cmake", "-S", ".", "-B", "static", *args, *std_cmake_args, "-DBUILD_SHARED_LIBS=OFF"
system "cmake", "--build", "static"
lib.install "static/src/libfluidsynth.a"
end
test do
# Synthesize wav file from example midi
resource("homebrew-test").stage testpath
wavout = testpath/"Drum_sample.wav"
system bin/"fluidsynth", "-F", wavout, pkgshare/"sf2/VintageDreamsWaves-v2.sf2", testpath/"Drum_sample.mid"
assert_predicate wavout, :exist?
# Check the pkg-config module
system "pkg-config", "--cflags", "--libs", "--static", lib/"pkgconfig/fluidsynth.pc"
end
end