From owner-freebsd-questions@FreeBSD.ORG Wed Jan 7 09:41:11 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4688A16A4CE for ; Wed, 7 Jan 2004 09:41:11 -0800 (PST) Received: from munk.nu (mail.munk.nu [213.152.51.194]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5114443D3F for ; Wed, 7 Jan 2004 09:41:06 -0800 (PST) (envelope-from munk@munk.nu) Received: from munk by munk.nu with local (Exim 4.24; FreeBSD) id 1AeHg1-0004Mx-Cl; Wed, 07 Jan 2004 17:41:05 +0000 Date: Wed, 7 Jan 2004 17:41:05 +0000 From: Jez Hancock To: Jason Williams Message-ID: <20040107174105.GA16085@users.munk.nu> Mail-Followup-To: Jason Williams , freebsd-questions@freebsd.org References: <5.2.1.1.0.20040107090523.00aa3b38@pop.courtesymortgage.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5.2.1.1.0.20040107090523.00aa3b38@pop.courtesymortgage.com> User-Agent: Mutt/1.4.1i cc: freebsd-questions@freebsd.org Subject: Re: Question on port usage X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jan 2004 17:41:11 -0000 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