From owner-freebsd-ports@FreeBSD.ORG Fri Feb 15 16:14:01 2008 Return-Path: Delivered-To: ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9325E16A419 for ; Fri, 15 Feb 2008 16:14:01 +0000 (UTC) (envelope-from swhetzel@gmail.com) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.152]) by mx1.freebsd.org (Postfix) with ESMTP id E7E2F13C442 for ; Fri, 15 Feb 2008 16:14:00 +0000 (UTC) (envelope-from swhetzel@gmail.com) Received: by fg-out-1718.google.com with SMTP id 16so557517fgg.35 for ; Fri, 15 Feb 2008 08:13:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=VaaJ8QfQhHmog9SXNeFZRBigrI2uzS/lWOjNbj1liDE=; b=Qf26uwYdBSoNx/Us49VKq5lypyQsPoDNX9ENF/eeDdvyvTNYISDe7FYT+U11r/ntuQBMd0xAwPaJbVXWhIHi0m92EZ/oIDHME+hCDFF562qCvVYp8k5apoOeZIr5o3p5PWtVFgm80P0Zentx0shRaJptZp5NRRMf9GKUQyMlh7o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=g0TwZ2L1jRGJOfPXOouD8nL5jsWotNdZHX1x8ybt2B/RQMutHfc3Hu3Vd3Se0bTyK69+p/gQuF8IMge2YcujWL3CuS2aolrm24K0ZWe0r36nV0ZNHV+INi/HsF6+2oXfHwhD6ACPwR6+Wkyc7+7d+iItUexDJiyVTyoITPzKBg0= Received: by 10.86.53.8 with SMTP id b8mr2637666fga.64.1203092039801; Fri, 15 Feb 2008 08:13:59 -0800 (PST) Received: by 10.86.99.17 with HTTP; Fri, 15 Feb 2008 08:13:59 -0800 (PST) Message-ID: <790a9fff0802150813s1be7cb20ge3a8be5b8c112d6b@mail.gmail.com> Date: Fri, 15 Feb 2008 10:13:59 -0600 From: "Scot Hetzel" To: "Gergely CZUCZY" , Joerg.Pulz@frm2.tum.de In-Reply-To: <20080215125235.GA58646@harmless.hu> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20080215125235.GA58646@harmless.hu> Cc: ports@freebsd.org Subject: Re: pkg-plist and WWWDIR 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: Fri, 15 Feb 2008 16:14:01 -0000 On Fri, Feb 15, 2008 at 6:52 AM, Gergely CZUCZY wrote: > Hello > > I've been updating sysutils/nut from 2.2.0 to .1, and I've > hit some issues there. > > First of all, bsd.port.mk sets WWWDIR for the actual port, > which is very nice of it. OTOH the CGI support is optional > in nut, which results in a conditional entry in pkg-plist. > the NUT_CGI plist variable is only set if the CGI support > is enabled, and WWWDIR is an absolute path. If the CGI > support is enabled, then NUT_CGI is set to an empty string. > And WWWDIR is added to the PKG_PLIST variables. > > The resulting lines in pkg-plist is the following: > %%NUT_CGI%%%%WWWDIR%%/file > > And when the pkg-plist is processed it preprends /usr/local, > since that's the PREFIX, so it will end up looking for ${PREFIX}/${WWWDIR}, > which will result in /usr/local/usr/local/www/nut/file . > > I've checked other ports, %%WWWDIR%% is used directly at other > places, so I think when an entry begins with a slash that will > transform to an absolute path, without prepending the PREFIX. > As i think the conditional %%NUT_CGI%% messes this auto-logic > up, and the double-prefix happens. > > For now I've fixed this with a workaround, by not setting > the WWWDIR plist variable to WWWDIR, but to "www/nut". > I don't consider this a solution, but just a workaround. > > My qestions are, how should these situations be handled? > Shouldn't bsd.port.mk export a version for WWWDIR suitable > for PLIST variables? > This situation is already handled in bsd.ports.mk: WWWDIR_REL?= ${WWWDIR:S,^${PREFIX}/,,} ETCDIR_REL?= ${ETCDIR:S,^${PREFIX}/,,} PLIST_SUB+= DOCSDIR="${DOCSDIR_REL}" \ EXAMPLESDIR="${EXAMPLESDIR_REL}" \ DATADIR="${DATADIR_REL}" \ WWWDIR="${WWWDIR_REL}" \ ETCDIR="${ETCDIR_REL}" WWWDIR_REL strips off the PREFIX from WWWDIR, and then adds it to PLIST_SUB. The problem is that sysutils/nut/Makefile has redefined WWWDIR in PLIST_SUB: .if !exists(${PREFIX}/www) && exists(${PREFIX}/share/apache) CGIDIR?= share/apache/cgi-bin WWWDIR?= share/apache/htdocs .else CGIDIR?= www/cgi-bin WWWDIR?= www/data .endif CONFIGURE_ARGS+= --with-cgi --with-cgipath=${PREFIX}/${CGIDIR}/nut \ --with-htmlpath=${PREFIX}/${WWWDIR}/nut \ --with-gd-includes=-I${PREFIX}/include \ --with-gd-libs="-L${PREFIX}/lib -lgd" PLIST_SUB+= NUT_CGI="" PLIST_SUB+= WWWDIR="${WWWDIR}" PLIST_SUB+= CGIDIR="${CGIDIR}" PLIST_SUB+= CGIETCDIR="etc/nut/" .else CONFIGURE_ARGS+= --without-cgi PLIST_SUB+= NUT_CGI="@comment " .endif If you do a "make -V PLIST_SUB" you'll see the double entry for WWWDIR. My guess is the WWWDIR defined in sysutils/nut/Makefile is before the WWWDIR defined in bsd.port.mk, and since substitutions occur in order, %%WWWDIR%% is being replaced with the wrong one. The port needs to remove PLIST_SUB+= WWWDIR=.... from its Makefile. Scot