homebrew-core/Formula/ocamlsdl.rb

46 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"
license "LGPL-2.1-or-later"
revision 13
bottle do
sha256 cellar: :any, catalina: "8ccd0c9f59b9fad6fe084e57e726cd20d0f26497e71e4be94ff7f603512cbef8"
sha256 cellar: :any, mojave: "6cd21f03d8a557368499d9cd61233dab4bab11fcd99c312036d58d660598c539"
sha256 cellar: :any, high_sierra: "6ae2abcf123aef7ce6cc2c5aad0d912bc459fdd9e7e2abfa99135d672767ddb7"
end
disable! date: "2020-09-21", because: :unmaintained
depends_on "ocaml"
depends_on "sdl"
depends_on "sdl_gfx"
depends_on "sdl_image"
depends_on "sdl_mixer"
depends_on "sdl_ttf"
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