Subject: Re: Q re. cc transform script: passing more than one cc argument?
To: Georg Schwarz <geos@epost.de>
From: Johnny C. Lam <jlam@NetBSD.org>
List: tech-pkg
Date: 09/25/2004 20:27:35
On Sat, Sep 25, 2004 at 06:12:25PM +0200, Georg Schwarz wrote:
> 
> I'm trying to write a wrapper transform logic for the IRIX 5.3 IDO cc.
> I'm using:
> 
> ######################################################################
> # IDO 5.3 seems to have problems with -O3, so downgrade it
> ######################################################################
> -O3)
>         arg=-O2 -Olimit 5000
>         msg_log $wrapperlog "   (transform-ido53-cc) to: $arg"
>         addtocache=yes
>         ;;
> 
> 
> A test yields the following:
> 
> ===> Building for nut-10.2
> cc -O3 -Wall -pedantic -ansi -DNUTDIR=\".nutdb\"
> -DFOODDIR=\"/usr/local/pkg/share/nut\"    -c -o addfood.o addfood.c
> /usr/people/schwarz/pkgsrc/biology/nut/work/.wrapper/bin/cc[49]:
> -Olimit:  not found
> 
> 
> Obviously something goes wrong here.
> How can I pass more than one argument without running into these
> problems?
> When I enclose the arguments in quotes they are passed to cc as a single
> argument, which does not work either:
> cc: Error: malformed or unknown option: -O2 -Olimit 5000

This is an unfortunate problem I've struggled with for a long time now.
It has to do with dealing with whitespace in an intelligent way, since
there are times when whitespace can legitimately be part of an option,
e.g. -I"/usr/path with space/include", so I can't always split options
along whitespace.

There is no good solution for this yet, though I have a few ideas for
fixing this.  For now, I would suggest just converting "-O3" to "-O2".

> Is the wrapper logic framework documented somewhere? Is there some
> documentation on how to use the new cmd-sink logic?

The mk/wrapper/NOTES file has a diagram that gives a birds-eye view
of how the various scripts interact.  When I have more time (by the
next pkgsrcCon at the latest), I'll have documentation that describes
how everything works together.

	Cheers,

	-- Johnny Lam <jlam@NetBSD.org>