Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Dec 2009 01:28:46 -0600
From:      Scot Hetzel <swhetzel@gmail.com>
To:        Yevgen Krapiva <ykrapiva@gmail.com>
Cc:        freebsd-ports@freebsd.org
Subject:   (no subject)
Message-ID:  <790a9fff0912282328o35ba5abfg580c01ec851e6c95@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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.

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



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