Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
/etc/portage/package.c{,xx}flags features - v1.0_rc1
View unanswered posts
View posts from last 24 hours

Goto page 1, 2, 3  Next  
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
thebigslide
l33t
l33t


Joined: 23 Dec 2004
Posts: 787
Location: under a car or on top of a keyboard

PostPosted: Sun Jan 16, 2005 10:40 pm    Post subject: /etc/portage/package.c{,xx}flags features - v1.0_rc1 Reply with quote

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:
## 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:
# 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:
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:
##/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
Back to top
View user's profile Send private message
Bob P
Advocate
Advocate


Joined: 20 Oct 2004
Posts: 3355
Location: Jackass! Development Labs

PostPosted: Sun Jan 16, 2005 11:15 pm    Post subject: Reply with quote

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:
_________________
.
Stage 1/3 | Jackass! | Rockhopper! | Thanks | Google Sucks
Back to top
View user's profile Send private message
thebigslide
l33t
l33t


Joined: 23 Dec 2004
Posts: 787
Location: under a car or on top of a keyboard

PostPosted: Mon Jan 17, 2005 7:55 am    Post subject: Reply with quote

EDIT: Merged into the first post.

Last edited by thebigslide on Fri Mar 04, 2005 9:42 am; edited 4 times in total
Back to top
View user's profile Send private message
thebigslide
l33t
l33t


Joined: 23 Dec 2004
Posts: 787
Location: under a car or on top of a keyboard

PostPosted: Mon Jan 17, 2005 8:40 am    Post subject: Reply with quote

Can someone help me out with those ugly for loops?
Back to top
View user's profile Send private message
sn4ip3r
Guru
Guru


Joined: 14 Dec 2002
Posts: 325
Location: Tallinn, Estonia

PostPosted: Mon Jan 17, 2005 1:20 pm    Post subject: Reply with quote

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


Use
Code:
for i in `seq 20`; do
Back to top
View user's profile Send private message
thebigslide
l33t
l33t


Joined: 23 Dec 2004
Posts: 787
Location: under a car or on top of a keyboard

PostPosted: Mon Jan 17, 2005 3:04 pm    Post subject: Reply with quote

thanks. I tried that last night, but didn't try /bin/seq. Edit made. I was looking for something like:
Code:
 while ${target[$i]}; do
I can't seem to figure out the syntax.
Back to top
View user's profile Send private message
IvanYosifov
l33t
l33t


Joined: 15 Oct 2004
Posts: 778
Location: Bulgaria

PostPosted: Fri Feb 25, 2005 2:57 pm    Post subject: Reply with quote

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 ?
Back to top
View user's profile Send private message
thebigslide
l33t
l33t


Joined: 23 Dec 2004
Posts: 787
Location: under a car or on top of a keyboard

PostPosted: Fri Feb 25, 2005 8:07 pm    Post subject: Reply with quote

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>
_________________
/etc/portage/package.c{,xx}flags and package.features!
All posts released under the GPL and the Creative Commons license
Back to top
View user's profile Send private message
IvanYosifov
l33t
l33t


Joined: 15 Oct 2004
Posts: 778
Location: Bulgaria

PostPosted: Fri Feb 25, 2005 8:38 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
thebigslide
l33t
l33t


Joined: 23 Dec 2004
Posts: 787
Location: under a car or on top of a keyboard

PostPosted: Fri Feb 25, 2005 9:43 pm    Post subject: Reply with quote

Haha, I do it the other way around. Global aggressive CFLAGS and I drop them down for individual packages when things break :twisted:
_________________
/etc/portage/package.c{,xx}flags and package.features!
All posts released under the GPL and the Creative Commons license
Back to top
View user's profile Send private message
thebigslide
l33t
l33t


Joined: 23 Dec 2004
Posts: 787
Location: under a car or on top of a keyboard

PostPosted: Thu Mar 03, 2005 9:55 am    Post subject: Reply with quote

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:
##/etc/portage/package.features
x11-wm/fluxbox GLOBALFEATURES cvs
Please note the absense of $ or {}, which is intentional.
_________________
/etc/portage/package.c{,xx}flags and package.features!
All posts released under the GPL and the Creative Commons license


Last edited by thebigslide on Thu Mar 03, 2005 11:28 am; edited 1 time in total
Back to top
View user's profile Send private message
thebigslide
l33t
l33t


Joined: 23 Dec 2004
Posts: 787
Location: under a car or on top of a keyboard

PostPosted: Thu Mar 03, 2005 11:26 am    Post subject: Reply with quote

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 '.'
_________________
/etc/portage/package.c{,xx}flags and package.features!
All posts released under the GPL and the Creative Commons license
Back to top
View user's profile Send private message
nelix
n00b
n00b


Joined: 22 Dec 2003
Posts: 30
Location: Melbourne Australia

PostPosted: Wed Mar 16, 2005 3:51 pm    Post subject: Reply with quote

this feature needs to be added to portage :P

Very nice.
_________________
eof
Back to top
View user's profile Send private message
ferret
n00b
n00b


Joined: 30 Jul 2003
Posts: 22
Location: Oxford UK

PostPosted: Sat Mar 19, 2005 4:30 pm    Post subject: Reply with quote

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. :)
Back to top
View user's profile Send private message
Maedhros
Bodhisattva
Bodhisattva


Joined: 14 Apr 2004
Posts: 5511
Location: Durham, UK

PostPosted: Sat Mar 19, 2005 10:25 pm    Post subject: Reply with quote

Moved from Portage & Programming.
_________________
No-one's more important than the earthworm.
Back to top
View user's profile Send private message
saltine
n00b
n00b


Joined: 25 Mar 2005
Posts: 24
Location: Winnipeg, Canada

PostPosted: Fri Mar 25, 2005 9:21 pm    Post subject: Nice work! Reply with quote

I like the script. It seems to do a nice job.
Back to top
View user's profile Send private message
SoTired
Apprentice
Apprentice


Joined: 19 May 2004
Posts: 173

PostPosted: Tue Apr 05, 2005 11:23 pm    Post subject: Reply with quote

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:
## 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
Back to top
View user's profile Send private message
rhill
Developer
Developer


Joined: 22 Oct 2004
Posts: 1629
Location: sk.ca

PostPosted: Fri Apr 15, 2005 8:25 am    Post subject: Reply with quote

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:
CFLAGS:
CXXFLAGS:
LDFLAGS:
FEATURES:


added some flags using the syntax 'app-arch/bzip2 [flags]':
Code:
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:
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
Back to top
View user's profile Send private message
SoTired
Apprentice
Apprentice


Joined: 19 May 2004
Posts: 173

PostPosted: Fri Apr 15, 2005 7:39 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
thebigslide
l33t
l33t


Joined: 23 Dec 2004
Posts: 787
Location: under a car or on top of a keyboard

PostPosted: Sat Apr 16, 2005 6:38 pm    Post subject: Reply with quote

Glad I've helped a few people out. Just out of curiosity, what packages are you compiling with special ldflags?
_________________
/etc/portage/package.c{,xx}flags and package.features!
All posts released under the GPL and the Creative Commons license
Back to top
View user's profile Send private message
smoked
n00b
n00b


Joined: 11 Jan 2005
Posts: 38

PostPosted: Sun Apr 17, 2005 7:27 am    Post subject: Reply with quote

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:

## 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:

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.
Back to top
View user's profile Send private message
rhill
Developer
Developer


Joined: 22 Oct 2004
Posts: 1629
Location: sk.ca

PostPosted: Sun Apr 17, 2005 10:43 am    Post subject: Reply with quote

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

Quote:
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
Back to top
View user's profile Send private message
Schwinni
Apprentice
Apprentice


Joined: 02 Sep 2004
Posts: 214
Location: quadrant1.earth. germany.wuerzburg

PostPosted: Wed May 04, 2005 9:21 am    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
Enlight
Advocate
Advocate


Joined: 28 Oct 2004
Posts: 3514
Location: Alsace (France)

PostPosted: Wed May 04, 2005 10:04 am    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
gnelson
n00b
n00b


Joined: 03 Jul 2005
Posts: 1

PostPosted: Sun Jul 03, 2005 9:08 pm    Post subject: package.features doesnt work for me Reply with quote

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
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum