|
| 1 | +class Transfig < Formula |
| 2 | + homepage 'http://www.xfig.org' |
| 3 | + url 'https://downloads.sourceforge.net/mcj/transfig.3.2.5e.tar.gz' |
| 4 | + version '3.2.5e' |
| 5 | + |
| 6 | + depends_on 'homebrew/x11/imake' => :build |
| 7 | + depends_on 'jpeg' |
| 8 | + depends_on 'ghostscript' |
| 9 | + depends_on :x11 |
| 10 | + depends_on 'gcc' |
| 11 | + |
| 12 | + fails_with :clang do |
| 13 | + cause "clang fails to process xfig's imake rules" |
| 14 | + end |
| 15 | + fails_with :llvm |
| 16 | + fails_with :gcc_4_0 |
| 17 | + |
| 18 | + env :std |
| 19 | + |
| 20 | + def install |
| 21 | + # transfig does not like to execute makefiles in parallel |
| 22 | + ENV.deparallelize |
| 23 | + |
| 24 | + # Patch tranfig/Imakefile |
| 25 | + inreplace "transfig/Imakefile", "XCOMM BINDIR = /usr/bin/X11", |
| 26 | + "BINDIR = #{bin}\n"+ # set install dir for bin |
| 27 | + "USRLIBDIR = #{lib}\n" # set install dir for lib |
| 28 | + inreplace "transfig/Imakefile", "XCOMM MANDIR = $(MANSOURCEPATH)$(MANSUFFIX)", |
| 29 | + "MANDIR = #{man}$(MANSUFFIX)" |
| 30 | + inreplace "transfig/Imakefile", "XCOMM USELATEX2E = -DLATEX2E", |
| 31 | + "USELATEX2E = -DLATEX2E" |
| 32 | + |
| 33 | + # Patch fig2dev/Imakefile |
| 34 | + inreplace "fig2dev/Imakefile", "XCOMM BINDIR = /usr/bin/X11", |
| 35 | + "BINDIR = #{bin}\n"+ # set install dir for bin |
| 36 | + "USRLIBDIR = #{lib}\n" # set install dir for lib |
| 37 | + inreplace "fig2dev/Imakefile", "XCOMM MANDIR = $(MANSOURCEPATH)$(MANSUFFIX)", |
| 38 | + "MANDIR = #{man}$(MANSUFFIX)" |
| 39 | + inreplace "fig2dev/Imakefile", "XFIGLIBDIR = /usr/local/lib/X11/xfig", |
| 40 | + "XFIGLIBDIR = #{share}" |
| 41 | + inreplace "fig2dev/Imakefile","XCOMM USEINLINE = -DUSE_INLINE", |
| 42 | + "USEINLINE = -DUSE_INLINE" |
| 43 | + inreplace "fig2dev/Imakefile", "RGB = $(LIBDIR)/rgb.txt", "RGB = #{MacOS::X11.share}/X11/rgb.txt" |
| 44 | + inreplace "fig2dev/Imakefile", "PNGINC = -I/usr/include/X11","PNGINC = -I#{MacOS::X11.include}" |
| 45 | + inreplace "fig2dev/Imakefile", "PNGLIBDIR = $(USRLIBDIR)","PNGLIBDIR = #{MacOS::X11.lib}" |
| 46 | + inreplace "fig2dev/Imakefile", "ZLIBDIR = $(USRLIBDIR)", "ZLIBDIR = /usr/lib" |
| 47 | + inreplace "fig2dev/Imakefile", "XPMLIBDIR = $(USRLIBDIR)", "XPMLIBDIR = #{MacOS::X11.lib}" |
| 48 | + inreplace "fig2dev/Imakefile", "XPMINC = -I/usr/include/X11", "XPMINC = -I#{MacOS::X11.include}/X11" |
| 49 | + inreplace "fig2dev/Imakefile", "XCOMM DDA4 = -DA4", "DDA4 = -DA4" |
| 50 | + inreplace "fig2dev/Imakefile", "FIG2DEV_LIBDIR = /usr/local/lib/fig2dev", |
| 51 | + "FIG2DEV_LIBDIR = #{lib}/fig2dev" |
| 52 | + |
| 53 | + # generate Makefiles |
| 54 | + system "make clean" |
| 55 | + system "xmkmf" |
| 56 | + system "make Makefiles" |
| 57 | + |
| 58 | + # build everything |
| 59 | + system "make", "CC=#{ENV["CC"]}", "CXX=#{ENV["CXX"]}", 'CCOPTIONS=""' |
| 60 | + |
| 61 | + # install everything |
| 62 | + system "make install" |
| 63 | + system "make install.man" |
| 64 | + |
| 65 | + end |
| 66 | + |
| 67 | + test do |
| 68 | + |
| 69 | + system "echo hello" |
| 70 | + |
| 71 | + end |
| 72 | + |
| 73 | +end |
0 commit comments