class Csound < Formula desc "Sound and music computing system" homepage "https://csound.com" url "https://github.com/csound/csound/archive/6.12.2.tar.gz" sha256 "39f4872b896eb1cbbf596fcacc0f2122fd3e5ebbb5cec14a81b4207d6b8630ff" revision 1 bottle do sha256 "c61580b06971b50952504c4c7ec913998531c1dc253f9f187d2a643ab92d3d55" => :mojave sha256 "8663be5e850243c2fdd345d26741657d261903922784bdfba449a6b9c356bfbc" => :high_sierra sha256 "4cee30249722264ebaca435af3798a2bffa3a88095212e6699e16fc811c03418" => :sierra end depends_on "cmake" => :build depends_on "fltk" depends_on "liblo" depends_on "libsamplerate" depends_on "libsndfile" depends_on "portaudio" depends_on "portmidi" depends_on "stk" def install inreplace "CMakeLists.txt", %r{^set\(CS_FRAMEWORK_DEST\s+"~/Library/Frameworks"\)$}, "set(CS_FRAMEWORK_DEST \"#{frameworks}\")" args = std_cmake_args + %W[ -DBUILD_FLUID_OPCODES=OFF -DBUILD_JAVA_INTERFACE=OFF -DBUILD_LUA_INTERFACE=OFF -DBUILD_PYTHON_INTERFACE=OFF -DCMAKE_INSTALL_RPATH=#{frameworks} ] mkdir "build" do system "cmake", "..", *args system "make", "install" include.install_symlink "#{frameworks}/CsoundLib64.framework/Headers" => "csound" end end test do (testpath/"test.orc").write <<~EOS 0dbfs = 1 FLrun pyinit instr 1 pyruni "from __future__ import print_function; print('hello, world')" aSignal STKPlucked 440, 1 out aSignal endin EOS (testpath/"test.sco").write <<~EOS i 1 0 1 e EOS ENV["OPCODE6DIR64"] = "#{HOMEBREW_PREFIX}/Frameworks/CsoundLib64.framework/Resources/Opcodes64" ENV["RAWWAVE_PATH"] = "#{HOMEBREW_PREFIX}/share/stk/rawwaves" require "open3" stdout, stderr, status = Open3.capture3("#{bin}/csound test.orc test.sco") assert_equal true, status.success? assert_equal "hello, world\n", stdout assert_match /^rtaudio:/, stderr assert_match /^rtmidi:/, stderr end end