homebrew-core/Formula/qscintilla2.rb
2019-12-29 17:37:22 +01: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://www.riverbankcomputing.com/static/Downloads/QScintilla/2.11.4/QScintilla-2.11.4.tar.gz"
sha256 "723f8f1d1686d9fc8f204cd855347e984322dd5cd727891d324d0d7d187bee20"
bottle do
cellar :any
sha256 "889b907f0384a161d9bb30d11c02e12f23dadb48b68bfcadcd5a6a42f994954e" => :catalina
sha256 "889b907f0384a161d9bb30d11c02e12f23dadb48b68bfcadcd5a6a42f994954e" => :mojave
sha256 "72baf9be5f0709256faaac3363d152f63153aae6e2b2679e2c13b532a9bb775b" => :high_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}",
"--no-dist-info"
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