/[gentoo-x86]/eclass/flag-o-matic.eclass
Gentoo

Diff of /eclass/flag-o-matic.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.49 Revision 1.50
1# Copyright 1999-2003 Gentoo Technologies, Inc. 1# Copyright 1999-2003 Gentoo Technologies, Inc.
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.49 2004/05/11 13:02:05 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.50 2004/05/12 13:36:17 pappy Exp $
4# 4#
5# Author Bart Verwilst <verwilst@gentoo.org> 5# Author Bart Verwilst <verwilst@gentoo.org>
6 6
7ECLASS=flag-o-matic 7ECLASS=flag-o-matic
8INHERITED="$INHERITED $ECLASS" 8INHERITED="$INHERITED $ECLASS"
52#### filter-ldflags <flags> #### 52#### filter-ldflags <flags> ####
53# Remove particular flags from LDFLAGS 53# Remove particular flags from LDFLAGS
54# Matches only complete flags 54# Matches only complete flags
55# 55#
56#### etexec-flags #### 56#### etexec-flags ####
57# hooked function for hardened-gcc that appends 57# hooked function for hardened gcc that appends
58# -yet_exec {C,CXX,LD}FLAGS when hardened-gcc is installed 58# -fno-pic to {C,CXX,LD}FLAGS
59# and a package is filtering -fPIC,-fpic, -fPIE, -fpie 59# when a package is filtering -fpic, -fPIC, -fpie, -fPIE
60# 60#
61#### fstack-flags #### 61#### fstack-flags ####
62# hooked function for hardened-gcc that appends 62# hooked function for hardened gcc that appends
63# -yno_propolice to {C,CXX,LD}FLAGS when hardened-gcc is installed 63# -fno-stack-protector to {C,CXX,LD}FLAGS
64# and a package is filtering -fstack-protector, -fstack-protector-all 64# when a package is filtering -fstack-protector, -fstack-protector-all
65# notice: modern automatic specs files will also suppress -fstack-protector-all
66# when only -fno-stack-protector is given
65# 67#
66 68
67# C[XX]FLAGS that we allow in strip-flags 69# C[XX]FLAGS that we allow in strip-flags
68setup-allowed-flags() { 70setup-allowed-flags() {
69 if [ -z "${ALLOWED_FLAGS}" ] ; then 71 if [ -z "${ALLOWED_FLAGS}" ] ; then
272} 274}
273 275
274has_pic() { 276has_pic() {
275 [ "${CFLAGS/-fPIC}" != "${CFLAGS}" ] && return 0 277 [ "${CFLAGS/-fPIC}" != "${CFLAGS}" ] && return 0
276 [ "${CFLAGS/-fpic}" != "${CFLAGS}" ] && return 0 278 [ "${CFLAGS/-fpic}" != "${CFLAGS}" ] && return 0
277 has_version sys-devel/hardened-gcc && return 0
278 [ ! -z "`${CC/ .*/} --version| grep pie`" ] && return 0 279 [ ! -z "`${CC/ .*/} --version| grep pie`" ] && return 0
279 return 1 280 return 1
280} 281}
281 282
282has_pie() { 283has_pie() {
283 [ "${CFLAGS/-fPIE}" != "${CFLAGS}" ] && return 0 284 [ "${CFLAGS/-fPIE}" != "${CFLAGS}" ] && return 0
284 [ "${CFLAGS/-fpie}" != "${CFLAGS}" ] && return 0 285 [ "${CFLAGS/-fpie}" != "${CFLAGS}" ] && return 0
285 has_version sys-devel/hardened-gcc && return 0
286 [ ! -z "`${CC/ .*/} --version| grep pie`" ] && return 0 286 [ ! -z "`${CC/ .*/} --version| grep pie`" ] && return 0
287 return 1 287 return 1
288} 288}
289 289
290has_ssp() { 290has_ssp() {
291 [ "${CFLAGS/-fstack-protector}" != "${CFLAGS}" ] && return 0 291 [ "${CFLAGS/-fstack-protector}" != "${CFLAGS}" ] && return 0
292 has_version sys-devel/hardened-gcc && return 0
293 [ ! -z "`${CC/ .*/} --version| grep ssp`" ] && return 0 292 [ ! -z "`${CC/ .*/} --version| grep ssp`" ] && return 0
294 return 1 293 return 1
295} 294}
296 295
297replace-sparc64-flags() { 296replace-sparc64-flags() {
341} 340}
342 341
343etexec-flags() { 342etexec-flags() {
344 has_pie || has_pic 343 has_pie || has_pic
345 if [ $? == 0 ] ; then 344 if [ $? == 0 ] ; then
346 [ -z "`is-flag -yet_exec`" ] && 345 [ -z "`is-flag -fno-pic`" ] &&
347 export CFLAGS="${CFLAGS} `test_flag -yet_exec`" 346 export CFLAGS="${CFLAGS} `test_flag -fno-pic`"
347
348 [ -z "`is-flag -nopie`" ] && 348 [ -z "`is-flag -nopie`" ] &&
349 export CFLAGS="${CFLAGS} `test_flag -nopie`" 349 export CFLAGS="${CFLAGS} `test_flag -nopie`"
350 fi 350 fi
351} 351}
352 352
353fstack-flags() { 353fstack-flags() {
354 has_ssp 354 has_ssp
355 if [ $? == 0 ] ; then 355 if [ $? == 0 ] ; then
356 [ -z "`is-flag -yno_propolice`" ] && 356 [ -z "`is-flag -fno-stack-protector`" ] &&
357 export CFLAGS="${CFLAGS} `test_flag -fno-stack-protector`" 357 export CFLAGS="${CFLAGS} `test_flag -fno-stack-protector`"
358 fi 358 fi
359} 359}

Legend:
Removed from v.1.49  
changed lines
  Added in v.1.50

  ViewVC Help
Powered by ViewVC 1.1.20