From 05379d59e9528500c445bc63e3313c26c6d8e044 Mon Sep 17 00:00:00 2001
From: Pyry Kontio <pyry.kontio@drasa.eu>
Date: Wed, 12 Jun 2019 01:25:01 +0900
Subject: [PATCH 1/2] swig@3.04: Remove unmaintained formula

---
 Formula/swig@3.04.rb | 49 --------------------------------------------
 1 file changed, 49 deletions(-)
 delete mode 100644 Formula/swig@3.04.rb

diff --git a/Formula/swig@3.04.rb b/Formula/swig@3.04.rb
deleted file mode 100644
index 12283735141cc..0000000000000
--- a/Formula/swig@3.04.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-class SwigAT304 < 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.4/swig-3.0.4.tar.gz"
-  sha256 "410ffa80ef5535244b500933d70c1b65206333b546ca5a6c89373afb65413795"
-
-  bottle do
-    sha256 "264a8dc6653c2fc3ae88f1b0a8d60aef2b54db681b4fce4ce783b4f73f6daa84" => :mojave
-    sha256 "fa6edd5df156b7a985bfe6f74f56cf15682af6b01d11f0ed342f2f05444234f0" => :high_sierra
-    sha256 "51b8115c0a2813caf115fb5f082e7aa1b84b7c51acec70822b8619e918969a14" => :sierra
-    sha256 "84988480f25dea3fce15b6ca0e9a3322222cc473066f23626d59b20001574fdf" => :el_capitan
-    sha256 "f5e5251fa5d8f6ce3a7e63c9f3762ccd3bbc49f4664d1d781b71425992c2425b" => :yosemite
-  end
-
-  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", "-flat_namespace", "-undefined", "suppress", "test.o", "test_wrap.o", "-o", "test.bundle"
-    assert_equal "2", shell_output("/usr/bin/ruby run.rb").strip
-  end
-end

From 24307ca6bf848bf53bd77d3bb9f42ec956d10d47 Mon Sep 17 00:00:00 2001
From: Pyry Kontio <pyry.kontio@drasa.eu>
Date: Wed, 12 Jun 2019 01:24:40 +0900
Subject: [PATCH 2/2] swig@3 3.0.12 (new formula)

---
 Aliases/swig@4    |  1 +
 Formula/swig@3.rb | 41 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+)
 create mode 120000 Aliases/swig@4
 create mode 100644 Formula/swig@3.rb

diff --git a/Aliases/swig@4 b/Aliases/swig@4
new file mode 120000
index 0000000000000..0d1a33d7ad9fa
--- /dev/null
+++ b/Aliases/swig@4
@@ -0,0 +1 @@
+../Formula/swig.rb
\ No newline at end of file
diff --git a/Formula/swig@3.rb b/Formula/swig@3.rb
new file mode 100644
index 0000000000000..502e81c53cd91
--- /dev/null
+++ b/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