-
Notifications
You must be signed in to change notification settings - Fork 25
/
qt@5.5.rb
182 lines (158 loc) · 7.21 KB
/
qt@5.5.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# Patches for Qt5 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 QtAT55 < Formula
desc "Cross-platform application and UI framework"
homepage "https://www.qt.io/"
url "https://download.qt.io/archive/qt/5.5/5.5.1/single/qt-everywhere-opensource-src-5.5.1.tar.xz"
mirror "https://www.mirrorservice.org/sites/download.qt-project.org/archive/qt/5.5/5.5.1/single/qt-everywhere-opensource-src-5.5.1.tar.xz"
sha256 "6f028e63d4992be2b4a5526f2ef3bfa2fe28c5c757554b11d9e8d86189652518"
revision 1
bottle do
root_url "https://homebrew.bintray.com/bottles"
sha256 high_sierra: "30c5a19c4c18737d40ab072d27a1b5220e746eb7a549812ceb1799eb07cfd58f"
sha256 sierra: "f44403a72ab524a6f010bcf86f1414c42729f4763f4e7c2cfb0f6cba2b6135d2"
sha256 el_capitan: "e1e66c950b66c9bd59b43566a4a5919f4f14a0331c7d9aa062d8c6a152e157c4"
sha256 yosemite: "debdc797d8314548a7cfc05ac97699d98ceeaf46265180a979bbb96190024d1c"
end
keg_only :versioned_formula
depends_on :xcode => :build
# Build error: Fix library detection for QtWebEngine with Xcode 7.
# https://codereview.qt-project.org/#/c/1w27759/
patch do
url "https://raw.githubusercontent.com/UniqMartin/patches/557a8bd4/qt5/webengine-xcode7.patch"
sha256 "7bd46f8729fa2c20bc486ddc5586213ccf2fb9d307b3d4e82daa78a2553f59bc"
end
# Fix for qmake producing broken pkg-config files, affecting Poppler et al.
# https://codereview.qt-project.org/#/c/126584/
# Should land in the 5.5.2 and/or 5.6 release.
patch do
url "https://gist.githubusercontent.com/UniqMartin/a54542d666be1983dc83/raw/f235dfb418c3d0d086c3baae520d538bae0b1c70/qtbug-47162.patch"
sha256 "e31df5d0c5f8a9e738823299cb6ed5f5951314a28d4a4f9f021f423963038432"
end
# Build issue: Fix install names with `-no-rpath` to be absolute paths.
# https://codereview.qt-project.org/#/c/138349
patch do
url "https://raw.githubusercontent.com/UniqMartin/patches/77d138fa/qt5/osx-no-rpath.patch"
sha256 "92c9cfe701f9152f4b16219a04a523338d4b77bb0725a8adccc3fc72c9fb576f"
end
# Fixes for Secure Transport in QtWebKit
# https://codereview.qt-project.org/#/c/139967/
# https://codereview.qt-project.org/#/c/139968/
# https://codereview.qt-project.org/#/c/139970/
# Should land in the 5.5.2 and/or 5.6 release.
patch do
url "https://gist.githubusercontent.com/The-Compiler/8202f92fff70da39353a/raw/884c3bef4d272d25d7d7202be99c3940248151ee/qt5.5-securetransport-qtwebkit.patch"
sha256 "c3302de2e23e74a99e62f22527e0edee5539b2e18d34c05e70075490ba7b3613"
end
# Upstream commit from 3 Oct 2016 "Fixed build with MaxOSX10.12 SDK"
# https://code.qt.io/cgit/qt/qtconnectivity.git/commit/?h=5.6&id=462323dba4f963844e8c9911da27a0d21e4abf43
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/04c2de3/qt5/qtconnectivity-bluetooth-fix.diff"
sha256 "41fd73cba0018180015c2be191d63b3c33289f19132c136f482f5c7477620931"
end
# Equivalent to upstream commit from 4 Oct 2016 "Fix CUPS compilation error in macOS 10.12"
# https://code.qt.io/cgit/qt/qtwebengine-chromium.git/commit/chromium/printing/backend/print_backend_cups.cc?h=53-based&id=3bd01037ab73b3ffbf4abbf97c54443a91b2fc4d
# https://codereview.chromium.org/2248343002
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/34a4ad8/qt5/cups-sierra.patch"
sha256 "63b5f37d694d0bd1db6d586d98f3c551239dc8818588f3b90dc75dfe6e9952be"
end
# Additional MaxOSX10.12 SDK bluetooth fixes
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/master/qt%405.5/qtconnectivity-bluetooth-fix-2.patch"
sha256 "d6d6b41aab16d8fbb1bdd1a9c05c519064258c4d5612d281e7f8661ec8990eaf"
end
# Fix QTBUG-62266 and deprecated Bluetooth API
if MacOS.version >= :high_sierra
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/3ad1b0e172/qt%405.5/high_sierra.patch"
sha256 "0959c86ac37c65a7ce4b813ee1e4942425117f76c981d64ff41da782ba7b2efc"
end
end
# Fix Xcode 9 build errors
if DevelopmentTools.clang_build_version >= 900
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/6152bded7d/qt%405.5/xcode9.patch"
sha256 "757f377f3fcf753ef6d5b543e6291928d07591c3e3ee8a536a88433aa49d4fbb"
end
end
def install
args = %W[
-prefix #{prefix}
-release
-opensource -confirm-license
-system-zlib
-qt-libpng
-qt-libjpeg
-no-openssl -securetransport
-nomake tests
-no-rpath
-nomake examples
]
system "./configure", *args
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
# configure saved PKG_CONFIG_LIBDIR set up by superenv; remove it
# see: https://github.com/Homebrew/homebrew/issues/27184
inreplace prefix/"mkspecs/qconfig.pri", /\n\n# pkgconfig/, ""
inreplace prefix/"mkspecs/qconfig.pri", /\nPKG_CONFIG_.*=.*$/, ""
# Qt tries to find xcrun using xcrun, which fails with Xcode 8 with the
# error "Project ERROR: Xcode not set up properly. You may need to confirm
# the license agreement by running /usr/bin/xcodebuild."
# See https://github.com/Homebrew/homebrew-core/issues/8777.
# Fixed upstream 7 Jul 2016 in https://code.qt.io/cgit/qt/qtbase.git/patch/configure?id=77a71c32c9d19b87f79b208929e71282e8d8b5d9.
if MacOS::Xcode.version >= "8.0"
inreplace prefix/"mkspecs/features/mac/default_pre.prf",
/xcrun -find xcrun/, "xcrun -find xcodebuild"
end
# Move `*.app` bundles into `libexec` to expose them to `brew linkapps` and
# because we don't like having them in `bin`. Also add a `-qt5` suffix to
# avoid conflict with the `*.app` bundles provided by the `qt` formula.
# (Note: This move/rename 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") do |app|
mv app, libexec/"#{app.basename(".app")}-qt5.app"
end
end
def caveats; <<~EOS
We agreed to the Qt opensource 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