/[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.41 Revision 1.42
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.41 2004/03/16 21:37:09 solar Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.42 2004/04/06 03:45:00 tseng 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"
263 fi 263 fi
264 done 264 done
265 return 1 265 return 1
266} 266}
267 267
268has_pic() {
269 [ "${CFLAGS/-fPIC}" != "${CFLAGS}" ] && return 0
270 [ "${CFLAGS/-fpic}" != "${CFLAGS}" ] && return 0
271 [ has_version sys-devel/hardened-gcc ] && return 0
272 [ ! -z "`${CC/ .*/} --version| grep pie`" ] && return 0
273 return 1
274}
275
276has_pie() {
277 [ "${CFLAGS/-fPIC}" != "${CFLAGS}" ] && return 0
278 [ "${CFLAGS/-fpic}" != "${CFLAGS}" ] && return 0
279 [ has_version sys-devel/hardened-gcc ] && return 0
280 [ ! -z "`${CC/ .*/} --version| grep pie`" ] && return 0
281 return 1
282}
283
284has_ssp() {
285 [ "${CFLAGS/-fstack-protector}" != "${CFLAGS}" ] && return 0
286 [ has_version sys-devel/hardened-gcc ] && return 0
287 [ ! -z "`${CC/ .*/} --version| grep ssp`" ] && return 0
288 return 1
289}
290
268replace-sparc64-flags() { 291replace-sparc64-flags() {
269 local SPARC64_CPUS="ultrasparc v9" 292 local SPARC64_CPUS="ultrasparc v9"
270 293
271 if [ "${CFLAGS/mtune}" != "${CFLAGS}" ] 294 if [ "${CFLAGS/mtune}" != "${CFLAGS}" ]
272 then 295 then
310 LDFLAGS="${LDFLAGS:1:${#LDFLAGS}-2}" 333 LDFLAGS="${LDFLAGS:1:${#LDFLAGS}-2}"
311 return 0 334 return 0
312} 335}
313 336
314etexec-flags() { 337etexec-flags() {
315 has_version sys-devel/hardened-gcc 338 has_pie || has_pic
316 if [ $? == 0 ] ; then 339 if [ $? == 0 ] ; then
340 # strip -fPIC regardless if you've gotten this far
341 strip-flags -fPIC -fpic -fPIE -fpie -pie
317 if [ "`is-flag -yet_exec`" != "true" ]; then 342 if [ "`is-flag -yet_exec`" != "true" ]; then
343 # If our compile support -yet_exec, append it now
344 [ -z "`gcc -yet_exec -S -o /dev/null -xc /dev/null 2>&1`" ] \
318 debug-print ">>> appending flags -yet_exec" 345 && ( debug-print ">>> appending flags -yet_exec" ; \
319 append-flags -yet_exec 346 append-flags -yet_exec ; append-ldflags -yet_exec )
320 append-ldflags -yet_exec
321 fi 347 fi
322 fi 348 fi
323} 349}
324 350
325fstack-flags() { 351fstack-flags() {
326 has_version sys-devel/hardened-gcc 352 has_ssp
327 if [ $? == 0 ] ; then 353 if [ $? == 0 ] ; then
354 # strip -fstack-protector regardless if you've gotten this far
355 strip-flags -fstack-protector -fstack-protector-all
328 if [ "`is-flag -yno_propolice`" != "true" ]; then 356 if [ "`is-flag -yno_propolice`" != "true" ]; then
357 # If our compile support -yno_propolice, append it now
358 [ -z "`gcc -yno_propolice -S -o /dev/null -xc /dev/null 2>&1`" ] \
329 debug-print ">>> appending flags -yno_propolice" 359 && ( debug-print ">>> appending flags -yno_propolice" ; \
330 append-flags -yno_propolice 360 append-flags -yno_propolice ; append-ldflags -yno_propolice )
331 append-ldflags -yno_propolice
332 fi 361 fi
333 fi 362 fi
334} 363}

Legend:
Removed from v.1.41  
changed lines
  Added in v.1.42

  ViewVC Help
Powered by ViewVC 1.1.20