Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 May 2010 03:39:30 -0400
From:      Sahil Tandon <sahil@FreeBSD.org>
To:        freebsd-questions@freebsd.org
Subject:   Re: portmaster not replacing %var% in final pkg-msg
Message-ID:  <20100531073930.GC243@magic.hamla.org>
In-Reply-To: <AANLkTikHg-bNFie6ver7MLm9GHfxpfZr0MGIzLsDlB34@mail.gmail.com>
References:  <AANLkTikHg-bNFie6ver7MLm9GHfxpfZr0MGIzLsDlB34@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 30 May 2010, Eitan Adler wrote:

> $cd lang/go && portmaster .
> ------------------------------------------------------------------
>  To build Go programs for FreeBSD, you'll want to set up your
>  environment properly. The following environment variables should
>  be set:
> ...
>  GOOS=freebsd
>  GOARCH=386
>  GOROOT=/usr/local/lib/go

This works because of the following sed-fu in lang/go/Makefile:

post-install:
        @${CAT} ${PKGMESSAGE} | ${SED}          \
                -e "s|%%PREFIX%%|${PREFIX}|g"   \
                -e "s|%%ARCH%%|${GOARCH}|g"     \
                -e "s|%%GOOBJ%%|${GOOBJ}|g"

> ===>>> pkg-message for go-20100413

[ .. ]

>  GOARCH=%%ARCH%%
>  GOROOT=%%PREFIX%%/lib/go

It's probably preferable for lang/go to utilize SUB_FILES and
SUB_LIST instead of using ${SED} to manually expand VAR=VALUE pairs in
post-install.  For context, see:

 http://www.freebsd.org/doc/en/books/porters-handbook/book.html#USING-SUB-FILES

-- 
Sahil Tandon <sahil@FreeBSD.org>



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