1 |
On Tuesday 24 February 2009 00:57:25 Andrew D Kirch wrote: |
2 |
> I was looking to do a workaround on a per compiler basis. |
3 |
> I'm looking at toolchain-funcs.eclass, and specifically |
4 |
> ${gcc-fullversion}. I've got a broken ebuild (dhcdbd) which requires |
5 |
> -U_FORTIFY_SOURCE to compile correctly with GCC 4.3.3. |
6 |
|
7 |
it's broken whenever fortify source is used, but gcc-4.3.3 is more of an issue |
8 |
because it's on by default. however, this flag should not go in any dhcdbd |
9 |
ebuild considering the fix posted by Magnus to that bug is clearly correct. |
10 |
|
11 |
> But reading |
12 |
> tells me that I should not use this eclass to set compiler settings |
13 |
> directly. Will this work, and other than the merit of the fix is there |
14 |
> a more desirable structure for such a solution? |
15 |
> |
16 |
> inherit flag-o-matic toolchain-funcs |
17 |
> |
18 |
> if [ "${gcc-fullversion}" -eq "4.3.3" ] #(or whatever the 4.3.3 |
19 |
> $gcc-fullversion} outputs) |
20 |
> then |
21 |
> append-flags -U_FORTIFY_SOURCE |
22 |
> fi |
23 |
|
24 |
i'll just address style/usage issues here rather than "is this change even |
25 |
correct" ... |
26 |
|
27 |
-eq is for numeric values, not strings. so you'd want: |
28 |
[[ $(gcc-fullversion) == "4.3.3" ]] && append-cppflags -U_FORTIFY_SOURCE |
29 |
-mike |