homebrew-core/Formula/qwt.rb
2019-10-11 15:52:40 +02:00

81 lines
2.6 KiB
Ruby

class Qwt < Formula
desc "Qt Widgets for Technical Applications"
homepage "https://qwt.sourceforge.io/"
url "https://downloads.sourceforge.net/project/qwt/qwt/6.1.4/qwt-6.1.4.tar.bz2"
sha256 "1529215329e51fc562e0009505a838f427919a18b362afff441f035b2d9b5bd9"
bottle do
sha256 "7c6d650a357ff7131f9c079008f6f92ab698673a1b87f43c6617c1be8d9c8d1f" => :catalina
sha256 "bbc1c7842159419ae1946cec3dcaa4e4eb645c37ee63249a93ffab255b6eeb25" => :mojave
sha256 "290203526a7fb210f43d53301597908172abc107d8b3260b36b1b24f73805c9f" => :high_sierra
sha256 "5737738dca1f1c423c45d43440baa652fc87183d6fdffa960f3df9b6b7c40a83" => :sierra
end
depends_on "qt"
# Update designer plugin linking back to qwt framework/lib after install
# See: https://sourceforge.net/p/qwt/patches/45/
patch :DATA
def install
inreplace "qwtconfig.pri" do |s|
s.gsub! /^\s*QWT_INSTALL_PREFIX\s*=(.*)$/, "QWT_INSTALL_PREFIX=#{prefix}"
# Install Qt plugin in `lib/qt/plugins/designer`, not `plugins/designer`.
s.sub! %r{(= \$\$\{QWT_INSTALL_PREFIX\})/(plugins/designer)$},
"\\1/lib/qt/\\2"
end
args = ["-config", "release", "-spec"]
if ENV.compiler == :clang
args << "macx-clang"
else
args << "macx-g++"
end
system "qmake", *args
system "make"
system "make", "install"
end
test do
(testpath/"test.cpp").write <<~EOS
#include <qwt_plot_curve.h>
int main() {
QwtPlotCurve *curve1 = new QwtPlotCurve("Curve 1");
return (curve1 == NULL);
}
EOS
system ENV.cxx, "test.cpp", "-o", "out",
"-std=c++11",
"-framework", "qwt", "-framework", "QtCore",
"-F#{lib}", "-F#{Formula["qt"].opt_lib}",
"-I#{lib}/qwt.framework/Headers",
"-I#{Formula["qt"].opt_lib}/QtCore.framework/Versions/5/Headers",
"-I#{Formula["qt"].opt_lib}/QtGui.framework/Versions/5/Headers"
system "./out"
end
end
__END__
diff --git a/designer/designer.pro b/designer/designer.pro
index c269e9d..c2e07ae 100644
--- a/designer/designer.pro
+++ b/designer/designer.pro
@@ -126,6 +126,16 @@ contains(QWT_CONFIG, QwtDesigner) {
target.path = $${QWT_INSTALL_PLUGINS}
INSTALLS += target
+
+ macx {
+ contains(QWT_CONFIG, QwtFramework) {
+ QWT_LIB = qwt.framework/Versions/$${QWT_VER_MAJ}/qwt
+ }
+ else {
+ QWT_LIB = libqwt.$${QWT_VER_MAJ}.dylib
+ }
+ QMAKE_POST_LINK = install_name_tool -change $${QWT_LIB} $${QWT_INSTALL_LIBS}/$${QWT_LIB} $(DESTDIR)$(TARGET)
+ }
}
else {
TEMPLATE = subdirs # do nothing