Hi,

while the misc/tkman port isn't totally broken on OpenBSD, nobody
did even minimal porting work on it, either.  In many respects, it
disregards even the most basic aspects of how OpenBSD documentation
works.

So, i decided to put some of my fingers where my mouth is and do a
few initial, minimal steps of actually porting this thing.  There
can't be the slightest doubt that much more can be done before this
can be called an adequate port.  Even with these minimal patches,
it is still doing lots of stuff that is rather absurd on OpenBSD,
so much more work would be useful.

But these initial patches already make it more useful in so far as
they repair some of the most blatant misconfigurations and delete
some of the most misleading warnings.

With this patch, try this:

 a) type tkman and press ENTER;
    this now actually shows the tkman welcome page without warnings
 b) then type "any=MAP_STACK" into the input box,
    press the "man" button and hold it down until the menu appears,
    select "apropos" from the menu, and relese the mouse button:
    mandoc-style semantic searching works
 c) then typ "erf" into the input box and hit enter:
    look at the formula in the DESCRIPTION: UTF-8 works

My reasons for non deleting this port are that

 1. the tkman program contains a number of interesting
    ideas and concepts;
 2. even though personally, i dislike GUIs, many users like them,
    and this is the most interesting man(1) GUI i have seen so far;
 3. at least for simple tasks, it is already fit for practical
    use, even though i still expect *lots* of rough edges

The patch below

 * uses mandoc for formatting rather than having a hidden
   dependency on groff;
 * produces UTF-8 for output rather than LATIN-1, which we don't even support
 * reorders the manual search path ("mastermen") in our default order;
 * deletes a bogus warning about stray cats
 * deletes bogus warnings about the absense of whatis files
 * no longer errors out when MANPATH is unset
 * regenerates the gui.tcl patch without Windows CR gore

OK?
  Ingo

P.S.
I do not promise that i'll do all the additional cleanup that should
be done all by myself, but at least i wanted to get this started.


Index: Makefile
===================================================================
RCS file: /cvs/ports/misc/tkman/Makefile,v
retrieving revision 1.27
diff -u -r1.27 Makefile
--- Makefile    3 Oct 2020 13:30:11 -0000       1.27
+++ Makefile    3 Oct 2020 15:45:43 -0000
@@ -3,7 +3,7 @@
 COMMENT =      Tcl/Tk-based manual browser
 
 DISTNAME =     tkman-2.2
-REVISION =     1
+REVISION =     2
 CATEGORIES =   misc 
 HOMEPAGE =     http://www.sourceforge.net/projects/tkman
 MAINTAINER =   Stuart Cassoff <s...@users.sourceforge.net>
@@ -20,7 +20,8 @@
 NO_TEST =      Yes
 
 pre-patch:
-       perl -pi -e 's!\r\n$$!\n!g;' ${WRKSRC}/Makefile
+       perl -pi -e 's!\r\n$$!\n!g;' ${WRKSRC}/Makefile \
+           ${WRKSRC}/{database,gui,manpath,tkmandesc}.tcl 
 
 do-install:
        @${MODTCL_WISH_ADJ} ${WRKSRC}/tkman ${WRKSRC}/retkman
Index: patches/patch-Makefile
===================================================================
RCS file: /cvs/ports/misc/tkman/patches/patch-Makefile,v
retrieving revision 1.5
diff -u -r1.5 patch-Makefile
--- patches/patch-Makefile      3 Oct 2020 13:30:12 -0000       1.5
+++ patches/patch-Makefile      3 Oct 2020 15:45:43 -0000
@@ -16,37 +16,28 @@
  # for a man pages and displaying its associated binaries (if any).
  # Use this feature carefully as a large number of directories can slow down 
startup.
 -mastermen = "/usr/man /usr/local/man"
-+mastermen = "${PREFIX}/man /usr/share/man ${X11BASE}/man"
++mastermen = "/usr/share/man ${X11BASE}/man ${PREFIX}/man"
  #mastermen = "/usr/man /usr/local/man /usr/sww/man /usr/share/man 
/usr/kerberos/man"
 -masterbin = "/usr/bin /usr/local/bin"
 +masterbin = "/usr/bin ${PREFIX}/bin ${X11BASE}/bin"
  #masterbin = "/usr/bin /usr/local/bin /usr/sww/bin /usr/sww/share/bin 
/usr/sww/share/X11R5/bin"
  
  
-@@ -113,7 +113,7 @@ dpis = "75 100"
+@@ -113,7 +113,8 @@ dpis = "75 100"
  # Lines are cached in .../man/cat<n>@<line-length>; 
  #   that is, the line length is appended to the usual cache directory names
  #manformat = {groff -te -Tascii -man /tmp/ll -}
 -manformat = {groff -te -Tlatin1 -man /tmp/ll -}
 +#manformat = {groff -te -Tlatin1 -man /tmp/ll -}
++manformat = {mandoc}
  # Ultrix users should uncomment the following line (you don't have eqn)
  #manformat = {tbl | nroff -man }
  # HP-UX uses a number of macros that groff doesn't define, so use the builtin 
nroff
-@@ -121,7 +121,7 @@ manformat = {groff -te -Tlatin1 -man /tmp/ll -}
- #  space between the .de and the macro name, and groff doesn't like this.)
- #manformat = {tbl | neqn | nroff -man }
- # BSD macros (.Sh, .Ss, .PP, ...) need -mandoc
--#manformat = {groff -Tascii -te -mandoc}
-+manformat = {groff -Tascii -te -mandoc}
- # BSDI
- #manformat = {tbl | eqn -Tascii | nroff -man }
- # It's actually legal to leave this empty if all the pages you'll ever
-@@ -165,14 +165,14 @@ zlist = {gz z Z}
- 
+@@ -166,13 +167,14 @@ zlist = {gz z Z}
  
  # pick a printing pipeline for which your platform has all the constituants
--#manprint = {groff -man -Tps -te -l}
-+manprint = {groff -mandoc -Tps -te -l}
+ #manprint = {groff -man -Tps -te -l}
++manprint = {mandoc -Tps}
  # alternatives
  #manprint = {groff -man -Tps -te -l | psnup -n2}
  #manprint = {tbl | eqn | troff -man -t | lpr -t}
@@ -58,7 +49,7 @@
  # printing string for preformatted pages without [tn]roff source
  #catprint = lpr
  #catprint = "lpr -h"
-@@ -203,7 +203,7 @@ shortnames = 0
+@@ -203,7 +205,7 @@ shortnames = 0
  # BY DEFAULT OFF
  glimpse = ""
  # Glimpse on, with Boolean scope set to entire file
@@ -67,7 +58,7 @@
  # give the full path, if you'd like
  #glimpse = /usr/sww/bin/glimpse
  # variations (refer to the Glimpse manual page)
-@@ -460,7 +460,7 @@ install: tkman retkman
+@@ -460,7 +462,7 @@ install: tkman retkman
        chmod +rx $(BINDIR)/tkman
        $(CP) retkman $(BINDIR)
        chmod +rx $(BINDIR)/retkman
Index: patches/patch-database_tcl
===================================================================
RCS file: patches/patch-database_tcl
diff -N patches/patch-database_tcl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-database_tcl  3 Oct 2020 15:45:43 -0000
@@ -0,0 +1,22 @@
+$OpenBSD$
+
+Warnings about stray cats make absolutely no sense on OpenBSD.
+There are many reasons why a manual page might only be available
+in preformatted form and not as man(7) or mdoc(7) source code.
+One example is the bsd.port.mk(5) USE_GROFF mechanism.
+
+Index: database.tcl
+--- database.tcl.orig
++++ database.tcl
+@@ -266,11 +266,6 @@ DEBUG { puts -nonewline stderr $n }
+               }
+ 
+               set manc($n,$i) $unique
+-              if {[llength $strays]} {
+-                      if {$manx(stray-warnings) eq ""} {set 
manx(stray-warnings) "Stray cats (formatted pages in .../man/catN without 
corresponding source in .../man/manN)\n"}
+-                      append manx(stray-warnings) "$d2\n\t$strays\n"
+-              }
+-
+               incr cnt [llength $unique]
+       }
+ 
Index: patches/patch-gui_tcl
===================================================================
RCS file: /cvs/ports/misc/tkman/patches/patch-gui_tcl,v
retrieving revision 1.1
diff -u -r1.1 patch-gui_tcl
--- patches/patch-gui_tcl       5 Jan 2011 17:34:17 -0000       1.1
+++ patches/patch-gui_tcl       3 Oct 2020 15:45:43 -0000
@@ -1,11 +1,12 @@
 $OpenBSD: patch-gui_tcl,v 1.1 2011/01/05 17:34:17 stu Exp $
---- gui.tcl.orig       Fri Dec 10 20:44:34 2010
-+++ gui.tcl    Fri Dec 10 20:46:05 2010
-@@ -746,6 +746,7 @@ proc manManTabSet {w} {
-       set repstr "ETRNIOASM          aaabcdeeeefghiijklmnnooprrsttuy"; set 
replen [string length $repstr]
- 
-       set rm [expr {[winfo width $t]-2*[$t cget -padx]-10}]
+Index: gui.tcl
+--- gui.tcl.orig
++++ gui.tcl
+@@ -746,6 +746,7 @@ proc manManTabSet {w} {
+       set repstr "ETRNIOASM          aaabcdeeeefghiijklmnnooprrsttuy"; set 
replen [string length $repstr]
+ 
+       set rm [expr {[winfo width $t]-2*[$t cget -padx]-10}]
 +      if {$rm <= 150} { set rm 151 }
-       $t tag configure info -tabs [list 0.3i $rm right]
-       $t tag configure census -tabs [list [expr {$rm-150}] right $rm right]
-       $t tag configure high -tabs [list $rm right]
+       $t tag configure info -tabs [list 0.3i $rm right]
+       $t tag configure census -tabs [list [expr {$rm-150}] right $rm right]
+       $t tag configure high -tabs [list $rm right]
Index: patches/patch-manpath_tcl
===================================================================
RCS file: patches/patch-manpath_tcl
diff -N patches/patch-manpath_tcl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-manpath_tcl   3 Oct 2020 15:45:43 -0000
@@ -0,0 +1,43 @@
+$OpenBSD$
+
+The archaic whatis file format is no longer used on OpenBSD.
+The only effect of looking for such files is misleading warnings.
+
+Index: manpath.tcl
+--- manpath.tcl.orig
++++ manpath.tcl
+@@ -12,7 +12,6 @@ proc manManpathCheck {} {
+       set manx(manpath-warnings) ""
+       set manx(paths) {}
+       set manpatherr ""
+-      set whatiserr 0
+       set glimpseerr 0
+       set glimpseuptodate 1
+       set pass 0
+@@ -83,26 +82,6 @@ proc manManpathCheck {} {
+                       if {![info exists man($root)]} {set man($root) 1}
+                       lappend manx(pathstat) $man($root)
+                       set manx($root,latest) [lfirst [manLatestMan $root]]
+-
+-                      # check for apropos index (called windex on Solaris)
+-                      if {!$manx(fBSDI) && !$fDebian && !$fHPUX} {
+-                              if {![file exists [set whatis [file join $root 
"windex"]]]} {
+-                                      set whatis $root/whatis
+-                              }
+-                      }
+-
+-                      if {![file exists $whatis]} {
+-                              append manpatherr "$root -- no `whatis' file 
for apropos\n"
+-                              if {!$whatiserr} {
+-                                      append manpatherr "    => generate 
`whatis' with mkwhatis/makewhatis/catman\n"
+-                                      set whatiserr 1
+-                              }
+-                      } elseif {![file readable $whatis]} {
+-                              # whatis set above
+-                              append manpatherr "$whatis not readable\n"
+-                      } elseif {[file mtime $whatis]<$manx($root,latest)} {
+-                              append manpatherr "$whatis out of date\n"
+-                      }
+ 
+                       # now check for Glimpse files
+                       if {$man(glimpse) ne ""} {
Index: patches/patch-tkmandesc_tcl
===================================================================
RCS file: patches/patch-tkmandesc_tcl
diff -N patches/patch-tkmandesc_tcl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-tkmandesc_tcl 3 Oct 2020 15:45:43 -0000
@@ -0,0 +1,32 @@
+$OpenBSD$
+
+Using the MANPATH environment variable is strongly discouraged
+on OpenBSD.  Instead, /etc/man.conf should be used, or even better,
+neither users nor system administrators should tweak such knobs.
+Where manual pages are stored is a matter of system configuration,
+not of user preference.
+
+Consequently, in the perfectly reasonable situation that MANPATH
+is not set, do not pester the user about it, but instead just use
+the default.
+
+Respecting /etc/man.conf might be even better, but nobody figured
+out yet how to achieve that.
+
+Index: tkmandesc.tcl
+--- tkmandesc.tcl.orig
++++ tkmandesc.tcl
+@@ -224,10 +224,10 @@ proc manDescManiCheck {{action "exit"}} {
+               set mani(manTitleList) $man(manTitleList)
+ 
+               if {![info exists env(MANPATH)] || [string trim $env(MANPATH)] 
eq ""} {
+-                      puts stderr "You must set a MANPATH environment 
variable,\nwhich is a colon-separated list of directories in which\nto find man 
pages, for example /usr/man:/usr/share/man.\n(See the help page for an 
explanation of why\nalternatives to the MANPATH are a bad thing.)"
+-                      exit 1
+-              }
++                      set manx(MANPATH0) [regsub -all " +" $manx(mastermen) 
":"]
++              } else {
+               set manx(MANPATH0) $env(MANPATH)
++              }
+ 
+               manManpathCheck
+ 

Reply via email to