-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtransfig.rb
73 lines (59 loc) · 2.59 KB
/
transfig.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
class Transfig < Formula
homepage 'http://www.xfig.org'
url 'https://downloads.sourceforge.net/mcj/transfig.3.2.5e.tar.gz'
version '3.2.5e'
depends_on 'homebrew/x11/imake' => :build
depends_on 'jpeg'
depends_on 'ghostscript'
depends_on :x11
depends_on 'gcc'
fails_with :clang do
cause "clang fails to process xfig's imake rules"
end
fails_with :llvm
fails_with :gcc_4_0
env :std
def install
# transfig does not like to execute makefiles in parallel
ENV.deparallelize
# Patch tranfig/Imakefile
inreplace "transfig/Imakefile", "XCOMM BINDIR = /usr/bin/X11",
"BINDIR = #{bin}\n"+ # set install dir for bin
"USRLIBDIR = #{lib}\n" # set install dir for lib
inreplace "transfig/Imakefile", "XCOMM MANDIR = $(MANSOURCEPATH)$(MANSUFFIX)",
"MANDIR = #{man}$(MANSUFFIX)"
inreplace "transfig/Imakefile", "XCOMM USELATEX2E = -DLATEX2E",
"USELATEX2E = -DLATEX2E"
# Patch fig2dev/Imakefile
inreplace "fig2dev/Imakefile", "XCOMM BINDIR = /usr/bin/X11",
"BINDIR = #{bin}\n"+ # set install dir for bin
"USRLIBDIR = #{lib}\n" # set install dir for lib
inreplace "fig2dev/Imakefile", "XCOMM MANDIR = $(MANSOURCEPATH)$(MANSUFFIX)",
"MANDIR = #{man}$(MANSUFFIX)"
inreplace "fig2dev/Imakefile", "XFIGLIBDIR = /usr/local/lib/X11/xfig",
"XFIGLIBDIR = #{share}"
inreplace "fig2dev/Imakefile","XCOMM USEINLINE = -DUSE_INLINE",
"USEINLINE = -DUSE_INLINE"
inreplace "fig2dev/Imakefile", "RGB = $(LIBDIR)/rgb.txt", "RGB = #{MacOS::X11.share}/X11/rgb.txt"
inreplace "fig2dev/Imakefile", "PNGINC = -I/usr/include/X11","PNGINC = -I#{MacOS::X11.include}"
inreplace "fig2dev/Imakefile", "PNGLIBDIR = $(USRLIBDIR)","PNGLIBDIR = #{MacOS::X11.lib}"
inreplace "fig2dev/Imakefile", "ZLIBDIR = $(USRLIBDIR)", "ZLIBDIR = /usr/lib"
inreplace "fig2dev/Imakefile", "XPMLIBDIR = $(USRLIBDIR)", "XPMLIBDIR = #{MacOS::X11.lib}"
inreplace "fig2dev/Imakefile", "XPMINC = -I/usr/include/X11", "XPMINC = -I#{MacOS::X11.include}/X11"
inreplace "fig2dev/Imakefile", "XCOMM DDA4 = -DA4", "DDA4 = -DA4"
inreplace "fig2dev/Imakefile", "FIG2DEV_LIBDIR = /usr/local/lib/fig2dev",
"FIG2DEV_LIBDIR = #{lib}/fig2dev"
# generate Makefiles
system "make clean"
system "xmkmf"
system "make Makefiles"
# build everything
system "make", "CC=#{ENV["CC"]}", "CXX=#{ENV["CXX"]}", 'CCOPTIONS=""'
# install everything
system "make install"
system "make install.man"
end
test do
system "echo hello"
end
end