List Info

Thread: SHELL command putting a newline at end of string




SHELL command putting a newline at end of string
country flaguser name
United States
2007-08-03 18:20:02
Hello,

The following Jamroot file does not work because a
newline is embedded at the end of the variable that is
filled with SHELL.

# Begin Jamroot
local wx_cppflags = [ SHELL "wx-config --cppflags"
] ;

exe hello : hello.cpp :
<cxxflags>"$(wx_cppflags)" ;
# End Jamroot

How can I remove this newline?  I tried replacing the
SHELL command with "wx-config --cppflags | head -n 1 |
sed -e s/s$//"; However, the newline persisted which
leads me to believe Boost.Jam has appended it.

Thank you,

Chris

# Output
cstankevitzcstankevitz-laptop:~/temp$ bjam
...found 8 targets...
...updating 2 targets...
gcc.compile.c++ bin/gcc/debug/hello.o
g++: no input files
/bin/sh: -c: not found

    "g++"  -ftemplate-depth-128 -O0 -fno-inline
-Wall
-g -fPIC
-I/usr/lib/wx/include/gtk2-unicode-release-2.6
-I/usr/include/wx-2.6 -DGTK_NO_CHECK_CASTS -D__WXGTK__
-D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DNO_GCC_PRAGMA
   -c -o "bin/gcc/debug/hello.o"
"hello.cpp" 

...failed gcc.compile.c++ bin/gcc/debug/hello.o...
...skipped <pbin/gcc/debug>hello for lack of
<pbin/gcc/debug>hello.o...
...failed updating 1 target...
...skipped 1 target...
cstankevitzcstankevitz-laptop:~/temp$ 


       
____________________________________________________________
________________________
Looking for a deal? Find great prices on flights and hotels
with Yahoo! FareChase.
http://farechase.yahoo.co
m/
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

Re: SHELL command putting a newline at end of string
country flaguser name
Spain
2007-08-06 02:21:04
hello, try this:

rule trim-nl ( str )
{
   return [ MATCH "([^
]*)" : $(str) ] ;
}

rule _shell ( cmd )
{
   return [ trim-nl [ SHELL $(cmd) ] ] ;
}

now instead of invoking SHELL, invoke _shell

be carefully when typing the rule trim-nl, the value
"([
]*)" should be typed exactly as it appears in this
mail: the character ^ 
should be the last in the line and the following ] should be
the first 
in the next line.

hope it helps,

Jorge

Chris Stankevitz wrote:
> Hello,
> 
> The following Jamroot file does not work because a
> newline is embedded at the end of the variable that is
> filled with SHELL.
> 
> # Begin Jamroot
> local wx_cppflags = [ SHELL "wx-config
--cppflags" ] ;
> 
> exe hello : hello.cpp :
<cxxflags>"$(wx_cppflags)" ;
> # End Jamroot
> 
> How can I remove this newline?  I tried replacing the
> SHELL command with "wx-config --cppflags | head -n
1 |
> sed -e s/s$//"; However, the newline persisted
which
> leads me to believe Boost.Jam has appended it.
> 
> Thank you,
> 
> Chris
> 
> # Output
> cstankevitzcstankevitz-laptop:~/temp$ bjam
> ...found 8 targets...
> ...updating 2 targets...
> gcc.compile.c++ bin/gcc/debug/hello.o
> g++: no input files
> /bin/sh: -c: not found
> 
>     "g++"  -ftemplate-depth-128 -O0
-fno-inline -Wall
> -g -fPIC
> -I/usr/lib/wx/include/gtk2-unicode-release-2.6
> -I/usr/include/wx-2.6 -DGTK_NO_CHECK_CASTS -D__WXGTK__
> -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DNO_GCC_PRAGMA
>    -c -o "bin/gcc/debug/hello.o"
"hello.cpp" 
> 
> ...failed gcc.compile.c++ bin/gcc/debug/hello.o...
> ...skipped <pbin/gcc/debug>hello for lack of
> <pbin/gcc/debug>hello.o...
> ...failed updating 1 target...
> ...skipped 1 target...
> cstankevitzcstankevitz-laptop:~/temp$ 
> 
> 
>        
>
____________________________________________________________
________________________
> Looking for a deal? Find great prices on flights and
hotels with Yahoo! FareChase.
> http://farechase.yahoo.co
m/
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
> 

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )