Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Mar 2017 17:05:05 +0100
From:      Michael Gmelin <freebsd@grem.de>
To:        Andrea Venturoli <ml@netfence.it>
Cc:        freebsd-ports@freebsd.org
Subject:   Re: Writing a port that simply installs a bunch of files
Message-ID:  <20170306170505.7e043310@bsd64.grem.de>
In-Reply-To: <20170306165104.51c4f071@bsd64.grem.de>
References:  <66d50818-f00e-9033-4c93-f159c38d04ba@netfence.it> <32660472-60AF-47C0-861C-023BAFC39C3D@grem.de> <5e3354dc-b597-7622-dbae-07d4119d1b7a@netfence.it> <20170306165104.51c4f071@bsd64.grem.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 6 Mar 2017 16:51:04 +0100
Michael Gmelin <freebsd@grem.de> wrote:

> On Mon, 6 Mar 2017 16:02:05 +0100
> Andrea Venturoli <ml@netfence.it> wrote:
> 
> > On 03/06/17 12:50, Michael Gmelin wrote:
> >   
> > > Yes, that's possible, see sysutils/bhyve-rc[0] for an example how
> > > to do it.    
> > 
> > Thanks for your answer: an example is really welcome.
> > 
> > However, I might be dumb, but that does not fully cover what I was 
> > looking for.
> > 
> > I see sysutils/bhyve-rc uses USE_RC_SUBR in order to install its
> > only file, but that's specific to rc.d scripts.
> > Suppose I want a mean to install generic files, should I use
> > SUB_FILES?
> > 
> > The first problem I encounter, then, is with subdirectories.
> > Suppose I want to install /usr/local/a/b/c.txt, I would use 
> > "SUB_FILES=a/b/c.txt" and provide files/a/b/c.txt.in.
> > However, I'll get:  
> > > cannot create /usr/ports/misc/xxx/work/a/b/c.txt: No such file or
> > > directory    
> > 
> > I've also tried "SUB_FILES=${WRKSRC}/a/b/c.txt", but then make will
> > say:  
> > > **
> > > Missing /usr/ports/misc/xxx/files//usr/ports/misc/xxx/work/xxx-y/a/b/c.txt.in
> > > for xxx-y.    
> > 
> > 
> > Am I missing something obvious?
> >   
> 
> What about something like this (your files are in files/input.tgz)?
> 
> # $FreeBSD: #
> 
> PORTNAME=       testport
> PORTVERSION=    1.0
> CATEGORIES=     sysutils
> MASTER_SITES=   # none
> DISTFILES=      # none
> EXTRACT_ONLY=   # none
> 
> MAINTAINER=     you@example.org
> COMMENT=        Blablabla
> 
> NO_WRKSUBDIR=   yes
> NO_BUILD=       yes
> NO_INSTALL=     yes
> 
> post-install:
>         @${TAR} -xf ${FILESDIR}/input.tgz -C ${STAGEDIR}
>         @${FIND} ${STAGEDIR} -type f | ${SED} "s|${STAGEDIR}||" >>
> ${TMPPLIST}
> 
> .include <bsd.port.mk>
> 
> 
> 
> 

Slightly cleaner version below, obviously you could use different
tools to get the files into ${STAGEDIR}.

# $FreeBSD: #

PORTNAME=	testport
PORTVERSION=	1.0
CATEGORIES=	sysutils
MASTER_SITES=	# none
DISTFILES=	# none
EXTRACT_ONLY=	# none

MAINTAINER=	you@example.org
COMMENT=	Blablabla

NO_WRKSUBDIR=	yes
NO_BUILD=	yes
NO_INSTALL=	yes

post-install:
	@${TAR} -xf ${FILESDIR}/input.tgz -C ${STAGEDIR}
	@${FIND} ${STAGEDIR} -type f | \
		${SED} "s|^${STAGEDIR}||" >> ${TMPPLIST}

.include <bsd.port.mk>




-- 
Michael Gmelin



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