From owner-freebsd-ports@FreeBSD.ORG Tue Feb 22 20:46:45 2005 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D69E316A4CE for ; Tue, 22 Feb 2005 20:46:45 +0000 (GMT) Received: from relay.pair.com (relay00.pair.com [209.68.1.20]) by mx1.FreeBSD.org (Postfix) with SMTP id D1C9C43D45 for ; Tue, 22 Feb 2005 20:46:42 +0000 (GMT) (envelope-from alejandro@varnet.biz) Received: (qmail 60875 invoked from network); 22 Feb 2005 20:46:41 -0000 Received: from unknown (HELO ale.varnet.bsd) (unknown) by unknown with SMTP; 22 Feb 2005 20:46:41 -0000 X-pair-Authenticated: 200.115.214.206 Date: Tue, 22 Feb 2005 17:47:15 -0300 From: Alejandro Pulver To: Peter Pentchev Message-ID: <20050222174715.7f11612c@ale.varnet.bsd> In-Reply-To: <20050222152607.GI805@straylight.m.ringlet.net> References: <20050219150641.43dd175f@ale.varnet.bsd> <20050222152607.GI805@straylight.m.ringlet.net> X-Mailer: Sylpheed-Claws 0.9.12b (GTK+ 1.2.10; i386-portbld-freebsd5.3) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit cc: freebsd-ports@freebsd.org Subject: Re: Building port with options X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Feb 2005 20:46:46 -0000 On Tue, 22 Feb 2005 17:26:07 +0200 Peter Pentchev wrote: > On Sat, Feb 19, 2005 at 03:06:41PM -0300, Alejandro Pulver wrote: > > Hello, > > > > I am making a port of an application that allows to build with the > > following options: > > > > WITH_GTK GTK+ interface (default). > > WITH_SDL Command-line interface (with WITH_SDL_AUDIO). > > WITH_SDL_AUDIO Use SDL audio instead of OSS (only available with GTK+). > > > > The port always uses SDL, but it offers a graphical UI (GTK+). If the > > command-line program is built, it will automatically use SDL audio. If > > compiled with the GTK+ GUI, it allows the use of SDL audio or OSS. > > This is done by passing different options to 'configure'. > > > > I can build it with all (3) the combinations (make -DWITH_*), but when > > the build terminates, I change the option "-D" to compile a different > > version, but it does nothing. So I have to 'make clean' or 'rm -rf > > work' before compiling with a different option. > > > > I also tried 'WANT_GNOME' before including 'bsd.ports.pre.mk' and > > 'USE_GNOME' instead of 'WITH_GNOME'. > > > > What am I doing wrong? > > Nothing; that's the way things are supposed to work :) > > That's the way that the 'fetch', 'extract', 'patch', 'configure', 'all', > and 'install' targets behave - after their work is done, they touch a > file in the work/ directory, and they actually depend on this file. You > can see these files with a 'ls -A work/' - there should be files with > names like ".extract_done.generator-cbiere-1.0._usr_local". If such a > file exists, 'make extract' will do nothing, since make(1) will know > that the 'extract' target has already been fulfilled. > > Consider this, now: if you have already configured and built the port > with, say, the WITH_GTK option defined, then the configure script has > generated a Makefile, object files have been created from all the source > files, and the final executable file has been linked from the object > files. What is the Ports framework supposed to do if you do a 'make' > now *without* WITH_GTK? An attempt to just do 'make all' in the port's > directory would not do anything, since the executable is newer than the > object files, and each object file is newer than the respective source > file, so there's nothing to be done. To accomplish something different, > the configure script should be run anew to recreate the Makefile so it > does not try to link the GTK library, and a 'make clean' or some > equivalent should be run in the port's WRKSRC directory to get rid of > the object files and the executable. Okay, but how is the ports > framework supposed to know whether it should run a 'make clean', then > reconfigure the thing, and how does it know when to stop on the way > back? In some cases, the fact that some option is or is not defined > influences things in post-patch, sometimes pre-patch, sometimes even > patch files are added or removed depending on whether some option is > selected. > > In short, the only way for the Ports framework to be *sure* that it has > a clean environment to build the port with the new options is to, well, > provide a really clean environment - remove the WRKSRC directory > whatsoever, and redo the full extract/patch/configure/build cycle from > scratch. That's basically what 'make clean' does, and that's what 'rm > -rf work' effectively does, as you have discovered :) > > G'luck, > Peter > > -- > Peter Pentchev roam@ringlet.net roam@cnsys.bg roam@FreeBSD.org > PGP key: http://people.FreeBSD.org/~roam/roam.key.asc > Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 > .siht ekil ti gnidaer eb d'uoy ,werbeH ni erew ecnetnes siht fI > Thanks for your reply. I was confused with the port of Vim, that uses different variables to pass the options (but I think it depends on the Vim build environment). So the port is just fine? I mean: Do I have to implement extra steps to make 'make' notice the changes? Can you please mention some ports that use build options? Thanks and Best Regards, Ale