From 93e31ace7aa82d708a9c72f0c10e053b7e68b6d0 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Tue, 22 Jun 2021 17:03:49 +0100 Subject: [PATCH] wxmac@3.0 3.0.5.1 (new formula) This is the long-term support version of wxWidgets. This version is needed by some formulae that currently depend on `wxmac`. --- Formula/wxmac@3.0.rb | 89 +++++++++++++++++++ .../versioned_keg_only_allowlist.json | 3 +- 2 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 Formula/wxmac@3.0.rb diff --git a/Formula/wxmac@3.0.rb b/Formula/wxmac@3.0.rb new file mode 100644 index 00000000000..1a0bc454be3 --- /dev/null +++ b/Formula/wxmac@3.0.rb @@ -0,0 +1,89 @@ +class WxmacAT30 < Formula + desc "Cross-platform C++ GUI toolkit (wxWidgets for macOS) - Stable Release" + homepage "https://www.wxwidgets.org" + url "https://github.com/wxWidgets/wxWidgets/releases/download/v3.0.5.1/wxWidgets-3.0.5.1.tar.bz2" + sha256 "440f6e73cf5afb2cbf9af10cec8da6cdd3d3998d527598a53db87099524ac807" + license "wxWindows" + + livecheck do + url :stable + regex(/^v?(\d+\.\d*[02468](?:\.\d+)*)$/i) + end + + depends_on "jpeg" + depends_on "libpng" + depends_on "libtiff" + + on_linux do + depends_on "pkg-config" => :build + depends_on "gtk+" + depends_on "libsm" + depends_on "mesa-glu" + end + + def install + args = [ + "--prefix=#{prefix}", + "--enable-clipboard", + "--enable-controls", + "--enable-dataviewctrl", + "--enable-display", + "--enable-dnd", + "--enable-graphics_ctx", + "--enable-std_string", + "--enable-svg", + "--enable-unicode", + "--enable-webkit", + "--enable-webview", + "--with-expat", + "--with-libjpeg", + "--with-libpng", + "--with-libtiff", + "--with-opengl", + "--with-zlib", + "--disable-precomp-headers", + # This is the default option, but be explicit + "--disable-monolithic", + ] + + on_macos do + # Set with-macosx-version-min to avoid configure defaulting to 10.5 + args << "--with-macosx-version-min=#{MacOS.version}" + args << "--with-osx_cocoa" + args << "--with-libiconv" + end + + system "./configure", *args + system "make", "install" + + # wx-config should reference the public prefix, not wxmac's keg + # this ensures that Python software trying to locate wxpython headers + # using wx-config can find both wxmac and wxpython headers, + # which are linked to the same place + inreplace "#{bin}/wx-config", prefix, HOMEBREW_PREFIX + + # Move some files out of the way to prevent conflict with `wxmac` + bin.install "#{bin}/wx-config" => "wx-config-#{version.major_minor}" + (bin/"wxrc").unlink + (share/"wx"/version.major_minor).install share/"aclocal", share/"bakefile" + Dir.glob(share/"locale/**/*.mo") { |file| add_suffix file, version.major_minor } + end + + def add_suffix(file, suffix) + dir = File.dirname(file) + ext = File.extname(file) + base = File.basename(file, ext) + File.rename file, "#{dir}/#{base}-#{suffix}#{ext}" + end + + def caveats + <<~EOS + To avoid conflicts with the wxmac formula, `wx-config` and `wxrc` + have been installed as `wx-config-#{version.major_minor}` and `wxrc-#{version.major_minor}`. + EOS + end + + test do + system bin/"wx-config-#{version.major_minor}", "--libs" + end +end diff --git a/audit_exceptions/versioned_keg_only_allowlist.json b/audit_exceptions/versioned_keg_only_allowlist.json index fb2982fbef6..5127144b0b0 100644 --- a/audit_exceptions/versioned_keg_only_allowlist.json +++ b/audit_exceptions/versioned_keg_only_allowlist.json @@ -22,5 +22,6 @@ "pangomm@2.46", "pyqt@5", "python@3.9", - "python-tk@3.9" + "python-tk@3.9", + "wxmac@3.0" ]