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 10 bottle do cellar :any sha256 "5b3c887b0120e2c2bd245039a61112515d589ec612b5aa9549997c86ff0c7e95" => :high_sierra sha256 "d17971236af3fe65db605b25423399e239d622428b34157e6c4e636ed0a52652" => :sierra sha256 "c59f56c6176d701173eb224d430889132a57053cc1a4856940c272bda9d51cac" => :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