From owner-freebsd-ports@FreeBSD.ORG Thu Aug 5 13:16:18 2004 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 2DAB616A4CE for ; Thu, 5 Aug 2004 13:16:18 +0000 (GMT) Received: from smtp.unsam.edu.ar (smtp.unsam.edu.ar [170.210.48.3]) by mx1.FreeBSD.org (Postfix) with ESMTP id 332EB43D6B for ; Thu, 5 Aug 2004 13:16:13 +0000 (GMT) (envelope-from fernan@iib.unsam.edu.ar) Received: from pi.iib.unsam.edu.ar (pi.iib.unsam.edu.ar [192.168.10.11]) by smtp.unsam.edu.ar (8.12.6/8.12.6) with ESMTP id i75DRDm8046566; Thu, 5 Aug 2004 10:27:14 -0300 (ART) (envelope-from fernan@iib.unsam.edu.ar) Received: from pi.iib.unsam.edu.ar (localhost.iib.unsam.edu.ar [127.0.0.1]) by pi.iib.unsam.edu.ar (8.12.11/8.12.9) with ESMTP id i75DBCmM072651; Thu, 5 Aug 2004 10:11:13 -0300 (ART) (envelope-from fernan@iib.unsam.edu.ar) Received: (from fernan@localhost) by pi.iib.unsam.edu.ar (8.12.11/8.12.11/Submit) id i75DBBtZ072650; Thu, 5 Aug 2004 10:11:11 -0300 (ART) (envelope-from fernan@iib.unsam.edu.ar) X-Authentication-Warning: pi.iib.unsam.edu.ar: fernan set sender to fernan@iib.unsam.edu.ar using -f Date: Thu, 5 Aug 2004 10:11:11 -0300 From: Fernan Aguero To: Sven Esbjerg Message-ID: <20040805131111.GB72520@iib.unsam.edu.ar> Mail-Followup-To: Sven Esbjerg , ports@freebsd.org References: <20040805124822.GE82359@esbjerg.name> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040805124822.GE82359@esbjerg.name> User-Agent: Mutt/1.4.1i cc: ports@freebsd.org Subject: Re: changing a Makefile based on user input 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: Thu, 05 Aug 2004 13:16:18 -0000 +----[ Sven Esbjerg (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.