|
| 1 | +require 'formula' |
| 2 | + |
| 3 | +class Doxygen1831 < Formula |
| 4 | + homepage 'http://www.doxygen.org/' |
| 5 | + url 'http://ftp.stack.nl/pub/users/dimitri/doxygen-1.8.3.1.src.tar.gz' |
| 6 | + mirror 'https://downloads.sourceforge.net/project/doxygen/rel-1.8.3.1/doxygen-1.8.3.1.src.tar.gz' |
| 7 | + sha1 '289fc809f44b8025d45279deefbaee7680efd88f' |
| 8 | + |
| 9 | + option 'with-dot', 'Build with dot command support from Graphviz.' |
| 10 | + option 'with-doxywizard', 'Build GUI frontend with qt support.' |
| 11 | + option 'with-libclang', 'Build with libclang support.' |
| 12 | + |
| 13 | + depends_on 'graphviz' if build.with? 'dot' |
| 14 | + depends_on 'qt' if build.with? 'doxywizard' |
| 15 | + depends_on 'llvm' => 'with-clang' if build.with? 'libclang' |
| 16 | + |
| 17 | + patch :DATA if build.with? 'doxywizard' |
| 18 | + |
| 19 | + def install |
| 20 | + # libclang is installed under #{HOMEBREW_PREFIX}/opt/llvm/ |
| 21 | + if build.with? 'libclang' |
| 22 | + inreplace 'configure' do |s| |
| 23 | + s.gsub! /libclang_hdr_dir=\".*$/, "libclang_hdr_dir=\"#{HOMEBREW_PREFIX}/opt/llvm/include\"" |
| 24 | + s.gsub! /libclang_lib_dir=\".*$/, "libclang_lib_dir=\"#{HOMEBREW_PREFIX}/opt/llvm/lib\"" |
| 25 | + end |
| 26 | + end |
| 27 | + |
| 28 | + args = ["--prefix", prefix] |
| 29 | + args << '--with-libclang-static' if build.with? 'libclang' |
| 30 | + args << '--with-doxywizard' if build.with? 'doxywizard' |
| 31 | + system "./configure", *args |
| 32 | + # Per Macports: |
| 33 | + # https://trac.macports.org/browser/trunk/dports/textproc/doxygen/Portfile#L92 |
| 34 | + inreplace %w[ libmd5/Makefile.libmd5 |
| 35 | + src/Makefile.libdoxycfg |
| 36 | + tmake/lib/macosx-c++/tmake.conf |
| 37 | + tmake/lib/macosx-intel-c++/tmake.conf |
| 38 | + tmake/lib/macosx-uni-c++/tmake.conf ] do |s| |
| 39 | + # makefiles hardcode both cc and c++ |
| 40 | + s.gsub! /cc$/, ENV.cc |
| 41 | + s.gsub! /c\+\+$/, ENV.cxx |
| 42 | + end |
| 43 | + |
| 44 | + # This is a terrible hack; configure finds lex/yacc OK but |
| 45 | + # one Makefile doesn't get generated with these, so pull |
| 46 | + # them out of a known good file and cram them into the other. |
| 47 | + lex = '' |
| 48 | + yacc = '' |
| 49 | + |
| 50 | + inreplace 'src/libdoxycfg.t' do |s| |
| 51 | + lex = s.get_make_var 'LEX' |
| 52 | + yacc = s.get_make_var 'YACC' |
| 53 | + end |
| 54 | + |
| 55 | + inreplace 'src/Makefile.libdoxycfg' do |s| |
| 56 | + s.change_make_var! 'LEX', lex |
| 57 | + s.change_make_var! 'YACC', yacc |
| 58 | + end |
| 59 | + |
| 60 | + system "make" |
| 61 | + # MAN1DIR, relative to the given prefix |
| 62 | + system "make", "MAN1DIR=share/man/man1", "install" |
| 63 | + end |
| 64 | +end |
| 65 | + |
| 66 | +__END__ |
| 67 | +# On Mac OS Qt builds an application bundle rather than a binary. We need to |
| 68 | +# give install the correct path to the doxywizard binary. This is similar to |
| 69 | +# what macports does: |
| 70 | +diff --git a/addon/doxywizard/Makefile.in b/addon/doxywizard/Makefile.in |
| 71 | +index 727409a..8b0d00f 100644 |
| 72 | +--- a/addon/doxywizard/Makefile.in |
| 73 | ++++ b/addon/doxywizard/Makefile.in |
| 74 | +@@ -30,7 +30,7 @@ distclean: Makefile.doxywizard |
| 75 | + |
| 76 | + install: |
| 77 | + $(INSTTOOL) -d $(INSTALL)/bin |
| 78 | +- $(INSTTOOL) -m 755 ../../bin/doxywizard $(INSTALL)/bin |
| 79 | ++ $(INSTTOOL) -m 755 ../../bin/doxywizard.app/Contents/MacOS/doxywizard $(INSTALL)/bin |
| 80 | + $(INSTTOOL) -d $(INSTALL)/$(MAN1DIR) |
| 81 | + cat ../../doc/doxywizard.1 | sed -e "s/DATE/$(DATE)/g" -e "s/VERSION/$(VERSION)/g" > doxywizard.1 |
| 82 | + $(INSTTOOL) -m 644 doxywizard.1 $(INSTALL)/$(MAN1DIR)/doxywizard.1 |
0 commit comments