changing a Makefile based on user input

Sven Esbjerg esbjerg at
Thu Aug 5 07:32:20 PDT 2004

On Thu, Aug 05, 2004 at 02:39:21PM +0100, Matthew Seaman wrote:
> Note that there is already a misc/rtfm port, with is an unrelated
> piece of software.  You could perhaps call your port 'rt-faq-manager'.
Hmmm... I guess that would be possible. My first thought was RTFM.

> Easy enough.  I'd basically copy pretty much what the www/rt3 port
> does.  This isn't going to be the easiest port to write -- whicle the
> install step is fairly obvious, you're going to have to deal with all
> of the different combinations of perl versions, apache versions,
> whether it's running under mod_perl or using FastCGI, MySQL vs PgSQL
> etc.
It was my impression that I could leave these dependencies to RT since RTFM
needs RT in the first place. Am I wrong?
I know that RTFM needs to know which database to use but these things are
pulled from RT - hence the need to know where RT has been installed.

> > However the Makefile needs to be changed according to the postgresql
> > installation - it needs a username for tampering with the database and a
> > password if that is required. It also needs to know where rt lives.
> All that stuff can be copied right out of the www/rt3 port.  You will
> probably need to confer with the maintainer of www/rt3 if you're going
> to be installing files into the same directory structure as that port.
> At a minimum you'll need to tweak pkg-plist contents so that neither
> one complains about being unable to delete a directory if the other
> one is still using it.  A common idiom is to use:
>     @unexec rmdir %D/foo/bar 2>/dev/null || true
> to remove directory foo/bar if it's empty, but not complain otherwise.

Good point!

> > I guess my question is: can I run some kind of script just after extracting
> > but before installing? 
> Yes.  Generally a pkg-install script would be used for that purpose --
> that script would also be included into any package made from the port
> and pkg_Add would automatically run it when installing that way.
> Actually the pkg-install script gets called twice, once, just before
> any files are installed, with a command line argument of 'PRE-INSTALL'
> and again, just after files are installed, with an argument of
> 'POST-INSTALL'. There's a corresponding pkg-deinstall script too,
> which works similarly.
I thought pkg-install was after the build process???

> Probably just create a patch for the Makefile and put it in the files
> directory.  Call it 'patch-something-or-other' and it will be applied
> automatically after your distfiles have been downloaded, checksummed
> and extracted into WRKDIR.

I can't create a standard patch since I need to patch dynamicly. RTFM's
Makefile is not created by configure - it's static. I guess I could create a
patch-file dynamicly but it's just as easy to edit (sed) the Makefile.

The way RTFM works is to rely heavily on RT. It's very much suited for manual

-- - på forhånd tak.

More information about the freebsd-ports mailing list