homebrew-core/Formula/libpqxx.rb
2019-07-05 11:30:52 +02:00

42 lines
1.4 KiB
Ruby

class Libpqxx < Formula
desc "C++ connector for PostgreSQL"
homepage "http://pqxx.org/development/libpqxx/"
url "https://github.com/jtv/libpqxx/archive/6.4.5.tar.gz"
sha256 "86921fdb0fe54495a79d5af2c96f2c771098c31e9b352d0834230fd2799ad362"
revision 1
bottle do
cellar :any
sha256 "8f4cdde8aa2ddbe3e8bc52608ab31aca62f259b7271c723555a051871d7a96af" => :mojave
sha256 "6d57ea59c5a3bb63c85de9211589f127346cb1dca8fc0c9faa6a3c2b802237a4" => :high_sierra
sha256 "55446bc04b5a91a842671a0cb45bfbbd8a7dd5d82f8e8c8210b6434e5f26c235" => :sierra
end
depends_on "pkg-config" => :build
depends_on "xmlto" => :build
depends_on "postgresql"
def install
system "./configure", "--prefix=#{prefix}", "--enable-shared"
system "make", "install"
end
test do
(testpath/"test.cpp").write <<~EOS
#include <pqxx/pqxx>
int main(int argc, char** argv) {
pqxx::connection con;
return 0;
}
EOS
system ENV.cxx, "-std=c++11", "test.cpp", "-L#{lib}", "-lpqxx",
"-I#{include}", "-o", "test"
# Running ./test will fail because there is no runnning postgresql server
# system "./test"
# `pg_config` uses Cellar paths not opt paths
postgresql_include = Formula["postgresql"].opt_include.realpath.to_s
assert_match postgresql_include, (lib/"pkgconfig/libpqxx.pc").read,
"Please revision bump libpqxx."
end
end