|
| 1 | +class Libptytty < Formula |
| 2 | + desc "Library for OS-independent pseudo-TTY management" |
| 3 | + homepage "https://software.schmorp.de/pkg/libptytty.html" |
| 4 | + url "http://dist.schmorp.de/libptytty/libptytty-2.0.tar.gz" |
| 5 | + sha256 "8033ed3aadf28759660d4f11f2d7b030acf2a6890cb0f7926fb0cfa6739d31f7" |
| 6 | + license "GPL-2.0-or-later" |
| 7 | + |
| 8 | + bottle do |
| 9 | + sha256 cellar: :any, arm64_tahoe: "5a8043eb470230c18db586ab547552e89aa343c13f3d101df7a8ddfb8ef2cd2f" |
| 10 | + sha256 cellar: :any, arm64_sequoia: "e04e49991b1e9e2df45463c865a99ba056d15bb854b30342955741b4be83bfae" |
| 11 | + sha256 cellar: :any, arm64_sonoma: "bc58487292ee8f7250be2ef35f6128e148038a29129bc6d69519ddee93afa865" |
| 12 | + sha256 cellar: :any, sonoma: "6d499c4ab02c6f3a3c2d43a1f5e50a937e8284f7fc89f856d693c05c023245cb" |
| 13 | + sha256 cellar: :any_skip_relocation, x86_64_linux: "3e60096e3e90c812a12c09d5e7c35e7b5e000650b06c76df6927d3346db9d8c8" |
| 14 | + end |
| 15 | + |
| 16 | + depends_on "cmake" => :build |
| 17 | + |
| 18 | + def install |
| 19 | + system "cmake", "-S", ".", "-B", "build", *std_cmake_args |
| 20 | + system "cmake", "--build", "build" |
| 21 | + system "cmake", "--install", "build" |
| 22 | + end |
| 23 | + |
| 24 | + test do |
| 25 | + (testpath/"test.c").write <<~C |
| 26 | + #include <stdio.h> |
| 27 | + #include <libptytty.h> |
| 28 | +
|
| 29 | + int main(void) { |
| 30 | + ptytty_init(); |
| 31 | + PTYTTY p = ptytty_create(); |
| 32 | + if (!p || !ptytty_get(p)) return 1; |
| 33 | + printf("ok\\n"); |
| 34 | + ptytty_delete(p); |
| 35 | + return 0; |
| 36 | + } |
| 37 | + C |
| 38 | + |
| 39 | + system ENV.cc, "test.c", "-I#{include}", "-L#{lib}", "-lptytty", "-o", "test" |
| 40 | + system "./test" |
| 41 | + end |
| 42 | +end |
0 commit comments