homebrew-core/Formula/sdl2_mixer.rb
2018-11-01 00:45:12 +01:00

62 lines
2 KiB
Ruby

class Sdl2Mixer < Formula
desc "Sample multi-channel audio mixer library"
homepage "https://www.libsdl.org/projects/SDL_mixer/"
url "https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.4.tar.gz"
sha256 "b4cf5a382c061cd75081cf246c2aa2f9df8db04bdda8dcdc6b6cca55bede2419"
head "https://hg.libsdl.org/SDL_mixer", :using => :hg
bottle do
cellar :any
sha256 "411aebe8a4b960a900879efc9d871575156efc174863beb135359679f3e7a8bf" => :mojave
sha256 "af842a740632725bec40acd7418fa21aafcce0bee03d11a283c8c3509a235c78" => :high_sierra
sha256 "359d8bd99a88d06f9484eb76b87b021ce48c777ac4583a0301ae0449e693cbf9" => :sierra
end
depends_on "pkg-config" => :build
depends_on "libmodplug"
depends_on "libvorbis"
depends_on "sdl2"
depends_on "flac" => :optional
depends_on "fluid-synth" => :optional
depends_on "libmikmod" => :optional
depends_on "mpg123" => :optional
def install
inreplace "SDL2_mixer.pc.in", "@prefix@", HOMEBREW_PREFIX
args = %W[
--prefix=#{prefix} --disable-dependency-tracking
--enable-music-ogg --disable-music-ogg-shared
--disable-music-flac-shared
--disable-music-midi-fluidsynth-shared
--disable-music-mod-mikmod-shared
--enable-music-mod-modplug
--disable-music-mod-modplug-shared
--disable-music-mp3-smpeg
--disable-music-mp3-mpg123-shared
]
args << "--disable-music-flac" if build.without? "flac"
args << "--disable-music-midi-fluidsynth" if build.without? "fluid-synth"
args << "--enable-music-mod-mikmod" if build.with? "libmikmod"
args << "--disable-music-mp3-mpg123" if build.without? "mpg123"
system "./configure", *args
system "make", "install"
end
test do
(testpath/"test.c").write <<~EOS
#include <SDL2/SDL_mixer.h>
int main()
{
int success = Mix_Init(0);
Mix_Quit();
return success;
}
EOS
system ENV.cc, "-L#{lib}", "-lsdl2_mixer", "test.c", "-o", "test"
system "./test"
end
end