Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Aug 2004 10:11:11 -0300
From:      Fernan Aguero <fernan@iib.unsam.edu.ar>
To:        Sven Esbjerg <esbjerg@xbsd.net>
Cc:        ports@freebsd.org
Subject:   Re: changing a Makefile based on user input
Message-ID:  <20040805131111.GB72520@iib.unsam.edu.ar>
In-Reply-To: <20040805124822.GE82359@esbjerg.name>
References:  <20040805124822.GE82359@esbjerg.name>

next in thread | previous in thread | raw e-mail | index | archive | help
+----[ Sven Esbjerg <esbjerg@xbsd.net> (05.Aug.2004 09:50):
|
| I'm trying to port RTFM (http://bestpractical.com/rtfm/) since we use it at
| work.
| 
| 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. 
| 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.

Hej! 

Have you started writing a skeleton port Makefile?

| 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 variables WITH_POSTGRESQL_USER and WITH_RT (or whatever
you would like to call them) in your port's Makefile. Once
your port is done, the user would have to call make like so:

make WITH_POSTGRESQL_USER=pgsql WITH_RT=/usr/local/rt3

That should do it.

| I guess my question is: can I run some kind of script just after extracting
| but before installing? 

Of course. Just define a post-extract target in your port's
Makefile and write your actions there:

post-extract:
	${ECHO} "This will be called after extracting the distfile"

| Is it advisable to create a sed script that does the actual mangling of the
| Makefile or?
| 
| Sven Esbjerg
|
+----]

Yes, and you can do that from your port's Makefile by
calling ${SED} or ${REINPLACE_CMD}.

If in doubt, check the Porter's Handbook: 
http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook

also, you can take a look at the magic between the scenes by
reading bsd.port.mk (should be in /usr/ports/Mk). It is well
documented and serves as an ideal reference.

And finally, do take a look at other port's Makefiles to see
how they use this things.

Happy porting!

Fernan

-- 
Fernan Aguero -  fernan at iib.unsam.edu.ar
Phone: +54 11 4580-7255/7 ext 310, Fax: +54 11 4752-9639
Check http://genoma.unsam.edu.ar/~fernan for more info.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040805131111.GB72520>