changing a Makefile based on user input

Matthew Seaman m.seaman at
Thu Aug 5 08:50:20 PDT 2004

On Thu, Aug 05, 2004 at 04:30:14PM +0200, Sven Esbjerg wrote:
> 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.

Yeah -- that could work too.  I don't think there would be any problem
with having two ports of the same name except for case differences,
but ICBW.
> > 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.

Well, that very much depends on the details of what the vendor code
actually does.  If you're lucky, you just copy it into place and it
will pick up the settings from the www/rt3 port at runtime.  If you're
unlucky you'll have to duplicate large chunks of the option management
stuff from the rt port.  But as the porter this is something you'll
have to think about, even if it's only to say "Hah! I don't need to do

What you won't have to do is restate all of the /dependencies/ -- as
far as I can see, your port just needs to depend on www/rt3 which
should pull in all the necessary perl modules etc.
> > > 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???

What build process is that?  You said there was nothing much to do
except unpack the distfiles and copy the files into place.  Remember
too that everything needs to work when installing a package as it does
when installing a port.
> > 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.

A good trick is to edit the Makefile in ${WRKSRC} so that it uses make
variables set in the port Makefile and automatically passed into the
Make environment.  Eg. you can patch the ${WRKSRC} Makefile to use
${PREFIX} itself, rather than trying to substitute in the value of
${PREFIX} at build time.



Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP:         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url :

More information about the freebsd-ports mailing list