#10430: Add some bugfixes to the PARI package
------------------------------+---------------------------------------------
   Reporter:  jdemeyer        |       Owner:  tbd                   
       Type:  defect          |      Status:  needs_work            
   Priority:  blocker         |   Milestone:  sage-4.6.2            
  Component:  packages        |    Keywords:  pari spkg bugs patches
     Author:  Jeroen Demeyer  |    Upstream:  N/A                   
   Reviewer:                  |      Merged:                        
Work_issues:                  |  
------------------------------+---------------------------------------------

Comment(by leif):

 Suggested changes:
 {{{
 #!diff
 diff -r d58606ef346e spkg-install
 --- a/spkg-install      Sun Dec 12 06:20:42 2010 +0100
 +++ b/spkg-install      Sun Dec 12 06:51:15 2010 +0100
 @@ -174,12 +174,12 @@

      if [ $? -ne 0 ]; then
          echo >&2 "Error: Configuring PARI with readline and GMP kernel
 failed."
 -        return 1
 +        exit 1
      fi

      if [ ! -f Makefile ]; then
          echo >&2 "Error: Unable to configure PARI: No Makefile
 generated!"
 -        return 1
 +        exit 1
      fi

      if [ "$UNAME" = "CYGWIN" ]; then
 @@ -198,7 +198,8 @@
  {
      echo "Installing PARI/GP..."

 -    $MAKE install install-lib-sta
 +    # Parallel install is broken:
 +    $MAKE -j1 install install-lib-sta
      if [ $? -ne 0 ]; then
          echo >&2 "Error installing PARI"
          exit 1
 @@ -258,20 +259,30 @@
  else
      # First try -O3, then -O2 and so on until the build works.
      # This is mainly meant to work around compiler bugs.
 -    initial_CFLAGS="-g $CFLAGS"
 -    for optflag in -O3 -O2 -O1 -O0; do
 -        CFLAGS="$optflag $initial_CFLAGS"
 -        echo "==========================================="
 -        echo "Building PARI/GP with optimization flag $optflag"
 -        echo "==========================================="
 -        if build; then
 -            build_success=yes
 -            break
 -        fi
 -    done
 +    CFLAGS="-O3 -g $CFLAGS"
 +    echo "==========================================="
 +    echo "Building PARI/GP with default optimization"
 +    echo "(-O3 or user-specified optimization level)"
 +    echo "==========================================="
 +    if ! build; then
 +        echo >&2 "Warning: Initial build of PARI/GP failed - retrying
 with" \
 +            "less optimization..."
 +        for optflag in -O2 -O1 -O0; do
 +            CFLAGS="$CFLAGS $optflag"
 +            echo "==========================================="
 +            echo "Building PARI/GP with optimization flag $optflag"
 +            echo "==========================================="
 +            if build; then
 +                build_success=yes
 +                break
 +            fi
 +        done
 +    else
 +        build_success=yes
 +    fi
  fi

 -if [ $build_success -ne yes ]; then
 +if [ $build_success != yes ]; then
      echo >&2 "Error building PARI/GP"
      exit 1
  fi
 @@ -280,9 +291,9 @@
  install


 -# All (previous) errors are catched in build(), so we don't test $? here.
 -# Although we perhaps should also check success of the numerous copy
 commands
 -# inside build().
 +# All (previous) errors are catched in build() and install(), so we don't
 test
 +# $? here. Although we perhaps should also check success of the numerous
 copy
 +# commands inside install().

  if [ "$UNAME" = "Darwin" ]; then
      pari_shlib="libpari.dylib"
 }}}

 Of course we could handle modified `CFLAGS` differently, such that we
 don't eventually end up with `-O3 -g ... -O2 -O1 -O0`, but that's IMHO a
 minor, cosmetic issue.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10430#comment:25>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to