(no subject)

Scot Hetzel swhetzel at gmail.com
Tue Dec 29 07:28:54 UTC 2009


On Mon, Dec 28, 2009 at 3:22 AM, Yevgen Krapiva <ykrapiva at 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


More information about the freebsd-ports mailing list