Re: Install data problems

Bram Moolenaar <[email protected]>
Newsgroups gmane.comp.tools.aap.devel
Message-ID <[email protected]>
Adriaan de Groot wrote:

> The addition of scopes has made INSTALL_DATA a little less easy to use
> than it used to be: instead of writing INSTALL_DATA += whatever, you
> need to write _top.INSTALL_DATA, in order to ensure that a parent
> toplevel recipe (if any) gets the files. In addition, because you need
> to specify paths relative to the toplevel recipe, you always need
> $TOPDIR, so a typical line would read:
> 
> 	_top.INSTALL_DATA += $TOPDIR/$*datafiles
> 
> instead of
> 
> 	INSTALL_DATA += $datafiles
> 
> A far cry, indeed, in terms of usability. But, power has its price, so let's 
> leave this.

True, consistency in the use of variables requires us doing it this way.
I don't like doing something automagical here.  It would be possible to
add a specific command for this, but I doubt that would be simpler than
just using the existing mechanisms.

> In addition, the use of $TOPDIR makes {keepdir} as an attribute kind of 
> useless: if there is a parent recipe, you probably don't want $TOPDIR 
> included in the installed path. The same goes for headers: if there's a 
> parent recipe, you don't want to involve $TOPDIR, but might still want to 
> install a specific header in include/sys, as opposed to just include/.
> 
> What to do?
> 
> One approach would be to not use INSTALL_DATA at all, and have recipes add 
> dependencies for install-dat instead, something like this:
> 
> install-data : $datafiles
> 	@for i in str2list(datafiles):
> 		@install_files(dest,i) # If "files" is taken literally, can skip the for 
> loop
> 
> while that's workable, to be sure, it seems more clumsy than it needs
> to be. I like the INSTALL_DATA approach myself, mostly because it
> looks shorter than the dependency approach.
> 
> The attached patch adds a new {installdir} attribute for installing
> files. You can set it to the relative path (relative to the relevant
> $...DIR) where you want the file to be installed. For instance
> 
> 	INSTALL_HEADER += $TOPDIR/time.h { installdir=sys }
> 
> will install time.h in $INCLUDEDIR/sys/time.h.

That looks good.  I think that's a nice and simple solution.  I'll
include the implementation of the {installdir} attribute.  Please also
write the documentation for this!  I'll fix the comments.

-- 
hundred-and-one symptoms of being an internet addict:
151. You find yourself engaged to someone you've never actually met,
     except through e-mail.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///          Creator of Vim - Vi IMproved -- http://www.Vim.org          \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\  Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html  ///


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.