Skip to content
Permalink
Browse files

swig@3 3.0.12 (new formula)

Closes #40882.

Signed-off-by: FX Coudert <fxcoudert@gmail.com>
  • Loading branch information...
golddranks authored and fxcoudert committed Jun 11, 2019
1 parent 71c82ba commit 2234b3b8030225252143d95e03dfc240563380a0
Showing with 42 additions and 0 deletions.
  1. +1 −0 Aliases/swig@4
  2. +41 −0 Formula/swig@3.rb
@@ -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

0 comments on commit 2234b3b

Please sign in to comment.
You can’t perform that action at this time.