Skip to content

Commit

Permalink
sdl3 3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
revmischa committed Jan 27, 2025
1 parent b3588d3 commit 9b5ab1b
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions Formula/s/sdl3.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
class Sdl3 < Formula
desc "Low-level access to audio, keyboard, mouse, joystick, and graphics"
homepage "https://www.libsdl.org/"
url "https://github.com/libsdl-org/SDL/releases/download/release-3.2.0/SDL3-3.2.0.tar.gz"
sha256 "bf308f92c5688b1479faf5cfe24af72f3cd4ce08d0c0670d6ce55bc2ec1e9a5e"
license "Zlib"
head "https://github.com/libsdl-org/SDL.git", branch: "main"

livecheck do
url :stable
regex(/release[._-](\d+(?:\.\d+)+)/i)
strategy :github_latest
end

depends_on "cmake" => :build

on_linux do
depends_on "pkgconf" => :build
depends_on "libice"
depends_on "libxcursor"
depends_on "libxscrnsaver"
depends_on "libxxf86vm"
depends_on "pulseaudio"
depends_on "xinput"
end

def install
inreplace "cmake/sdl3.pc.in", "@SDL_PKGCONFIG_PREFIX@", HOMEBREW_PREFIX

args = [
"-DSDL_HIDAPI=ON",
"-DSDL_WAYLAND=OFF",
]

args += if OS.mac?
["-DSDL_X11=OFF"]
else
["-DSDL_X11=ON", "-DSDL_PULSEAUDIO=ON"]
end

system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args
system "cmake", "--build", "build"
system "cmake", "--install", "build"
end

test do
(testpath/"test.c").write <<~CPP
#include <SDL3/SDL.h>
int main() {
if (SDL_Init(SDL_INIT_VIDEO) != 1) {
return 1;
}
SDL_Quit();
return 0;
}
CPP
system ENV.cc, "test.c", "-I#{include}", "-L#{lib}", "-lSDL3", "-o", "test"
ENV["SDL_VIDEODRIVER"] = "dummy"
system "./test"
end
end

0 comments on commit 9b5ab1b

Please sign in to comment.