class Libssh < Formula desc "C library SSHv1/SSHv2 client and server protocols" homepage "https://www.libssh.org/" url "https://www.libssh.org/files/0.11/libssh-0.11.1.tar.xz" sha256 "14b7dcc72e91e08151c58b981a7b570ab2663f630e7d2837645d5a9c612c1b79" license "LGPL-2.1-or-later" head "https://git.libssh.org/projects/libssh.git", branch: "master" depends_on "cmake" => :build depends_on "openssl@3" uses_from_macos "zlib" def install args = %w[ -DBUILD_STATIC_LIB=ON -DWITH_SYMBOL_VERSIONING=OFF ] system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args system "cmake", "--build", "build" system "cmake", "--install", "build" lib.install "build/src/libssh.a" end test do (testpath/"test.c").write <<~EOS #include #include int main() { ssh_session my_ssh_session = ssh_new(); if (my_ssh_session == NULL) exit(-1); ssh_free(my_ssh_session); return 0; } EOS system ENV.cc, "test.c", "-o", "test", "-I#{include}", "-L#{lib}", "-lssh" system "./test" end end