homebrew-core/Formula/qt-percona-server.rb

103 lines
3.1 KiB
Ruby

class QtPerconaServer < Formula
desc "Qt SQL Database Driver"
homepage "https://www.qt.io/"
url "https://download.qt.io/official_releases/qt/6.4/6.4.1/submodules/qtbase-everywhere-src-6.4.1.tar.xz"
sha256 "532ad71cc0f9c8f7cb92766c47bc3d23263c60876becd9053802f9727af24fae"
license any_of: ["GPL-2.0-only", "GPL-3.0-only", "LGPL-3.0-only"]
livecheck do
formula "qt"
end
bottle do
sha256 cellar: :any, arm64_ventura: "74a6823944b10442f69886c1a422488c5cef24813da103e29081a2dbffdf9751"
sha256 cellar: :any, arm64_monterey: "e1af14e97eb88694c4516ca8dc0fdf4ef5a8cd8e80b4ffdfeec811d170f44859"
sha256 cellar: :any, arm64_big_sur: "8e1b2c36383e7ebd9252b861700c57b5ebf8c8257b641e25eb8ae001c95c93ea"
sha256 cellar: :any, ventura: "dcfe4f4a2ee3dba8c7883eb9e64430f62b27db4a327fbfefb7eaf9f6f2236aef"
sha256 cellar: :any, monterey: "963f3440aed8ce25f411b038f70ac1cda1fa2bc67061572accbcebbfc57c07dd"
sha256 cellar: :any, big_sur: "6ed0561551f071a949a3e10d8efe4560065ef0eb7d5ff9f6ad0c14217285a29f"
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