В Пнд, 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.
>From 989cd3700ec0f3aa13cfca08b97c4c461b738883 Mon Sep 17 00:00:00 2001 From: Peter Volkov <p...@gentoo.org> Date: Tue, 28 Jun 2011 10:05:17 +0400 Subject: [PATCH] Use | as a separator for sed'ing CFLAGS /, : is a bad idea per thread on gentoo-dev: http://archives.gentoo.org/gentoo-dev/msg_654cd9daf2548a524c8a09a82b80916f.xml --- .../functions/src_compile/building/text.xml | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ebuild-writing/functions/src_compile/building/text.xml b/ebuild-writing/functions/src_compile/building/text.xml index 700f0f1..550ef5c 100644 --- a/ebuild-writing/functions/src_compile/building/text.xml +++ b/ebuild-writing/functions/src_compile/building/text.xml @@ -58,15 +58,17 @@ src_compile() { # We have a weird build.sh to work with which ignores our # compiler preferences. yay! - sed -i -e "s:cc -O2:$(tc-getCC) ${CFLAGS} ${LDFLAGS}:" build.sh \ + sed -i -e "s|cc -O2|$(tc-getCC) ${CFLAGS} ${LDFLAGS}|" build.sh \ || die "sed fix failed. Uh-oh..." ./build.sh || die "Build failed!" } </codesample> <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 +this characters so <c>sed</c> will fail after bash expansion. The recommended +character is a vertical bar: '|' (the pipe). </note> <p> -- 1.7.3.4