Go Back   { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Linux > Gentoo

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-10-2008, 05:08 PM
Nikos Chantziaras
 
Posts: n/a
Appending switches to CXXFLAGS in an ebuild

I want to append switches to CXXFLAGS but not in CFLAGS. This:

append-flags "-fno-strict-aliasing -fno-rtti -fno-exceptions"

will append those switches to both CFLAGS as well as CXXFLAGS, which I
don't want. Any solution?

PS:
The first switch (-fno-strict-aliasing) is needed; the C++ part of the
program segfaults otherwise on some systems with -O2 and higher (not on
mine though, but I want to contribute the ebuild). It's safe with -O1
(even when using "-O1 -fstrict-aliasing); probably a compiler bug, not
sure. The C part of the program isn't affected so this switch isn't
needed in CFLAGS.

The other flags are just to "optimize" a bit; the package doesn't use
RTTI nor exceptions so I think it's a good idea to use those flags for a
slightly smaller runtime. Those flags are never in the global CXXFLAGS
since they simply break packages that do use RTTI and exceptions.
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 05:44 PM
Arthur Hagen
 
Posts: n/a
Re: Appending switches to CXXFLAGS in an ebuild

pk <pk@pk.invalid> wrote:
> Nikos Chantziaras wrote:
>
>> I want to append switches to CXXFLAGS but not in CFLAGS. This:
>>
>> append-flags "-fno-strict-aliasing -fno-rtti -fno-exceptions"
>>
>> will append those switches to both CFLAGS as well as CXXFLAGS, which
>> I don't want. Any solution?

>
> - if you want this for all the packages, set CXXFLAGS in
> /etc/make.conf
> - if it's only for some packages, then put the flags
> in /etc/portage/env/category/package or in /etc/portage/bashrc
>
> Google for "gentoo per-package CFLAGS". See bug #44796 on
> bugs.gentoo.org.


He wants to know how to do this in an *ebuild* -- in other words a package
he can distribute, so that all clients who emerge that ebuild will get those
flags added.

--
*Art

Reply With Quote
  #3 (permalink)  
Old 04-10-2008, 05:53 PM
pk
 
Posts: n/a
Re: Appending switches to CXXFLAGS in an ebuild

Nikos Chantziaras wrote:

> I want to append switches to CXXFLAGS but not in CFLAGS. This:
>
> append-flags "-fno-strict-aliasing -fno-rtti -fno-exceptions"
>
> will append those switches to both CFLAGS as well as CXXFLAGS, which I
> don't want. Any solution?


- if you want this for all the packages, set CXXFLAGS in /etc/make.conf
- if it's only for some packages, then put the flags
in /etc/portage/env/category/package or in /etc/portage/bashrc

Google for "gentoo per-package CFLAGS". See bug #44796 on bugs.gentoo.org.

Reply With Quote
  #4 (permalink)  
Old 04-10-2008, 06:25 PM
pk
 
Posts: n/a
Re: Appending switches to CXXFLAGS in an ebuild

Arthur Hagen wrote:

> He wants to know how to do this in an *ebuild* -- in other words a package
> he can distribute, so that all clients who emerge that ebuild will get
> those flags added.


Ah, well. Then the question is best discussed on the gentoo-dev mailing
linst, since it seems that the flag-o-matic eclass can't help in this case
(short of ugly tricks like saving CFLAGS, changing flags as needed, and
restoring CFLAGS with the saved value).

Reply With Quote
  #5 (permalink)  
Old 04-10-2008, 09:20 PM
clifto
 
Posts: n/a
Re: Appending switches to CXXFLAGS in an ebuild

Nikos Chantziaras wrote:
> I want to append switches to CXXFLAGS but not in CFLAGS. This:
>
> append-flags "-fno-strict-aliasing -fno-rtti -fno-exceptions"
>
> will append those switches to both CFLAGS as well as CXXFLAGS, which I
> don't want. Any solution?


# X="abcde" ; echo $X ; X=$X"fghij" ; echo $X
abcde
abcdefghij


--
"Theoretically, there is nothing that can stop the government from taxing 100%
of income so long as the people get benefits from the government commensurate
with their income which is taxed." -- Barack Obama
Reply With Quote
Reply

  { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Linux > Gentoo


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 01:05 PM.


Powered by vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
© 1999-2008 mindfrost82.com v11.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109