Date: Thu, 01 Feb 2007 21:57:12 +0000 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: Luigi Rizzo <rizzo@icir.org> Cc: ports@freebsd.org Subject: Re: proper way to do a recursive install ? Message-ID: <45C26238.9050405@infracaninophile.co.uk> In-Reply-To: <20070201110345.A83474@xorpc.icir.org> References: <20070201110345.A83474@xorpc.icir.org>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig8EC1BA4C1FB509A2E580A759 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Luigi Rizzo wrote: > I have a port that just need to install the content of a tarball > (a set of headers and C sources) into > /usr/local/share/linux-bsd-kmod/linux_compat, >=20 > and was wondering what is the proper way to handle this (both in > the port's Makefile and in the pkg_plist file). > do-install: > ${MKDIR} -p ${MY_DST} > cp -Rp ${WRKSRC} ${MY_DST} > find ${MY_DST} -type f -exec chmod ${SHAREMODE} \{\} \; > chown -R ${SHAREOWN}:${SHAREGRP} ${MY_DST} cpio is a common choice for this. For instance this example from the java/diablo-jre15 port: do-install: ${MKDIR} "${INSTALL_DIR}" cd "${WRKSRC}" && ${FIND} . \ | ${CPIO} -pdmu -R ${LIBOWN}:${LIBGRP} "${INSTALL_DIR}" cpio is handy because it can set the ownership on the installed files in the same pass as they are installed. It relies on the correct permissions being set in the source directory, which it will apply to the copied files and directories (although use of 'find -depth' does give best results for directory permissions). There are plenty of other choices around the ports tree though. > #--- this is pkg-plist 000 > @exec mkdir -p %D/share/linux-bsd-kmod > @exec echo "installing into %D/share/linux-bsd-kmod" > @unexec echo "uninstalling into %D/share/linux-bsd-kmod" > @unexec rm -rf %D/share/linux-bsd-kmod If your build process generates a constant set of files, then why wouldn't you just generate a pkg-plist exactly as would be done for any other port? It might be a bit long, but so what? We have computers that can wrangle all that stuff for us. http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/plist-a= utoplist.html You can even generate a PLIST on the fly as an afterthought to the build process, although nowadays the preference is to have a static pkg-plist or else use the PLIST_DIRS and PLIST_FILES make variables unless there are good reasons not to do so.=20 See, for instance the code that implements the PORTDOCS functionality in bsd.port.mk. Or this example from the phpmyadmin port I maintain: post-patch: ${CP} ${FILESDIR}/${CFGFILE}.sample ${WRKSRC}/${CFGFILE}.sample cd ${WRKSRC} ; \ ${FIND} . ! -type d ! -name ${CFGFILE}.sample | ${SORT} | \ ${SED} -e "s,^\.,%%MYADMDIR%%," >${PLIST} ; \ ${CAT} ${PKGDIR}/pkg-plist-chunk >>${PLIST} ; \ ${FIND} . -type d | ${SORT} -r | ${SED} \ -e "s,^\.$$,@dirrmtry %%MYADMDIR%%," \ -e "s,^\.,@dirrm %%MYADMDIR%%," >>${PLIST} Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW --------------enig8EC1BA4C1FB509A2E580A759 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.1 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFwmJA8Mjk52CukIwRCFHiAKCTLH0Pezxn7YvTt2Agrq0nQ6vB+gCfWrrT 3A0gD1wff1OojEScqEFMCcE= =SpkP -----END PGP SIGNATURE----- --------------enig8EC1BA4C1FB509A2E580A759--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?45C26238.9050405>