From owner-freebsd-ports@FreeBSD.ORG Tue Feb 22 15:26:10 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 6D08A16A4CE for ; Tue, 22 Feb 2005 15:26:10 +0000 (GMT) Received: from gandalf.online.bg (gandalf.online.bg [217.75.128.9]) by mx1.FreeBSD.org (Postfix) with SMTP id E7F5B43D4C for ; Tue, 22 Feb 2005 15:26:08 +0000 (GMT) (envelope-from roam@ringlet.net) Received: (qmail 28546 invoked from network); 22 Feb 2005 15:26:05 -0000 Received: from unknown (HELO straylight.ringlet.net) (213.16.36.109) by gandalf.online.bg with SMTP; 22 Feb 2005 15:26:05 -0000 Received: (qmail 19048 invoked by uid 1000); 22 Feb 2005 15:26:07 -0000 Date: Tue, 22 Feb 2005 17:26:07 +0200 From: Peter Pentchev To: Alejandro Pulver Message-ID: <20050222152607.GI805@straylight.m.ringlet.net> Mail-Followup-To: Alejandro Pulver , freebsd-ports@freebsd.org References: <20050219150641.43dd175f@ale.varnet.bsd> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="MPkR1dXiUZqK+927" Content-Disposition: inline In-Reply-To: <20050219150641.43dd175f@ale.varnet.bsd> User-Agent: Mutt/1.5.8i 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 15:26:10 -0000 --MPkR1dXiUZqK+927 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Feb 19, 2005 at 03:06:41PM -0300, Alejandro Pulver wrote: > Hello, >=20 > I am making a port of an application that allows to build with the > following options: >=20 > 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+). >=20 > 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'. >=20 > 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. >=20 > I also tried 'WANT_GNOME' before including 'bsd.ports.pre.mk' and > 'USE_GNOME' instead of 'WITH_GNOME'. >=20 > 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 --=20 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 =2Esiht ekil ti gnidaer eb d'uoy ,werbeH ni erew ecnetnes siht fI --MPkR1dXiUZqK+927 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (FreeBSD) iD8DBQFCG08P7Ri2jRYZRVMRAvScAKC58f1KHCxgCxqALowu9sgUJDIISgCfXAFR xnDKW44WtDGTnzJ3UPKo7u8= =Iwf8 -----END PGP SIGNATURE----- --MPkR1dXiUZqK+927--