Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

changing a Makefile based on user input

1 view
Skip to first unread message

esb...@xbsd.net

unread,
Aug 5, 2004, 8:51:35 AM8/5/04
to
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.

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.

I guess my question is: can I run some kind of script just after extracting
but before installing?
Is it advisable to create a sed script that does the actual mangling of the
Makefile or?


Sven Esbjerg
--
http://www.usenet.dk/netikette - på forhånd tak.
_______________________________________________
freebs...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-port...@freebsd.org"

fer...@iib.unsam.edu.ar

unread,
Aug 5, 2004, 9:16:37 AM8/5/04
to
+----[ Sven Esbjerg <esb...@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.

fer...@iib.unsam.edu.ar

unread,
Aug 5, 2004, 9:44:06 AM8/5/04
to
+----[ Sven Esbjerg <esb...@xbsd.net> (05.Aug.2004 10:20):

|
| > Yes, and you can do that from your port's Makefile by
| > calling ${SED} or ${REINPLACE_CMD}.
|
| I have noticed that i several ports but I haven't seen it mentioned in the
| documentation.

I don't have the porter's handbook in my head ... perhaps
it's not there but it's certainly in bsd.port.mk. Look in
there and you'll see a list of variables that you can use to
call executables and their default args.

| > Happy porting!
|
| Thanks. And thank you for the quick reply.

Varsågod.

|
| Sven
|
+----]

Fernan

PS: I'm sending the message again to the list so you can get
it (the previous message I sent to your address bounced
(seems like it didn't like my address)

eike...@fillmore-labs.com

unread,
Aug 5, 2004, 11:45:22 AM8/5/04
to
Matthew Seaman wrote:

> Use the make(1) conditional assignment operator:
>
> RT_PATH?= ${PREFIX}/rt3

Sigh. *Your* port lives at PREFIX, other ports live at LOCALBASE. No
exceptions.

-Oliver

eike...@fillmore-labs.com

unread,
Aug 5, 2004, 12:43:09 PM8/5/04
to

Am Donnerstag den, 5. August 2004, um 16:30, schrieb Sven Esbjerg:

> 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.

<http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-
handbook/makefile-naming.html#PORTING-PKGNAME>:

"The first letter of <name> part should be lowercase."

lin...@lonesome.com

unread,
Aug 5, 2004, 1:56:50 PM8/5/04
to
On Thu, 5 Aug 2004, Matthew Seaman wrote:

> I don't think there would be any problem with having two ports of the
> same name except for case differences, but ICBW.

Please don't do this. In addition to the user confusion, portsmon
will be unable to properly assign PRs about the capitalized version
of the port. (Internally, everything is mapped to lowercase to
compensate for PR submitters' typos.)

In addition, I thought that policy was to prefer all lowercase for
port names; never mind the fact that commits with uppercase do sneak
through, and that many existing ports use uppercase.

mcl

0 new messages