qt: bump version 6.0.1

master
PaperChalice 2021-02-11 06:04:17 +08:00 committed by Carlo Cabrera
parent c47834aa5c
commit ab9d906d07
3 changed files with 151 additions and 85 deletions

1
Aliases/qt6 Symbolic link
View File

@ -0,0 +1 @@
../Formula/qt.rb

1
Aliases/qt@6 Symbolic link
View File

@ -0,0 +1 @@
../Formula/qt.rb

View File

@ -1,12 +1,12 @@
# 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 class Qt < Formula
desc "Cross-platform application and UI framework" desc "Cross-platform application and UI framework"
homepage "https://www.qt.io/" 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" url "https://download.qt.io/official_releases/qt/6.0/6.0.1/single/qt-everywhere-src-6.0.1.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 "http://mirror.bit.edu.cn/qtproject/official_releases/qt/6.0/6.0.1/single/qt-everywhere-src-6.0.1.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" mirror "http://ftp.jaist.ac.jp/pub/qtproject/official_releases/qt/6.0/6.0.1/single/qt-everywhere-src-6.0.1.tar.xz"
sha256 "3a530d1b243b5dec00bc54937455471aaa3e56849d2593edb8ded07228202240" mirror "https://mirrors.dotsrc.org/qtproject/official_releases/qt/6.0/6.0.1/single/qt-everywhere-src-6.0.1.tar.xz"
mirror "https://mirrors.ocf.berkeley.edu/qt/official_releases/qt/6.0/6.0.1/single/qt-everywhere-src-6.0.1.tar.xz"
sha256 "d13cfac103cd80b216cd2f73d0211dd6b1a1de2516911c89ce9c5ed14d9631a8"
license all_of: ["GFDL-1.3-only", "GPL-2.0-only", "GPL-3.0-only", "LGPL-2.1-only", "LGPL-3.0-only"] 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 head "https://code.qt.io/qt/qt5.git", branch: "dev", shallow: false
@ -24,73 +24,108 @@ class Qt < Formula
sha256 cellar: :any, mojave: "25c4a693c787860b090685ac5cbeea18128d4d6361eed5b1bfed1b16ff6e4494" sha256 cellar: :any, mojave: "25c4a693c787860b090685ac5cbeea18128d4d6361eed5b1bfed1b16ff6e4494"
end end
keg_only "Qt 5 has CMake issues when linked" depends_on "cmake" => [:build, :test]
depends_on "ninja" => :build
depends_on "pkg-config" => :build depends_on "pkg-config" => :build
depends_on xcode: :build depends_on xcode: :build
depends_on macos: :sierra
uses_from_macos "gperf" => :build depends_on "assimp"
uses_from_macos "bison" depends_on "dbus"
uses_from_macos "flex" depends_on "double-conversion"
depends_on "freetype"
depends_on "glib"
depends_on "icu4c"
depends_on "jasper"
depends_on "jpeg"
depends_on "libb2"
depends_on "libpng"
depends_on "libproxy"
depends_on "libtiff"
depends_on "pcre2"
depends_on "python@3.9"
depends_on "webp"
depends_on "zstd"
uses_from_macos "cups"
uses_from_macos "krb5"
uses_from_macos "perl"
uses_from_macos "sqlite" uses_from_macos "sqlite"
uses_from_macos "zlib"
# Find SDK for 11.x macOS resource "qtimageformats" do
# Upstreamed, remove when Qt updates Chromium url "https://download.qt.io/official_releases/additional_libraries/qtimageformats/6.0/6.0.1/qtimageformats-everywhere-src-6.0.1.tar.xz"
patch do mirror "http://mirror.bit.edu.cn/qtproject/official_releases/additional_libraries/qtimageformats/6.0/6.0.1/qtimageformats-everywhere-src-6.0.1.tar.xz"
url "https://raw.githubusercontent.com/Homebrew/formula-patches/92d4cf/qt/5.15.2.diff" mirror "http://ftp.jaist.ac.jp/pub/qtproject/official_releases/additional_libraries/qtimageformats/6.0/6.0.1/qtimageformats-everywhere-src-6.0.1.tar.xz"
sha256 "fa99c7ffb8a510d140c02694a11e6c321930f43797dbf2fe8f2476680db4c2b2" mirror "https://mirrors.dotsrc.org/qtproject/official_releases/additional_libraries/qtimageformats/6.0/6.0.1/qtimageformats-everywhere-src-6.0.1.tar.xz"
mirror "https://mirrors.ocf.berkeley.edu/qt/official_releases/additional_libraries/qtimageformats/6.0/6.0.1/qtimageformats-everywhere-src-6.0.1.tar.xz"
sha256 "27a9d6e85dcd56ad981ef2aac27844e782f8cce0598f83283e6fbbd2a3810105"
end end
# Patch for qmake on ARM resource "qt3d" do
# https://codereview.qt-project.org/c/qt/qtbase/+/327649 url "https://download.qt.io/official_releases/additional_libraries/qt3d/6.0/6.0.1/qt3d-everywhere-src-6.0.1.tar.xz"
if Hardware::CPU.arm? mirror "http://mirror.bit.edu.cn/qtproject/official_releases/additional_libraries/qt3d/6.0/6.0.1/qt3d-everywhere-src-6.0.1.tar.xz"
patch do mirror "http://ftp.jaist.ac.jp/pub/qtproject/official_releases/additional_libraries/qt3d/6.0/6.0.1/qt3d-everywhere-src-6.0.1.tar.xz"
url "https://raw.githubusercontent.com/Homebrew/formula-patches/9dc732/qt/qt-split-arch.patch" mirror "https://mirrors.dotsrc.org/qtproject/official_releases/additional_libraries/qt3d/6.0/6.0.1/qt3d-everywhere-src-6.0.1.tar.xz"
sha256 "36915fde68093af9a147d76f88a4e205b789eec38c0c6f422c21ae1e576d45c0" mirror "https://mirrors.ocf.berkeley.edu/qt/official_releases/additional_libraries/qt3d/6.0/6.0.1/qt3d-everywhere-src-6.0.1.tar.xz"
directory "qtbase" sha256 "1234c6904ad13894fb1a798a5540317d241b5cbded70e980e929f477bc060f34"
end end
resource "qtnetworkauth" do
url "https://download.qt.io/official_releases/additional_libraries/qtnetworkauth/6.0/6.0.1/qtnetworkauth-everywhere-src-6.0.1.tar.xz"
mirror "http://mirror.bit.edu.cn/qtproject/official_releases/additional_libraries/qtnetworkauth/6.0/6.0.1/qtnetworkauth-everywhere-src-6.0.1.tar.xz"
mirror "http://ftp.jaist.ac.jp/pub/qtproject/official_releases/additional_libraries/qtnetworkauth/6.0/6.0.1/qtnetworkauth-everywhere-src-6.0.1.tar.xz"
mirror "https://mirrors.dotsrc.org/qtproject/official_releases/additional_libraries/qtnetworkauth/6.0/6.0.1/qtnetworkauth-everywhere-src-6.0.1.tar.xz"
mirror "https://mirrors.ocf.berkeley.edu/qt/official_releases/additional_libraries/qtnetworkauth/6.0/6.0.1/qtnetworkauth-everywhere-src-6.0.1.tar.xz"
sha256 "7f348acedb24e7c33927bd475b87b3c0c9901122f2e11f8c8209de4497e36122"
end end
def install def install
args = %W[ resources.each { |addition| addition.stage buildpath/addition.name }
-verbose
-prefix #{prefix} config_args = %W[
-release -release
-opensource -confirm-license
-system-zlib -prefix #{HOMEBREW_PREFIX}
-qt-libpng -extprefix #{prefix}
-qt-libjpeg
-qt-freetype -libexecdir share/qt/libexec
-qt-pcre -plugindir share/qt/plugins
-nomake examples -qmldir share/qt/qml
-nomake tests -docdir share/doc/qt
-no-rpath -examplesdir share/qt/examples
-pkg-config -testsdir share/qt/tests
-dbus-runtime
-libproxy
-no-feature-relocatable
-system-sqlite
] ]
if Hardware::CPU.arm? cmake_args = std_cmake_args.reject { |s| s["CMAKE_INSTALL_PREFIX"]||s["CMAKE_FIND_FRAMEWORK"] } + %W[
# Temporarily fixes for Apple Silicon -DICU_ROOT=#{Formula["icu4c"].opt_prefix}
args << "-skip" << "qtwebengine" << "-no-assimp"
else
# Should be reenabled unconditionnaly once it is fixed on Apple Silicon
args << "-proprietary-codecs"
end
system "./configure", *args -DCMAKE_OSX_DEPLOYMENT_TARGET=#{MacOS.version}
-DCMAKE_FIND_FRAMEWORK=FIRST
# Remove reference to shims directory -DINSTALL_MKSPECSDIR=share/qt/mkspecs
inreplace "qtbase/mkspecs/qmodule.pri", -DINSTALL_DESCRIPTIONSDIR=share/qt/modules
/^PKG_CONFIG_EXECUTABLE = .*$/, -DINSTALL_TRANSLATIONSDIR=share/qt/translations
"PKG_CONFIG_EXECUTABLE = #{Formula["pkg-config"].opt_bin/"pkg-config"}"
system "make" -DFEATURE_pkg_config=ON
ENV.deparallelize -DFEATURE_qt3d_system_assimp=ON
system "make", "install" -DTEST_assimp=ON
]
system "./configure", *config_args, "--", *cmake_args
system "ninja"
system "ninja", "install"
rm bin/"qt-cmake-private-install.cmake"
# Some config scripts will only find Qt in a "Frameworks" folder # Some config scripts will only find Qt in a "Frameworks" folder
frameworks.install_symlink Dir["#{lib}/*.framework"] frameworks.install_symlink Dir["#{lib}/*.framework"]
inreplace lib/"cmake/Qt6/qt.toolchain.cmake", /.*set.__qt_initial_.*/, ""
# The pkg-config files installed suggest that headers can be found in the # The pkg-config files installed suggest that headers can be found in the
# `include` directory. Make this so by creating symlinks from `include` to # `include` directory. Make this so by creating symlinks from `include` to
# the Frameworks' Headers folders. # the Frameworks' Headers folders.
@ -98,35 +133,43 @@ class Qt < Formula
include.install_symlink path => path.parent.basename(".framework") include.install_symlink path => path.parent.basename(".framework")
end end
# Move `*.app` bundles into `libexec` to expose them to `brew linkapps` and mkdir libexec
# because we don't like having them in `bin`. Pathname.glob("#{bin}/*.app") do |app|
# (Note: This move breaks invocation of Assistant via the Help menu mv app, libexec
# of both Designer and Linguist as that relies on Assistant being in `bin`.) bin.write_exec_script "#{libexec/app.stem}.app/Contents/MacOS/#{app.stem}"
libexec.mkpath
Pathname.glob("#{bin}/*.app") { |app| mv app, libexec }
end
def caveats
s = <<~EOS
We agreed to the Qt open source license for you.
If this is unacceptable you should uninstall.
EOS
if Hardware::CPU.arm?
s += <<~EOS
This version of Qt on Apple Silicon does not include QtWebEngine
EOS
end end
s
end end
test do test do
(testpath/"hello.pro").write <<~EOS (testpath/"CMakeLists.txt").write <<~EOS
QT += core cmake_minimum_required(VERSION 3.19.0)
QT -= gui
TARGET = hello project(test VERSION 1.0.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
find_package(Qt6 COMPONENTS Core Widgets Sql Concurrent
3DCore Svg Quick3D Network NetworkAuth REQUIRED)
add_executable(test
main.cpp
)
target_link_libraries(test PRIVATE Qt6::Core Qt6::Widgets
Qt6::Sql Qt6::Concurrent Qt6::3DCore Qt6::Svg Qt6::Quick3D
Qt6::Network Qt6::NetworkAuth
)
EOS
(testpath/"test.pro").write <<~EOS
QT += core svg 3dcore network networkauth quick3d \
sql
TARGET = test
CONFIG += console CONFIG += console
CONFIG -= app_bundle CONFIG -= app_bundle
TEMPLATE = app TEMPLATE = app
@ -134,24 +177,45 @@ class Qt < Formula
EOS EOS
(testpath/"main.cpp").write <<~EOS (testpath/"main.cpp").write <<~EOS
#undef QT_NO_DEBUG
#include <QCoreApplication> #include <QCoreApplication>
#include <Qt3DCore>
#include <QtQuick3D>
#include <QImageReader>
#include <QtNetworkAuth>
#include <QtSql>
#include <QtSvg>
#include <QDebug> #include <QDebug>
#include <iostream>
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QCoreApplication a(argc, argv); QCoreApplication a(argc, argv);
qDebug() << "Hello World!"; QSvgGenerator generator;
auto *handler = new QOAuthHttpServerReplyHandler();
delete handler; handler = nullptr;
auto *root = new Qt3DCore::QEntity();
delete root; root = nullptr;
Q_ASSERT(QSqlDatabase::isDriverAvailable("QSQLITE"));
const auto &list = QImageReader::supportedImageFormats();
for(const char* fmt:{"bmp", "cur", "gif", "heic", "heif",
"icns", "ico", "jp2", "jpeg", "jpg", "pbm", "pgm", "png",
"ppm", "svg", "svgz", "tga", "tif", "tiff", "wbmp", "webp",
"xbm", "xpm"}) {
Q_ASSERT(list.contains(fmt));
}
return 0; return 0;
} }
EOS EOS
system "cmake", testpath
system "make"
system "./test"
# Work around "error: no member named 'signbit' in the global namespace" # Work around "error: no member named 'signbit' in the global namespace"
ENV.delete "CPATH" ENV.delete "CPATH"
system bin/"qmake", testpath/"test.pro"
system bin/"qmake", testpath/"hello.pro"
system "make" system "make"
assert_predicate testpath/"hello", :exist? system "./test"
assert_predicate testpath/"main.o", :exist?
system "./hello"
end end
end end