|
| 1 | +class Mandoc < Formula |
| 2 | + desc "UNIX manpage compiler toolset" |
| 3 | + homepage "https://mandoc.bsd.lv/" |
| 4 | + url "https://mandoc.bsd.lv/snapshots/mandoc-1.14.6.tar.gz" |
| 5 | + sha256 "8bf0d570f01e70a6e124884088870cbed7537f36328d512909eb10cd53179d9c" |
| 6 | + license "ISC" |
| 7 | + revision 1 |
| 8 | + head "[email protected]:/cvs", using: :cvs |
| 9 | + |
| 10 | + livecheck do |
| 11 | + url "https://mandoc.bsd.lv/snapshots/" |
| 12 | + regex(/href=.*?mandoc[._-]v?(\d+(?:\.\d+)+)\.t/i) |
| 13 | + end |
| 14 | + |
| 15 | + bottle do |
| 16 | + root_url "https://github.com/gromgit/homebrew-core-aarch64_linux/releases/download/mandoc-1.14.6" |
| 17 | + sha256 cellar: :any_skip_relocation, aarch64_linux: "ffd5ecbc5673d6a71262d4c61ce14212546031a198414b11269a6262e0a41fc0" |
| 18 | + end |
| 19 | + |
| 20 | + uses_from_macos "zlib" |
| 21 | + |
| 22 | + def install |
| 23 | + localconfig = [ |
| 24 | + |
| 25 | + # Sane prefixes. |
| 26 | + "PREFIX=#{prefix}", |
| 27 | + "INCLUDEDIR=#{include}", |
| 28 | + "LIBDIR=#{lib}", |
| 29 | + "MANDIR=#{man}", |
| 30 | + "WWWPREFIX=#{prefix}/var/www", |
| 31 | + "EXAMPLEDIR=#{share}/examples", |
| 32 | + |
| 33 | + # Executable names, where utilities would be replaced/duplicated. |
| 34 | + # The mandoc versions of the utilities are definitely *not* ready |
| 35 | + # for prime-time on Darwin, though some changes in HEAD are promising. |
| 36 | + # The "bsd" prefix (like bsdtar, bsdmake) is more informative than "m". |
| 37 | + "BINM_MAN=bsdman", |
| 38 | + "BINM_APROPOS=bsdapropos", |
| 39 | + "BINM_WHATIS=bsdwhatis", |
| 40 | + "BINM_MAKEWHATIS=bsdmakewhatis", # default is "makewhatis". |
| 41 | + "BINM_SOELIM=bsdsoelim", # conflicts with groff's soelim |
| 42 | + |
| 43 | + # These are names for *section 7* pages only. Several other pages are |
| 44 | + # prefixed "mandoc_", similar to the "groff_" pages. |
| 45 | + "MANM_MAN=man", |
| 46 | + "MANM_MDOC=mdoc", |
| 47 | + "MANM_ROFF=mandoc_roff", # This is the only one that conflicts (groff). |
| 48 | + "MANM_EQN=eqn", |
| 49 | + "MANM_TBL=tbl", |
| 50 | + |
| 51 | + # Not quite sure what to do here. The default ("/usr/share", etc.) needs |
| 52 | + # sudoer privileges, or will error. So just brew's manpages for now? |
| 53 | + "MANPATH_DEFAULT=#{HOMEBREW_PREFIX}/share/man", |
| 54 | + |
| 55 | + "HAVE_MANPATH=0", # Our `manpath` is a symlink to system `man`. |
| 56 | + "STATIC=", # No static linking on Darwin. |
| 57 | + |
| 58 | + "HOMEBREWDIR=#{HOMEBREW_CELLAR}", # ? See configure.local.example, NEWS. |
| 59 | + "BUILD_CGI=1", |
| 60 | + ] |
| 61 | + |
| 62 | + # Bottom corner signature line. |
| 63 | + localconfig << if OS.mac? |
| 64 | + "OSNAME='macOS #{MacOS.version}'" |
| 65 | + else |
| 66 | + "OSNAME='Linux'" |
| 67 | + end |
| 68 | + |
| 69 | + File.rename("cgi.h.example", "cgi.h") # For man.cgi |
| 70 | + |
| 71 | + (buildpath/"configure.local").write localconfig.join("\n") |
| 72 | + system "./configure" |
| 73 | + |
| 74 | + # I've tried twice to send a bug report on this to [email protected]. |
| 75 | + # In theory, it should show up with: |
| 76 | + # search.gmane.org/?query=jobserver&group=gmane.comp.tools.mdocml.devel |
| 77 | + ENV.deparallelize do |
| 78 | + system "make" |
| 79 | + system "make", "install" |
| 80 | + end |
| 81 | + end |
| 82 | + |
| 83 | + test do |
| 84 | + system bin/"mandoc", "-Thtml", |
| 85 | + "-Ostyle=#{share}/examples/example.style.css", "#{man1}/mandoc.1" |
| 86 | + end |
| 87 | +end |
0 commit comments