class Ocamlsdl < Formula desc "OCaml interface with the SDL C library" homepage "https://ocamlsdl.sourceforge.io/" url "https://downloads.sourceforge.net/project/ocamlsdl/OCamlSDL/ocamlsdl-0.9.1/ocamlsdl-0.9.1.tar.gz" sha256 "abfb295b263dc11e97fffdd88ea1a28b46df8cc2b196777093e4fe7f509e4f8f" revision 9 bottle do cellar :any sha256 "8313d585edbdf92234128947a792ca26e2a0d2181d83ce1c2e90bc6c46d97f03" => :high_sierra sha256 "8a40a90601e1f63f0a6ec5bf83cb5e78d401f8bd94bef4f5c2ca48d881bc961a" => :sierra sha256 "6cd7f7cf05819e1109d24a678ee2f21a742c8f743a3d23b56a80e2b8897ead98" => :el_capitan end depends_on "sdl" depends_on "ocaml" depends_on "sdl_mixer" => :recommended depends_on "sdl_image" => :recommended depends_on "sdl_gfx" => :recommended depends_on "sdl_ttf" => :recommended def install ENV["OCAMLPARAM"] = "safe-string=0,_" # OCaml 4.06.0 compat system "./configure", "--prefix=#{prefix}", "OCAMLLIB=#{lib}/ocaml" system "make" system "make", "install" end test do (testpath/"test.ml").write <<~EOS let main () = Sdl.init [`VIDEO]; Sdl.quit () let _ = main () EOS system "#{Formula["ocaml"].opt_bin}/ocamlopt", "-I", "+sdl", "sdl.cmxa", "-cclib", "-lSDLmain", "-cclib", "-lSDL", "-cclib", "-Wl,-framework,Cocoa", "-o", "test", "test.ml" system "./test" end end