Hello Georgious,

On Jan 28, 2008 2:59 AM, Giorgos Keramidas <[EMAIL PROTECTED]> wrote:
> On 2008-01-28 00:48, Ivan Rambius Ivanov <[EMAIL PROTECTED]> wrote:
> > Hello,
> >
> > I am developing a FreeBSD port and I would like to invoke a shell
> > command from it and assign its output to a variable. The command in
> > question is
> >
> > # make -f /usr/ports/lang/fpc/Makefile -V PORTVERSION
> >
> > and I have verified that it works on the command line.
> >
> > I try to use it in my port's Makefile in the following way:
> >
> > FPCVERSION=             `make -f /usr/ports/lang/fpc/Makefile -V 
> > PORTVERSION`
> >
> > but it fails with the following error
> >
> > Syntax error: EOF in backquote substitution
>
> Try the BSD-specific syntax which uses bang-equal assignment to grab the
> output of a shell command and assign it to a make variable:
>
>         FPCVERSION!= shell cmd here
>
> i.e. something like:
>
>         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/<portversion_of_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.

Regards
Rambius

[1] http://bricxcc.sourceforge.net/nbc/
[2] http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/116274
[3] http://www.freepascal.org/

-- 
Tangra Mega Rock: http://www.radiotangra.com
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to