homebrew-core/Formula/qscintilla2.rb
2019-08-30 17:59:54 +02:00

75 lines
2.6 KiB
Ruby

class Qscintilla2 < Formula
desc "Port to Qt of the Scintilla editing component"
homepage "https://www.riverbankcomputing.com/software/qscintilla/intro"
url "https://downloads.sourceforge.net/project/pyqt/QScintilla2/QScintilla-2.10.4/QScintilla_gpl-2.10.4.tar.gz"
sha256 "0353e694a67081e2ecdd7c80e1a848cf79a36dbba78b2afa36009482149b022d"
revision 2
bottle do
cellar :any
sha256 "0a8b6269a63c30e21fea2f7837788600f28b78018443200bcb5d616e5181aede" => :mojave
sha256 "8597f1ace710c6d3febec12c35a8a1c46eafd3f4e6f4a5f8e5133c05b530b376" => :high_sierra
sha256 "2950b2b8d8a1f70ce96d7be911ea14cf1e4c8477a41b91bf62758c4e75c0db2a" => :sierra
end
depends_on "pyqt"
depends_on "python"
depends_on "qt"
depends_on "sip"
def install
spec = (ENV.compiler == :clang) ? "macx-clang" : "macx-g++"
args = %W[-config release -spec #{spec}]
cd "Qt4Qt5" do
inreplace "qscintilla.pro" do |s|
s.gsub! "$$[QT_INSTALL_LIBS]", lib
s.gsub! "$$[QT_INSTALL_HEADERS]", include
s.gsub! "$$[QT_INSTALL_TRANSLATIONS]", prefix/"trans"
s.gsub! "$$[QT_INSTALL_DATA]", prefix/"data"
s.gsub! "$$[QT_HOST_DATA]", prefix/"data"
end
inreplace "features/qscintilla2.prf" do |s|
s.gsub! "$$[QT_INSTALL_LIBS]", lib
s.gsub! "$$[QT_INSTALL_HEADERS]", include
end
system "qmake", "qscintilla.pro", *args
system "make"
system "make", "install"
end
# Add qscintilla2 features search path, since it is not installed in Qt keg's mkspecs/features/
ENV["QMAKEFEATURES"] = prefix/"data/mkspecs/features"
cd "Python" do
(share/"sip").mkpath
version = Language::Python.major_minor_version "python3"
pydir = "#{lib}/python#{version}/site-packages/PyQt5"
system "python3", "configure.py", "-o", lib, "-n", include,
"--apidir=#{prefix}/qsci",
"--destdir=#{pydir}",
"--stubsdir=#{pydir}",
"--qsci-sipdir=#{share}/sip",
"--qsci-incdir=#{include}",
"--qsci-libdir=#{lib}",
"--pyqt=PyQt5",
"--pyqt-sipdir=#{Formula["pyqt"].opt_share}/sip/Qt5",
"--sip-incdir=#{Formula["sip"].opt_include}",
"--spec=#{spec}"
system "make"
system "make", "install"
system "make", "clean"
end
end
test do
(testpath/"test.py").write <<~EOS
import PyQt5.Qsci
assert("QsciLexer" in dir(PyQt5.Qsci))
EOS
system "python3", "test.py"
end
end