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:
parent
b1f2230714
commit
cc22550ebb
1 changed files with 17 additions and 7 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue