Subject: Proposal & new pkglint update
To: None <tech-pkg@netbsd.org>
From: Todd Vierling <tv@pobox.com>
List: tech-pkg
Date: 05/27/1999 21:52:48
A few people have asked me about status on the implementation of the
proposals and the replacement for pkglint I proposed privately.  I must have
been REALLY bloody bored over the past couple days, because I did a lot of
hacking in that much time.  :-P

A preview of what I've done thus far is available on ftp.duh.org in
/pub/NetBSD-hacks/pkgsrc-19990527 - you'll find a newpkglint.gz and a
bsd.pkg.mk.gz.

Newpkglint is intended as a complete replacement for pkglint, written
specifically for NetBSD's pkgsrc, which is slowly but surely diverging from
FreeBSD's ports system.  It's also meant to be easier-to-read
code--apologies to the portlint authors, of course, but portlint is *very*
hard to hack.

This newpkglint is currently written against the pkgsrc format as it stands
today, not including my proposed changes.  It's pretty good at catching the
most common pkglint errors, including many the current pkglint doesn't
catch, but is missing some robustness yet.  It even has two additional
style-based warnings that can be turned on by changing the $warn_style
setting to 1 (...this to become a command line option).

As to bsd.pkg.mk, I became a little too frustrated trying to patch the
proposals into the bsd.pkg.mk as-is, so I have been rewriting the entire
file as I go.  The version you will find on that site is a partial
implementation of many of the proposal points, including the flexible
extract handling (though not yet the flexible master site handling or all of
the file control points).  It is quite cleaned up visually from the current
bsd.pkg.mk, so don't expect a "diff" to tell you much!  Instead, the
commentary I've written on it thus far is attached at bottom.

Do note that if you attempt to use this bsd.pkg.mk on a package which uses a
non-.tar.gz and non-.tar.bz2 distfile, you'll be in for a big surprise; the
flexible extract handling will attempt to kick in (and not work, on the old
package Makefiles).  Same for packages that use LICENSE or NO_WRKSUBDIR.

If you have any comments on either of these files, they would be most
appreciated.

=====

- Reorganize more variables and group them.  Reduce the .if conditionals
  where possible for easier readability.  (Still more to do, but this
  much cleanup makes a big difference.)

- Make the recursive calls to package targets uniform, by using new
  variables ${MAKE_RECURSE} and ${MAKE_RECURSE_NOFLAGS} (the latter is used
  when calling a "print to stdout" target; it omits ${.MAKEFLAGS}).  In
  addition, strike "cd ${.CURDIR}" (we don't use bmake objdirs!) and
  ${MAKE_ENV} (that should ONLY be passed to third party makefiles) as needed.
  "No more -O3 -O3 -pipe -pipe -O3 -O3 -pipe -pipe!"

- Pass ${BSD_PKG_MK_ENV} to recursive makes called with ${MAKE_RECURSE}.
  This contains variables not specific to the pkg, but which can speed up
  recursion if predefined (currently contains OPSYS and OS_VERSION).

- Introduce ALL_ENV, which is explicitly added to all of MAKE_ENV,
  CONFIGURE_ENV, and SCRIPTS_ENV.

- Add MAKECONF=/dev/null NOPROFILE=1 MANINSTALL=maninstall to MAKE_ENV
  to prevent BSD makefile irregularities in the PLIST.  This ensures a
  uniform build environment for such applications, with the pertinent
  information passed via MAKE_ENV.

- Introduce ALL_ENV_VARS, MAKE_ENV_VARS, CONFIGURE_ENV_VARS, and
  SCRIPTS_ENV_VARS, lists of Make variables that should be duplicated in
  the appropriate environment.  This is a shorthand that allows:
      CONFIGURE_ENV_VARS+=  FOO
  to be the same as:
      CONFIGURE_ENV+=       FOO=${FOO:Q}

- Pass more compilation pertinent variables to ALL_ENV_VARS by default:
      PATH CC CXX CFLAGS CXXFLAGS CPPFLAGS LDFLAGS

- Use ${VARNAME:Q} instead of "${VARNAME}" in some places where a
  shell-quoted string is desired, including *_ENV.

- Introduce Make variable ${PERL} which is explicitly set to
  ${LOCALBASE}/bin/perl, for easier substitution (and possible
  conditionalization in the future).

- Introduce PERL_CONFIGURE, which when defined, does the following in the
  default do-configure (with appropriate substitutions):
      cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} ${PERL} Makefile.PL

- Introduce USE_LICENSE and DIST_LICENSE and their enablers PKG_USE_LICENSES
  and PKG_DIST_LICENSES.  The DIST_LICENSE implementation uses
  IGNORE_PACKAGE, which isn't implemented yet....

- More to come!

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