mysql-connector-c++: use :mysql requirement.

Also added a trivial test

Closes #6928.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
Jose Quinteiro 2016-11-15 00:24:46 -08:00 committed by Mike McQuaid
parent b1f2230714
commit cc22550ebb

View file

@ -1,9 +1,3 @@
class MysqlClientRequirement < Requirement
fatal true
default_formula "mysql"
satisfy { which "mysql" }
end
class MysqlConnectorCxx < Formula
desc "MySQL database connector for C++ applications"
homepage "https://dev.mysql.com/downloads/connector/cpp/"
@ -22,10 +16,26 @@ class MysqlConnectorCxx < Formula
depends_on "cmake" => :build
depends_on "boost" => :build
depends_on "openssl"
depends_on MysqlClientRequirement
depends_on :mysql
def install
system "cmake", ".", *std_cmake_args
system "make", "install"
end
test do
(testpath/"test.cpp").write <<-EOS.undent
#include <cppconn/driver.h>
int main(void) {
try {
sql::Driver *driver = get_driver_instance();
} catch (sql::SQLException &e) {
return 1;
}
return 0;
}
EOS
system ENV.cxx, "test.cpp", `mysql_config --include`.chomp, "-L#{lib}", "-lmysqlcppconn", "-o", "test"
system "./test"
end
end