FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Development

 
 
LinkBack Thread Tools
 
Old 06-28-2011, 06:16 AM
Peter Volkov
 
Default demanual update (was: Don't use / when applying sed with CFLAGS)

В Пнд, 27/06/2011 в 17:01 +0200, Fabian Groffen пишет:
> On 27-06-2011 14:08:52 +0000, Justin Lecher wrote:
> > Please do not use / as seperater when using sed with CFLAGS. I came
> across a bug today where it failed for crossdev. Here the toolchain
> header paths in the cflags and consowuently the seds fail.

This is already documented (see link below).

> Please also don't use ':' as separator, as some platforms have options
> for their toolchain that includes colons.

But still our documentation explicitly suggests ':' for CFLAGS cases and
example allows bash substitution.

http://devmanual.gentoo.org/ebuild-writing/functions/src_compile/building/index.html
see example in "Fixing Compiler Usage" section and text below:
sed -i -e "s:cc -O2:$(tc-getCC) ${CFLAGS} ${LDFLAGS}:" build.sh

Are there any objections to suggest '|' for CFLAGS, LDFLAGS (see
attachment)?

--
Peter.
 
Old 06-28-2011, 06:24 AM
Fabian Groffen
 
Default demanual update (was: Don't use / when applying sed with CFLAGS)

On 28-06-2011 10:16:06 +0400, Peter Volkov wrote:
> Are there any objections to suggest '|' for CFLAGS, LDFLAGS (see
> attachment)?

Not from my side. It's what we've been using so far.

> <note>
> -When using <c>sed</c> with <c>CFLAGS</c> or <c>LDFLAGS</c>, it is not safe to use
> -a comma or a slash as a delimiter. The recommended character is a colon.
> +When using <c>sed</c> with <c>CFLAGS</c> or <c>LDFLAGS</c>, it is not safe to
> +use a comma, a colon or a slash as a delimiter. <c>gcc</c> options may contain

gcc -> gcc, ld, ar, etc.

> +this characters so <c>sed</c> will fail after bash expansion. The recommended
> +character is a vertical bar: '|' (the pipe).


--
Fabian Groffen
Gentoo on a different level
 
Old 06-28-2011, 06:54 AM
Michał Górny
 
Default demanual update (was: Don't use / when applying sed with CFLAGS)

On Tue, 28 Jun 2011 10:16:06 +0400
Peter Volkov <pva@gentoo.org> wrote:

> But still our documentation explicitly suggests ':' for CFLAGS cases
> and example allows bash substitution.
>
> http://devmanual.gentoo.org/ebuild-writing/functions/src_compile/building/index.html
> see example in "Fixing Compiler Usage" section and text below:
> sed -i -e "s:cc -O2:$(tc-getCC) ${CFLAGS} ${LDFLAGS}:" build.sh
>
> Are there any objections to suggest '|' for CFLAGS, LDFLAGS (see
> attachment)?

I think that also a good idea may be to provide an Makefile example,
showing that often sed is unnecessary, and it's enough to do things
like:

emake CC="$(tc-getCC)" CFLAGS="${CFLAGS}"...

--
Best regards,
Michał Górny
 
Old 06-28-2011, 12:25 PM
Peter Volkov
 
Default demanual update (was: Don't use / when applying sed with CFLAGS)

Thank you Fabian, Michał. Added note on Makefile and mentioned other
tools as well. Updated patch is in attachment.

--
Peter.
 
Old 06-28-2011, 12:25 PM
Peter Volkov
 
Default demanual update (was: Don't use / when applying sed with CFLAGS)

Thank you Fabian, Michał. Added note on Makefile and mentioned other
tools as well. Updated patch is in attachment.

--
Peter.
 
Old 06-28-2011, 04:23 PM
Mike Frysinger
 
Default demanual update (was: Don't use / when applying sed with CFLAGS)

On Tuesday, June 28, 2011 02:54:03 Michał Górny wrote:
> On Tue, 28 Jun 2011 10:16:06 +0400 Peter Volkov wrote:
> > But still our documentation explicitly suggests ':' for CFLAGS cases
> > and example allows bash substitution.
> >
> > http://devmanual.gentoo.org/ebuild-writing/functions/src_compile/building
> > /index.html see example in "Fixing Compiler Usage" section and text
> > below:
> > sed -i -e "s:cc -O2:$(tc-getCC) ${CFLAGS} ${LDFLAGS}:" build.sh
> >
> > Are there any objections to suggest '|' for CFLAGS, LDFLAGS (see
> > attachment)?
>
> I think that also a good idea may be to provide an Makefile example,
> showing that often sed is unnecessary, and it's enough to do things
> like:
>
> emake CC="$(tc-getCC)" CFLAGS="${CFLAGS}"...

this is easily dangerous when it comes to packages (and many do) that append
in the Makefile. specifying on the command line blocks those while passing
via env works fine. i'm not sure it's appropriate to provide as an example.
-mike
 
Old 06-28-2011, 04:27 PM
Mike Frysinger
 
Default demanual update (was: Don't use / when applying sed with CFLAGS)

On Tuesday, June 28, 2011 08:25:50 Peter Volkov wrote:
> +Sometimes a package will not use the user's <c>${CFLAGS}</c> or
> +<c>${LDFLAGS}</c>.

there are more flag vars than this. you should use language like:
Sometimes a package will not use the user's build settings (such as CFLAGS or
LDFLAGS).

> - sed -i -e "s:cc -O2:$(tc-getCC) ${CFLAGS} ${LDFLAGS}:" build.sh
> + sed -i -e "s|cc -O2|$(tc-getCC) ${CFLAGS} ${LDFLAGS}|" build.sh

probably better to suggest delaying of the expansion in the first place.
sed -i -e "s|cc -O2|$(tc-getCC) ${CFLAGS} ${LDFLAGS}|" build.sh

also, your example ignores CPPFLAGS
-mike
 
Old 06-28-2011, 06:24 PM
Peter Volkov
 
Default demanual update (was: Don't use / when applying sed with CFLAGS)

В Втр, 28/06/2011 в 12:23 -0400, Mike Frysinger пишет:
> On Tuesday, June 28, 2011 02:54:03 Michał Górny wrote:
> > emake CC="$(tc-getCC)" CFLAGS="${CFLAGS}"...
>
> this is easily dangerous when it comes to packages (and many do) that append
> in the Makefile. specifying on the command line blocks those while passing
> via env works fine. i'm not sure it's appropriate to provide as an example.

Hm, I'm not sure I understand what you are talking about here. Could you
provide example?

--
Peter.
 
Old 06-28-2011, 07:04 PM
Nathan Phillip Brink
 
Default demanual update (was: Don't use / when applying sed with CFLAGS)

On Tue, Jun 28, 2011 at 10:24:26PM +0400, Peter Volkov wrote:
> ?? ??????, 28/06/2011 ?? 12:23 -0400, Mike Frysinger ??????????:
> > On Tuesday, June 28, 2011 02:54:03 Micha?? G??rny wrote:
> > > emake CC="$(tc-getCC)" CFLAGS="${CFLAGS}"...
> >
> > this is easily dangerous when it comes to packages (and many do) that append
> > in the Makefile. specifying on the command line blocks those while passing
> > via env works fine. i'm not sure it's appropriate to provide as an example.
>
> Hm, I'm not sure I understand what you are talking about here. Could you
> provide example?

I think he's referring to somethine like:

Makefile:
CFLAGS += `pkg-config --cflags libxml-2.0`

which would work fine for:
emake

but which would override the pkg-config flags if you do:
emake CFLAGS="${CFLAGS}"

--
binki
 
Old 06-28-2011, 07:08 PM
Alexis Ballier
 
Default demanual update (was: Don't use / when applying sed with CFLAGS)

On Tue, 28 Jun 2011 22:24:26 +0400
Peter Volkov <pva@gentoo.org> wrote:

> В Втр, 28/06/2011 в 12:23 -0400, Mike Frysinger пишет:
> > On Tuesday, June 28, 2011 02:54:03 Michał Górny wrote:
> > > emake CC="$(tc-getCC)" CFLAGS="${CFLAGS}"...
> >
> > this is easily dangerous when it comes to packages (and many do)
> > that append in the Makefile. specifying on the command line blocks
> > those while passing via env works fine. i'm not sure it's
> > appropriate to provide as an example.
>
> Hm, I'm not sure I understand what you are talking about here. Could
> you provide example?
>

if the makefile contains something like CFLAGS+="-DMYFEATURE=1" then
'emake CFLAGS="blah"' overrides it but 'CFLAGS="blah" emake' doesnt.

A.
 

Thread Tools




All times are GMT. The time now is 09:56 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org