From 8f63ea756b96cf7cbb4956bab1cfae1ef6f9ae70 Mon Sep 17 00:00:00 2001 From: FX Coudert Date: Fri, 21 Jul 2017 14:33:07 +0200 Subject: [PATCH] glpk: migrate from homebrew/science Closes #15833. Signed-off-by: FX Coudert --- Formula/glpk.rb | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Formula/glpk.rb diff --git a/Formula/glpk.rb b/Formula/glpk.rb new file mode 100644 index 0000000000..ca6d8b159e --- /dev/null +++ b/Formula/glpk.rb @@ -0,0 +1,31 @@ +class Glpk < Formula + desc "Library for Linear and Mixed-Integer Programming" + homepage "https://www.gnu.org/software/glpk/" + url "https://ftp.gnu.org/gnu/glpk/glpk-4.62.tar.gz" + mirror "https://ftpmirror.gnu.org/glpk/glpk-4.62.tar.gz" + sha256 "096e4be3f83878ccf70e1fdb62ad1c178715ef8c0d244254c29e2f9f0c1afa70" + + depends_on "gmp" + + def install + system "./configure", "--prefix=#{prefix}", + "--disable-dependency-tracking", + "--with-gmp" + system "make", "install" + end + + test do + (testpath/"test.c").write <<-EOF.undent + #include + #include "glpk.h" + + int main(int argc, const char *argv[]) + { + printf("%s", glp_version()); + return 0; + } + EOF + system ENV.cc, "test.c", "-L#{lib}", "-I#{include}", "-lglpk", "-o", "test" + assert_match version.to_s, shell_output("./test") + end +end