homebrew-core/Formula/libconfig.rb

48 lines
1.5 KiB
Ruby

class Libconfig < Formula
desc "Configuration file processing library"
homepage "https://www.hyperrealm.com/libconfig/"
url "https://github.com/hyperrealm/libconfig/archive/v1.6.tar.gz"
sha256 "18739792eb463d73525d7aea9b0a48b14106fae1cfec09aedc668d8c1079adf1"
bottle do
rebuild 1
sha256 "23e530c1de99bced2f55361347920cb9149b816dcd6e273db90c8211bbbbe025" => :high_sierra
sha256 "238bf662b61ce2ed2b3e4ef0cf932ab4c9fe784f23d5d82576b79ce552db10b6" => :sierra
sha256 "2194870d1e0f7dcdc03df3637bfb16c92ddd03f1a65870c0498e28b06308f5bd" => :el_capitan
end
head do
url "https://github.com/hyperrealm/libconfig.git"
depends_on "automake" => :build
depends_on "autoconf" => :build
depends_on "libtool" => :build
end
def install
system "autoreconf", "-i" if build.head?
system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}"
# Fixes "scanner.l:137:59: error: too few arguments to function call ..."
# Forces regeneration of the BUILT_SOURCES "scanner.c" and "scanner.h"
# Reported 6 Jun 2016: https://github.com/hyperrealm/libconfig/issues/66
touch "lib/scanner.l"
system "make", "install"
end
test do
(testpath/"test.c").write <<-EOS.undent
#include <libconfig.h>
int main() {
config_t cfg;
config_init(&cfg);
config_destroy(&cfg);
return 0;
}
EOS
system ENV.cc, "-I#{include}", "-L#{lib}", "-lconfig",
testpath/"test.c", "-o", testpath/"test"
system "./test"
end
end