swig@3 3.0.12 (new formula)

Closes #40882.

Signed-off-by: FX Coudert <fxcoudert@gmail.com>
This commit is contained in:
Pyry Kontio 2019-06-12 01:24:40 +09:00 committed by FX Coudert
parent 71c82ba7df
commit 2234b3b803
2 changed files with 42 additions and 0 deletions

1
Aliases/swig@4 Symbolic link
View file

@ -0,0 +1 @@
../Formula/swig.rb

41
Formula/swig@3.rb Normal file
View file

@ -0,0 +1,41 @@
class SwigAT3 < Formula
desc "Generate scripting interfaces to C/C++ code"
homepage "http://www.swig.org/"
url "https://downloads.sourceforge.net/project/swig/swig/swig-3.0.12/swig-3.0.12.tar.gz"
sha256 "7cf9f447ae7ed1c51722efc45e7f14418d15d7a1e143ac9f09a668999f4fc94d"
keg_only :versioned_formula
depends_on "pcre"
def install
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}"
system "make"
system "make", "install"
end
test do
(testpath/"test.c").write <<~EOS
int add(int x, int y)
{
return x + y;
}
EOS
(testpath/"test.i").write <<~EOS
%module test
%inline %{
extern int add(int x, int y);
%}
EOS
(testpath/"run.rb").write <<~EOS
require "./test"
puts Test.add(1, 1)
EOS
system "#{bin}/swig", "-ruby", "test.i"
system ENV.cc, "-c", "test.c"
system ENV.cc, "-c", "test_wrap.c", "-I#{MacOS.sdk_path}/System/Library/Frameworks/Ruby.framework/Headers/"
system ENV.cc, "-bundle", "-undefined", "dynamic_lookup", "test.o", "test_wrap.o", "-o", "test.bundle"
assert_equal "2", shell_output("/usr/bin/ruby run.rb").strip
end
end