class Sdl2 < 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-2.30.10/SDL2-2.30.10.tar.gz" sha256 "f59adf36a0fcf4c94198e7d3d776c1b3824211ab7aeebeb31fe19836661196aa" license "Zlib" livecheck do url :stable regex(/release[._-](\d+(?:\.\d+)+)/i) strategy :github_latest end head do url "https://github.com/libsdl-org/SDL.git", branch: "SDL2" depends_on "autoconf" => :build depends_on "automake" => :build depends_on "libtool" => :build end 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 # We have to do this because most build scripts assume that all SDL modules # are installed to the same prefix. Consequently SDL stuff cannot be # keg-only but I doubt that will be needed. inreplace "sdl2.pc.in", "@prefix@", HOMEBREW_PREFIX system "./autogen.sh" if build.head? args = %W[--prefix=#{prefix} --enable-hidapi] args += if OS.mac? %w[--without-x] else %w[ --disable-rpath --enable-pulseaudio --enable-pulseaudio-shared --enable-video-dummy --enable-video-opengl --enable-video-opengles --enable-video-x11 --enable-video-x11-scrnsaver --enable-video-x11-xcursor --enable-video-x11-xinerama --enable-video-x11-xinput --enable-video-x11-xrandr --enable-video-x11-xshape --enable-x11-shared --with-x ] end system "./configure", *args system "make", "install" end test do system bin/"sdl2-config", "--version" end end