From owner-freebsd-ports@FreeBSD.ORG Tue Dec 29 07:28:54 2009 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8EB5C106568D for ; Tue, 29 Dec 2009 07:28:54 +0000 (UTC) (envelope-from swhetzel@gmail.com) Received: from mail-iw0-f198.google.com (mail-iw0-f198.google.com [209.85.223.198]) by mx1.freebsd.org (Postfix) with ESMTP id 5AE798FC08 for ; Tue, 29 Dec 2009 07:28:54 +0000 (UTC) Received: by iwn36 with SMTP id 36so7382454iwn.3 for ; Mon, 28 Dec 2009 23:28:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:cc:content-type; bh=cduXG76eVf08hhqAAsxr/wncsA3lOdCJ4RNRZi5XO5Y=; b=cBXtSz0ia8oquQ+pnxC2yepGgpGjeq5laak4ifYYPvNbZuREmB1yq+85DMVvvVDQOf hN0N62cdn36ugziGEwDQ0e/A28nD5iXMF8bje6wZ9wfHIntx8oj3wf9bgU2jiZiaGbD7 4RpUJm4exy2z3P+hdxsPDBq7xnEJoFT6HqJx4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type; b=bmVRm8qsAGRWjXvKKufDT3TZqwRMN2UePzzipNhsHmeGPawS5444UC/i1+wj+qspls 06cvCuoyJawY6RRWwABLxW/my/JrxT/lAc6r64B3ZPBgEnOSGTCXBci/ORa/BQjvi8Mu hiecM1WcGEUVj+UQ6CU4c8hSPgLC2SbvIaDEw= MIME-Version: 1.0 Received: by 10.231.125.19 with SMTP id w19mr1089446ibr.8.1262071726828; Mon, 28 Dec 2009 23:28:46 -0800 (PST) Date: Tue, 29 Dec 2009 01:28:46 -0600 Message-ID: <790a9fff0912282328o35ba5abfg580c01ec851e6c95@mail.gmail.com> From: Scot Hetzel To: Yevgen Krapiva Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-ports@freebsd.org Subject: (no subject) X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Dec 2009 07:28:54 -0000 On Mon, Dec 28, 2009 at 3:22 AM, Yevgen Krapiva 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 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 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 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