forked from ahmadia/homebrew-science
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxmgredit.rb
111 lines (95 loc) · 2.48 KB
/
xmgredit.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
require 'formula'
class Xmgredit < Formula
url 'http://dl.dropbox.com/u/72178/dist/xmgredit-5.tar.gz'
homepage 'http://www.stccmop.org/~pturner/'
sha1 '7580e10e0779e5ea9d154fa27c1c9a852d86a0da'
depends_on :x11
depends_on 'lesstif'
depends_on 'netcdf'
depends_on 'triangle'
patch :DATA
def install
bin.mkpath
system "make", "install", "INSTALLDIR=#{prefix}"
end
end
__END__
Patch to remove Triangle dependencies (as those are handled by the Triangle
formula), to enable NetCDF support and to sort out compiler flags.
diff -u b/Makefile b/Makefile
--- b/Makefile
+++ b/Makefile
@@ -10,20 +10,20 @@
# Uncomment the following 3 defines for netCDF support
# adjust paths to suit local conditions
#
-#NETCDF = -DHAVE_NETCDF
-#NETCDFINCLUDES = -I/usr/local/ace/netcdf/include
-#NETCDFLIBS = -L/usr/local/ace/netcdf/lib -lnetcdf
+NETCDFFLAGS=-DHAVE_NETCDF
+NETCDFLIBS=-lnetcdf
+
+TRIANGLEFLAGS=-DDO_TRIANGLE
+TRIAGLELIBS=-ltriangle
############################################
# LINUX
-LIBS = -L/usr/X11R6/lib64 -lXm -lXp -lXt -lXext -lXpm -lX11 -lICE -lSM -lm
-INCLUDES = -I/usr/X11R6/include
-CC = gcc -g -O
+LIBS=$(LDFLAGS) -lXm -lXp -lXt -lXext -lXpm -lX11 -lICE -lSM -lm $(NETCDFLIBS) $(TRIAGLELIBS)
+CFLAGS+=$(NETCDFFLAGS) $(TRIANGLEFLAGS)
#################
####### End of configuration, no changes should be required below #########
#################
-CFLAGS = -DDO_TRIANGLE $(INCLUDES)
OBJS = main.o\
vers.o\
@@ -75,7 +75,6 @@
params.o\
malerts.o\
motifutils.o\
- triangle.o\
tritest.o\
vedglist.o\
vgeometry.o\
@@ -140,7 +139,6 @@
params.c\
malerts.c\
motifutils.c\
- triangle.c\
tritest.c\
vedglist.c\
vgeometry.c\
@@ -173,21 +171,17 @@
patterns.h\
special.h\
graphics.h\
- triangle.h\
vdefines.h\
vdefs.h
-all: xmgredit5
+all: xmgredit
-xmgredit5: $(OBJS) $(PARSOBJS)
- $(CC) $(OBJS) $(PARSOBJS) -o xmgredit5 $(LIBS)
+xmgredit: $(OBJS) $(PARSOBJS)
+ $(CC) $(CFLAGS) $(CPPFLAGS) $(OBJS) $(PARSOBJS) -o xmgredit $(LIBS)
$(OBJS): defines.h globals.h
eventproc.c: defines.h globals.h
-triangle.o:
- $(CC) -c -DTRILIBRARY triangle.c
-
pars.o: pars.y
vers.o: $(SRCS) pars.y
@@ -218,8 +212,8 @@
touch rcs
grep Id: Makefile $(SRCS) $(INCS) $(PARSSRCS) > release.tmp
-install: xmgredit5
- cp -p xmgredit5 $(INSTALLDIR)/bin/xmgredit5
+install: xmgredit
+ cp -p xmgredit $(INSTALLDIR)/bin/xmgredit
lint:
lint -axv -wk -Nn10000 -Nd10000 $(SRCS) $(PARSSRCS)
@@ -230,3 +224,3 @@
clean:
- /bin/rm *.o xmgredit5
+ /bin/rm *.o xmgredit