Writing a port that simply installs a bunch of files
Michael Gmelin
freebsd at grem.de
Mon Mar 6 16:05:08 UTC 2017
On Mon, 6 Mar 2017 16:51:04 +0100
Michael Gmelin <freebsd at grem.de> wrote:
> On Mon, 6 Mar 2017 16:02:05 +0100
> Andrea Venturoli <ml at 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 at 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 at 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
More information about the freebsd-ports
mailing list