Skip to content

Commit 2234b3b

Browse files
golddranksfxcoudert
authored andcommitted
swig@3 3.0.12 (new formula)
Closes #40882. Signed-off-by: FX Coudert <[email protected]>
1 parent 71c82ba commit 2234b3b

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

Aliases/swig@4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../Formula/swig.rb

Formula/[email protected]

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
class SwigAT3 < Formula
2+
desc "Generate scripting interfaces to C/C++ code"
3+
homepage "http://www.swig.org/"
4+
url "https://downloads.sourceforge.net/project/swig/swig/swig-3.0.12/swig-3.0.12.tar.gz"
5+
sha256 "7cf9f447ae7ed1c51722efc45e7f14418d15d7a1e143ac9f09a668999f4fc94d"
6+
7+
keg_only :versioned_formula
8+
9+
depends_on "pcre"
10+
11+
def install
12+
system "./configure", "--disable-dependency-tracking",
13+
"--prefix=#{prefix}"
14+
system "make"
15+
system "make", "install"
16+
end
17+
18+
test do
19+
(testpath/"test.c").write <<~EOS
20+
int add(int x, int y)
21+
{
22+
return x + y;
23+
}
24+
EOS
25+
(testpath/"test.i").write <<~EOS
26+
%module test
27+
%inline %{
28+
extern int add(int x, int y);
29+
%}
30+
EOS
31+
(testpath/"run.rb").write <<~EOS
32+
require "./test"
33+
puts Test.add(1, 1)
34+
EOS
35+
system "#{bin}/swig", "-ruby", "test.i"
36+
system ENV.cc, "-c", "test.c"
37+
system ENV.cc, "-c", "test_wrap.c", "-I#{MacOS.sdk_path}/System/Library/Frameworks/Ruby.framework/Headers/"
38+
system ENV.cc, "-bundle", "-undefined", "dynamic_lookup", "test.o", "test_wrap.o", "-o", "test.bundle"
39+
assert_equal "2", shell_output("/usr/bin/ruby run.rb").strip
40+
end
41+
end

0 commit comments

Comments
 (0)