Hi Marc,

these changes make sense to me, and they seem to work with the
xwit port.

Marc Espie wrote on Tue, Aug 07, 2018 at 11:50:27AM +0200:

> This tries to make imake more "regular".
> Specifically, it had a few LOCALBASE, but it can have LOCALBASE
> and X11BASE throughout.
> 
> This is a better config.  I might go slightly further: it generates
> makefiles so we could unhardcode LOCALBASE and X11BASE entirely
> probably (by switching to $(LOCALBASE) and $(X11BASE) where applicable,
> which work with make, but do not influence pkg_subst at all.
> 
> Also (Hey, Ingo)  imake.cf + Ports harcodes the use of nroff.

At least as far as i can see in the patch below, only in the sense
of defining NroffCmd to look for nroff in the PATH.  That doesn't
look particularly dangerous because a port without USE_GROFF will
hardly run NroffCmd during the build, right?  So the definition
will simply remain unused, right?

Actually, i fail to see how defining NroffCmd to "mandoc" could ever
be useful.  If something uses mandoc, it is *not* supposed to run
mandoc at build time, but to install the mdoc(7) or man(7) sources.
So not defining NroffCmd and friends *at all* when UseGroff is not
defined might be better and might help catch porting errors.
Of course, that change can be kept separate from this patch,
and it needs a bulk for testing.

(Defining NroffCmd to mandoc may have been useful in the remote
past when we still installed preformatted manual pages formatted
with mandoc.)

> Well, it's "easy" enough to fix that, just need to move USE_GROFF
> definition higher, and actually make use of it in the configuration.
> 
> To the best of my knowledge, this affects only xwit, which might not
> actually require groff to function...

Actually, it does still need USE_GROFF due to this horrible line:

  'in \n(.iu+\w'\fBxwit \fR'u

Mandoc cannot handle that for more than one reason:

 - The mandoc parsers still implement .in on the man(7) macro
   level, even though it actually is a roff(7) request.  Fixing
   that is technically tricky.  While mandoc can now generate
   syntax tree nodes on the roff(7) level, the .in request
   needs to open a block node, but block nodes work totally
   differently in mdoc(7) and man(7), especially when it comes
   to rewinding them.

 - Consequently, mandoc cannot handle the addition in that line.
   Arithmetic expressions are only implemented in the roff(7) parser,
   not in the man(7) formatters.

 - Mandoc cannot easily implement the \(.i "measure current
   indentation" predefined number register.  It is a very serious
   layering violation.  It needs to be evaluated at syntax tree
   parse time, but it requires formatting time information,
   which will not yet be available for a long time.

 - Mandoc cannot handle that particular \w width measurement.
   Mandoc can only measure the width of plain strings, not the
   width of strings containing font instructions.

Basically, nothing in that line can work with mandoc.
So many problems in so few bytes...
And they totally garble the indentation of the SYNOPSIS.

This is actually among the most offensive instances of low-level
roff(7) we have in the ports tree.


That said, in this particular case, it might be an option to
completely get rid of roff and mandoc support in imake and
instead just patch away that one line in the xwig port.
In general, i discourage patching up manuals to work with
mandoc, but in this case, it might make sense:  The xwig port
is not likely to ever change, no new imake ports will ever show
up nowadays, and it would allow garbage collection of obsolete
infrastructure...

What do you think?


> Index: devel/imake-cf/Makefile
> ===================================================================
> RCS file: /cvs/ports/devel/imake-cf/Makefile,v
> retrieving revision 1.12
> diff -u -p -r1.12 Makefile
> --- devel/imake-cf/Makefile   25 Feb 2017 22:08:41 -0000      1.12
> +++ devel/imake-cf/Makefile   7 Aug 2018 09:45:28 -0000
> @@ -6,7 +6,7 @@ CATEGORIES =  devel x11
>  V =          1.0.6
>  DISTNAME =   xorg-cf-files-${V}
>  PKGNAME =    imake-cf-${V}
> -REVISION =   1
> +REVISION =   2
>  MASTER_SITES =       ${MASTER_SITE_XORG:=util/}
>  
>  PERMIT_PACKAGE_CDROM =               Yes
> @@ -19,11 +19,11 @@ XCONFDIR =        ${PREFIX}/lib/X11/config
>  
>  NO_TEST=     Yes
>  
> -do-build:
> -     sed ${SUBST} <${WRKSRC}/site.def.in >${WRKSRC}/site.def
> -
>  pre-configure:
>       ${SUBST_CMD} ${WRKSRC}/OpenBSD.cf
> +
> +do-build:
> +     sed ${SUBST} <${WRKSRC}/site.def.in >${WRKSRC}/site.def
>  
>  do-install:
>       ${INSTALL_DATA_DIR} ${XCONFDIR}
> Index: devel/imake-cf/patches/patch-OpenBSD_cf
> ===================================================================
> RCS file: /cvs/ports/devel/imake-cf/patches/patch-OpenBSD_cf,v
> retrieving revision 1.7
> diff -u -p -r1.7 patch-OpenBSD_cf
> --- devel/imake-cf/patches/patch-OpenBSD_cf   25 Feb 2017 22:08:42 -0000      
> 1.7
> +++ devel/imake-cf/patches/patch-OpenBSD_cf   7 Aug 2018 09:45:28 -0000
> @@ -1,20 +1,39 @@
>  $OpenBSD: patch-OpenBSD_cf,v 1.7 2017/02/25 22:08:42 naddy Exp $
> ---- OpenBSD.cf.orig  Tue Dec 22 02:28:02 2015
> -+++ OpenBSD.cf       Sat Feb 25 23:01:15 2017
> -@@ -26,10 +26,12 @@ XCOMM operating system:  OSName (OSMajorVersion./**/OS
> - #define LibDir                      /usr/local/lib/X11
> - #define UsrLibDir           /usr/local/lib
> - #define ManDirectoryRoot    /usr/local/man
> +Index: OpenBSD.cf
> +--- OpenBSD.cf.orig
> ++++ OpenBSD.cf
> +@@ -22,18 +22,20 @@ XCOMM operating system:  OSName (OSMajorVersion./**/OS
> + 
> + #ifdef Ports
> + 
> +-#define BinDir                      /usr/local/bin
> +-#define LibDir                      /usr/local/lib/X11
> +-#define UsrLibDir           /usr/local/lib
> +-#define ManDirectoryRoot    /usr/local/man
> +-#define LdPreLib            -L/usr/X11R6/lib -L/usr/local/lib
> +-#define XpmLibDir           /usr/X11R6/lib
> +-#define XpmIncDir           /usr/X11R6/include
> +-#define ConfigDir           /usr/X11R6/lib/X11/config
> +-#define IncRoot                     /usr/local/include
> +-#define TopXInclude         -I/usr/X11R6/include
> ++#define BinDir                      ${LOCALBASE}/bin
> ++#define LibDir                      ${LOCALBASE}/lib/X11
> ++#define UsrLibDir           ${LOCALBASE}/lib
> ++#define ManDirectoryRoot    ${LOCALBASE}/man
>  +#define FontDir                     ${LOCALBASE}/share/fonts
>  +#define FontEncDir          ${LOCALBASE}/share/fonts/encodings
> - #define LdPreLib            -L/usr/X11R6/lib -L/usr/local/lib
> - #define XpmLibDir           /usr/X11R6/lib
> - #define XpmIncDir           /usr/X11R6/include
> --#define ConfigDir           /usr/X11R6/lib/X11/config
> ++#define LdPreLib            -L${X11BASE}/lib -L${LOCALBASE}/lib
> ++#define XpmLibDir           ${X11BASE}/lib
> ++#define XpmIncDir           ${X11BASE}/include
>  +#define ConfigDir           ${LOCALBASE}/lib/X11/config
> - #define IncRoot                     /usr/local/include
> - #define TopXInclude         -I/usr/X11R6/include
> ++#define IncRoot                     ${LOCALBASE}/include
> ++#define TopXInclude         -I${X11BASE}/include
>   #define ImakeCmd            imake -DPorts
> +-#define DocDir                      /usr/local/share/doc
> ++#define DocDir                      ${LOCALBASE}/share/doc
> + #define BuildHtmlManPages   NO
> + 
> + #endif
>  @@ -172,6 +174,9 @@ XCOMM operating system:  OSName (OSMajorVersion./**/OS
>   #ifndef CcCmd
>   #define CcCmd                       cc
> @@ -32,7 +51,7 @@ $OpenBSD: patch-OpenBSD_cf,v 1.7 2017/02
>  -#define NeqnCmd                     neqn -Tlatin1
>  -#define NroffCmd            nroff -Tlatin1
>  -#define     EqnCmd                  eqn -Tps
> -+#ifdef Ports
> ++#ifdef UseGroff
>  +# define NroffCmd           ${LOCALBASE}/bin/nroff -Tascii -c
>  +# define TroffCmd           ${LOCALBASE}/bin/nroff -Tps
>  +# define HTMLroffCmd                ${LOCALBASE}/bin/nroff -Thtml
> Index: infrastructure/mk/bsd.port.mk
> ===================================================================
> RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v
> retrieving revision 1.1436
> diff -u -p -r1.1436 bsd.port.mk
> --- infrastructure/mk/bsd.port.mk     6 Aug 2018 09:36:32 -0000       1.1436
> +++ infrastructure/mk/bsd.port.mk     7 Aug 2018 09:45:29 -0000
> @@ -272,6 +272,7 @@ NO_DEPENDS ?= No
>  NO_BUILD ?= No
>  NO_TEST ?= No
>  INSTALL_TARGET ?= install
> +USE_GROFF ?= No
>  
>  .if !defined(_ARCH_DEFINES_INCLUDED)
>  _ARCH_DEFINES_INCLUDED = Done
> @@ -594,7 +595,6 @@ ERRORS += "   (No flavors for this port)
>  .  endif
>  .endif
>  
> -USE_GROFF ?= No
>  .if ${USE_GROFF:L} == "yes"
>  BUILD_DEPENDS += textproc/groff>=1.21
>  _PKG_ARGS += -DUSE_GROFF=1
> Index: infrastructure/mk/imake.port.mk
> ===================================================================
> RCS file: /cvs/ports/infrastructure/mk/imake.port.mk,v
> retrieving revision 1.9
> diff -u -p -r1.9 imake.port.mk
> --- infrastructure/mk/imake.port.mk   26 Apr 2016 10:56:59 -0000      1.9
> +++ infrastructure/mk/imake.port.mk   7 Aug 2018 09:45:29 -0000
> @@ -11,6 +11,10 @@ INSTALL_TARGET +=  install.man
>  XMKMF ?=             xmkmf -a
>  XMKMF +=             -DPorts
>  
> +.if ${USE_GROFF:L} == "yes"
> +XMKMF +=             -DUseGroff
> +.endif
> +
>  .if !exists(${X11BASE})
>  IGNORE =     "uses imake, but ${X11BASE} not found"
>  .endif

Reply via email to