forked from ahmadia/homebrew-science
-
Notifications
You must be signed in to change notification settings - Fork 0
/
asl.rb
39 lines (31 loc) · 1.14 KB
/
asl.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
require 'formula'
class Asl < Formula
url 'http://www.ampl.com/netlib/ampl/solvers.tgz'
sha1 '58bc9a250656e61fb7c906f8b19f10d3cf6b9c67'
version '20140205'
homepage 'http://www.ampl.com/hooking.html'
def install
args = ["CC=#{ENV.cc}", 'CFLAGS="-I. -O -fPIC"']
# Dynamic libraries are more user friendly.
# Inclusion of the following in ASL was suggested to David Gay.
(buildpath / 'makefile.brew').write <<-EOS.undent
include makefile.u
libasl.dylib: ${a:.c=.o}
\t$(CC) -shared -Wl,-install_name -Wl,#{lib}/libasl.dylib -o libasl.dylib $?
libfuncadd0.dylib: funcadd0.o
\t$(CC) -shared -Wl,-install_name -Wl,#{lib}/libfuncadd0.dylib -o libfuncadd0.dylib $?
EOS
ENV.deparallelize
system *(%w[make -f makefile.brew arith.h stdio1.h libasl.dylib libfuncadd0.dylib] + args)
lib.install 'libasl.dylib', 'libfuncadd0.dylib'
(include+'asl').install Dir['*.h']
(include+'asl').install Dir['*.hd']
doc.install 'README'
end
def caveats; <<-EOS.undent
Include files are in #{include}/asl.
To link with the ASL, you may simply use
-L#{lib} -lasl -lfuncadd0
EOS
end
end