127 lines
3.9 KiB
Ruby
127 lines
3.9 KiB
Ruby
# Patches for Qt must be at the very least submitted to Qt's Gerrit codereview
|
|
# rather than their bug-report Jira. The latter is rarely reviewed by Qt.
|
|
class Qt < Formula
|
|
desc "Cross-platform application and UI framework"
|
|
homepage "https://www.qt.io/"
|
|
url "https://download.qt.io/official_releases/qt/5.15/5.15.2/single/qt-everywhere-src-5.15.2.tar.xz"
|
|
mirror "https://mirrors.dotsrc.org/qtproject/archive/qt/5.15/5.15.2/single/qt-everywhere-src-5.15.2.tar.xz"
|
|
mirror "https://mirrors.ocf.berkeley.edu/qt/archive/qt/5.15/5.15.2/single/qt-everywhere-src-5.15.2.tar.xz"
|
|
sha256 "3a530d1b243b5dec00bc54937455471aaa3e56849d2593edb8ded07228202240"
|
|
license all_of: ["GFDL-1.3-only", "GPL-2.0-only", "GPL-3.0-only", "LGPL-2.1-only", "LGPL-3.0-only"]
|
|
|
|
head "https://code.qt.io/qt/qt5.git", branch: "dev", shallow: false
|
|
|
|
livecheck do
|
|
url :head
|
|
regex(/^v?(\d+(?:\.\d+)+)$/i)
|
|
end
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "ac22ab5828d894518e42f00e254f1e36d5be4e5f3f1c08b3cd49b57819daaf2d" => :big_sur
|
|
sha256 "51ab78a99ff3498a236d15d9bed92962ddd2499c4020356469f7ab1090cf6825" => :catalina
|
|
sha256 "25c4a693c787860b090685ac5cbeea18128d4d6361eed5b1bfed1b16ff6e4494" => :mojave
|
|
end
|
|
|
|
keg_only "Qt 5 has CMake issues when linked"
|
|
|
|
depends_on "pkg-config" => :build
|
|
depends_on xcode: :build
|
|
depends_on macos: :sierra
|
|
|
|
uses_from_macos "bison"
|
|
uses_from_macos "flex"
|
|
uses_from_macos "sqlite"
|
|
|
|
# Find SDK for 11.x macOS
|
|
# Upstreamed, remove when Qt updates Chromium
|
|
patch do
|
|
url "https://raw.githubusercontent.com/Homebrew/formula-patches/92d4cf/qt/5.15.2.diff"
|
|
sha256 "fa99c7ffb8a510d140c02694a11e6c321930f43797dbf2fe8f2476680db4c2b2"
|
|
end
|
|
|
|
def install
|
|
args = %W[
|
|
-verbose
|
|
-prefix #{prefix}
|
|
-release
|
|
-opensource -confirm-license
|
|
-system-zlib
|
|
-qt-libpng
|
|
-qt-libjpeg
|
|
-qt-freetype
|
|
-qt-pcre
|
|
-nomake examples
|
|
-nomake tests
|
|
-no-rpath
|
|
-pkg-config
|
|
-dbus-runtime
|
|
-proprietary-codecs
|
|
]
|
|
|
|
system "./configure", *args
|
|
|
|
# Remove reference to shims directory
|
|
inreplace "qtbase/mkspecs/qmodule.pri",
|
|
/^PKG_CONFIG_EXECUTABLE = .*$/,
|
|
"PKG_CONFIG_EXECUTABLE = #{Formula["pkg-config"].opt_bin/"pkg-config"}"
|
|
system "make"
|
|
ENV.deparallelize
|
|
system "make", "install"
|
|
|
|
# Some config scripts will only find Qt in a "Frameworks" folder
|
|
frameworks.install_symlink Dir["#{lib}/*.framework"]
|
|
|
|
# The pkg-config files installed suggest that headers can be found in the
|
|
# `include` directory. Make this so by creating symlinks from `include` to
|
|
# the Frameworks' Headers folders.
|
|
Pathname.glob("#{lib}/*.framework/Headers") do |path|
|
|
include.install_symlink path => path.parent.basename(".framework")
|
|
end
|
|
|
|
# Move `*.app` bundles into `libexec` to expose them to `brew linkapps` and
|
|
# because we don't like having them in `bin`.
|
|
# (Note: This move breaks invocation of Assistant via the Help menu
|
|
# of both Designer and Linguist as that relies on Assistant being in `bin`.)
|
|
libexec.mkpath
|
|
Pathname.glob("#{bin}/*.app") { |app| mv app, libexec }
|
|
end
|
|
|
|
def caveats
|
|
<<~EOS
|
|
We agreed to the Qt open source license for you.
|
|
If this is unacceptable you should uninstall.
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
(testpath/"hello.pro").write <<~EOS
|
|
QT += core
|
|
QT -= gui
|
|
TARGET = hello
|
|
CONFIG += console
|
|
CONFIG -= app_bundle
|
|
TEMPLATE = app
|
|
SOURCES += main.cpp
|
|
EOS
|
|
|
|
(testpath/"main.cpp").write <<~EOS
|
|
#include <QCoreApplication>
|
|
#include <QDebug>
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
QCoreApplication a(argc, argv);
|
|
qDebug() << "Hello World!";
|
|
return 0;
|
|
}
|
|
EOS
|
|
|
|
system bin/"qmake", testpath/"hello.pro"
|
|
system "make"
|
|
assert_predicate testpath/"hello", :exist?
|
|
assert_predicate testpath/"main.o", :exist?
|
|
system "./hello"
|
|
end
|
|
end
|