102 lines
3.0 KiB
Ruby
102 lines
3.0 KiB
Ruby
class QtPerconaServer < Formula
|
|
desc "Qt SQL Database Driver"
|
|
homepage "https://www.qt.io/"
|
|
url "https://download.qt.io/official_releases/qt/6.3/6.3.2/submodules/qtbase-everywhere-src-6.3.2.tar.xz"
|
|
sha256 "7929ba4df870b6b30870bc0aed2525cfc606ed7091107b23cf7ed7e434caa9a6"
|
|
license all_of: ["LGPL-2.1-only", "LGPL-3.0-only"]
|
|
|
|
livecheck do
|
|
formula "qt"
|
|
end
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_monterey: "b727e99ecb189970645c89efb7c9cd589faf5fdd93ec7d7ee759480cc5badeba"
|
|
sha256 cellar: :any, arm64_big_sur: "6ec7c0c488e9b30312ed36d821af2859c4720baf59dabdd42aecc43828d4e61c"
|
|
sha256 cellar: :any, monterey: "38997281d0d2e615ed71e602aea0e7ab0bf594df4ca0863cd9b873e5c749531c"
|
|
sha256 cellar: :any, big_sur: "e431a3d4a46799d54b7f2eae981e9413900204752f4e06b6e7a39d4a886a1f96"
|
|
sha256 cellar: :any, catalina: "d84059511534f15b1766a6c594f82a6fa96784d54aa8eb169ad711ba92e3951d"
|
|
end
|
|
|
|
depends_on "cmake" => [:build, :test]
|
|
depends_on "pkg-config" => :build
|
|
|
|
depends_on "percona-server"
|
|
depends_on "qt"
|
|
|
|
conflicts_with "qt-mysql", "qt-mariadb",
|
|
because: "qt-mysql, qt-mariadb, and qt-percona-server install the same binaries"
|
|
|
|
fails_with gcc: "5"
|
|
|
|
def install
|
|
args = std_cmake_args + %W[
|
|
-DCMAKE_STAGING_PREFIX=#{prefix}
|
|
|
|
-DFEATURE_sql_ibase=OFF
|
|
-DFEATURE_sql_mysql=ON
|
|
-DFEATURE_sql_oci=OFF
|
|
-DFEATURE_sql_odbc=OFF
|
|
-DFEATURE_sql_psql=OFF
|
|
-DFEATURE_sql_sqlite=OFF
|
|
|
|
-DMySQL_LIBRARY=#{Formula["percona-server"].opt_lib}/#{shared_library("libperconaserverclient")}
|
|
]
|
|
|
|
cd "src/plugins/sqldrivers" do
|
|
system "cmake", "-S", ".", "-B", "build", *args
|
|
system "cmake", "--build", "build"
|
|
system "cmake", "--install", "build"
|
|
end
|
|
end
|
|
|
|
test do
|
|
(testpath/"CMakeLists.txt").write <<~EOS
|
|
cmake_minimum_required(VERSION 3.16.0)
|
|
project(test VERSION 1.0.0 LANGUAGES CXX)
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_AUTOMOC ON)
|
|
set(CMAKE_AUTORCC ON)
|
|
set(CMAKE_AUTOUIC ON)
|
|
find_package(Qt6 COMPONENTS Core Sql REQUIRED)
|
|
add_executable(test
|
|
main.cpp
|
|
)
|
|
target_link_libraries(test PRIVATE Qt6::Core Qt6::Sql)
|
|
EOS
|
|
|
|
(testpath/"test.pro").write <<~EOS
|
|
QT += core sql
|
|
QT -= gui
|
|
TARGET = test
|
|
CONFIG += console
|
|
CONFIG -= app_bundle
|
|
TEMPLATE = app
|
|
SOURCES += main.cpp
|
|
EOS
|
|
|
|
(testpath/"main.cpp").write <<~EOS
|
|
#include <QCoreApplication>
|
|
#include <QtSql>
|
|
#include <cassert>
|
|
int main(int argc, char *argv[])
|
|
{
|
|
QCoreApplication::addLibraryPath("#{share}/qt/plugins");
|
|
QCoreApplication a(argc, argv);
|
|
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
|
|
assert(db.isValid());
|
|
return 0;
|
|
}
|
|
EOS
|
|
|
|
system "cmake", "-DCMAKE_BUILD_TYPE=Debug", testpath
|
|
system "make"
|
|
system "./test"
|
|
|
|
ENV.delete "CPATH"
|
|
system "qmake"
|
|
system "make"
|
|
system "./test"
|
|
end
|
|
end
|