From owner-freebsd-ports@FreeBSD.ORG Thu Feb 1 19:28:47 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 8E3D716A403 for ; Thu, 1 Feb 2007 19:28:47 +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 8450D13C4B2 for ; Thu, 1 Feb 2007 19:28:47 +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 l11J3j6t083630; Thu, 1 Feb 2007 11:03:45 -0800 (PST) (envelope-from rizzo@xorpc.icir.org) Received: (from rizzo@localhost) by xorpc.icir.org (8.12.11/8.12.3/Submit) id l11J3jnP083629; Thu, 1 Feb 2007 11:03:45 -0800 (PST) (envelope-from rizzo) Date: Thu, 1 Feb 2007 11:03:45 -0800 From: Luigi Rizzo To: ports@freebsd.org Message-ID: <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 Cc: Subject: 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 19:28:47 -0000 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. In my opinion naming individual files would be a mainteinance nightmare. In a case like this, the destination directory is private for the port and there is not any reason to be shared. cheers luigi