homebrew-core/Formula/ocamlsdl.rb

43 lines
1.4 KiB
Ruby

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 8
bottle do
cellar :any
sha256 "01d4b6848f1e138e621ee37698f81d128dd8aba1edb09e6b2a2466c1a413d085" => :high_sierra
sha256 "6015c0a5a2c6e1f60ed2c67947df817d3f91f59e74179615ede58bd0fa7ac463" => :sierra
sha256 "12bcce8fd2e3779988014ee22cc96653caaabb660010c6aefde798a64a030601" => :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