Files

57 lines
1.7 KiB
Ruby

class Npth < Formula
bottle do
root_url "https://homebrew.hyprnet/bottles"
sha256 cellar: :any, arm64_sequoia: "7836af0109be87ab2b8155b533cd33508eb3b738190031c8ca2e2b94df6f5c2b"
sha256 cellar: :any, arm64_tahoe: "7dc8a83801469950381677b61404e103e5fd8fb22bc6b4e0f68db292d5801e3a"
sha256 cellar: :any_skip_relocation, x86_64_linux: "dfe2b3f4f5fb1b8e05b3ddbc5dddbf44d3b03b95ca9712ff4fc33cbd045368b4"
end
desc "New GNU portable threads library"
homepage "https://gnupg.org/"
url "https://gnupg.org/ftp/gcrypt/npth/npth-1.8.tar.bz2"
mirror "https://www.mirrorservice.org/sites/ftp.gnupg.org/gcrypt/npth/npth-1.8.tar.bz2"
sha256 "8bd24b4f23a3065d6e5b26e98aba9ce783ea4fd781069c1b35d149694e90ca3e"
license "LGPL-2.1-or-later"
livecheck do
url "https://gnupg.org/ftp/gcrypt/npth/"
regex(/href=.*?npth[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
def install
system "./configure", "--disable-silent-rules", *std_configure_args
system "make", "install"
end
test do
(testpath/"test.c").write <<~C
#include <stdio.h>
#include <npth.h>
void* thread_function(void *arg) {
printf("Hello from nPth thread!\\n");
return NULL;
}
int main() {
npth_t thread_id;
int status;
status = npth_init();
if (status != 0) {
fprintf(stderr, "Failed to initialize nPth.\\n");
return 1;
}
status = npth_create(&thread_id, NULL, thread_function, NULL);
npth_join(thread_id, NULL);
return 0;
}
C
system ENV.cc, "test.c", "-L#{lib}", "-lnpth", "-o", "test"
assert_match "Hello from nPth thread!", shell_output("./test")
end
end