Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Jan 2004 17:41:05 +0000
From:      Jez Hancock <jez.hancock@munk.nu>
To:        Jason Williams <jwilliams@courtesymortgage.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Question on port usage
Message-ID:  <20040107174105.GA16085@users.munk.nu>
In-Reply-To: <5.2.1.1.0.20040107090523.00aa3b38@pop.courtesymortgage.com>
References:  <5.2.1.1.0.20040107090523.00aa3b38@pop.courtesymortgage.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jan 07, 2004 at 09:13:24AM -0800, Jason Williams wrote:
> I was reading through 'Absolute BSD' last night and was reading up on the 
> section on port's. I was unaware that with ports, you can actually edit the 
> makefile to add certain options at installation time. Sorta like 
> ./configure when you install programs from source correct?
Pretty much - the port maintainer has to decide which of the configure
options he wants to allow the port user/admin to turn on/off and then
add code to the Makefile for the port to handle the case that certain
make environment variables are set.  See below...

> I have been working with cyrus-imapd as im going to roll out a mail server 
> here pretty soon.
> Looking at the make file, I see this:
> 
> .if defined(WITH_BDB_VER)
> USE_BDB_VER=    ${WITH_BDB_VER}
> .else
> USE_BDB_VER=    3
> .endif
> .if ${USE_BDB_VER} == 41
> LIB_DEPENDS+=   db41.1:${PORTSDIR}/databases/db41
> .elif ${USE_BDB_VER} == 4
> LIB_DEPENDS+=   db4.0:${PORTSDIR}/databases/db4
> .elif ${USE_BDB_VER} == 3
> LIB_DEPENDS+=   db3.3:${PORTSDIR}/databases/db3
> .else
> BROKEN=         "WITH_BDB_VER must be 3, 4 or 41"
> .endif
> CONFIGURE_ARGS+=--with-bdb-incdir=${LOCALBASE}/include/db${USE_BDB_VER} \
>                 --with-bdb=db${USE_BDB_VER}
> 
> .if defined(WITH_SKIPLIST)
> WITH_SKIPLIST_MBOX=     YES
> WITH_SKIPLIST_SEEN=     YES
> .endif
> .if defined(WITH_SKIPLIST_MBOX)
> CONFIGURE_ARGS+=--with-mboxlist-db=skiplist
> .endif
> .if defined(WITH_SKIPLIST_SEEN)
> CONFIGURE_ARGS+=--with-seen-db=skiplist
> .endif
> 
> .if defined(WITH_MURDER)
> 
> 
> With what is listed above, you can actually specify what and how you want 
> the software built?
> 
> For instance:
> make WITH_BDB_VER=41 WITH_SKIPLIST=YES WITH_MURDER install clean
> Would setup cyrus-imapd with Berkeley db41, with_skiplist and with murder 
> correct? Or not?
Almost - you would do:

make -DWITH_BDB_VER=41 -DWITH_SKIPLIST=YES -DWITH_MURDER install clean

> Lastly, since there are quite a few options that you can use to compile 
> with most programs, is it possible to specify them somehow at the command 
> line when installing through the ports tree?
Generally you can only set options as in the above example - that's to
say the port maintainer decides which options are going to be
overridable by the end user (ie the user that's installing the port).

In most cases this is sufficient though, most of the ports contain
enough options most users will ever need - you would probably only ever
need additional options at the point you need to tweak an application to
perform better - at which point you're probably ready to modify the
FreeBSD Makefiles yourself anyway! :P

If you search through your Makefile for 'if defined', you usually get an
idea of the options that you're allowed to set - as you can see in the
Makefile snippet you pasted above the options you can set include
WITH_SKIPLIST, WITH_SKIPLIST_MBOX, WITH_SKIPLIST_SEEN and so on.

Sometimes some ports can be a real pain to remember how you last
configured them - which is where it can be useful to use the portupgrade
tool (in /usr/ports/sysutils/portupgrade).  With portupgrade you can
upgrade ports easily when new versions are released and by setting
options in /usr/local/etc/pkgtools.conf you can let portupgrade know
what make options you want used with your ports when you upgrade.

There's an article/guide I wrote about portupgrade here:

http://jez.hancock-family.com/archives/15_Portupgrade_and_usrlocaletcpkgtoolsconf.html

For more info check out the man pages for ports, which contains lots of
useful info on what 'targets' the make command takes (ie the 'clean' and
'install' in 'make clean install' are both 'targets' to the make
command).  Of course there's also the freebsd handbook section about the
ports tree.  Also useful reading is the 'bleeding edge' section of the
handbook regarding cvsup, again detailed in the handbook.

Also the freebsd-questions list is full of questions about ports and
setting options for make.  A searchable archive is here:

http://freebsd.rambler.ru/

There's loads of info there about FreeBSD ports :P

-- 
Jez Hancock
 - System Administrator / PHP Developer

http://munk.nu/
http://jez.hancock-family.com/  - personal weblog
http://ipfwstats.sf.net/        - ipfw peruser traffic logging



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