From owner-freebsd-questions@FreeBSD.ORG Mon Jan 28 03:38:12 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F22716A41A for ; Mon, 28 Jan 2008 03:38:12 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from mx-out.forthnet.gr (mx-out.forthnet.gr [193.92.150.104]) by mx1.freebsd.org (Postfix) with ESMTP id B09E413C45A for ; Mon, 28 Jan 2008 03:38:11 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from mx-av-01.forthnet.gr (mx-av.forthnet.gr [193.92.150.27]) by mx-out-02.forthnet.gr (8.14.0/8.14.0) with ESMTP id m0S3c92t023725; Mon, 28 Jan 2008 05:38:09 +0200 Received: from MX-IN-04.forthnet.gr (mx-in-04.forthnet.gr [193.92.150.163]) by mx-av-01.forthnet.gr (8.14.1/8.14.1) with ESMTP id m0S3c9UA012133; Mon, 28 Jan 2008 05:38:09 +0200 Received: from kobe.laptop (ppp47-170.adsl.forthnet.gr [62.1.64.170]) by MX-IN-04.forthnet.gr (8.14.2/8.14.2) with ESMTP id m0S3c8qC027826; Mon, 28 Jan 2008 05:38:09 +0200 Authentication-Results: MX-IN-04.forthnet.gr smtp.mail=keramida@ceid.upatras.gr; spf=neutral Authentication-Results: MX-IN-04.forthnet.gr header.from=keramida@ceid.upatras.gr; sender-id=neutral Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.2/8.14.2) with ESMTP id m0S3c8Te005999; Mon, 28 Jan 2008 05:38:08 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.2/8.14.2/Submit) id m0S3c6tM005998; Mon, 28 Jan 2008 05:38:06 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Date: Mon, 28 Jan 2008 05:38:06 +0200 From: Giorgos Keramidas To: Ivan Rambius Ivanov Message-ID: <20080128033806.GA5932@kobe.laptop> References: <89ce7f740801271448x27371cf7lfe5255256fb498ec@mail.gmail.com> <20080128005944.GA3072@kobe.laptop> <89ce7f740801271919n107c20a8v2341687285728fb1@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <89ce7f740801271919n107c20a8v2341687285728fb1@mail.gmail.com> Cc: freebsd-questions@freebsd.org Subject: Re: Slightly OT: Invoking a shell command from a Makeile X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2008 03:38:12 -0000 On 2008-01-28 05:19, Ivan Rambius Ivanov wrote: > On Jan 28, 2008 2:59 AM, Giorgos Keramidas wrote: > > FPCVERSION!= make -f ${PORTSDIR}/lang/fpc/Makefile -V PORTVERSION > > Yes, I found this out after some searching in google. > > > I'm curious though. Why do you have to find the value of the > > {PORTVERSION} from a Ports makefile? > > > > Perhaps there is already a `standard' feature of the Ports which can do > > something similar. Have you asked around in freebsd-ports? > > The port I am developing builds and installs a software called nbc > [1], [2]. It is written in Pascal and uses the freepascal compiler [3] > coming from lang/fpc port and some other pascal libraries called units > coming from devel/fpc-fcl-base. These units are installed into > /usr/local/lib/fpc/, where portversion of_fpc is > the version of the freepascal compiler as defined in PORTVERSION > variable in fpc's Makefile. Currently it is 2.2.0. I do not want to > hardcode that number in nbc port's Makefile - I want to extract it on > the fly from fpc port's Makefile, this is why I am doing this trick. That's interesting, but the *installed* copy of devel/fpc-fcl-base may be older than the available version in `/usr/ports'. Many programs install an `xxx-config' script too, which can be queried at runtime, i.e.: $ net-snmp-config --version 5.3.1 This runs from ${LOCALBASE} and it is *always* the same as the installed version of the net-snmp port. Maybe a similar script can be added to the devel/fpc-fcl-base port, if one is not already part of it? In a similar vein, the editors/emacs* ports support installing extensions in multiple subdirs of ${LOCALBASE} by switching make variables depending on the value of ${EMACS_PORT_NAME}. It's probably more work to make devel/fpc-fcl-base tunable like this, but it is going to be safer than assuming that the /usr/ports/lang/fpc version is actually the same as the installed version. This assumption is only true until the next CVSup of the ports tree, or until portsnap fetches a newer version of lang/fpc. I'm *not* a ports hacker, so some of the above may be false and all of it should be taken with a grain of salt, but I'm sure our freebsd-ports guys can help :) It's definitely worth asking them for the best way to implement something like this. - Giorgos