Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Unsupported Software
  • Search

/etc/portage/package.c{,xx}flags features - v1.0_rc1

This forum covers all Gentoo-related software not officially supported by Gentoo. Ebuilds/software posted here might harm the health and stability of your system(s), and are not supported by Gentoo developers. Bugs/errors caused by ebuilds from overlays.gentoo.org are covered by this forum, too.
Post Reply
Advanced search
65 posts
  • 1
  • 2
  • 3
  • Next
Author
Message
thebigslide
l33t
l33t
User avatar
Posts: 792
Joined: Thu Dec 23, 2004 12:25 pm
Location: under a car or on top of a keyboard

/etc/portage/package.c{,xx}flags features - v1.0_rc1

  • Quote

Post by thebigslide » Sun Jan 16, 2005 10:40 pm

I found a neat script to parse a package.cflags file and use them for per-package cflags written by Ned Ludd. I modified it a bit. It now uses 3 files: /etc/portage/package.cflags, /etc/portage/package.cxxflags, and /etc/portage/features to allow one to OVERRIDE CFLAGS, CXXFLAGS and FEATURES in make.conf
You can define a category specific rule or a package specific rule:

any CFLAGS you put in will OVERRIDE the setting in make.conf, also, one can use GLOBALCFLAGS, GLOBALCXXFLAGS, and GLOBALFEATURES in packages.c{,xx}flags and package.features if you want to include the flags set in make.conf.

This is a bashrc that should be moved to /etc/portage/bashrc.

Code: Select all

## Copyright 1999-2005 Gentoo Foundation 
# Distributed under the terms of the GNU General Public License v2 
# $Header: /etc/portage/bashrc$ 
# Originally written by Ned Ludd (solar_at_gentoo.org) 
# modifications by Ryan McIntosh (thebigslide_at_gmail.com) 
# V1.0_rc1
# - /etc/portage/bashrc 

if [ "$0" = "/usr/lib/portage/bin/ebuild.sh" -o "$0" = "/usr/lib/portage/bin/ebuild-daemon.sh" ]; then 


   append-cflags() { 
        export CFLAGS="${CFLAGS} $*" 
   return 0 
   } 

   append-cxxflags() { 
        export CXXFLAGS="${CXXFLAGS} $*" 
   return 0 
   } 

   append-features() { 
   	export FEATURES="${FEATURES} $*" 
   return 0 
   } 

   package-cflags() { 
           # bail if file does not exist or is not readable. 
           [ -r ${ROOT}/etc/portage/package.cflags ] || return 0 

           while read -a target; do 
                   if [ "${target}" = "${CATEGORY}" ];   then 
                   	unset CFLAGS 
                        for i in `/bin/seq 20`;    do #linelength 
                        	if [ "${target[$i]}" = "GLOBALCFLAGS" ]; then 
		               		append-cflags $GLOBALCFLAGS 
            			else 
		        	       	if [ "${target[$i]}" = "GLOBALCXXFLAGS" ]; then 
					     	append-cflags $GLOBALCXXFLAGS 
				       	else
               					append-cflags ${target[$i]} 
					fi
            			fi 
                        done 
                        	export -n CFLAGS 
                   else 
                   if [ "${target}" = "${CATEGORY}/${PN}" ]; then 
             		unset CFLAGS 
                        for i in `/bin/seq 20`;    do #linelength 
                        	if [ "${target[$i]}" = "GLOBALCFLAGS" ]; then 
                  			append-cflags $GLOBALCFLAGS 
               			else 
		        	       	if [ "${target[$i]}" = "GLOBALCXXFLAGS" ]; then 
					     	append-cflags $GLOBALCXXFLAGS 
				       	else
                  				append-cflags ${target[$i]} 
					fi
               			fi 
                        done 
                        export -n CFLAGS 
                   fi 
                   fi 
           done <  ${ROOT}/etc/portage/package.cflags 
   } 

   package-cxxflags() { 
        # bail if file does not exist or is not readable. 
        [ -r ${ROOT}/etc/portage/package.cxxflags ] || return 0 
            
	while read -a target; do 
        	if [ "${target}" = "${CATEGORY}" ];   then 
                      	unset CXXFLAGS 
                       	for i in `/bin/seq 20`;    do #linelength 
                               
				if [ "${target[$i]}" = "GLOBALCXXFLAGS" ]; then 
			               	append-cxxflags $GLOBALCXXFLAGS 
			        else 
		               		if [ "${target[$i]}" = "GLOBALCFLAGS" ]; then 
				        	append-cxxflags $GLOBALCFLAGS 
			       		else
			               		append-cxxflags ${target[$i]} 
					fi
			        fi 
	                 done 
                 	 export -n CXXFLAGS 
        	 else 

                 if [ "${target}" = "${CATEGORY}/${PN}" ]; then 
	               	unset CXXFLAGS 
                       	for i in `/bin/seq 20`;    do #linelength 
       	               		if [ "${target[$i]}" = "GLOBALCXXFLAGS" ]; then 
					append-cxxflags $GLOBALCXXFLAGS 
			        else 
		        	   	if [ "${target[$i]}" = "GLOBALCFLAGS" ]; then 
					       	append-cxxflags $GLOBALCFLAGS 
				       	else
				        	append-cxxflags ${target[$i]} 
					fi
			        fi 
                         done 
                         export -n CXXFLAGS 
                  fi 
	          fi 
      	done <  $ROOT/etc/portage/package.cxxflags 
   } 

   package-features() { 
           # bail if file does not exist or is not readable. 
           [ -r ${ROOT}/etc/portage/package.features ] || return 0 
            
	   while read -a target; do 
           	if [ "${target}" = "${CATEGORY}" ];   then 
                	unset FEATURES 
                        for i in `/bin/seq 20`;    do #linelength 
                	        if [ "${target[$i]}" = "GLOBALFEATURES" ]; then 
		     	    		append-features $GLOBALFEATURES 
			        else 
		        	       	append-features ${target[$i]} 
			        fi 
                        done 
                        export -n FEATURES 
                 else 
                 
		 if [ "${target}" = "${CATEGORY}/${PN}" ]; then 
	         	unset FEATURES 
                        for i in `/bin/seq 20`;    do #linelength 
                        	if [ "${target[$i]}" = "GLOBALFEATURES" ]; then 
		                	append-features $GLOBALFEATURES 
		               	else 
			                append-features ${target[$i]} 
			        fi 
                        done 
                        export -n FEATURES 
                 fi 
                 fi 
           done <  $ROOT/etc/portage/package.features 
   } 

   export GLOBALCFLAGS=$CFLAGS 
   export GLOBALCXXFLAGS=$CXXFLAGS 
   export GLOBALFEATURES=$FEATURES 

   package-cflags 
   package-cxxflags 
   package-features 
    
   unset GLOBALCFLAGS 
   unset GLOBALCXXFLAG 
   unset GLOBALFEATURES 

else 
   echo "This bashrc does not know anything about $0" 
fi
Here's a sample file that would work for package.cflags OR package.cxxflags

Code: Select all

# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

# - /etc/portage/package.cflags and /etc/portage/package/cxxflags=

##############
# Important: #
##############
# >=dev-blah/blah syntax is not supported by this files. 
# We can take individual category names
# Or we can take individual ebuild names
# Changes to this file OVERRIDE settings in make.conf

##############
# CATEGORIES #
##############
app-editors -Os -march=-686
sys-apps GLOBALCFLAGS -Os
sys-fs GLOBALCFLAGS -Os
dev-libs -O1
net-misc -O2
net-www	 -O2
sys-boot -fno-stack-protector-all
sys-libs -O1 
sys-devel -Os
gnome-base GLOBALCXXFLAGS -Wl,-O1
gnome-extra -Wl,-O1
media-libs -O1
x11-misc -Wl,-O1 
x11-wm -Wl,-O1

#################
# PACKAGE NAMES #
#################
net-www/mozilla -O3 -Wl,-01
sys-apps/chpax -O1
sys-apps/paxctl -O1
mail-client/evolution -Wl,-O1
media-video/mplayer -O3 -mno-sse2 -fno-stack-protector -fno-stack-protector-all
Note that you CAN put GLOBALCXXFLAGS in package.cflags, but if you have C++ specific flags in CXXFLAGS in make.conf, this script will NOT filter them out.

*****UPDATE: You can now make tweaks to packages by doing

Code: Select all

echo app-type/package-name -flag >> /etc/portage/package.cflags && cleanfile cflags
This script will sift through package.[argument] and combine all the flags for each package and sort everything, eliminating duplicate lines. You can even call 'cleanfile use' and it will even warn you of combining -flag and flag for the same package if you've accidentally done this on different lines.

Code: Select all

##/sbin/cleanfile
#!/bin/bash 
cleanfile() { 
local PKGLIST USEFLAGS TEMPUSE ANTIFLAG DUPTEST I J 

PKGLIST=`cat /etc/portage/package.${1} | cut -d " " -f1 | sort -u` 
for I in $PKGLIST 
do 
        USEFLAGS=`grep "$I" /etc/portage/package.${1} | cut -d " " -f2-` 
        echo -n "$I " >> /etc/portage/package.${1}.temp 
        rm -f /etc/portage/.TEMP &>/dev/null 
        for J in $USEFLAGS; 
        do 
                echo $J >> /etc/portage/.TEMP 
                if [ `echo $J | cut -c 1` = "-" ]; then 
                        ANTIFLAG=`echo $J | cut -d "-" -f2` 
                        DUPTEST=`echo $USEFLAGS | grep " $ANTIFLAG"` 
                        if [ "$DUPTEST" != "" ]; then 
                                echo "$I USEs both $J and $ANTIFLAG!!!" 
                        fi 
                fi 
        done 
        echo `sort -u < /etc/portage/.TEMP` >> /etc/portage/package.${1}.temp 
        rm -f /etc/portage/.TEMP &>/dev/null 
done 
} 
cleanfile $1
If it breaks anything, the old filenames are prepended with a '.'
Last edited by thebigslide on Sat Mar 26, 2005 6:27 pm, edited 16 times in total.
Top
Bob P
Advocate
Advocate
User avatar
Posts: 3374
Joined: Wed Oct 20, 2004 9:15 pm
Location: USA

  • Quote

Post by Bob P » Sun Jan 16, 2005 11:15 pm

it sounds like a very cool idea! 8)

unfortunately, i have so much on my plate right now that i can't join in testing. but i'll keep my eye on this thead! :wink:
Top
thebigslide
l33t
l33t
User avatar
Posts: 792
Joined: Thu Dec 23, 2004 12:25 pm
Location: under a car or on top of a keyboard

  • Quote

Post by thebigslide » Mon Jan 17, 2005 7:55 am

EDIT: Merged into the first post.
Last edited by thebigslide on Fri Mar 04, 2005 9:42 am, edited 4 times in total.
Top
thebigslide
l33t
l33t
User avatar
Posts: 792
Joined: Thu Dec 23, 2004 12:25 pm
Location: under a car or on top of a keyboard

  • Quote

Post by thebigslide » Mon Jan 17, 2005 8:40 am

Can someone help me out with those ugly for loops?
Top
sn4ip3r
Guru
Guru
User avatar
Posts: 325
Joined: Sat Dec 14, 2002 12:39 pm
Location: Tallinn, Estonia

  • Quote

Post by sn4ip3r » Mon Jan 17, 2005 1:20 pm

thebigslide wrote:Can someone help me out with those ugly for loops?
Use

Code: Select all

for i in `seq 20`; do
Top
thebigslide
l33t
l33t
User avatar
Posts: 792
Joined: Thu Dec 23, 2004 12:25 pm
Location: under a car or on top of a keyboard

  • Quote

Post by thebigslide » Mon Jan 17, 2005 3:04 pm

thanks. I tried that last night, but didn't try /bin/seq. Edit made. I was looking for something like:

Code: Select all

 while ${target[$i]}; do
I can't seem to figure out the syntax.
Top
IvanYosifov
l33t
l33t
User avatar
Posts: 778
Joined: Fri Oct 15, 2004 6:33 pm
Location: Bulgaria

  • Quote

Post by IvanYosifov » Fri Feb 25, 2005 2:57 pm

This seems like a very cool and usefull idea. What are the chances of this code , or some other implemntation of per-package C(XX)FLAGS going into portage ?
Top
thebigslide
l33t
l33t
User avatar
Posts: 792
Joined: Thu Dec 23, 2004 12:25 pm
Location: under a car or on top of a keyboard

  • Quote

Post by thebigslide » Fri Feb 25, 2005 8:07 pm

I believe it's planned for the next major version. Probably won't be using a bashrc, tho. Funny thing is, it's not that useful unless you're trying to run your system on the edge. You'd think this is something the dev's wouldn't particularly care for owing to all the false bugreports people like me can generate :) <flame protection> I don't, I make sure on another system before filing</flame protection>
Top
IvanYosifov
l33t
l33t
User avatar
Posts: 778
Joined: Fri Oct 15, 2004 6:33 pm
Location: Bulgaria

  • Quote

Post by IvanYosifov » Fri Feb 25, 2005 8:38 pm

Well , I deffinitely try to run the system on the edge. But I still want it to run, though :) Per-package CFLAGS can actually help bring down the number of false bug-reports. You will be able to heavily optimize only the parts of the system that matter and are ( considered ) safe. This is better than having global agressive CFLAGS , I guess.
Top
thebigslide
l33t
l33t
User avatar
Posts: 792
Joined: Thu Dec 23, 2004 12:25 pm
Location: under a car or on top of a keyboard

  • Quote

Post by thebigslide » Fri Feb 25, 2005 9:43 pm

Haha, I do it the other way around. Global aggressive CFLAGS and I drop them down for individual packages when things break :twisted:
Top
thebigslide
l33t
l33t
User avatar
Posts: 792
Joined: Thu Dec 23, 2004 12:25 pm
Location: under a car or on top of a keyboard

  • Quote

Post by thebigslide » Thu Mar 03, 2005 9:55 am

now there's no need to change make.conf for packages broken by userpriv or sandboxing! I just added package.features support and fixed the use of GLOBALCFLAGS and the like in the config files (which were broken the whole time and I never realized it :oops:)

The use of GLOBALwhatever is as follows

Code: Select all

##/etc/portage/package.features
x11-wm/fluxbox GLOBALFEATURES cvs
Please note the absense of $ or {}, which is intentional.
Last edited by thebigslide on Thu Mar 03, 2005 11:28 am, edited 1 time in total.
Top
thebigslide
l33t
l33t
User avatar
Posts: 792
Joined: Thu Dec 23, 2004 12:25 pm
Location: under a car or on top of a keyboard

  • Quote

Post by thebigslide » Thu Mar 03, 2005 11:26 am

Here's another little tastey that will remove duplicate entries in /etc/portage/package.use, cflags, cxxflags, features, merge and sort the arguments and warn of opposing USE flags.
EDIT: Merged into the first post for clarity of use.
If it breaks anything, the old filenames are prepended with a '.'
Top
nelix
n00b
n00b
Posts: 30
Joined: Mon Dec 22, 2003 4:58 pm
Location: Melbourne Australia

  • Quote

Post by nelix » Wed Mar 16, 2005 3:51 pm

this feature needs to be added to portage :P

Very nice.
eof
Top
ferret
n00b
n00b
Posts: 22
Joined: Wed Jul 30, 2003 8:43 pm
Location: Oxford UK
Contact:
Contact ferret
Website

  • Quote

Post by ferret » Sat Mar 19, 2005 4:30 pm

Instead of using a huge bash script, you could just do this in make.conf:

CFLAGS="${MAIN_CFLAGS} `cat /tmp/cflags/\${PN} 2>/dev/null`"

and yes, this can actually work, sortof. I put my options in a file /tmp/cflags/yacc then did 'emerge yacc', and sure enough:

i686-pc-linux-gnu-gcc `cat /tmp/cflags/yacc` -o yacc closure.c error.c lalr.c lr0.c main.c mkpar.c .........

And yes, it does actually read from the file and use the options therein. I checked. Slight problem however: it breaks configure scripts. Like, all of them. So don't use it. :)
Top
Maedhros
Bodhisattva
Bodhisattva
User avatar
Posts: 5511
Joined: Wed Apr 14, 2004 8:10 pm
Location: Durham, UK

  • Quote

Post by Maedhros » Sat Mar 19, 2005 10:25 pm

Moved from Portage & Programming.
No-one's more important than the earthworm.
Top
saltine
n00b
n00b
User avatar
Posts: 24
Joined: Fri Mar 25, 2005 6:46 pm
Location: Winnipeg, Canada

Nice work!

  • Quote

Post by saltine » Fri Mar 25, 2005 9:21 pm

I like the script. It seems to do a nice job.
Top
SoTired
Apprentice
Apprentice
User avatar
Posts: 174
Joined: Wed May 19, 2004 12:52 am

  • Quote

Post by SoTired » Tue Apr 05, 2005 11:23 pm

First off, great script! This is definitely a really needed feature.

Anyways, I decided to add a little feature to it, namely package.ldflags - along the way I kind of moved all the repetative code into one big function. So feel free to add changes or not or whatever - here's what I ended up with (not sure how well it works):

Code: Select all

## Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /etc/portage/bashrc$
# Originally written by Ned Ludd (solar_at_gentoo.org)
# modifications by Ryan McIntosh (thebigslide_at_gmail.com)
# V1.0_rc1
# - /etc/portage/bashrc

loopize()
{
	local file=$1
	local var
	
	# Bail if file does not exist or is not readable.
	[ -r ${ROOT}/etc/portage/package.$file ] || return 0
		
	while read -a target
	do
		unset var
		if [ "${target}" = "${CATEGORY}" -o "${target}" = "${CATEGORY}/${PN}" ]
		then
			unset `echo $file | /usr/bin/tr a-z A-Z`
			# Skip the package part of the line
			target[0]=""
			for i in "${target[@]}"
			do
				case "$i" in
					GLOBALCFLAGS) var="$var $GLOBALCFLAGS" ;;
					GLOBALCXXFLAGS) var="$var $GLOBALCXXFLAGS" ;;
					GLOBALLDFLAGS) var="$var $GLOBALLDFLAGS" ;;
					GLOBALFEATURES) var="$var $GLOBALFEATURES" ;;
					*) var="$var $i"
				esac
			done
			export `echo $file | /usr/bin/tr a-z A-Z`="`echo $var`"
		fi
	done < ${ROOT}/etc/portage/package.$file
}

if [ "$0" = "/usr/lib/portage/bin/ebuild.sh" -o "$0" = "/usr/lib/portage/bin/ebuild-daemon.sh" ]
then
	export GLOBALCFLAGS=$CFLAGS
	export GLOBALCXXFLAGS=$CXXFLAGS
	export GLOBALLDFLAGS=$LDFLAGS
	export GLOBALFEATURES=$FEATURES
	loopize "cflags"
	loopize "cxxflags"
	loopize "ldflags"
	loopize "features"
	unset GLOBALCFLAGS
	unset GLOBALCXXFLAG
	unset GLOBALLDFLAGS
	unset GLOBALFEATURES
else
	echo "This bashrc does not know anything about $0"
fi

EDIT: Fixed the problem mentioned by dirtyepic one post down.
Last edited by SoTired on Fri Apr 15, 2005 7:38 pm, edited 1 time in total.
Top
rhill
Retired Dev
Retired Dev
User avatar
Posts: 1629
Joined: Fri Oct 22, 2004 9:58 am
Location: sk.ca

  • Quote

Post by rhill » Fri Apr 15, 2005 8:25 am

nice work. :D

i tried SoTired's script because right now i need per-package LDFLAGS management, but it doesn't seem to be working. it looks like the values set in make.conf are getting wiped for all packages, whether they have an entry in the new package files or not.

i changed the bzip2 ebuild to print the environment info emerge was seeing.

with package.cflags/cxxflags/ldflags/features empty:

Code: Select all

CFLAGS: 
CXXFLAGS: 
LDFLAGS: 
FEATURES: 
added some flags using the syntax 'app-arch/bzip2 [flags]':

Code: Select all

CFLAGS: -O2 -fweb
CXXFLAGS: -O2 -fweb
LDFLAGS: -Wl,-O1
FEATURES: test
which is what i entered so that bit works. but here's something strange i found when i added the GLOBAL stuff in each file.

Code: Select all

CFLAGS: -O2 -march=pentium3 -fomit-frame-pointer -pipe -fno-ident -floop-optimize2 -ftree-vectorize -ftree-vectorizer-verbose=1 -O2 -fweb -O2 -fweb -O2 -fweb
CXXFLAGS: -O2 -march=pentium3 -fomit-frame-pointer -pipe -fno-ident -floop-optimize2 -ftree-vectorize -ftree-vectorizer-verbose=1 -fvisibility-inlines-hidden -O2 -fweb -O2 -fweb -O2 -fweb
LDFLAGS: -Wl,-O1 -Wl,-O1 -Wl,-O1
FEATURES: autoaddcvs autoconfig ccache distlocks sandbox sfperms test test test
so it does have my make.conf values stored, it's just not using them when it should. i have no idea why the flags i added to the package files all get appended 3 times to the end though.

i'll give thebigslide's bashrc a try and see if works and if it does what the difference is..

[edit]
thebigslide's bashrc also has the triple-flag thing when using GLOBALs but otherwise works as advertised. i think that all that needs fixing is detecting whether a package is actually in the package files and carrying over the make.conf values when it's not.
by design, by neglect
for a fact or just for effect
Top
SoTired
Apprentice
Apprentice
User avatar
Posts: 174
Joined: Wed May 19, 2004 12:52 am

  • Quote

Post by SoTired » Fri Apr 15, 2005 7:39 pm

The flags being added three times is (I believe) a problem with portage. It definitely calls the bashrc more than once, but perhaps it is supposed to do so. In any case having the flags more than once doesn't hurt anything.

About my modifications breaking everything: Oops. I think I fixed it, I had a line in the wrong place.
Top
thebigslide
l33t
l33t
User avatar
Posts: 792
Joined: Thu Dec 23, 2004 12:25 pm
Location: under a car or on top of a keyboard

  • Quote

Post by thebigslide » Sat Apr 16, 2005 6:38 pm

Glad I've helped a few people out. Just out of curiosity, what packages are you compiling with special ldflags?
Top
smoked
n00b
n00b
User avatar
Posts: 38
Joined: Tue Jan 11, 2005 10:30 am

  • Quote

Post by smoked » Sun Apr 17, 2005 7:27 am

I tried SoTired's version and found a few things I felt could be improved:
  • Fails to read last line if not ended by a linebreak.
  • Doesn't prioritise package entries over category entries.
  • Doesn't notice duplicated entries.
  • Doesn't provide a mechanism for feedback about what the script actually does.
Eventually I ended up doing a complete rewrite. Here's the result:

Code: Select all

## Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /etc/portage/bashrc$
# Originally written by Ned Ludd (solar_at_gentoo.org)
# modifications by Ryan McIntosh (thebigslide_at_gmail.com)
# rewrite by Magnus Lidbom (magnus.lidbom_at_gmail.com)
# V1.0_rc1
# - /etc/portage/bashrc

print_debug_message()
{
   if [ "$DEBUG" != "" ]; then  
      echo "BASHRC":$1  
   fi 
}

print_error_message()
{
   echo "BASHRC:ERROR:"$1  
}

attemp_override()
{
   local setting=$1
   local global_setting=`eval echo '$'$setting`
   local include_global_setting=GLOBAL$setting
   local package_pattern="^[[:space:]]*${CATEGORY}/${PN}[[:space:]]"
   local category_pattern="^[[:space:]]*${CATEGORY}[[:space:]]"
   
   local file=${ROOT}etc/portage/package.`echo $setting | /usr/bin/tr A-Z a-z`	
   if [ -r $file ] 
   then     
      package_settings=`/bin/grep $package_pattern $file | /bin/sed s/"${CATEGORY}\/${PN}"//g`
      if [ "$package_settings" != "" ]; then          
         if [ `/bin/grep $package_pattern $file | /bin/wc -l` -gt 1 ]; then
            print_error_message "${CATEGORY}/${PN}:$setting: multiple rows for package in $file. Ignoring overridden setting."
            return
         fi
         print_debug_message "${CATEGORY}/${PN}:$setting: Package override."
      else
         package_settings=`/bin/grep $category_pattern $file | /bin/sed s/"${CATEGORY}"//g`	 
         if [ "$package_settings" != "" ]; then
            if [ `/bin/grep $category_pattern $file | /bin/wc -l` -gt 1 ]; then
               print_error_message "${CATEGORY}/${PN}:$setting: multiple rows for category in $file. Ignoring overridden setting."
               return
            fi    
            print_debug_message "${CATEGORY}/${PN}:$setting: Category override"
         else
            print_debug_message "${CATEGORY}/${PN}:$setting: No override."
            return
         fi        
      fi
                   
      print_debug_message "${CATEGORY}/${PN}:$setting:old: $global_setting"
      print_debug_message "${CATEGORY}/${PN}:$setting:new: `echo $package_settings | /bin/sed s/"$include_global_setting"/"$global_setting"/g`"
      
      export `echo $setting`="`echo $package_settings | /bin/sed s/"$include_global_setting"/"$global_setting"/g`"
   fi
}

if [ "$0" = "/usr/lib/portage/bin/ebuild.sh" -o "$0" = "/usr/lib/portage/bin/ebuild-daemon.sh" ]
then
   attemp_override "CFLAGS"
   attemp_override "CXXFLAGS"
   attemp_override "LDFLAGS"
   attemp_override "FEATURES"
else
   echo "This bashrc does not know anything about $0"
fi
Simple way to test:

Code: Select all

DEBUG=1 ebuild /usr/portage/net-www/apache/apache-2.0.53.ebuild clean
Setting the DEBUG environment variable makes the sript print info about what it finds and does.

:!: This is my first, non-trivial, bash script. I'd appreciate constructive feedback.
Top
rhill
Retired Dev
Retired Dev
User avatar
Posts: 1629
Joined: Fri Oct 22, 2004 9:58 am
Location: sk.ca

  • Quote

Post by rhill » Sun Apr 17, 2005 10:43 am

thebigslide wrote:Glad I've helped a few people out. Just out of curiosity, what packages are you compiling with special ldflags?
i was having some issues with binutils 2.16 on certain packages, but i managed to figure out the problem since. :D
Setting the DEBUG environment variable makes the sript print info about what it finds and does.
cool. that's going to come in handy.
by design, by neglect
for a fact or just for effect
Top
Schwinni
Apprentice
Apprentice
Posts: 214
Joined: Thu Sep 02, 2004 6:48 am
Location: quadrant1.earth. germany.wuerzburg
Contact:
Contact Schwinni
Website

  • Quote

Post by Schwinni » Wed May 04, 2005 9:21 am

thebigslide wrote:Glad I've helped a few people out. Just out of curiosity, what packages are you compiling with special ldflags?
I don't use any special ldflags, but I have to use some special cflags:

libsdl 1.2.8 and ocaml don't compile with "-msse2" (what a shame).

And I'm gonna do a "emerge -e" with my system.
I'm very happy that I have found this script, because else I never could do this! :)

Thanks and greetz.

Schwinni

P.S.: Ah yes, among all the code pieces posted here in this script, what is the "right" version to use?
Top
Enlight
Advocate
Advocate
User avatar
Posts: 3519
Joined: Thu Oct 28, 2004 9:42 am
Location: Alsace (France)

  • Quote

Post by Enlight » Wed May 04, 2005 10:04 am

Great, this and the mount into ram how-to, I really should track yours posts :wink:
thebigslide wrote:Glad I've helped a few people out. Just out of curiosity, what packages are you compiling with special ldflags?
Emacs breaks without empty ldflags settings.

BTW I was wondering, your script doesn't override the stripe/append/etc.../-flag(s) from ebuilds?
Top
gnelson
n00b
n00b
Posts: 1
Joined: Sun Jul 03, 2005 8:59 pm

package.features doesnt work for me

  • Quote

Post by gnelson » Sun Jul 03, 2005 9:08 pm

Hello, thank you for this script as imho gentoo is really needing a package.cflags and a package.features .

package.features does not work for me, this is the line I have in package.features:
gnome-base/gnome-vfs GLOBALFEATURES nostrip noclean
Top
Post Reply

65 posts
  • 1
  • 2
  • 3
  • Next

Return to “Unsupported Software”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy