homebrew-core/Formula/mysql++.rb

55 lines
2.1 KiB
Ruby

class Mysqlxx < Formula
desc "C++ wrapper for MySQL's C API"
homepage "https://tangentsoft.com/mysqlpp/home"
url "https://tangentsoft.com/mysqlpp/releases/mysql++-3.3.0.tar.gz"
sha256 "449cbc46556cc2cc9f9d6736904169a8df6415f6960528ee658998f96ca0e7cf"
license "LGPL-2.1-or-later"
livecheck do
url :homepage
regex(/href=.*?mysql\+\+[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 cellar: :any, arm64_big_sur: "f7a7c4dc1a39553297a0be0dcae8914afee296416318ce447413988d94306906"
sha256 cellar: :any, big_sur: "d7957ee5ab8476ac890144b0c64bcd20137867b1266d3e022305a5c4f2c3372a"
sha256 cellar: :any, catalina: "14dd4833fb2dbfbefa0267f36ffc828f7306509a2dbd12c6fdec7f6f9173cf81"
sha256 cellar: :any, mojave: "d9a31961dea425b21c279b5fb995d242b6201332e4745662e06647631ff98fba"
sha256 cellar: :any_skip_relocation, x86_64_linux: "85e07407a7b99c89510e5b66d43db09ffbd3bb4f0e1a758c8eb04afb6a6c640d"
end
depends_on "mysql-client"
def install
mysql = Formula["mysql-client"]
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}",
"--with-field-limit=40",
"--with-mysql-lib=#{mysql.opt_lib}",
"--with-mysql-include=#{mysql.opt_include}/mysql"
# Delete "version" file incorrectly included as C++20 <version> header
# Issue ref: https://tangentsoft.com/mysqlpp/tktview/4ea874fe67e39eb13ed4b41df0c591d26ef0a26c
# Remove when fixed upstream
rm "version"
system "make", "install"
end
test do
(testpath/"test.cpp").write <<~EOS
#include <mysql++/cmdline.h>
int main(int argc, char *argv[]) {
mysqlpp::examples::CommandLine cmdline(argc, argv);
if (!cmdline) {
return 1;
}
return 0;
}
EOS
system ENV.cxx, "test.cpp", "-I#{Formula["mysql-client"].opt_include}/mysql",
"-L#{lib}", "-lmysqlpp", "-o", "test"
system "./test", "-u", "foo", "-p", "bar"
end
end