changing a Makefile based on user input
m.seaman at infracaninophile.co.uk
Thu Aug 5 06:39:29 PDT 2004
On Thu, Aug 05, 2004 at 02:48:22PM +0200, Sven Esbjerg wrote:
> I'm trying to port RTFM (http://bestpractical.com/rtfm/) since we use it at
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'.
> It's my first port and I'm unsure of how the following should be done.
> Intalling RTFM is simple. Untar the tarball. Edit the Makefile
> and run make install.
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
> 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.
> I would like to provide the user with defaults (pgsql user and /usr/local/rt3
> as installation directory) but I would also like the user to be able to
> specify these options.
Use the make(1) conditional assignment operator:
which sets RT_PATH to that, unless an override is given, eg from the command line:
> 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.
> Is it advisable to create a sed script that does the actual mangling of the
> Makefile or?
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 suggest that you take a good long read of the Porter's Handbook
before you go any further:
and don't be afraid to just look for similar ports in the tree and
unashamedly copy what other porters have done.
Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks
PGP: http://www.infracaninophile.co.uk/pgpkey Marlow
Tel: +44 1628 476614 Bucks., SL7 1TH UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20040805/7d118942/attachment.bin
More information about the freebsd-ports