|
| 1 | +class Sdl3Mixer < Formula |
| 2 | + desc "Sample multi-channel audio mixer library" |
| 3 | + homepage "https://github.com/libsdl-org/SDL_mixer" |
| 4 | + url "https://github.com/libsdl-org/SDL_mixer/releases/download/release-3.2.0/SDL3_mixer-3.2.0.tar.gz" |
| 5 | + sha256 "1f86fae7226d58f2ad210ca4d9e06488db722230032803423d83bad6d35fc395" |
| 6 | + license "Zlib" |
| 7 | + |
| 8 | + head "https://github.com/libsdl-org/SDL_mixer.git", branch: "main" |
| 9 | + |
| 10 | + livecheck do |
| 11 | + url :stable |
| 12 | + regex(/^(?:release[._-])?v?(3(?:\.\d+)+)$/i) |
| 13 | + end |
| 14 | + |
| 15 | + depends_on "cmake" => :build |
| 16 | + depends_on "pkgconf" => :build |
| 17 | + depends_on "flac" |
| 18 | + depends_on "fluid-synth" |
| 19 | + depends_on "game-music-emu" |
| 20 | + depends_on "libvorbis" |
| 21 | + depends_on "libxmp" |
| 22 | + depends_on "mpg123" |
| 23 | + depends_on "opusfile" |
| 24 | + depends_on "sdl3" |
| 25 | + depends_on "wavpack" |
| 26 | + |
| 27 | + def install |
| 28 | + system "cmake", "-S", ".", |
| 29 | + "-B", "build", |
| 30 | + "-DSDLMIXER_DEPS_SHARED=OFF", |
| 31 | + "-DSDLMIXER_VENDORED=OFF", |
| 32 | + *std_cmake_args |
| 33 | + system "cmake", "--build", "build" |
| 34 | + system "cmake", "--install", "build" |
| 35 | + end |
| 36 | + |
| 37 | + test do |
| 38 | + (testpath/"test.c").write <<~C |
| 39 | + #include <SDL3_mixer/SDL_mixer.h> |
| 40 | + #include <stdlib.h> |
| 41 | +
|
| 42 | + int main() |
| 43 | + { |
| 44 | + int result = MIX_Init(); |
| 45 | + MIX_Quit(); |
| 46 | + return result != 0 ? EXIT_SUCCESS : EXIT_FAILURE; |
| 47 | + } |
| 48 | + C |
| 49 | + system ENV.cc, "test.c", "-I#{Formula["sdl3"].opt_include}", |
| 50 | + "-L#{lib}", "-lSDL3_mixer", "-o", "test" |
| 51 | + system "./test" |
| 52 | + end |
| 53 | +end |
0 commit comments