101 lines
3.2 KiB
Ruby
101 lines
3.2 KiB
Ruby
class QtLibiodbc < Formula
|
|
desc "Qt SQL Database Driver"
|
|
homepage "https://www.qt.io/"
|
|
url "https://download.qt.io/official_releases/qt/6.4/6.4.2/submodules/qtbase-everywhere-src-6.4.2.tar.xz"
|
|
sha256 "a88bc6cedbb34878a49a622baa79cace78cfbad4f95fdbd3656ddb21c705525d"
|
|
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: "300087729b1028ad226e6786c1c2dcabfd54fe8baab54763b1ada6d1483a27cd"
|
|
sha256 cellar: :any, arm64_monterey: "2a876e7224d245295650c9091df0eeaad063300e430206f1e3f1cf3165728719"
|
|
sha256 cellar: :any, arm64_big_sur: "776631217b61ddd52ad8caa609869ccc1c100236632f139242b7244bcd628b2a"
|
|
sha256 cellar: :any, ventura: "aca29c9284d8fc369ecca608a061740d2a37f7b0883b3a70832eed6d5193664c"
|
|
sha256 cellar: :any, monterey: "a7d5f8ad9c463401535a10fe1285fd950149b524c7fdb82ac643796b0c180840"
|
|
sha256 cellar: :any, big_sur: "9c38f0c9dcc064a14087365204d94cec20572d6e55a083458fcc89b8cedfe6d2"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "041c390ca43f14ed362919b2e5f4a5a9e456ea559d2266cd30b45d7af7f2f488"
|
|
end
|
|
|
|
depends_on "cmake" => [:build, :test]
|
|
|
|
depends_on "libiodbc"
|
|
depends_on "qt"
|
|
|
|
conflicts_with "qt-unixodbc",
|
|
because: "qt-unixodbc and qt-libiodbc 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=OFF
|
|
-DFEATURE_sql_oci=OFF
|
|
-DFEATURE_sql_odbc=ON
|
|
-DFEATURE_sql_psql=OFF
|
|
-DFEATURE_sql_sqlite=OFF
|
|
]
|
|
|
|
cd "src/plugins/sqldrivers" do
|
|
system "cmake", ".", *args
|
|
system "cmake", "--build", "."
|
|
system "cmake", "--install", "."
|
|
end
|
|
end
|
|
|
|
test do
|
|
(testpath/"CMakeLists.txt").write <<~EOS
|
|
cmake_minimum_required(VERSION #{Formula["cmake"].version})
|
|
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 debug
|
|
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("QODBC");
|
|
assert(db.isValid());
|
|
return 0;
|
|
}
|
|
EOS
|
|
|
|
system "cmake", "-S", ".", "-B", "build", "-DCMAKE_BUILD_TYPE=Debug"
|
|
system "cmake", "--build", "build"
|
|
system "./build/test"
|
|
|
|
ENV.delete "CPATH"
|
|
system "qmake"
|
|
system "make"
|
|
system "./test"
|
|
end
|
|
end
|