45 lines
1.2 KiB
Ruby
45 lines
1.2 KiB
Ruby
class Libaio < Formula
|
|
desc "Linux-native asynchronous I/O access library"
|
|
homepage "https://pagure.io/libaio"
|
|
url "https://pagure.io/libaio/archive/libaio-0.3.112/libaio-libaio-0.3.112.tar.gz"
|
|
sha256 "b7cf93b29bbfb354213a0e8c0e82dfcf4e776157940d894750528714a0af2272"
|
|
license "LGPL-2.1-or-later"
|
|
head "https://pagure.io/libaio.git", branch: "master"
|
|
|
|
# This regex only captures the first three numeric parts of the version
|
|
# (e.g., 0.3.110) and omits the optional trailing number (e.g., 0.3.110-1 or
|
|
# 0-3-107.1).
|
|
livecheck do
|
|
url :head
|
|
regex(/^libaio[._-]v?(\d+(?:[.-]\d+){1,2})(?:[.-]\d+)*$/i)
|
|
strategy :git do |tags, regex|
|
|
tags.map { |tag| tag[regex, 1]&.tr("-", ".") }
|
|
end
|
|
end
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "259d47affeaf26f081c49737f2121dc63ac5692c9752ecab4f1e333c81d19b53"
|
|
end
|
|
|
|
depends_on :linux
|
|
|
|
def install
|
|
system "make"
|
|
system "make", "prefix=#{prefix}", "install"
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.c").write <<~EOS
|
|
#include <libaio.h>
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
struct io_event *event;
|
|
}
|
|
EOS
|
|
|
|
system ENV.cc, "test.c", "-I#{include}", "-L#{lib}", "-laio", "-o", "test"
|
|
system "./test"
|
|
end
|
|
end
|