From owner-freebsd-ports@FreeBSD.ORG Thu Feb 1 21:25:07 2007 Return-Path: X-Original-To: ports@freebsd.org Delivered-To: freebsd-ports@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F0DF416A402 for ; Thu, 1 Feb 2007 21:25:07 +0000 (UTC) (envelope-from rizzo@icir.org) Received: from xorpc.icir.org (xorpc.icir.org [192.150.187.68]) by mx1.freebsd.org (Postfix) with ESMTP id C0EEC13C471 for ; Thu, 1 Feb 2007 21:25:07 +0000 (UTC) (envelope-from rizzo@icir.org) Received: from xorpc.icir.org (localhost [127.0.0.1]) by xorpc.icir.org (8.12.11/8.13.6) with ESMTP id l11LP7cP085584 for ; Thu, 1 Feb 2007 13:25:07 -0800 (PST) (envelope-from rizzo@xorpc.icir.org) Received: (from rizzo@localhost) by xorpc.icir.org (8.12.11/8.12.3/Submit) id l11LP7aR085583 for ports@freebsd.org; Thu, 1 Feb 2007 13:25:07 -0800 (PST) (envelope-from rizzo) Date: Thu, 1 Feb 2007 13:25:07 -0800 From: Luigi Rizzo To: ports@freebsd.org Message-ID: <20070201132507.A85548@xorpc.icir.org> References: <20070201110345.A83474@xorpc.icir.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20070201110345.A83474@xorpc.icir.org>; from rizzo@icir.org on Thu, Feb 01, 2007 at 11:03:45AM -0800 Cc: Subject: Re: proper way to do a recursive install ? X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2007 21:25:08 -0000 On Thu, Feb 01, 2007 at 11:03:45AM -0800, 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, > > and was wondering what is the proper way to handle this (both in > the port's Makefile and in the pkg_plist file). > > Given that INSTALL doesn't have a 'recursive' flag, and a combination > of 'find' and INSTALL is quite clumsy (short of calling INSTALL on > each file) to preserve the full pathnames, I have come up with > something like the combination of find/cp/chown below (to set up > permissions and ownership correctly). > > #--- this is in the Makefile --- > > .... > .include > MY_DST= ${DESTDIR}${PREFIX}/share/linux-bsd-kmod/linux_compat > > do-build: # nothing to build here > > 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} > > .include > > #--- 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 > > Given that it seems a relatively common problem, and that is is > easy to make mistakes in the above commands re. pathnames and > permissions, i wonder if it wouldn't be the case to put together a > 'recursive install' function that can be called from the port's top > level makefile. And for the benefit of the archives, these are numbers that show that it _is_ a common problem. Grepping INSTALL in the ports' Makefiles give these counts (sorted, largest first): ./graphics/libx3dtk/Makefile : 464 YUCK!!! ./irc/psybnc/Makefile : 252 ./editors/setedit/Makefile : 79 ./www/ssserver/Makefile : 59 ./games/macopix/Makefile : 43 ./x11-toolkits/open-motif/Makefile : 34 ./www/awstats/Makefile : 29 ./www/validator/Makefile : 28 ./mail/mailscanner/Makefile : 28 ./ftp/bsdftpd-ssl/Makefile : 28 ... There are 262 entries with 10 or more 'INSTALL' in them; several use tricks like this .for f in dot.mosaic-hotlist-default @${INSTALL_DATA} ${FILESDIR}/${f} ${SAMPLEDIR} .endfor so, it seems a feature that is largely useful cheers luigi