Date: Thu, 5 Aug 2004 14:39:21 +0100 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: Sven Esbjerg <esbjerg@xbsd.net> Cc: ports@freebsd.org Subject: Re: changing a Makefile based on user input Message-ID: <20040805133921.GA70345@happy-idiot-talk.infracaninophile.co.uk> In-Reply-To: <20040805124822.GE82359@esbjerg.name> References: <20040805124822.GE82359@esbjerg.name>
next in thread | previous in thread | raw e-mail | index | archive | help
--bg08WKrSYDhXBjb5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 > work. 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'. =20 > 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.=20 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. > 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. =20 > 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.=20 Use the make(1) conditional assignment operator: RT_PATH?=3D ${PREFIX}/rt3 which sets RT_PATH to that, unless an override is given, eg from the comman= d line: make RT_PATH=3D/opt/rt3 =20 > I guess my question is: can I run some kind of script just after extracti= ng > but before installing?=20 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 t= he > 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: http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/index= =2Ehtml and don't be afraid to just look for similar ports in the tree and unashamedly copy what other porters have done. Cheers, Matthew=09 --=20 Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way PGP: http://www.infracaninophile.co.uk/pgpkey Marlow Tel: +44 1628 476614 Bucks., SL7 1TH UK --bg08WKrSYDhXBjb5 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (FreeBSD) iD8DBQFBEjiJiD657aJF7eIRAlRdAJ0ZPNioUxpN3OAWauueDWkUEUjARwCeKre2 HQ/gGYpVusWicOJDlw/L7to= =fUGC -----END PGP SIGNATURE----- --bg08WKrSYDhXBjb5--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040805133921.GA70345>