Subject: bsd.pkg.mk proposal 4: uniform sed substitution
To: None <tech-pkg@netbsd.org>
From: Todd Vierling <tv@pobox.com>
List: tech-pkg
Date: 05/21/1999 12:59:26
Comments, please.

=====

$Revision: 1.1 $

This proposal streamlines the way that generated package files (PLIST,
DESCR, MESSAGE, README.html) are created with "sed".  Often there are needed
variable substitutions that are dependent on the operating system and/or
build environment, and these are not consistent between these files.

- DESCR:  Removed; this should not be overridden (use DESCR_SRC).

- PLIST_SRC, DESCR_SRC, MESSAGE_SRC:  Points to files used for creation of
  the given file in ${PKGDIR}, which may be changed.  All three use a
  _uniform_ sed substitution.  The README.html will be created based on
  the DESCR_SRC, which will also use this substitution.

- README.html will still contain additional expansions as above, but the
  %%variable%% format will be transformed into ${variable}.

- A variable SED_EXPAND_VARS lists all variables which must be expanded when
  generating PLIST, DESCR, or MESSAGE.  The expansion string is of the
  form ${VARNAME}, but each variable is listed plain in SED_EXPAND_VARS.
  This list always includes:

  SED_EXPAND_VARS += PREFIX LOCALBASE X11BASE MACHINE_ARCH MACHINE_GNU_ARCH \
    MACHINE_GNU_TARGET LOWER_OPSYS OS_VERSION

  (This list may be expanded by the final draft.)

- The new variable MACHINE_GNU_TARGET defaults to
    ${LOWER_ARCH}-${LOWER_VENDOR}-${LOWER_OPSYS}
  and is passed to GNU_CONFIGURE pkgs as "--host=${MACHINE_GNU_TARGET}".

- SED_EXPAND_VARS is expanded into another variable, SED_EXPAND_EXPR, which
  may include additional sed expressions set by the pkg Makefile.  The
  transform from SED_EXPAND_VARS is implemented by:

.for _var_ in ${SED_EXPAND_VARS}
SED_EXPAND_EXPR += -e 's,\$${${_var_}},${${_var_}},g'
.endfor

- The last sed expression will always be "-e 's,\$$\$${,$${,'" to allow
  escaping of a ${ in one of PLIST_SRC, DESCR_SRC, or MESSAGE_SRC.

=====

-- 
-- Todd Vierling (Personal tv@pobox.com; Bus. todd_vierling@xn.xerox.com)