class Libpqxx < Formula desc "C++ connector for PostgreSQL" homepage "http://pqxx.org/development/libpqxx/" url "https://github.com/jtv/libpqxx/archive/6.2.5.tar.gz" sha256 "36fcf8439ac7f7cc68b21e95b20e921ece4487cda1cc1d09b798a84e7cb3a4b7" revision 6 bottle do cellar :any sha256 "5e336b88e12119319f974b3519753e3136a32063f9b76aa2c9572c5614f3a707" => :mojave sha256 "25263a0771fe09fea35496f4ebd85c44e686095f80f0f48511fa0b5c92575ba3" => :high_sierra sha256 "caa899ab8e3ec34cee07cd8ea7619495d1c21a453ad083f1ab42847e65c4b711" => :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 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