Skip to content

Commit ae4ee03

Browse files
authored
Fix macOS CI (#597)
* ci(macos): fix attempt #1 * Revert "ci(macos): fix attempt #1" This reverts commit b846490. * ci(macos): provide QTDIR when building OBS * Revert "ci(macos): provide QTDIR when building OBS" This reverts commit 74a882f. * ci(macos): use local qt formula * ci(macos): update qt.rb
1 parent f61f45f commit ae4ee03

File tree

2 files changed

+143
-166
lines changed

2 files changed

+143
-166
lines changed

CI/install-dependencies-macos.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,8 @@ done
3535

3636
# qtwebsockets deps
3737
echo "[obs-websocket] Installing obs-websocket dependency 'QT 5.10.1'.."
38-
# =!= NOTICE =!=
39-
# When building QT5 from sources on macOS 10.13+, use local qt5 formula:
40-
# brew install ./CI/macos/qt.rb
41-
# Pouring from the bottle is much quicker though, so use bottle for now.
42-
# =!= NOTICE =!=
4338

44-
brew install https://gist.githubusercontent.com/DDRBoxman/b3956fab6073335a4bf151db0dcbd4ad/raw/ed1342a8a86793ea8c10d8b4d712a654da121ace/qt.rb
39+
brew install ./CI/macos/qt.rb
4540

4641
# Pin this version of QT5 to avoid `brew upgrade`
4742
# upgrading it to incompatible version

CI/macos/qt.rb

Lines changed: 142 additions & 160 deletions
Original file line numberDiff line numberDiff line change
@@ -1,163 +1,145 @@
11
# Patches for Qt must be at the very least submitted to Qt's Gerrit codereview
22
# rather than their bug-report Jira. The latter is rarely reviewed by Qt.
33
class Qt < Formula
4-
desc "Cross-platform application and UI framework"
5-
homepage "https://www.qt.io/"
6-
url "https://download.qt.io/archive/qt/5.10/5.10.1/single/qt-everywhere-src-5.10.1.tar.xz"
7-
mirror "https://mirrorservice.org/sites/download.qt-project.org/official_releases/qt/5.10/5.10.1/single/qt-everywhere-src-5.10.1.tar.xz"
8-
sha256 "05ffba7b811b854ed558abf2be2ddbd3bb6ddd0b60ea4b5da75d277ac15e740a"
9-
head "https://code.qt.io/qt/qt5.git", :branch => "5.10.1", :shallow => false
10-
11-
bottle do
12-
sha256 "8b4bad005596a5f8790150fe455db998ac2406f4e0f04140d6656205d844d266" => :high_sierra
13-
sha256 "9c488554935fb573554a4e36d36d3c81e47245b7fefc4b61edef894e67ba1740" => :sierra
14-
sha256 "c0407afba5951df6cc4c6f6c1c315972bd41c99cecb4e029919c4c15ab6f7bdc" => :el_capitan
15-
end
16-
17-
keg_only "Qt 5 has CMake issues when linked"
18-
19-
option "with-docs", "Build documentation"
20-
option "with-examples", "Build examples"
21-
22-
deprecated_option "with-mysql" => "with-mysql-client"
23-
24-
# OS X 10.7 Lion is still supported in Qt 5.5, but is no longer a reference
25-
# configuration and thus untested in practice. Builds on OS X 10.7 have been
26-
# reported to fail: <https://github.com/Homebrew/homebrew/issues/45284>.
27-
depends_on :macos => :mountain_lion
28-
29-
depends_on "pkg-config" => :build
30-
depends_on :xcode => :build
31-
depends_on "mysql-client" => :optional
32-
depends_on "postgresql" => :optional
33-
34-
# Restore `.pc` files for framework-based build of Qt 5 on OS X. This
35-
# partially reverts <https://codereview.qt-project.org/#/c/140954/> merged
36-
# between the 5.5.1 and 5.6.0 releases. (Remove this as soon as feasible!)
37-
#
38-
# Core formulae known to fail without this patch (as of 2016-10-15):
39-
# * gnuplot (with `--with-qt` option)
40-
# * mkvtoolnix (with `--with-qt` option, silent build failure)
41-
# * poppler (with `--with-qt` option)
42-
patch do
43-
url "https://github.com/raw/Homebrew/formula-patches/e8fe6567/qt5/restore-pc-files.patch"
44-
sha256 "48ff18be2f4050de7288bddbae7f47e949512ac4bcd126c2f504be2ac701158b"
45-
end
46-
47-
# Fix compile error on macOS 10.13 around QFixed:
48-
# https://github.com/Homebrew/homebrew-core/issues/27095
49-
# https://bugreports.qt.io/browse/QTBUG-67545
50-
patch do
51-
url "https://github.com/raw/z00m1n/formula-patches/0de0e229/qt/QTBUG-67545.patch"
52-
sha256 "4a115097c7582c7dce4207f5500d13feb8c990eb8a05a43f41953985976ebe6c"
53-
end
54-
55-
# Fix compile error on macOS 10.13 caused by qtlocation dependency
56-
# mapbox-gl-native using Boost 1.62.0 does not build with C++ 17:
57-
# https://github.com/Homebrew/homebrew-core/issues/27095
58-
# https://bugreports.qt.io/browse/QTBUG-67810
59-
patch do
60-
url "https://github.com/raw/z00m1n/formula-patches/a1a1f0dd/qt/QTBUG-67810.patch"
61-
sha256 "8ee0bf71df1043f08ebae3aa35036be29c4d9ebff8a27e3b0411a6bd635e9382"
62-
end
63-
64-
def install
65-
args = %W[
66-
-verbose
67-
-prefix #{prefix}
68-
-release
69-
-opensource -confirm-license
70-
-system-zlib
71-
-qt-libpng
72-
-qt-libjpeg
73-
-qt-freetype
74-
-qt-pcre
75-
-nomake tests
76-
-no-rpath
77-
-pkg-config
78-
-dbus-runtime
79-
-no-assimp
80-
]
81-
82-
args << "-nomake" << "examples" if build.without? "examples"
83-
84-
if build.with? "mysql-client"
85-
args << "-plugin-sql-mysql"
86-
(buildpath/"brew_shim/mysql_config").write <<~EOS
87-
#!/bin/sh
88-
if [ x"$1" = x"--libs" ]; then
89-
mysql_config --libs | sed "s/-lssl -lcrypto//"
90-
else
91-
exec mysql_config "$@"
92-
fi
93-
EOS
94-
chmod 0755, "brew_shim/mysql_config"
95-
args << "-mysql_config" << buildpath/"brew_shim/mysql_config"
96-
end
97-
98-
args << "-plugin-sql-psql" if build.with? "postgresql"
99-
100-
system "./configure", *args
101-
system "make"
102-
ENV.deparallelize
103-
system "make", "install"
104-
105-
if build.with? "docs"
106-
system "make", "docs"
107-
system "make", "install_docs"
108-
end
109-
110-
# Some config scripts will only find Qt in a "Frameworks" folder
111-
frameworks.install_symlink Dir["#{lib}/*.framework"]
112-
113-
# The pkg-config files installed suggest that headers can be found in the
114-
# `include` directory. Make this so by creating symlinks from `include` to
115-
# the Frameworks' Headers folders.
116-
Pathname.glob("#{lib}/*.framework/Headers") do |path|
117-
include.install_symlink path => path.parent.basename(".framework")
118-
end
119-
120-
# Move `*.app` bundles into `libexec` to expose them to `brew linkapps` and
121-
# because we don't like having them in `bin`.
122-
# (Note: This move breaks invocation of Assistant via the Help menu
123-
# of both Designer and Linguist as that relies on Assistant being in `bin`.)
124-
libexec.mkpath
125-
Pathname.glob("#{bin}/*.app") { |app| mv app, libexec }
126-
end
127-
128-
def caveats; <<~EOS
129-
We agreed to the Qt opensource license for you.
130-
If this is unacceptable you should uninstall.
131-
EOS
132-
end
133-
134-
test do
135-
(testpath/"hello.pro").write <<~EOS
136-
QT += core
137-
QT -= gui
138-
TARGET = hello
139-
CONFIG += console
140-
CONFIG -= app_bundle
141-
TEMPLATE = app
142-
SOURCES += main.cpp
143-
EOS
144-
145-
(testpath/"main.cpp").write <<~EOS
146-
#include <QCoreApplication>
147-
#include <QDebug>
148-
149-
int main(int argc, char *argv[])
150-
{
151-
QCoreApplication a(argc, argv);
152-
qDebug() << "Hello World!";
153-
return 0;
154-
}
155-
EOS
156-
157-
system bin/"qmake", testpath/"hello.pro"
158-
system "make"
159-
assert_predicate testpath/"hello", :exist?
160-
assert_predicate testpath/"main.o", :exist?
161-
system "./hello"
162-
end
163-
end
4+
desc "Cross-platform application and UI framework"
5+
homepage "https://www.qt.io/"
6+
url "https://download.qt.io/official_releases/qt/5.10/5.10.1/single/qt-everywhere-src-5.10.1.tar.xz"
7+
mirror "https://www.mirrorservice.org/sites/download.qt-project.org/official_releases/qt/5.10/5.10.1/single/qt-everywhere-src-5.10.1.tar.xz"
8+
sha256 "05ffba7b811b854ed558abf2be2ddbd3bb6ddd0b60ea4b5da75d277ac15e740a"
9+
head "https://code.qt.io/qt/qt5.git", :branch => "5.10", :shallow => false
10+
11+
bottle do
12+
sha256 "8b4bad005596a5f8790150fe455db998ac2406f4e0f04140d6656205d844d266" => :high_sierra
13+
sha256 "9c488554935fb573554a4e36d36d3c81e47245b7fefc4b61edef894e67ba1740" => :sierra
14+
sha256 "c0407afba5951df6cc4c6f6c1c315972bd41c99cecb4e029919c4c15ab6f7bdc" => :el_capitan
15+
end
16+
17+
keg_only "Qt 5 has CMake issues when linked"
18+
19+
option "with-docs", "Build documentation"
20+
option "with-examples", "Build examples"
21+
option "without-proprietary-codecs", "Don't build with proprietary codecs (e.g. mp3)"
22+
23+
# OS X 10.7 Lion is still supported in Qt 5.5, but is no longer a reference
24+
# configuration and thus untested in practice. Builds on OS X 10.7 have been
25+
# reported to fail: <https://github.com/Homebrew/homebrew/issues/45284>.
26+
# depends_on :macos => :mountain_lion
27+
28+
depends_on "pkg-config" => :build
29+
depends_on :xcode => :build
30+
depends_on "mysql" => :optional
31+
depends_on "postgresql" => :optional
32+
33+
# Restore `.pc` files for framework-based build of Qt 5 on OS X. This
34+
# partially reverts <https://codereview.qt-project.org/#/c/140954/> merged
35+
# between the 5.5.1 and 5.6.0 releases. (Remove this as soon as feasible!)
36+
#
37+
# Core formulae known to fail without this patch (as of 2016-10-15):
38+
# * gnuplot (with `--with-qt` option)
39+
# * mkvtoolnix (with `--with-qt` option, silent build failure)
40+
# * poppler (with `--with-qt` option)
41+
patch do
42+
url "https://github.com/raw/Homebrew/formula-patches/e8fe6567/qt5/restore-pc-files.patch"
43+
sha256 "48ff18be2f4050de7288bddbae7f47e949512ac4bcd126c2f504be2ac701158b"
44+
end
45+
46+
def install
47+
args = %W[
48+
-verbose
49+
-prefix #{prefix}
50+
-release
51+
-opensource -confirm-license
52+
-system-zlib
53+
-qt-libpng
54+
-qt-libjpeg
55+
-qt-freetype
56+
-qt-pcre
57+
-nomake tests
58+
-no-rpath
59+
-pkg-config
60+
-dbus-runtime
61+
]
62+
63+
args << "-nomake" << "examples" if build.without? "examples"
64+
65+
if build.with? "mysql"
66+
args << "-plugin-sql-mysql"
67+
(buildpath/"brew_shim/mysql_config").write <<~EOS
68+
#!/bin/sh
69+
if [ x"$1" = x"--libs" ]; then
70+
mysql_config --libs | sed "s/-lssl -lcrypto//"
71+
else
72+
exec mysql_config "$@"
73+
fi
74+
EOS
75+
chmod 0755, "brew_shim/mysql_config"
76+
args << "-mysql_config" << buildpath/"brew_shim/mysql_config"
77+
end
78+
79+
args << "-plugin-sql-psql" if build.with? "postgresql"
80+
args << "-proprietary-codecs" if build.with? "proprietary-codecs"
81+
82+
system "./configure", *args
83+
system "make"
84+
ENV.deparallelize
85+
system "make", "install"
86+
87+
if build.with? "docs"
88+
system "make", "docs"
89+
system "make", "install_docs"
90+
end
91+
92+
# Some config scripts will only find Qt in a "Frameworks" folder
93+
frameworks.install_symlink Dir["#{lib}/*.framework"]
94+
95+
# The pkg-config files installed suggest that headers can be found in the
96+
# `include` directory. Make this so by creating symlinks from `include` to
97+
# the Frameworks' Headers folders.
98+
Pathname.glob("#{lib}/*.framework/Headers") do |path|
99+
include.install_symlink path => path.parent.basename(".framework")
100+
end
101+
102+
# Move `*.app` bundles into `libexec` to expose them to `brew linkapps` and
103+
# because we don't like having them in `bin`.
104+
# (Note: This move breaks invocation of Assistant via the Help menu
105+
# of both Designer and Linguist as that relies on Assistant being in `bin`.)
106+
libexec.mkpath
107+
Pathname.glob("#{bin}/*.app") { |app| mv app, libexec }
108+
end
109+
110+
def caveats; <<~EOS
111+
We agreed to the Qt opensource license for you.
112+
If this is unacceptable you should uninstall.
113+
EOS
114+
end
115+
116+
test do
117+
(testpath/"hello.pro").write <<~EOS
118+
QT += core
119+
QT -= gui
120+
TARGET = hello
121+
CONFIG += console
122+
CONFIG -= app_bundle
123+
TEMPLATE = app
124+
SOURCES += main.cpp
125+
EOS
126+
127+
(testpath/"main.cpp").write <<~EOS
128+
#include <QCoreApplication>
129+
#include <QDebug>
130+
131+
int main(int argc, char *argv[])
132+
{
133+
QCoreApplication a(argc, argv);
134+
qDebug() << "Hello World!";
135+
return 0;
136+
}
137+
EOS
138+
139+
system bin/"qmake", testpath/"hello.pro"
140+
system "make"
141+
assert_predicate testpath/"hello", :exist?
142+
assert_predicate testpath/"main.o", :exist?
143+
system "./hello"
144+
end
145+
end

0 commit comments

Comments
 (0)