Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Dec 2009 10:40:02 +0300
From:      Yuri Pankov <yuri.pankov@gmail.com>
To:        Scot Hetzel <swhetzel@gmail.com>
Cc:        Yevgen Krapiva <ykrapiva@gmail.com>, freebsd-ports@freebsd.org
Subject:   Re: (no subject)
Message-ID:  <20091229074002.GA3117@darklight.org.ru>
In-Reply-To: <790a9fff0912282328o35ba5abfg580c01ec851e6c95@mail.gmail.com>
References:  <790a9fff0912282328o35ba5abfg580c01ec851e6c95@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Dec 29, 2009 at 01:28:46AM -0600, Scot Hetzel wrote:
> On Mon, Dec 28, 2009 at 3:22 AM, Yevgen Krapiva <ykrapiva@gmail.com> wrote:
> > Hi guys,
> >
> > I'm trying to create my own port. I'm stucked with the following
> > Makefile:
> >
> > PORTNAME=      openjsip
> > PORTVERSION=   0.0.4
> > ...
> > ...
> > MY_FILE=       proxy.properties
> >
> > do-check:
> >
> > #FIRST TEST
> > . if !exists(/usr/local/share/openjsip/conf/proxy.properties)
> > @${ECHO_MSG} ">> /usr/local/share/openjsip/conf/proxy.properties doesn't
> > exist"
> > . else
> > @${ECHO_MSG} ">> /usr/local/share/openjsip/conf/proxy.properties exists"
> > . endif
> >
> > #SECOND TEST
> > @${ECHO_MSG} ">> DATADIR=${DATADIR}"
> >
> > .for f in ${MY_FILE}
> > . if !exists(${DATADIR}/conf/${f})
> > @${ECHO_MSG} ">> File ${DATADIR}/conf/${f} doesn't exist"
> > . else
> > @${ECHO_MSG} ">> File ${DATADIR}/conf/${f} exists"
> > . endif
> > .endfor
> >
> >
> > I'm trying to make script to check the existence of proxy.properties
> > file.
> > The first test works well while to other one (with the use of 'for')
> > doesn't.
> > Can you help me, I don't understand why the second test fails.
> >
> I figured out why the second test fails.  I first created this test:
> 
> do-check:
> .for f in motd hald
> .if !exists(${LOCALBASE}/etc/rc.d/${f})
>         @${ECHO_MSG} "File ${LOCALBASE}/etc/rc.d/${f} doesnt exist"
> .else
>         @${ECHO_MSG} "File ${LOCALBASE}/etc/rc.d/${f} exists"
> .endif
> .endfor
> 
> .include <bsd.port.mk>
> 
> When make do-check is executed, the test fails to correctly detect the
> files in LOCALBASE:
> 
> dv8t01# make do-check
> File /usr/local/etc/rc.d/motd exists
> File /usr/local/etc/rc.d/hald doesnt exist
> 
> This Makefile fails due to LOCALBASE is not defined at the time that
> the exists check is run.

How come that ${DATADIR} (and ${LOCALBASE}) are correctly expanded in
${ECHO_MSG} then?

> 
> But if the Makefile is modified to:
> 
> .include <bsd.port.pre.mk>
> 
> do-check:
> .for f in test1 hald
> .if !exists(${LOCALBASE}/etc/rc.d/${f})
>         @${ECHO_MSG} "File ${LOCALBASE}/etc/rc.d/${f} doesnt exist"
> .else
>         @${ECHO_MSG} "File ${LOCALBASE}/etc/rc.d/${f} exists"
> .endif
> .endfor
> 
> .include <bsd.port.post.mk>
> 
> It correctly detects the existence of the files in LOCALBASE:
> 
> dv8t01# make do-check
> File /usr/local/etc/rc.d/motd doesnt exist
> File /usr/local/etc/rc.d/hald exists
> 
> Scot


Yuri



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091229074002.GA3117>