Subject: Re: calling package INSTALL and REQ (REQUIRE!) scripts from bsd.pkg.mk
To: NetBSD Packages Technical Discussion List <tech-pkg@NetBSD.ORG>
From: Greg A. Woods <woods@most.weird.com>
List: tech-pkg
Date: 03/15/2000 15:10:17
[ On Wednesday, March 15, 2000 at 16:13:56 (+0100), Hubert Feyrer wrote: ]
> Subject: Re: CVS commit: pkgsrc
>
> On Tue, 14 Mar 2000, Rene Hexel wrote:
> > Modified Files:
> > 	pkgsrc/misc/staroffice: Makefile
> > 	pkgsrc/misc/staroffice/files: soffice
> > 
> > Log Message:
> > Add check whether /proc is mounted.  Closes pr 9560 by Tim Walls, thx!
> 
> this should be done via pkg/INSTALL (pre-install), so it gets checked for
> binary packages as well. (I dunno, though, if that file is run from
> bsd.pkg.mk - please check)

No, pkg/INSTALL is not run from bsd.pkg.mk.  But it should be.

I've been meaning to write up a more detailed patch and accompanying
proposal and send-pr it on this issue.

I've been modifying a *lot* of pkgsrc modules to do this via their own
Makefile and I had recently reached the conclusion that I was
duplicating a lot of work that should be handled automatically by the
framework.

Namely I've been moving things out of the Makefile, usually from the
'install' target, and putting them into the INSTALL and REQ (REQUIRE!)
scripts and then arranging for the makefile to call these scripts just
as 'pkg_add' does so that binary packages work properly (i.e. work the
same way on install as direct pkgsrc installs do).  (Obviously the
'{pre-,post-}install' targets should never do anything but copy files
into place -- any other actions that have to be done at install time
must be done in INSTALL or REQ (REQUIRE!) scripts.)

In the end I usually have something like the following, perhaps with the
odd extra file install or directory creation, etc.:

pre-install:
        @${SETENV} ${MAKE_ENV} ${SH} ${REQUIRE_FILE} ${PKGNAME} INSTALL
        @${SETENV} ${MAKE_ENV} ${SH} ${INSTALL_FILE} ${PKGNAME} PRE-INSTALL

post-install:
        @${SETENV} ${MAKE_ENV} ${SH} ${INSTALL_FILE} ${PKGNAME} POST-INSTALL

Yes, I do think these actions should always be done automatically by the
framework but I've not yet actually tried making this change so I've no
patch yet to show that it can work.

-- 
							Greg A. Woods

+1 416 218-0098      VE3TCP      <gwoods@acm.org>      <robohack!woods>
Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>