First Last Prev Next    No search results available      Search page      Enter new bug
Bug#: 46816
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Donnie Berkholz <dberkholz@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Aron Griffis (RETIRED) <agriffis@gentoo.org>
Add CC:
CC:
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
molden-4.0.ebuild.patch patch for molden-4.0.ebuild patch Aron Griffis (RETIRED) 2004-04-04 20:06 0000 1.98 KB Details | Diff
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 46816 depends on: Show dependency tree
Show dependency graph
Bug 46816 blocks:
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)







View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2004-04-04 19:54 0000
The molden ebuilds use error-prone syntax.  Here is a patch that prevents the
need for sedding the makefile.  The problem with the previous code was that it
assumed none of the variables would contain a colon, and there's no reason to
do all that work.

------- Comment #1 From Aron Griffis (RETIRED) 2004-04-04 20:06:08 0000 -------
Created an attachment (id=28714) [edit]
patch for molden-4.0.ebuild

------- Comment #2 From Aron Griffis (RETIRED) 2004-04-19 12:35:16 0000 -------
Full explanation of the patch:

1. Remove all the sedding.  There are a few problems with using sed like this: First it relies on future versions of the Makefile using the same formatting.  Second it uses ${CFLAGS} in a sed expression, which has the potential to screw up sed if anything in ${CFLAGS} is a sed meta-character.  Third, there was no checking (|| die) after the expressions, so you'd never know if sed were to stop working.  Fourth, it makes a lot more sense to move variable dependencies into src_compile() where they're actually used.

2. The "use alpha && append-flags -mieee" was something I found in the molden documentation or Makefile while reading through.  Since I work on alpha I know essentially what it does: protection against floating point exception on divide-by-zero.  Additionally it makes floating point math work correctly instead of just quickly.

3. Next, declare an array named args.  We use an array because it lets us have a list with items that include spaces, similar to using positional parameters ($1, $2, "$@", etc) but storing in a named location.

4. Assign a list to the array.  Here are the elements in the array:
     CC="${CC} ${CFLAGS}"
        This is a single element in the array, which contains spaces.
        It will be passed to make as an argument to override the Makefile's
        default CC

     ${FC:+FC="${FC}" LDR="${FC}"}
        Okay, this takes a little explanation.  :-)  The first thing to
        understand is this: ${VAR:+blah}.  This means: If VAR is empty then
        substitute nothing, otherwise substitute blah.  In this case VAR is
        FC and blah is FC="${FC}" LDR="${FC}".

        So the result?  If FC is set, then we'll add 2 elements to the array:
        FC="${FC}" and LDR="${FC}".  If FC is unset or empty, then we'll add
        nothing to the array.  Make sense?  This construct is particularly 
        useful when making conditional assignments to an array.

     ${FFLAGS:+FFLAGS="${FFLAGS}"}
        This is pretty much the same as FC above

     emake "${args[@]}"
        This passes the args array to emake on the cmdline, preserving spacing.
        It's exactly like doing "$@" but uses the args array instead of the
        positional parameters.  The result would look something like this:
           emake CC="gcc -mcpu=alphaev67 -O3 -pipe -mieee" \
              FFLAGS="-my -fflags"

     emake "${args[@]}" moldenogl
        This is the reason we stuffed everything into args instead of putting
        it all on the cmdline.  It's because we need to call emake more than
        once and we want to avoid duplicated information in the ebuild.

Hope this helps!

------- Comment #3 From Donnie Berkholz 2004-04-21 11:25:54 0000 -------
Fixed. Thanks for inspiring me to read up on some advanced bash.

First Last Prev Next    No search results available      Search page      Enter new bug