Re: How to expand environment variable in compilation command?

Bart van Strien <[email protected]>
Newsgroups gmane.comp.file-systems.zero-install.devel
Message-ID <[email protected]>
Hello Ilja,

 From what I can tell, what you'd do to use <for-each> is first get all 
the paths in some environment variable, say 'INCLUDES', then wherever 
the arguments need to be expanded, you'd iterate over all entries, and 
emit args using them. In the past I wrote a little helper to deal with 
includes and library paths, though[1], with example usage here[2]. I 
just looked up the code again, and it's fairly horrible, but it does work.

Regards,

Bart

P.S. I'm not sure how old that code is, but I do know I definitely was 
not aware of for-each at the time.

[1]: http://0install.bartbes.com/zerocompileflags.xml
[2]: http://0install.bartbes.com/love.xml

On 08/09/15 20:01, Ilja Honkonen wrote:
> Hello
> Is there a way to make 0install/0compile expand multiple items in an
> environment variable into command line arguments for a program? A local
> feed of mine depends on boost headers:
> <requires interface = '../boost/boost.xml'>
>     <environment name = 'CPPFLAGS' insert = 'include' mode = 'append'>
>     </environment>
> </requires>
> which works well when I use shell-command = 'c++ -I $CPPFLAGS
> $SRCDIR/test.cpp -o $DISTDIR/test' to compile but as soon as I have
> several dependencies injected to CPPFLAGS it fails. The documentation
> and example for <for-each item-from='...' separator='...'? > ...
> </for-each> wasn't very clear and I couldn't get it to do anything, can
> it do what I'd need in this case (for each item in CPPFLAGS append -I
> $item to shell-command) or is it for something else? Thanks
> Ilja
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Zero-install-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/zero-install-devel


------------------------------------------------------------------------------
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.