# Documentation: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Formula-Cookbook.md
# /usr/local/Library/Contributions/example-formula.rb
#
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
#
# FOR LOCAL INSTALLATION COPY IT IN /usr/local/Library/Formula/
#
class J2objc < Formula
homepage "http://j2objc.org/"
url "https://github.com/google/j2objc/releases/download/0.9.7/j2objc-0.9.7.zip"
version "0.9.7"
sha1 "0346eb7ad20793a8cc7e2e6a907039290b0abe3d"
# depends_on "cmake" => :build
#depends_on :x11 # if your formula requires any X11/XQuartz components
def shim_script target
<<-EOS.undent
#!/bin/bash
export J2OBJC_HOME=#{libexec}
"#{libexec}/#{target}" "$@"
EOS
end
def install
libexec.install %w{ lib include }
man.install Dir["man/*"]
libexec.install "j2objc"
libexec.install "j2objcc"
libexec.install "cycle_finder"
(bin+'j2objc').write shim_script('j2objc')
(bin+'j2objcc').write shim_script('j2objcc')
(bin+'cycle_finder').write shim_script('cycle_finder')
#bin.install_symlink libexec/"j2objc"
#bin.install_symlink libexec/"j2objcc"
#bin.install_symlink libexec/"cycle_finder"
end
test do
# `test do` will create, run in and delete a temporary directory.
#
# This test will fail and we won't accept that! It's enough to just replace
# "false" with the main program this formula installs, but it'd be nice if you
# were more thorough. Run the test with `brew test j2objc`. Options passed
# to `brew install` such as `--HEAD` also need to be provided to `brew test`.
#
# The installed folder is not in the path, so use the entire path to any
# executables being tested: `system "#{bin}/program", "do", "something"`.
#system "false"
end
end