glpk: migrate from homebrew/science

Closes #15833.

Signed-off-by: FX Coudert <fxcoudert@gmail.com>
This commit is contained in:
FX Coudert 2017-07-21 14:33:07 +02:00
parent 7e34c36b88
commit 8f63ea756b

31
Formula/glpk.rb Normal file
View file

@ -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 <stdio.h>
#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