Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Nov 2014 12:32:34 -0800
From:      John-Mark Gurney <jmg@funkthat.com>
To:        Waitman Gobble <waitman@waitman.net>
Cc:        ports@freebsd.org
Subject:   Re: help w/ port just installing files...
Message-ID:  <20141118203234.GD24601@funkthat.com>
In-Reply-To: <e9c1b3250aab70ea4f3a000ba4414146.squirrel@mx.waitman.net>
References:  <20141118033110.GX24601@funkthat.com> <7db681007f95ef2c174fad49ea4a1e1a.squirrel@mx.waitman.net> <e9c1b3250aab70ea4f3a000ba4414146.squirrel@mx.waitman.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Waitman Gobble wrote this message on Mon, Nov 17, 2014 at 12:37 -0800:
> On Mon, November 17, 2014 12:14 pm, Waitman Gobble wrote:
> 
> > On Mon, November 17, 2014 7:31 pm, John-Mark Gurney wrote:
> >
> >> So, I'm trying to get a port that will install the NIST's KAT vectors
> >> so I can write a test program using them...
> >>
> >> I don't know what is the best way to handle plist creation and
> >> installation.  I have this Makefile so far: # Created by: John-Mark
> >> Gurney
> >> <jmg@FreeBSD.org>
> >> # $FreeBSD$
> >>
> >> PORTNAME=	nist-kat
> >> DISTVERSION=	1.0
> >> CATEGORIES=	security
> >>
> >> MAINTAINER=	jmg@FreeBSD.org
> >> COMMENT=	Collection of NIST's Know Answer Test Vectors
> >>
> >> #LICENSE=	PUBLICDOMAIN
> >>
> >> BASE_URL=	http://csrc.nist.gov/groups/STM/cavp/documents
> >> MASTER_SITES=	${BASE_URL}/aes/:aes
> >> MASTER_SITES+=	${BASE_URL}/des/:des
> >> MASTER_SITES+=	${BASE_URL}/mac/:mac
> >>
> >> DISTFILES=	KAT_AES.zip:aes
> >> DISTFILES+=	XTSTestVectors.zip:aes
> >> DISTFILES+=	KAT_TDES.zip:des
> >> DISTFILES+=	gcmtestvectors.zip:mac
> >> DISTFILES+=	hmactestvectors.zip:mac
> >>
> >> # We want each dist file in it's own subdir
> >> EXTRACT_CMD=	mkdir $${file%.zip}; ${TAR}
> >> EXTRACT_AFTER_ARGS=-C $${file%.zip}
> >>
> >> NO_BUILD=
> >> NO_WRKSUBDIR=
> >>
> >> do-install:
> >> mkdir -p ${PREFIX}/share/nist-kat && \ cp -Rp ${WRKSRC}/
> >> ${PREFIX}/share/nist-kat
> >>
> >> .include <bsd.port.mk>
> >>
> >> But the cp command copies more than I want, including the staging dir.
> >>
> >> Does someone know an easier way to do this?
> >
> > I tested this, it seems to work. But it installs everything in
> > /usr/local/share/nist-kat without sub-directories. (if you want that?)
> >
> > There's no need to create the directory under /usr/local/share...
> >
> > 'make deinstall' also removes all the rsp files, which is good i think.
> >
> > do-install:
> > cd ${WRKSRC}/KAT_AES && ${COPYTREE_SHARE} . ${DOCSDIR} && \ cd
> > ${WRKSRC}/XTSTestVectors && ${COPYTREE_SHARE} . ${DOCSDIR} && \
> > cd ${WRKSRC}/KAT_TDES && ${COPYTREE_SHARE} . ${DOCSDIR} && \ cd
> > ${WRKSRC}/gcmtestvectors && ${COPYTREE_SHARE} . ${DOCSDIR} && \
> > cd ${WRKSRC}/hmactestvectors && ${COPYTREE_SHARE} . ${DOCSDIR}
> 
> OOPs, jumped the gun. It's putting in /usr/local/share/doc.
> 
> If you want in /usr/local/share/${PORT_NAME} then use ${DATADIR}
> 
> Also, it's not removing them on make deinstall, I was looking in the wrong
> place. :(

I decided to improve my extract so things wouldn't be in the root of
WRKDIR, so extract is now:
EXTRACT_CMD=    mkdir -p ${PORTNAME}/$${file%.zip} && ${TAR}
EXTRACT_AFTER_ARGS=-C ${PORTNAME}/$${file%.zip} && \
                    chmod -R a-w ${PORTNAME}/$${file%.zip}

The chmod is required because tar doesn't honor umask, and uzip w/o
permissions default to 0666.

I decided to try to make install install to stagedir instead of
PREFIX even though bsd.port.mk still says that you should:
# Variables that serve as convenient "aliases" for your *-install targets.
# Use these like: "${INSTALL_PROGRAM} ${WRKSRC}/prog ${PREFIX}/bin".

That example should probably read ${WRKSRC}/prog ${STAGEDIR}${LOCALBASE}/bin

But, if I install to STAGEDIR like so:
do-install:
        mkdir -p ${STAGEDIR}${LOCALBASE}/share && \
        cp -Rp ${WRKSRC}/${PORTNAME} ${STAGEDIR}${LOCALBASE}/share

Every thing seems to work fine...  I'll follow on w/ another email w/
the complete port for review.

Thanks.

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."



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