homebrew-core/Formula/sdl_mixer.rb

75 lines
2.8 KiB
Ruby

class SdlMixer < Formula
desc "Sample multi-channel audio mixer library"
homepage "https://www.libsdl.org/projects/SDL_mixer/release-1.2.html"
url "https://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-1.2.12.tar.gz"
sha256 "1644308279a975799049e4826af2cfc787cad2abb11aa14562e402521f86992a"
license "Zlib"
revision 5
bottle do
sha256 cellar: :any, arm64_monterey: "bf7c8686812fd5eb59e7e7bd9f120b1e85f474acce17b612f240761d46739f9b"
sha256 cellar: :any, arm64_big_sur: "90a26748047828c1919a1de00143c669814734188c0550722fd38bbdd1f39899"
sha256 cellar: :any, monterey: "65e25407a6d47938fc46477fc74d1e5c40fcdba60e29a914931cd5fb50b58b4c"
sha256 cellar: :any, big_sur: "3f8870e236f1834fe0f2dbe7d6aae3375be338f48f84eac7587c84f881a0c069"
sha256 cellar: :any, catalina: "914bf00dad1257cd265def31604f50cda4438da321e1a0df64019f91bb6ab68b"
sha256 cellar: :any_skip_relocation, x86_64_linux: "3caaa090c550de558ec29df8b9b5868013bb37cb7b5eab2ad2841aa666f43600"
end
head do
url "https://github.com/libsdl-org/SDL_mixer.git", branch: "SDL-1.2"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
# SDL 1.2 is deprecated, unsupported, and not recommended for new projects.
# Commented out while this formula still has dependents.
# deprecate! date: "2013-08-17", because: :deprecated_upstream
depends_on "pkg-config" => :build
depends_on "flac"
depends_on "libmikmod"
depends_on "libogg"
depends_on "libvorbis"
depends_on "sdl"
# Source file for sdl_mixer example
resource "playwave" do
url "https://github.com/libsdl-org/SDL_mixer/raw/1a14d94ed4271e45435ecb5512d61792e1a42932/playwave.c"
sha256 "92f686d313f603f3b58431ec1a3a6bf29a36e5f792fb78417ac3d5d5a72b76c9"
end
def install
inreplace "SDL_mixer.pc.in", "@prefix@", HOMEBREW_PREFIX
system "./autogen.sh" if build.head?
args = %W[
--prefix=#{prefix}
--disable-dependency-tracking
--enable-music-ogg
--enable-music-flac
--disable-music-ogg-shared
--disable-music-mod-shared
]
system "./configure", *args
system "make", "install"
end
test do
testpath.install resource("playwave")
cocoa = []
cocoa << "-Wl,-framework,Cocoa" if OS.mac?
system ENV.cc, "playwave.c", *cocoa, "-I#{include}/SDL",
"-I#{Formula["sdl"].opt_include}/SDL",
"-L#{lib}", "-lSDL_mixer",
"-L#{Formula["sdl"].lib}", "-lSDLmain", "-lSDL",
"-o", "playwave"
Utils.safe_popen_read({ "SDL_VIDEODRIVER" => "dummy", "SDL_AUDIODRIVER" => "disk" },
"./playwave", test_fixtures("test.wav"))
assert_predicate testpath/"sdlaudio.raw", :exist?
end
end