class Libpqxx < Formula desc "C++ connector for PostgreSQL" homepage "http://pqxx.org/development/libpqxx/" url "https://github.com/jtv/libpqxx/archive/6.4.4.tar.gz" sha256 "6ae3a0113a242db6bb9d998943b7cc23699652d843dab702aa06a8b9330c171a" bottle do cellar :any sha256 "b81d5d5fbecdebad76201a599c341aa6e09aa66e6af2a21c20b1c2ca4348e146" => :mojave sha256 "40b9be249b893b8f0ef7f31c30e1222e6193d9454902064fda4e85404eddf510" => :high_sierra sha256 "28c8597b50f2bfb45e2ebe89b3a510ccdf63d7ff971f5571861a4e8dbbb5d7f9" => :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