Attachment 'sage-4.6.1.alpha2.patch'

Download

   1 local/bin/make000755 000314 000000 00000000000 11320004222 017537 2/usr/local/bin/gmakeustar00peterwheel000000 000000 local/bin/gfortran000755 000314 000000 00000000000 11423202337 021366 2/usr/local/bin/gfortran45ustar00peterwheel000000 000000 local/bin/gcc000755 000314 000000 00000000000 11413615755 017225 2/usr/local/bin/gcc45ustar00peterwheel000000 000000 local/bin/g++000755 000314 000000 00000000000 11413615761 016662 2/usr/local/bin/g++45ustar00peterwheel000000 000000 spkg/base/sage-spkg000755 000314 000000 00000033564 11471023065 015020 0ustar00peterwheel000000 000000 #!/usr/bin/env bash
   2 
   3 # William Stein, 2005-12-20 -- removed "m" option from tar,
   4 # which was seriously confusing the build process on some
   5 # (too fast?) machines, especially for mpfr. 
   6 
   7 #######################################################
   8 #  Install a Sage package.  This script is
   9 #  typically invoked by giving the command
  10 #      sage -i <package name>
  11 #
  12 #  A package may assume that the following environment 
  13 #  variables are defined:
  14 #
  15 #      SAGE_ROOT   -- root directory of sage install
  16 #      SAGE_LOCAL  -- $SAGE_ROOT/local
  17 #      SAGE_DATA   -- $SAGE_ROOT/data
  18 #      LIBRARY_PATH, PYTHONPATH, LD_LIBRARY_PATH, DYLD_LIBRARY_PATH
  19 #      CC, CXX, CFLAGS, CXXFLAGS, LDFLAGS, MAKE
  20 #
  21 #  Your package script should try to build using the giving CC, CXX,
  22 #  CFLAGS, MAKE, etc, via a file spkg-install in your script.
  23 #
  24 #  This script does the following:
  25 #
  26 #      1. Set environment variables (by calling sage-env)
  27 #      2. Decompress package into a build directory
  28 #      3. Run the script in the package called spkg-install
  29 #      4. Return error 1 if anything goes wrong.
  30 #
  31 #######################################################
  32 
  33 mymkdir()
  34 {
  35     if [ ! -d $1 ]; then
  36 	    mkdir $1
  37     fi
  38 }
  39 
  40 no_version()
  41 {
  42     if [ -z "`echo "$1" | grep -`" ]; then
  43         echo "no version"
  44     fi
  45 }
  46 # The following sets environment variables for building
  47 # packages.  (Using dot suggested by W. Cheung.)
  48 
  49 . "$SAGE_ROOT/local/bin/sage-env"
  50 
  51 cd "$SAGE_PACKAGES"
  52 
  53 if [ $# -eq 0 ]; then
  54     echo "Currently installed packages:"
  55     /bin/ls -1 "$SAGE_PACKAGES/installed/"
  56     exit 0
  57 fi
  58 
  59 
  60 cd "$SAGE_PACKAGES"
  61 mymkdir "$BUILD"
  62 mymkdir installed
  63 cd "$BUILD"
  64 mymkdir old
  65 
  66 # the following two options are mutually exclusive -- i.e., you
  67 # can give only one. 
  68 
  69 INFO=0
  70 if [ $1 = '-info' ]; then
  71     INFO=1
  72     shift
  73 fi
  74 
  75 FORCE=0
  76 if [ $1 = '-f' ]; then
  77     FORCE=1
  78     shift
  79 fi
  80 export FORCE
  81 
  82 DELETE_TMP=0
  83 if [ $1 = '-s' -o $1 = '-m' ]; then
  84     DELETE_TMP=0
  85     shift
  86 fi
  87 
  88 INSTALLED="$SAGE_PACKAGES/installed/"
  89 PKG_NAME=`echo "$1" | sed -e "s/\.spkg$//"`
  90 PKG_NAME=`basename "$PKG_NAME"`
  91 PKG_SRC="$1"
  92 PKG_BASE=`echo "$PKG_NAME" | sed -e "s/-.*//"`
  93 
  94 # check if noclobber is set and warn about it
  95 if [ $PKG_SRC == "noclobber" ]; then
  96     echo "***********************************************************"
  97     echo "* WARNING WARNING WARNING WARNING WARNING WARNING WARNING *"
  98     echo "*                                                         *"
  99     echo "* noclobber is set in .bashrc and/or .bash_profile - you  *"
 100     echo "* should consider disabling it. The Sage install should   *"
 101     echo "* continue to work, so don't worry about it too much.     *"
 102     echo "*                                                         *"
 103     echo "* WARNING WARNING WARNING WARNING WARNING WARNING WARNING *"
 104     echo "***********************************************************"
 105     exit 0
 106 fi
 107 
 108 if [ ! -f "$PKG_SRC" ]; then
 109     if [ -f "$SAGE_PACKAGES/standard/$PKG_NAME.spkg" ]; then
 110         PKG_SRC="$SAGE_PACKAGES/standard/$PKG_NAME.spkg"
 111     else
 112         if [ -f "$SAGE_PACKAGES/optional/$PKG_NAME.spkg" ]; then
 113             PKG_SRC="$SAGE_PACKAGES/optional/$PKG_NAME.spkg"
 114         else
 115             CUR=`pwd`
 116             cd "$SAGE_PACKAGES"
 117             PKG_NEWEST_VER=`./standard/newest_version "$PKG_NAME" 2> /dev/null`
 118             if [ -n "$PKG_NEWEST_VER" ]; then
 119                 PKG_SRC="$SAGE_PACKAGES/standard/$PKG_NEWEST_VER.spkg"
 120             else
 121                 PKG_NEWEST_VER=`./standard/newest_version -base "$PKG_NAME" 2> /dev/null`
 122                 if [ -n "$PKG_NEWEST_VER" ]; then
 123                     PKG_SRC="$SAGE_PACKAGES/standard/$PKG_NEWEST_VER.spkg"
 124                 fi
 125             fi
 126         fi
 127     fi
 128 fi
 129 
 130 # Don't verbosely extract files from spkgs by default (#10040):
 131 
 132 if [ "$SAGE_SPKG_LIST_FILES" = "yes" ]; then
 133     UNTAR_VERBOSE=v
 134 else
 135     unset UNTAR_VERBOSE
 136 fi
 137 
 138 if [ $INFO -ne 0 ]; then
 139     if [ ! -f "$PKG_SRC" ]; then
 140         echo "Package $PKG_NAME not found"
 141     fi
 142     bunzip2 -c "$PKG_SRC" 2>/dev/null | tar Ofx${UNTAR_VERBOSE} - $PKG_NAME/SAGE.txt 2>/dev/null
 143     if [ $? -ne 0 ]; then
 144         tar Ofx${UNTAR_VERBOSE} "$PKG_SRC" "$PKG_NAME/SAGE.txt" 2>/dev/null
 145     fi
 146     echo ""
 147     if [ $? -ne 0 ]; then
 148         echo "No file SAGE.txt in $PKG_NAME"
 149         exit 1
 150     fi
 151     exit 0
 152 fi
 153 
 154 echo "$PKG_NAME"
 155 
 156 echo "Machine:"
 157 uname -a
 158 
 159 if [ -f "$INSTALLED/$PKG_NAME" -a $FORCE -eq 0 ]; then
 160     echo "sage: $1 is already installed"
 161     touch "$INSTALLED/$PKG_NAME"
 162     exit 0
 163 fi
 164 
 165 cd "$SAGE_PACKAGES/build"
 166 
 167 if [ $DELETE_TMP -eq 1 ]; then
 168     echo "Deleting directories from past builds of previous/current versions of $PKG_NAME"
 169     # Make triply sure that we are in the build directory before doing 
 170     # a scary "rm -rf".
 171     cd "$SAGE_PACKAGES/build"
 172     if [ $? -ne 0 ]; then 
 173         echo "Unable to find build directory."
 174     else
 175         rm -rf "$PKG_BASE-"* 
 176     fi 
 177 else
 178     echo "Moving directories from past builds of previous/current versions of $PKG_NAME to build/old"
 179     mv -f "$PKG_BASE-"* old/  2>/dev/null
 180 fi
 181 
 182 if [ ! -f "$PKG_SRC" ]; then
 183 
 184     echo "$0: file $PKG_NAME does not exist" 
 185     echo "Attempting to download it."
 186     CUR=`pwd`
 187     cd "$SAGE_PACKAGES"
 188     if [ ! -d optional ]; then
 189         mkdir optional
 190     fi
 191     cd optional
 192     
 193     FOUND_VERSION=''
 194     if [ -n "`no_version "$PKG_NAME"`" ]; then
 195         echo "Searching for latest version of $PKG_NAME"
 196         PKG_NAME=`sage-latest-online-package "$PKG_NAME"`
 197         if [ $? -eq 0 ]; then
 198             echo "Found package $PKG_NAME"
 199 	    FOUND_VERSION='1'
 200         else
 201             echo "$PKG_NAME"
 202             exit 1
 203         fi
 204     fi
 205 
 206     # See trac ticket #7544. One should be able to install a package using
 207     # sage -i <package-name> where <package-name> can be any of the
 208     # following values:
 209     #
 210     # 1. <package>-x.y.z, i.e. the name of the package plus the package's
 211     #    version numbers.
 212     # 2. the full name <package>-x.y.z.spkg, i.e. the name of the package in
 213     #    addition to the version numbers and the ".spkg" extension.
 214     # 3. <URL>/<package>-x.y.z.spkg, i.e. the full URL where the package is
 215     #    hosted. This can be a URL on the Sage website or somewhere else.
 216     # 4. /path/to/<package>-x.y.z.spkg, i.e. the package is found somewhere
 217     #    in your file system and you're giving an absolute or relative path
 218     #    to the package.
 219     #
 220     # See trac ticket #8043. If no version was specified but a version
 221     # was found above, then $PKG_NAME now contains the version number.
 222     # Download this, since it's a known Sage package.  Otherwise,
 223     # download the package specified by $1, since it either already
 224     # contains the version number or is a URL.
 225     if [ "x$FOUND_VERSION" = "x" ]; then
 226 	sage-download_package "$1"
 227     else
 228 	sage-download_package "$PKG_NAME"
 229     fi
 230     if [ ! -f "$PKG_NAME.spkg" ]; then 
 231 	    echo "sage: Failed to download package $PKG_NAME from $SAGE_SERVER"
 232 	    exit 1
 233     fi
 234     PKG_SRC="`pwd`/$PKG_NAME.spkg"
 235     cd "$CUR"
 236 fi
 237 
 238 # * The -i option below to ignore checksum errors, since 
 239 #   I've had problems with this on Solaris.
 240 # * The m option avoids clock skew problems.    
 241 
 242 echo "Extracting package $PKG_SRC ..."
 243 ls -l "$PKG_SRC"
 244 
 245 if [ -d "$PKG_NAME" ]; then
 246     echo "Removing previous version."
 247     rm -rf "$PKG_NAME"
 248 fi
 249 
 250 bunzip2 -c "$PKG_SRC" 2>/dev/null | tar fx${UNTAR_VERBOSE} -  2>/dev/null
 251 if [ ! -d "$PKG_NAME" ]; then
 252     tar fx${UNTAR_VERBOSE} "$PKG_SRC"
 253 fi
 254 echo "Finished extraction"
 255 
 256 if [ ! -d "$PKG_NAME" ]; then
 257     echo "sage: After decompressing the directory $PKG_NAME does not exist"
 258     echo "This means that the corresponding .spkg needs to be downloaded"
 259     echo "again."
 260     if [ -n "`no_version "$PKG_NAME"`" ]; then
 261         echo "Searching for latest version of $PKG_NAME"
 262         PKG_NAME=`sage-latest-online-package "$PKG_NAME"`
 263         if [ $? -eq 0 ]; then
 264             echo "Found package $PKG_NAME"
 265         else
 266             echo "$PKG_NAME"
 267             exit 1
 268         fi
 269     fi
 270     sage-download_package "$PKG_NAME"
 271     echo `pwd`
 272     bunzip2 -c "$PKG_NAME.spkg"  | tar fx${UNTAR_VERBOSE} - 
 273     if [ ! -d "$PKG_NAME.spkg" ]; then
 274         tar fx${UNTAR_VERBOSE} "$PKG_NAME.spkg"
 275     fi
 276     if [ ! -d "$PKG_NAME" ]; then
 277         echo "Second download resulted in a corrupted package."
 278         exit 1
 279     fi
 280 fi
 281 
 282 if [ -f "$SAGE_PACKAGES/patches/$PKG_NAME.patch" ]; then
 283     echo "Applying local patches for $PKG_NAME"
 284     if ! patch -p0 < "$SAGE_PACKAGES/patches/$PKG_NAME.patch"; then
 285 	echo "Patching failed"
 286 	exit 1
 287     fi
 288 fi
 289 
 290 cd "$PKG_NAME"
 291 if [ ! -f spkg-install ]; then
 292     echo "#!/usr/bin/env bash" > spkg-install
 293     echo "" >> spkg-install
 294     if [ -f setup.py ]; then
 295         echo "python setup.py install" >> spkg-install
 296     else
 297         if [ -f configure ]; then
 298             echo "./configure --prefix=\$SAGE_ROOT/local/" >> spkg-install
 299             echo "make" >> spkg-install
 300             echo "make install" >> spkg-install 
 301         else
 302             echo "There is no spkg-install script, no setup.py, and no configure script,"
 303             echo "so I do not know how to install $PKG_SRC."
 304             exit 1
 305         fi
 306     fi
 307 fi
 308 
 309 chmod +x spkg-install
 310 
 311 # this is just wrong... (so don't do it)
 312 #echo "TOUCHING"
 313 #touch * */* */*/* */*/*/* 1>/dev/null 2>/dev/null
 314 
 315 echo "****************************************************"
 316 echo "Host system"
 317 echo "uname -a:"
 318 uname -a
 319 if [ $? -ne 0 ]; then
 320     echo "Unable to determine host system information."
 321 fi
 322 echo "****************************************************"
 323 
 324 echo "****************************************************"
 325 echo "CC Version"
 326 echo "$CC -v"
 327 $CC -v
 328 if [ $? -ne 0 ]; then
 329     echo "Unable to determine C compiler version."
 330 fi
 331 echo "****************************************************"
 332 
 333 
 334 ##################################################################
 335 # If spkg-install is a Python script, verify that the Sage Python
 336 # has already been installed.
 337 ##################################################################
 338 # Check the first line of the file for the string "python".
 339 head -1 spkg-install | grep python > /dev/null
 340 if [ $? -eq 0 ]; then   # if it is found, then the exit code will be 0
 341     if [ ! -f "$SAGE_LOCAL"/bin/python ]; then   # now check if the python program is in local/bin/
 342          # if so, exit with an error.  
 343          echo "The spkg-install script depends on the Sage Python package,"
 344          echo "but the Sage Python package is not yet installed.  This may be"
 345          echo "a bug in the Sage build system dependency file.  Please"
 346          echo "update the $SAGE_ROOT/spkg/standard/deps makefile."
 347          exit 1
 348     fi 
 349 fi
 350 
 351 BASEDIR=`pwd`
 352 if [ -n "$DEBIAN_RELEASE" ]; then
 353     SAGE_CHECK=''
 354     if [ -e ./spkg-debian ]; then
 355 	    time ./spkg-debian
 356     else
 357 	    time sage-build-debian $BASEDIR
 358     fi
 359 else
 360     time ./spkg-install
 361 fi
 362 
 363 if [ $? -eq 0 ]; then
 364     cd $INSTALLED
 365     # TURNED OFF: Remove all old packages with the same name up to the first "-":
 366     # rm -f $PKG_BASE-*
 367 
 368     # Mark that the new package has been installed. 
 369     # This file will eventually be a certificate like in OS X.
 370     echo "PACKAGE NAME: $PKG_NAME" > "$PKG_NAME"
 371     echo "INSTALL DATE: `date`" >> "$PKG_NAME"
 372     echo "UNAME: `uname -a`" >> "$PKG_NAME"
 373     echo "Sage VERSION: `grep Sage $SAGE_LOCAL/bin/sage-banner`" >> "$PKG_NAME"
 374     echo "Successfully installed $PKG_NAME"
 375 
 376     cd $BASEDIR
 377     if [ "$SAGE_CHECK" != "" -a -f spkg-check ]; then
 378         echo "Running the test suite."
 379         chmod +x spkg-check
 380         ./spkg-check
 381         if [ $? -ne 0 ]; then
 382             echo "*************************************"
 383             echo "Error testing package ** $PKG_NAME **"
 384             echo "*************************************"
 385             rm -f $SAGE_ROOT/spkg/installed/$PKG_NAME
 386             echo "sage: An error occurred while testing $PKG_NAME"
 387             echo "Please email sage-devel http://groups.google.com/group/sage-devel"
 388             echo "explaining the problem and send the relevant part of"
 389             echo "of $SAGE_ROOT/install.log.  Describe your computer, operating system, etc."
 390             echo "If you want to try to fix the problem yourself, *don't* just cd to"
 391             echo "`pwd` and type 'make check' or whatever is appropriate."
 392             echo "Instead, the following commands setup all environment variables"
 393             echo "correctly and load a subshell for you to debug the error:"
 394             echo "(cd '`pwd`' && '$SAGE_ROOT/sage' -sh)"
 395             echo "When you are done debugging, you can type \"exit\" to leave the"
 396             echo "subshell."
 397             exit 1
 398         else 
 399             echo "TEST SUITE: passed" >> "$PKG_NAME"
 400         fi
 401     fi
 402 
 403 
 404     # Delete the temporary build directory if required.
 405     if [ $DELETE_TMP -eq 1 ]; then
 406         echo "Now cleaning up tmp files."
 407         if [ -d "$SAGE_PACKAGES/build/$PKG_NAME" ]; then
 408            # the if is there only to avoid the possibility of a weird bug.
 409             cd "$SAGE_PACKAGES/build/"
 410             rm -rf "$SAGE_PACKAGES/build/$PKG_NAME"
 411         fi
 412     else
 413         echo "You can safely delete the temporary build directory"
 414         echo "$SAGE_PACKAGES/build/$PKG_NAME"
 415     fi
 416 
 417 else
 418     echo "sage: An error occurred while installing $PKG_NAME"
 419     echo "Please email sage-devel http://groups.google.com/group/sage-devel"
 420     echo "explaining the problem and send the relevant part of"
 421     echo "of $SAGE_ROOT/install.log.  Describe your computer, operating system, etc."
 422     echo "If you want to try to fix the problem yourself, *don't* just cd to"
 423     echo "`pwd` and type 'make check' or whatever is appropriate."
 424     echo "Instead, the following commands setup all environment variables"
 425     echo "correctly and load a subshell for you to debug the error:"
 426     echo "(cd '`pwd`' && '$SAGE_ROOT/sage' -sh)"
 427     echo "When you are done debugging, you can type \"exit\" to leave the"
 428     echo "subshell."
 429     exit 1
 430 fi
 431 
 432 
 433 echo "Making Sage/Python scripts relocatable..."
 434 
 435 cd "$SAGE_LOCAL"/bin
 436 ./sage-make_relative
 437 
 438 echo "Finished installing $PKG_NAME.spkg" 
 439 
 440 # It's OK if the above fails -- in fact it will until Python
 441 # itself gets installed. That's fine. 
 442 exit 0   
 443 spkg/patches/000755 000314 000000 00000000000 11471023423 013711 5ustar00peterwheel000000 000000 spkg/patches/cephes-2.8.patch000644 000314 000000 00000122452 11423203347 016516 0ustar00peterwheel000000 000000 --- cephes-2.8/spkg-install.orig	2010-05-26 11:10:08.000000000 +1000
 444 +++ cephes-2.8/spkg-install	2010-07-26 08:25:54.669312906 +1000
 445 @@ -1,12 +1,11 @@
 446  #!/usr/bin/env bash
 447  
 448 -if [ "$UNAME" != "CYGWIN" ]; then
 449 -    echo "We do not install the cephes library on any operating system except Cygwin."
 450 -    exit 0
 451 -fi
 452 +# Abort if anything fails unexpectedly
 453 +set -e
 454  
 455  CUR=`pwd`
 456  
 457 +# Cygwin patch/build/install functions
 458  function patch {
 459      cd "$CUR"
 460      cp patches/complex.h src/
 461 @@ -77,5 +76,20 @@
 462      make_c9x_complex
 463  }
 464  
 465 -patch
 466 -build
 467 +# Actually execute the code
 468 +if [ "$UNAME" = "CYGWIN" ]; then
 469 +    patch
 470 +    build
 471 +elif [ "$UNAME" = "FreeBSD" ]; then
 472 +    cp patches/Makefile_bsd src/Makefile
 473 +    cp patches/c9x-complex/makefile src/c9x-complex
 474 +    cp patches/c9x-complex/*.c src/c9x-complex
 475 +    cp patches/double/makefile src/double
 476 +    cp patches/ldouble/makefile patches/ldouble/gammal.c src/ldouble
 477 +    cd src
 478 +    make
 479 +    make install
 480 +else
 481 +    echo "We only install the cephes library on Cygwin and FreeBSD."
 482 +    exit 0
 483 +fi
 484 --- cephes-2.8/patches/ldouble/makefile.orig	2010-04-06 19:27:43.000000000 +1000
 485 +++ cephes-2.8/patches/ldouble/makefile	2010-07-26 08:25:54.665317219 +1000
 486 @@ -12,7 +12,7 @@
 487  exp10l.o exp2l.o expl.o fdtrl.o gammal.o gdtrl.o igamil.o igaml.o \
 488  incbetl.o incbil.o isnanl.o j0l.o j1l.o jnl.o ldrand.o log10l.o log2l.o \
 489  logl.o nbdtrl.o ndtril.o ndtrl.o pdtrl.o powl.o powil.o sinhl.o sinl.o \
 490 -sqrtl.o stdtrl.o tanhl.o tanl.o unityl.o ynl.o \
 491 +sqrtl.o stdtrl.o tanhl.o tanl.o ynl.o \
 492  floorl.o polevll.o unityl.o mtherr.o
 493  # cmplxl.o clogl.o
 494  
 495 --- cephes-2.8/patches/ldouble/gammal.c.patch.orig	2010-07-26 13:41:37.467088450 +1000
 496 +++ cephes-2.8/patches/ldouble/gammal.c.patch	2010-07-26 13:42:52.710029506 +1000
 497 @@ -0,0 +1,240 @@
 498 +--- ../../src/ldouble/gammal.c	2000-05-29 01:21:01.000000000 +1000
 499 ++++ gammal.c	2010-07-26 13:38:38.030338022 +1000
 500 +@@ -6,20 +6,16 @@
 501 +  *
 502 +  * SYNOPSIS:
 503 +  *
 504 +- * long double x, y, gammal();
 505 +- * extern int sgngam;
 506 ++ * long double x, y, tgammal();
 507 +  *
 508 +- * y = gammal( x );
 509 ++ * y = tgammal( x );
 510 +  *
 511 +  *
 512 +  *
 513 +  * DESCRIPTION:
 514 +  *
 515 +  * Returns gamma function of the argument.  The result is
 516 +- * correctly signed, and the sign (+1 or -1) is also
 517 +- * returned in a global (extern) variable named sgngam.
 518 +- * This variable is also filled in by the logarithmic gamma
 519 +- * function lgam().
 520 ++ * correctly signed.
 521 +  *
 522 +  * Arguments |x| <= 13 are reduced by recurrence and the function
 523 +  * approximated by a rational function of degree 7/8 in the
 524 +@@ -38,7 +34,7 @@
 525 +  * Accuracy for large arguments is dominated by error in powl().
 526 +  *
 527 +  */
 528 +-/*							lgaml()
 529 ++/*							lgammal()
 530 +  *
 531 +  *	Natural logarithm of gamma function
 532 +  *
 533 +@@ -46,10 +42,10 @@
 534 +  *
 535 +  * SYNOPSIS:
 536 +  *
 537 +- * long double x, y, lgaml();
 538 +- * extern int sgngam;
 539 ++ * long double x, y, lgammal();
 540 ++ * extern int signgam;
 541 +  *
 542 +- * y = lgaml( x );
 543 ++ * y = lgammal( x );
 544 +  *
 545 +  *
 546 +  *
 547 +@@ -58,7 +54,7 @@
 548 +  * Returns the base e (2.718...) logarithm of the absolute
 549 +  * value of the gamma function of the argument.
 550 +  * The sign (+1 or -1) of the gamma function is returned in a
 551 +- * global (extern) variable named sgngam.
 552 ++ * global (extern) variable named signgam.
 553 +  *
 554 +  * For arguments greater than 33, the logarithm of the gamma
 555 +  * function is approximated by the logarithmic version of
 556 +@@ -90,7 +86,6 @@
 557 + Copyright 1994 by Stephen L. Moshier
 558 + */
 559 + 
 560 +-
 561 + #include "mconf.h"
 562 + /*
 563 + gamma(x+2)  = gamma(x+2) P(x)/Q(x)
 564 +@@ -336,18 +331,18 @@
 565 + };
 566 + #endif
 567 + 
 568 +-int sgngaml = 0;
 569 +-extern int sgngaml;
 570 ++/*int signgam = 0;*/
 571 ++extern int signgam;
 572 + extern long double MAXLOGL, MAXNUML, PIL;
 573 + /* #define PIL 3.14159265358979323846L */
 574 + /* #define MAXNUML 1.189731495357231765021263853E4932L */
 575 + 
 576 + #ifdef ANSIPROT
 577 + extern long double fabsl ( long double );
 578 +-extern long double lgaml ( long double );
 579 ++extern long double lgammal ( long double );
 580 + extern long double logl ( long double );
 581 + extern long double expl ( long double );
 582 +-extern long double gammal ( long double );
 583 ++extern long double tgammal ( long double );
 584 + extern long double sinl ( long double );
 585 + extern long double floorl ( long double );
 586 + extern long double powl ( long double, long double );
 587 +@@ -357,7 +352,7 @@
 588 + extern int isfinitel ( long double );
 589 + static long double stirf ( long double );
 590 + #else
 591 +-long double fabsl(), lgaml(), logl(), expl(), gammal(), sinl();
 592 ++long double fabsl(), lgammal(), logl(), expl(), tgammal(), sinl();
 593 + long double floorl(), powl(), polevll(), p1evll(), isnanl(), isfinitel();
 594 + static long double stirf();
 595 + #endif
 596 +@@ -403,13 +398,13 @@
 597 + 
 598 + 
 599 + 
 600 +-long double gammal(x)
 601 ++long double tgammal(x)
 602 + long double x;
 603 + {
 604 + long double p, q, z;
 605 + int i;
 606 ++int signgam = 1;
 607 + 
 608 +-sgngaml = 1;
 609 + #ifdef NANS
 610 + if( isnanl(x) )
 611 + 	return(NANL);
 612 +@@ -435,7 +430,7 @@
 613 + 			{
 614 + gamnan:
 615 + #ifdef NANS
 616 +-			mtherr( "gammal", DOMAIN );
 617 ++			mtherr( "tgammal", DOMAIN );
 618 + 			return (NANL);
 619 + #else
 620 + 			goto goverf;
 621 +@@ -443,7 +438,7 @@
 622 + 			}
 623 + 		i = p;
 624 + 		if( (i & 1) == 0 )
 625 +-			sgngaml = -1;
 626 ++			signgam = -1;
 627 + 		z = q - p;
 628 + 		if( z > 0.5L )
 629 + 			{
 630 +@@ -456,10 +451,10 @@
 631 + 			{
 632 + goverf:
 633 + #ifdef INFINITIES
 634 +-			return( sgngaml * INFINITYL);
 635 ++			return( signgam * INFINITYL);
 636 + #else
 637 +-			mtherr( "gammal", OVERFLOW );
 638 +-			return( sgngaml * MAXNUML);
 639 ++			mtherr( "tgammal", OVERFLOW );
 640 ++			return( signgam * MAXNUML);
 641 + #endif
 642 + 			}
 643 + 		z = PIL/z;
 644 +@@ -468,7 +463,7 @@
 645 + 		{
 646 + 		z = stirf(x);
 647 + 		}
 648 +-	return( sgngaml * z );
 649 ++	return( signgam * z );
 650 + 	}
 651 + 
 652 + z = 1.0L;
 653 +@@ -642,13 +637,13 @@
 654 + /* Logarithm of gamma function */
 655 + 
 656 + 
 657 +-long double lgaml(x)
 658 ++long double lgammal(x)
 659 + long double x;
 660 + {
 661 + long double p, q, w, z, f, nx;
 662 + int i;
 663 + 
 664 +-sgngaml = 1;
 665 ++signgam = 1;
 666 + #ifdef NANS
 667 + if( isnanl(x) )
 668 + 	return(NANL);
 669 +@@ -660,12 +655,12 @@
 670 + if( x < -34.0L )
 671 + 	{
 672 + 	q = -x;
 673 +-	w = lgaml(q); /* note this modifies sgngam! */
 674 ++	w = lgammal(q); /* note this modifies signgam! */
 675 + 	p = floorl(q);
 676 + 	if( p == q )
 677 + 		{
 678 + #ifdef INFINITIES
 679 +-		mtherr( "lgaml", SING );
 680 ++		mtherr( "lgammal", SING );
 681 + 		return (INFINITYL);
 682 + #else
 683 + 		goto loverf;
 684 +@@ -673,9 +668,9 @@
 685 + 		}
 686 + 	i = p;
 687 + 	if( (i & 1) == 0 )
 688 +-		sgngaml = -1;
 689 ++		signgam = -1;
 690 + 	else
 691 +-		sgngaml = 1;
 692 ++		signgam = 1;
 693 + 	z = q - p;
 694 + 	if( z > 0.5L )
 695 + 		{
 696 +@@ -711,11 +706,11 @@
 697 + 		}
 698 + 	if( z < 0.0L )
 699 + 		{
 700 +-		sgngaml = -1;
 701 ++		signgam = -1;
 702 + 		z = -z;
 703 + 		}
 704 + 	else
 705 +-		sgngaml = 1;
 706 ++		signgam = 1;
 707 + 	if( x == 2.0L )
 708 + 		return( logl(z) );
 709 + 	x = (nx - 2.0L) + f;
 710 +@@ -727,10 +722,10 @@
 711 + 	{
 712 + loverf:
 713 + #ifdef INFINITIES
 714 +-	return( sgngaml * INFINITYL );
 715 ++	return( signgam * INFINITYL );
 716 + #else
 717 +-	mtherr( "lgaml", OVERFLOW );
 718 +-	return( sgngaml * MAXNUML );
 719 ++	mtherr( "lgammal", OVERFLOW );
 720 ++	return( signgam * MAXNUML );
 721 + #endif
 722 + 	}
 723 + 
 724 +@@ -754,11 +749,11 @@
 725 + 	q = z / (x * polevll( x, S, 8 ));
 726 + if( q < 0.0L )
 727 + 	{
 728 +-	sgngaml = -1;
 729 ++	signgam = -1;
 730 + 	q = -q;
 731 + 	}
 732 + else
 733 +-	sgngaml = 1;
 734 ++	signgam = 1;
 735 + q = logl( q );
 736 + return(q);
 737 + }
 738 --- cephes-2.8/patches/ldouble/gammal.c.orig	2010-07-26 13:12:17.957613369 +1000
 739 +++ cephes-2.8/patches/ldouble/gammal.c	2010-07-26 13:38:38.030338022 +1000
 740 @@ -0,0 +1,759 @@
 741 +/*							gammal.c
 742 + *
 743 + *	Gamma function
 744 + *
 745 + *
 746 + *
 747 + * SYNOPSIS:
 748 + *
 749 + * long double x, y, tgammal();
 750 + *
 751 + * y = tgammal( x );
 752 + *
 753 + *
 754 + *
 755 + * DESCRIPTION:
 756 + *
 757 + * Returns gamma function of the argument.  The result is
 758 + * correctly signed.
 759 + *
 760 + * Arguments |x| <= 13 are reduced by recurrence and the function
 761 + * approximated by a rational function of degree 7/8 in the
 762 + * interval (2,3).  Large arguments are handled by Stirling's
 763 + * formula. Large negative arguments are made positive using
 764 + * a reflection formula.  
 765 + *
 766 + *
 767 + * ACCURACY:
 768 + *
 769 + *                      Relative error:
 770 + * arithmetic   domain     # trials      peak         rms
 771 + *    IEEE     -40,+40      10000       3.6e-19     7.9e-20
 772 + *    IEEE    -1755,+1755   10000       4.8e-18     6.5e-19
 773 + *
 774 + * Accuracy for large arguments is dominated by error in powl().
 775 + *
 776 + */
 777 +/*							lgammal()
 778 + *
 779 + *	Natural logarithm of gamma function
 780 + *
 781 + *
 782 + *
 783 + * SYNOPSIS:
 784 + *
 785 + * long double x, y, lgammal();
 786 + * extern int signgam;
 787 + *
 788 + * y = lgammal( x );
 789 + *
 790 + *
 791 + *
 792 + * DESCRIPTION:
 793 + *
 794 + * Returns the base e (2.718...) logarithm of the absolute
 795 + * value of the gamma function of the argument.
 796 + * The sign (+1 or -1) of the gamma function is returned in a
 797 + * global (extern) variable named signgam.
 798 + *
 799 + * For arguments greater than 33, the logarithm of the gamma
 800 + * function is approximated by the logarithmic version of
 801 + * Stirling's formula using a polynomial approximation of
 802 + * degree 4. Arguments between -33 and +33 are reduced by
 803 + * recurrence to the interval [2,3] of a rational approximation.
 804 + * The cosecant reflection formula is employed for arguments
 805 + * less than -33.
 806 + *
 807 + * Arguments greater than MAXLGML (10^4928) return MAXNUML.
 808 + *
 809 + *
 810 + *
 811 + * ACCURACY:
 812 + *
 813 + *
 814 + * arithmetic      domain        # trials     peak         rms
 815 + *    IEEE         -40, 40        100000     2.2e-19     4.6e-20
 816 + *    IEEE    10^-2000,10^+2000    20000     1.6e-19     3.3e-20
 817 + * The error criterion was relative when the function magnitude
 818 + * was greater than one but absolute when it was less than one.
 819 + *
 820 + */
 821 +
 822 +/*							gamma.c	*/
 823 +/*	gamma function	*/
 824 +
 825 +/*
 826 +Copyright 1994 by Stephen L. Moshier
 827 +*/
 828 +
 829 +#include "mconf.h"
 830 +/*
 831 +gamma(x+2)  = gamma(x+2) P(x)/Q(x)
 832 +0 <= x <= 1
 833 +Relative error
 834 +n=7, d=8
 835 +Peak error =  1.83e-20
 836 +Relative error spread =  8.4e-23
 837 +*/
 838 +#if UNK
 839 +static long double P[8] = {
 840 + 4.212760487471622013093E-5L,
 841 + 4.542931960608009155600E-4L,
 842 + 4.092666828394035500949E-3L,
 843 + 2.385363243461108252554E-2L,
 844 + 1.113062816019361559013E-1L,
 845 + 3.629515436640239168939E-1L,
 846 + 8.378004301573126728826E-1L,
 847 + 1.000000000000000000009E0L,
 848 +};
 849 +static long double Q[9] = {
 850 +-1.397148517476170440917E-5L,
 851 + 2.346584059160635244282E-4L,
 852 +-1.237799246653152231188E-3L,
 853 +-7.955933682494738320586E-4L,
 854 + 2.773706565840072979165E-2L,
 855 +-4.633887671244534213831E-2L,
 856 +-2.243510905670329164562E-1L,
 857 + 4.150160950588455434583E-1L,
 858 + 9.999999999999999999908E-1L,
 859 +};
 860 +#endif
 861 +#if IBMPC
 862 +static short P[] = {
 863 +0x434a,0x3f22,0x2bda,0xb0b2,0x3ff0, XPD
 864 +0xf5aa,0xe82f,0x335b,0xee2e,0x3ff3, XPD
 865 +0xbe6c,0x3757,0xc717,0x861b,0x3ff7, XPD
 866 +0x7f43,0x5196,0xb166,0xc368,0x3ff9, XPD
 867 +0x9549,0x8eb5,0x8c3a,0xe3f4,0x3ffb, XPD
 868 +0x8d75,0x23af,0xc8e4,0xb9d4,0x3ffd, XPD
 869 +0x29cf,0x19b3,0x16c8,0xd67a,0x3ffe, XPD
 870 +0x0000,0x0000,0x0000,0x8000,0x3fff, XPD
 871 +};
 872 +static short Q[] = {
 873 +0x5473,0x2de8,0x1268,0xea67,0xbfee, XPD
 874 +0x334b,0xc2f0,0xa2dd,0xf60e,0x3ff2, XPD
 875 +0xbeed,0x1853,0xa691,0xa23d,0xbff5, XPD
 876 +0x296e,0x7cb1,0x5dfd,0xd08f,0xbff4, XPD
 877 +0x0417,0x7989,0xd7bc,0xe338,0x3ff9, XPD
 878 +0x3295,0x3698,0xd580,0xbdcd,0xbffa, XPD
 879 +0x75ef,0x3ab7,0x4ad3,0xe5bc,0xbffc, XPD
 880 +0xe458,0x2ec7,0xfd57,0xd47c,0x3ffd, XPD
 881 +0x0000,0x0000,0x0000,0x8000,0x3fff, XPD
 882 +};
 883 +#endif
 884 +#if MIEEE
 885 +static long P[24] = {
 886 +0x3ff00000,0xb0b22bda,0x3f22434a,
 887 +0x3ff30000,0xee2e335b,0xe82ff5aa,
 888 +0x3ff70000,0x861bc717,0x3757be6c,
 889 +0x3ff90000,0xc368b166,0x51967f43,
 890 +0x3ffb0000,0xe3f48c3a,0x8eb59549,
 891 +0x3ffd0000,0xb9d4c8e4,0x23af8d75,
 892 +0x3ffe0000,0xd67a16c8,0x19b329cf,
 893 +0x3fff0000,0x80000000,0x00000000,
 894 +};
 895 +static long Q[27] = {
 896 +0xbfee0000,0xea671268,0x2de85473,
 897 +0x3ff20000,0xf60ea2dd,0xc2f0334b,
 898 +0xbff50000,0xa23da691,0x1853beed,
 899 +0xbff40000,0xd08f5dfd,0x7cb1296e,
 900 +0x3ff90000,0xe338d7bc,0x79890417,
 901 +0xbffa0000,0xbdcdd580,0x36983295,
 902 +0xbffc0000,0xe5bc4ad3,0x3ab775ef,
 903 +0x3ffd0000,0xd47cfd57,0x2ec7e458,
 904 +0x3fff0000,0x80000000,0x00000000,
 905 +};
 906 +#endif
 907 +/*
 908 +static long double P[] = {
 909 +-3.01525602666895735709e0L,
 910 +-3.25157411956062339893e1L,
 911 +-2.92929976820724030353e2L,
 912 +-1.70730828800510297666e3L,
 913 +-7.96667499622741999770e3L,
 914 +-2.59780216007146401957e4L,
 915 +-5.99650230220855581642e4L,
 916 +-7.15743521530849602425e4L
 917 +};
 918 +static long double Q[] = {
 919 + 1.00000000000000000000e0L,
 920 +-1.67955233807178858919e1L,
 921 + 8.85946791747759881659e1L,
 922 + 5.69440799097468430177e1L,
 923 +-1.98526250512761318471e3L,
 924 + 3.31667508019495079814e3L,
 925 + 1.60577839621734713377e4L,
 926 +-2.97045081369399940529e4L,
 927 +-7.15743521530849602412e4L
 928 +};
 929 +*/
 930 +#define MAXGAML 1755.455L
 931 +/*static long double LOGPI = 1.14472988584940017414L;*/
 932 +
 933 +/* Stirling's formula for the gamma function
 934 +gamma(x) = sqrt(2 pi) x^(x-.5) exp(-x) (1 + 1/x P(1/x))
 935 +z(x) = x
 936 +13 <= x <= 1024
 937 +Relative error
 938 +n=8, d=0
 939 +Peak error =  9.44e-21
 940 +Relative error spread =  8.8e-4
 941 +*/
 942 +#if UNK
 943 +static long double STIR[9] = {
 944 + 7.147391378143610789273E-4L,
 945 +-2.363848809501759061727E-5L,
 946 +-5.950237554056330156018E-4L,
 947 + 6.989332260623193171870E-5L,
 948 + 7.840334842744753003862E-4L,
 949 +-2.294719747873185405699E-4L,
 950 +-2.681327161876304418288E-3L,
 951 + 3.472222222230075327854E-3L,
 952 + 8.333333333333331800504E-2L,
 953 +};
 954 +#endif
 955 +#if IBMPC
 956 +static short STIR[] = {
 957 +0x6ede,0x69f7,0x54e3,0xbb5d,0x3ff4, XPD
 958 +0xc395,0x0295,0x4443,0xc64b,0xbfef, XPD
 959 +0xba6f,0x7c59,0x5e47,0x9bfb,0xbff4, XPD
 960 +0x5704,0x1a39,0xb11d,0x9293,0x3ff1, XPD
 961 +0x30b7,0x1a21,0x98b2,0xcd87,0x3ff4, XPD
 962 +0xbef3,0x7023,0x6a08,0xf09e,0xbff2, XPD
 963 +0x3a1c,0x5ac8,0x3478,0xafb9,0xbff6, XPD
 964 +0xc3c9,0x906e,0x38e3,0xe38e,0x3ff6, XPD
 965 +0xa1d5,0xaaaa,0xaaaa,0xaaaa,0x3ffb, XPD
 966 +};
 967 +#endif
 968 +#if MIEEE
 969 +static long STIR[27] = {
 970 +0x3ff40000,0xbb5d54e3,0x69f76ede,
 971 +0xbfef0000,0xc64b4443,0x0295c395,
 972 +0xbff40000,0x9bfb5e47,0x7c59ba6f,
 973 +0x3ff10000,0x9293b11d,0x1a395704,
 974 +0x3ff40000,0xcd8798b2,0x1a2130b7,
 975 +0xbff20000,0xf09e6a08,0x7023bef3,
 976 +0xbff60000,0xafb93478,0x5ac83a1c,
 977 +0x3ff60000,0xe38e38e3,0x906ec3c9,
 978 +0x3ffb0000,0xaaaaaaaa,0xaaaaa1d5,
 979 +};
 980 +#endif
 981 +#define MAXSTIR 1024.0L
 982 +static long double SQTPI = 2.50662827463100050242E0L;
 983 +
 984 +/* 1/gamma(x) = z P(z)
 985 + * z(x) = 1/x
 986 + * 0 < x < 0.03125
 987 + * Peak relative error 4.2e-23
 988 + */
 989 +#if UNK
 990 +static long double S[9] = {
 991 +-1.193945051381510095614E-3L,
 992 + 7.220599478036909672331E-3L,
 993 +-9.622023360406271645744E-3L,
 994 +-4.219773360705915470089E-2L,
 995 + 1.665386113720805206758E-1L,
 996 +-4.200263503403344054473E-2L,
 997 +-6.558780715202540684668E-1L,
 998 + 5.772156649015328608253E-1L,
 999 + 1.000000000000000000000E0L,
1000 +};
1001 +#endif
1002 +#if IBMPC
1003 +static short S[] = {
1004 +0xbaeb,0xd6d3,0x25e5,0x9c7e,0xbff5, XPD
1005 +0xfe9a,0xceb4,0xc74e,0xec9a,0x3ff7, XPD
1006 +0x9225,0xdfef,0xb0e9,0x9da5,0xbff8, XPD
1007 +0x10b0,0xec17,0x87dc,0xacd7,0xbffa, XPD
1008 +0x6b8d,0x7515,0x1905,0xaa89,0x3ffc, XPD
1009 +0xf183,0x126b,0xf47d,0xac0a,0xbffa, XPD
1010 +0x7bf6,0x57d1,0xa013,0xa7e7,0xbffe, XPD
1011 +0xc7a9,0x7db0,0x67e3,0x93c4,0x3ffe, XPD
1012 +0x0000,0x0000,0x0000,0x8000,0x3fff, XPD
1013 +};
1014 +#endif
1015 +#if MIEEE
1016 +static long S[27] = {
1017 +0xbff50000,0x9c7e25e5,0xd6d3baeb,
1018 +0x3ff70000,0xec9ac74e,0xceb4fe9a,
1019 +0xbff80000,0x9da5b0e9,0xdfef9225,
1020 +0xbffa0000,0xacd787dc,0xec1710b0,
1021 +0x3ffc0000,0xaa891905,0x75156b8d,
1022 +0xbffa0000,0xac0af47d,0x126bf183,
1023 +0xbffe0000,0xa7e7a013,0x57d17bf6,
1024 +0x3ffe0000,0x93c467e3,0x7db0c7a9,
1025 +0x3fff0000,0x80000000,0x00000000,
1026 +};
1027 +#endif
1028 +/* 1/gamma(-x) = z P(z)
1029 + * z(x) = 1/x
1030 + * 0 < x < 0.03125
1031 + * Peak relative error 5.16e-23
1032 + * Relative error spread =  2.5e-24
1033 + */
1034 +#if UNK
1035 +static long double SN[9] = {
1036 + 1.133374167243894382010E-3L,
1037 + 7.220837261893170325704E-3L,
1038 + 9.621911155035976733706E-3L,
1039 +-4.219773343731191721664E-2L,
1040 +-1.665386113944413519335E-1L,
1041 +-4.200263503402112910504E-2L,
1042 + 6.558780715202536547116E-1L,
1043 + 5.772156649015328608727E-1L,
1044 +-1.000000000000000000000E0L,
1045 +};
1046 +#endif
1047 +#if IBMPC
1048 +static short SN[] = {
1049 +0x5dd1,0x02de,0xb9f7,0x948d,0x3ff5, XPD
1050 +0x989b,0xdd68,0xc5f1,0xec9c,0x3ff7, XPD
1051 +0x2ca1,0x18f0,0x386f,0x9da5,0x3ff8, XPD
1052 +0x783f,0x41dd,0x87d1,0xacd7,0xbffa, XPD
1053 +0x7a5b,0xd76d,0x1905,0xaa89,0xbffc, XPD
1054 +0x7f64,0x1234,0xf47d,0xac0a,0xbffa, XPD
1055 +0x5e26,0x57d1,0xa013,0xa7e7,0x3ffe, XPD
1056 +0xc7aa,0x7db0,0x67e3,0x93c4,0x3ffe, XPD
1057 +0x0000,0x0000,0x0000,0x8000,0xbfff, XPD
1058 +};
1059 +#endif
1060 +#if MIEEE
1061 +static long SN[27] = {
1062 +0x3ff50000,0x948db9f7,0x02de5dd1,
1063 +0x3ff70000,0xec9cc5f1,0xdd68989b,
1064 +0x3ff80000,0x9da5386f,0x18f02ca1,
1065 +0xbffa0000,0xacd787d1,0x41dd783f,
1066 +0xbffc0000,0xaa891905,0xd76d7a5b,
1067 +0xbffa0000,0xac0af47d,0x12347f64,
1068 +0x3ffe0000,0xa7e7a013,0x57d15e26,
1069 +0x3ffe0000,0x93c467e3,0x7db0c7aa,
1070 +0xbfff0000,0x80000000,0x00000000,
1071 +};
1072 +#endif
1073 +
1074 +/*int signgam = 0;*/
1075 +extern int signgam;
1076 +extern long double MAXLOGL, MAXNUML, PIL;
1077 +/* #define PIL 3.14159265358979323846L */
1078 +/* #define MAXNUML 1.189731495357231765021263853E4932L */
1079 +
1080 +#ifdef ANSIPROT
1081 +extern long double fabsl ( long double );
1082 +extern long double lgammal ( long double );
1083 +extern long double logl ( long double );
1084 +extern long double expl ( long double );
1085 +extern long double tgammal ( long double );
1086 +extern long double sinl ( long double );
1087 +extern long double floorl ( long double );
1088 +extern long double powl ( long double, long double );
1089 +extern long double polevll ( long double, void *, int );
1090 +extern long double p1evll ( long double, void *, int );
1091 +extern int isnanl ( long double );
1092 +extern int isfinitel ( long double );
1093 +static long double stirf ( long double );
1094 +#else
1095 +long double fabsl(), lgammal(), logl(), expl(), tgammal(), sinl();
1096 +long double floorl(), powl(), polevll(), p1evll(), isnanl(), isfinitel();
1097 +static long double stirf();
1098 +#endif
1099 +#ifdef INFINITIES
1100 +extern long double INFINITYL;
1101 +#endif
1102 +#ifdef NANS
1103 +extern long double NANL;
1104 +#endif
1105 +
1106 +/* Gamma function computed by Stirling's formula.
1107 + */
1108 +static long double stirf(x)
1109 +long double x;
1110 +{
1111 +long double y, w, v;
1112 +
1113 +w = 1.0L/x;
1114 +/* For large x, use rational coefficients from the analytical expansion.  */
1115 +if( x > 1024.0L )
1116 +	w = (((((6.97281375836585777429E-5L * w
1117 +		+ 7.84039221720066627474E-4L) * w
1118 +		- 2.29472093621399176955E-4L) * w
1119 +		- 2.68132716049382716049E-3L) * w
1120 +		+ 3.47222222222222222222E-3L) * w
1121 +		+ 8.33333333333333333333E-2L) * w
1122 +		+ 1.0L;
1123 +else
1124 +	w = 1.0L + w * polevll( w, STIR, 8 );
1125 +y = expl(x);
1126 +if( x > MAXSTIR )
1127 +	{ /* Avoid overflow in pow() */
1128 +	v = powl( x, 0.5L * x - 0.25L );
1129 +	y = v * (v / y);
1130 +	}
1131 +else
1132 +	{
1133 +	y = powl( x, x - 0.5L ) / y;
1134 +	}
1135 +y = SQTPI * y * w;
1136 +return( y );
1137 +}
1138 +
1139 +
1140 +
1141 +long double tgammal(x)
1142 +long double x;
1143 +{
1144 +long double p, q, z;
1145 +int i;
1146 +int signgam = 1;
1147 +
1148 +#ifdef NANS
1149 +if( isnanl(x) )
1150 +	return(NANL);
1151 +#endif
1152 +#ifdef INFINITIES
1153 +if(x == INFINITYL)
1154 +	return(INFINITYL);
1155 +#ifdef NANS
1156 +if(x == -INFINITYL)
1157 +	goto gamnan;
1158 +#endif
1159 +#endif
1160 +q = fabsl(x);
1161 +
1162 +if( q > 13.0L )
1163 +	{
1164 +	if( q > MAXGAML )
1165 +		goto goverf;
1166 +	if( x < 0.0L )
1167 +		{
1168 +		p = floorl(q);
1169 +		if( p == q )
1170 +			{
1171 +gamnan:
1172 +#ifdef NANS
1173 +			mtherr( "tgammal", DOMAIN );
1174 +			return (NANL);
1175 +#else
1176 +			goto goverf;
1177 +#endif
1178 +			}
1179 +		i = p;
1180 +		if( (i & 1) == 0 )
1181 +			signgam = -1;
1182 +		z = q - p;
1183 +		if( z > 0.5L )
1184 +			{
1185 +			p += 1.0L;
1186 +			z = q - p;
1187 +			}
1188 +		z = q * sinl( PIL * z );
1189 +		z = fabsl(z) * stirf(q);
1190 +		if( z <= PIL/MAXNUML )
1191 +			{
1192 +goverf:
1193 +#ifdef INFINITIES
1194 +			return( signgam * INFINITYL);
1195 +#else
1196 +			mtherr( "tgammal", OVERFLOW );
1197 +			return( signgam * MAXNUML);
1198 +#endif
1199 +			}
1200 +		z = PIL/z;
1201 +		}
1202 +	else
1203 +		{
1204 +		z = stirf(x);
1205 +		}
1206 +	return( signgam * z );
1207 +	}
1208 +
1209 +z = 1.0L;
1210 +while( x >= 3.0L )
1211 +	{
1212 +	x -= 1.0L;
1213 +	z *= x;
1214 +	}
1215 +
1216 +while( x < -0.03125L )
1217 +	{
1218 +	z /= x;
1219 +	x += 1.0L;
1220 +	}
1221 +
1222 +if( x <= 0.03125L )
1223 +	goto small;
1224 +
1225 +while( x < 2.0L )
1226 +	{
1227 +	z /= x;
1228 +	x += 1.0L;
1229 +	}
1230 +
1231 +if( x == 2.0L )
1232 +	return(z);
1233 +
1234 +x -= 2.0L;
1235 +p = polevll( x, P, 7 );
1236 +q = polevll( x, Q, 8 );
1237 +return( z * p / q );
1238 +
1239 +small:
1240 +if( x == 0.0L )
1241 +	{
1242 +	  goto gamnan;
1243 +	}
1244 +else
1245 +	{
1246 +	if( x < 0.0L )
1247 +		{
1248 +		x = -x;
1249 +		q = z / (x * polevll( x, SN, 8 ));
1250 +		}
1251 +	else
1252 +		q = z / (x * polevll( x, S, 8 ));
1253 +	}
1254 +return q;
1255 +}
1256 +
1257 +
1258 +
1259 +/* A[]: Stirling's formula expansion of log gamma
1260 + * B[], C[]: log gamma function between 2 and 3
1261 + */
1262 +
1263 +
1264 +/* log gamma(x) = ( x - 0.5 ) * log(x) - x + LS2PI + 1/x A(1/x^2)
1265 + * x >= 8
1266 + * Peak relative error 1.51e-21
1267 + * Relative spread of error peaks 5.67e-21
1268 + */
1269 +#if UNK
1270 +static long double A[7] = {
1271 + 4.885026142432270781165E-3L,
1272 +-1.880801938119376907179E-3L,
1273 + 8.412723297322498080632E-4L,
1274 +-5.952345851765688514613E-4L,
1275 + 7.936507795855070755671E-4L,
1276 +-2.777777777750349603440E-3L,
1277 + 8.333333333333331447505E-2L,
1278 +};
1279 +#endif
1280 +#if IBMPC
1281 +static short A[] = {
1282 +0xd984,0xcc08,0x91c2,0xa012,0x3ff7, XPD
1283 +0x3d91,0x0304,0x3da1,0xf685,0xbff5, XPD
1284 +0x3bdc,0xaad1,0xd492,0xdc88,0x3ff4, XPD
1285 +0x8b20,0x9fce,0x844e,0x9c09,0xbff4, XPD
1286 +0xf8f2,0x30e5,0x0092,0xd00d,0x3ff4, XPD
1287 +0x4d88,0x03a8,0x60b6,0xb60b,0xbff6, XPD
1288 +0x9fcc,0xaaaa,0xaaaa,0xaaaa,0x3ffb, XPD
1289 +};
1290 +#endif
1291 +#if MIEEE
1292 +static long A[21] = {
1293 +0x3ff70000,0xa01291c2,0xcc08d984,
1294 +0xbff50000,0xf6853da1,0x03043d91,
1295 +0x3ff40000,0xdc88d492,0xaad13bdc,
1296 +0xbff40000,0x9c09844e,0x9fce8b20,
1297 +0x3ff40000,0xd00d0092,0x30e5f8f2,
1298 +0xbff60000,0xb60b60b6,0x03a84d88,
1299 +0x3ffb0000,0xaaaaaaaa,0xaaaa9fcc,
1300 +};
1301 +#endif
1302 +
1303 +/* log gamma(x+2) = x B(x)/C(x)
1304 + * 0 <= x <= 1
1305 + * Peak relative error 7.16e-22
1306 + * Relative spread of error peaks 4.78e-20
1307 + */
1308 +#if UNK
1309 +static long double B[7] = {
1310 +-2.163690827643812857640E3L,
1311 +-8.723871522843511459790E4L,
1312 +-1.104326814691464261197E6L,
1313 +-6.111225012005214299996E6L,
1314 +-1.625568062543700591014E7L,
1315 +-2.003937418103815175475E7L,
1316 +-8.875666783650703802159E6L,
1317 +};
1318 +static long double C[7] = {
1319 +/* 1.000000000000000000000E0L,*/
1320 +-5.139481484435370143617E2L,
1321 +-3.403570840534304670537E4L,
1322 +-6.227441164066219501697E5L,
1323 +-4.814940379411882186630E6L,
1324 +-1.785433287045078156959E7L,
1325 +-3.138646407656182662088E7L,
1326 +-2.099336717757895876142E7L,
1327 +};
1328 +#endif
1329 +#if IBMPC
1330 +static short B[] = {
1331 +0x9557,0x4995,0x0da1,0x873b,0xc00a, XPD
1332 +0xfe44,0x9af8,0x5b8c,0xaa63,0xc00f, XPD
1333 +0x5aa8,0x7cf5,0x3684,0x86ce,0xc013, XPD
1334 +0x259a,0x258c,0xf206,0xba7f,0xc015, XPD
1335 +0xbe18,0x1ca3,0xc0a0,0xf80a,0xc016, XPD
1336 +0x168f,0x2c42,0x6717,0x98e3,0xc017, XPD
1337 +0x2051,0x9d55,0x92c8,0x876e,0xc016, XPD
1338 +};
1339 +static short C[] = {
1340 +/*0x0000,0x0000,0x0000,0x8000,0x3fff, XPD*/
1341 +0xaa77,0xcf2f,0xae76,0x807c,0xc008, XPD
1342 +0xb280,0x0d74,0xb55a,0x84f3,0xc00e, XPD
1343 +0xa505,0xcd30,0x81dc,0x9809,0xc012, XPD
1344 +0x3369,0x4246,0xb8c2,0x92f0,0xc015, XPD
1345 +0x63cf,0x6aee,0xbe6f,0x8837,0xc017, XPD
1346 +0x26bb,0xccc7,0xb009,0xef75,0xc017, XPD
1347 +0x462b,0xbae8,0xab96,0xa02a,0xc017, XPD
1348 +};
1349 +#endif
1350 +#if MIEEE
1351 +static long B[21] = {
1352 +0xc00a0000,0x873b0da1,0x49959557,
1353 +0xc00f0000,0xaa635b8c,0x9af8fe44,
1354 +0xc0130000,0x86ce3684,0x7cf55aa8,
1355 +0xc0150000,0xba7ff206,0x258c259a,
1356 +0xc0160000,0xf80ac0a0,0x1ca3be18,
1357 +0xc0170000,0x98e36717,0x2c42168f,
1358 +0xc0160000,0x876e92c8,0x9d552051,
1359 +};
1360 +static long C[21] = {
1361 +/*0x3fff0000,0x80000000,0x00000000,*/
1362 +0xc0080000,0x807cae76,0xcf2faa77,
1363 +0xc00e0000,0x84f3b55a,0x0d74b280,
1364 +0xc0120000,0x980981dc,0xcd30a505,
1365 +0xc0150000,0x92f0b8c2,0x42463369,
1366 +0xc0170000,0x8837be6f,0x6aee63cf,
1367 +0xc0170000,0xef75b009,0xccc726bb,
1368 +0xc0170000,0xa02aab96,0xbae8462b,
1369 +};
1370 +#endif
1371 +
1372 +/* log( sqrt( 2*pi ) ) */
1373 +static long double LS2PI  =  0.91893853320467274178L;
1374 +#define MAXLGM 1.04848146839019521116e+4928L
1375 +
1376 +
1377 +/* Logarithm of gamma function */
1378 +
1379 +
1380 +long double lgammal(x)
1381 +long double x;
1382 +{
1383 +long double p, q, w, z, f, nx;
1384 +int i;
1385 +
1386 +signgam = 1;
1387 +#ifdef NANS
1388 +if( isnanl(x) )
1389 +	return(NANL);
1390 +#endif
1391 +#ifdef INFINITIES
1392 +if( !isfinitel(x) )
1393 +	return(INFINITYL);
1394 +#endif
1395 +if( x < -34.0L )
1396 +	{
1397 +	q = -x;
1398 +	w = lgammal(q); /* note this modifies signgam! */
1399 +	p = floorl(q);
1400 +	if( p == q )
1401 +		{
1402 +#ifdef INFINITIES
1403 +		mtherr( "lgammal", SING );
1404 +		return (INFINITYL);
1405 +#else
1406 +		goto loverf;
1407 +#endif
1408 +		}
1409 +	i = p;
1410 +	if( (i & 1) == 0 )
1411 +		signgam = -1;
1412 +	else
1413 +		signgam = 1;
1414 +	z = q - p;
1415 +	if( z > 0.5L )
1416 +		{
1417 +		p += 1.0L;
1418 +		z = p - q;
1419 +		}
1420 +	z = q * sinl( PIL * z );
1421 +	if( z == 0.0L )
1422 +		goto loverf;
1423 +/*	z = LOGPI - logl( z ) - w; */
1424 +	z = logl( PIL/z ) - w;
1425 +	return( z );
1426 +	}
1427 +
1428 +if( x < 13.0L )
1429 +	{
1430 +	z = 1.0L;
1431 +	nx = floorl( x +  0.5L );
1432 +	f = x - nx;
1433 +	while( x >= 3.0L )
1434 +		{
1435 +		nx -= 1.0L;
1436 +		x = nx + f;
1437 +		z *= x;
1438 +		}
1439 +	while( x < 2.0L )
1440 +		{
1441 +		if( fabsl(x) <= 0.03125 )
1442 +			goto lsmall;
1443 +		z /= nx +  f;
1444 +		nx += 1.0L;
1445 +		x = nx + f;
1446 +		}
1447 +	if( z < 0.0L )
1448 +		{
1449 +		signgam = -1;
1450 +		z = -z;
1451 +		}
1452 +	else
1453 +		signgam = 1;
1454 +	if( x == 2.0L )
1455 +		return( logl(z) );
1456 +	x = (nx - 2.0L) + f;
1457 +	p = x * polevll( x, B, 6 ) / p1evll( x, C, 7);
1458 +	return( logl(z) + p );
1459 +	}
1460 +
1461 +if( x > MAXLGM )
1462 +	{
1463 +loverf:
1464 +#ifdef INFINITIES
1465 +	return( signgam * INFINITYL );
1466 +#else
1467 +	mtherr( "lgammal", OVERFLOW );
1468 +	return( signgam * MAXNUML );
1469 +#endif
1470 +	}
1471 +
1472 +q = ( x - 0.5L ) * logl(x) - x + LS2PI;
1473 +if( x > 1.0e10L )
1474 +	return(q);
1475 +p = 1.0L/(x*x);
1476 +q += polevll( p, A, 6 ) / x;
1477 +return( q );
1478 +
1479 +
1480 +lsmall:
1481 +if( x == 0.0L )
1482 +	goto loverf;
1483 +if( x < 0.0L )
1484 +	{
1485 +	x = -x;
1486 +	q = z / (x * polevll( x, SN, 8 ));
1487 +	}
1488 +else
1489 +	q = z / (x * polevll( x, S, 8 ));
1490 +if( q < 0.0L )
1491 +	{
1492 +	signgam = -1;
1493 +	q = -q;
1494 +	}
1495 +else
1496 +	signgam = 1;
1497 +q = logl( q );
1498 +return(q);
1499 +}
1500 --- cephes-2.8/patches/math_bsd.h.orig	2010-07-26 08:25:54.647311343 +1000
1501 +++ cephes-2.8/patches/math_bsd.h	2010-07-26 08:25:54.652310772 +1000
1502 @@ -0,0 +1,201 @@
1503 +/*
1504 +** Replacement <math.h> merging host version with cephes functions
1505 +*/
1506 +
1507 +/* Start by using host math file.
1508 + * This has to come before the following protective #ifdef so that
1509 + * #include "math.h" is correctly handled. */
1510 +#include_next <math.h>
1511 +
1512 +#ifndef __CEPHES_MATH_H
1513 +#define __CEPHES_MATH_H
1514 +
1515 +#if defined(__cplusplus)
1516 +extern "C" {
1517 +#endif
1518 +
1519 +/* The following content is derived from
1520 + * http://www.opengroup.org/onlinepubs/9699919799/basedefs/math.h.html
1521 + */
1522 +extern double      (acos)(double);
1523 +extern float       (acosf)(float);
1524 +extern double      (acosh)(double);
1525 +extern float       (acoshf)(float);
1526 +extern long double (acoshl)(long double);
1527 +extern long double (acosl)(long double);
1528 +extern double      (asin)(double);
1529 +extern float       (asinf)(float);
1530 +extern double      (asinh)(double);
1531 +extern float       (asinhf)(float);
1532 +extern long double (asinhl)(long double);
1533 +extern long double (asinl)(long double);
1534 +extern double      (atan)(double);
1535 +extern double      (atan2)(double, double);
1536 +extern float       (atan2f)(float, float);
1537 +extern long double (atan2l)(long double, long double);
1538 +extern float       (atanf)(float);
1539 +extern double      (atanh)(double);
1540 +extern float       (atanhf)(float);
1541 +extern long double (atanhl)(long double);
1542 +extern long double (atanl)(long double);
1543 +extern double      (cbrt)(double);
1544 +extern float       (cbrtf)(float);
1545 +extern long double (cbrtl)(long double);
1546 +extern double      (ceil)(double);
1547 +extern float       (ceilf)(float);
1548 +extern long double (ceill)(long double);
1549 +extern double      (copysign)(double, double);
1550 +extern float       (copysignf)(float, float);
1551 +extern long double (copysignl)(long double, long double);
1552 +extern double      (cos)(double);
1553 +extern float       (cosf)(float);
1554 +extern double      (cosh)(double);
1555 +extern float       (coshf)(float);
1556 +extern long double (coshl)(long double);
1557 +extern long double (cosl)(long double);
1558 +extern double      (erf)(double);
1559 +extern double      (erfc)(double);
1560 +extern float       (erfcf)(float);
1561 +extern long double (erfcl)(long double);
1562 +extern float       (erff)(float);
1563 +extern long double (erfl)(long double);
1564 +extern double      (exp)(double);
1565 +extern double      (exp2)(double);
1566 +extern float       (exp2f)(float);
1567 +extern long double (exp2l)(long double);
1568 +extern float       (expf)(float);
1569 +extern long double (expl)(long double);
1570 +extern double      (expm1)(double);
1571 +extern float       (expm1f)(float);
1572 +extern long double (expm1l)(long double);
1573 +extern double      (fabs)(double);
1574 +extern float       (fabsf)(float);
1575 +extern long double (fabsl)(long double);
1576 +extern double      (fdim)(double, double);
1577 +extern float       (fdimf)(float, float);
1578 +extern long double (fdiml)(long double, long double);
1579 +extern double      (floor)(double);
1580 +extern float       (floorf)(float);
1581 +extern long double (floorl)(long double);
1582 +extern double      (fma)(double, double, double);
1583 +extern float       (fmaf)(float, float, float);
1584 +extern long double (fmal)(long double, long double, long double);
1585 +extern double      (fmax)(double, double);
1586 +extern float       (fmaxf)(float, float);
1587 +extern long double (fmaxl)(long double, long double);
1588 +extern double      (fmin)(double, double);
1589 +extern float       (fminf)(float, float);
1590 +extern long double (fminl)(long double, long double);
1591 +extern double      (fmod)(double, double);
1592 +extern float       (fmodf)(float, float);
1593 +extern long double (fmodl)(long double, long double);
1594 +extern double      (frexp)(double, int *);
1595 +extern float       (frexpf)(float, int *);
1596 +extern long double (frexpl)(long double, int *);
1597 +extern double      (hypot)(double, double);
1598 +extern float       (hypotf)(float, float);
1599 +extern long double (hypotl)(long double, long double);
1600 +extern int         (ilogb)(double);
1601 +extern int         (ilogbf)(float);
1602 +extern int         (ilogbl)(long double);
1603 +extern double      (j0)(double);		/* XSI extension */
1604 +extern double      (j1)(double);		/* XSI extension */
1605 +extern double      (jn)(int, double);		/* XSI extension */
1606 +extern double      (ldexp)(double, int);
1607 +extern float       (ldexpf)(float, int);
1608 +extern long double (ldexpl)(long double, int);
1609 +extern double      (lgamma)(double);
1610 +extern float       (lgammaf)(float);
1611 +extern long double (lgammal)(long double);
1612 +extern long long   (llrint)(double);
1613 +extern long long   (llrintf)(float);
1614 +extern long long   (llrintl)(long double);
1615 +extern long long   (llround)(double);
1616 +extern long long   (llroundf)(float);
1617 +extern long long   (llroundl)(long double);
1618 +extern double      (log)(double);
1619 +extern double      (log10)(double);
1620 +extern float       (log10f)(float);
1621 +extern long double (log10l)(long double);
1622 +extern double      (log1p)(double);
1623 +extern float       (log1pf)(float);
1624 +extern long double (log1pl)(long double);
1625 +extern double      (log2)(double);
1626 +extern float       (log2f)(float);
1627 +extern long double (log2l)(long double);
1628 +extern double      (logb)(double);
1629 +extern float       (logbf)(float);
1630 +extern long double (logbl)(long double);
1631 +extern float       (logf)(float);
1632 +extern long double (logl)(long double);
1633 +extern long        (lrint)(double);
1634 +extern long        (lrintf)(float);
1635 +extern long        (lrintl)(long double);
1636 +extern long        (lround)(double);
1637 +extern long        (lroundf)(float);
1638 +extern long        (lroundl)(long double);
1639 +extern double      (modf)(double, double *);
1640 +extern float       (modff)(float, float *);
1641 +extern long double (modfl)(long double, long double *);
1642 +extern double      (nan)(const char *);
1643 +extern float       (nanf)(const char *);
1644 +extern long double (nanl)(const char *);
1645 +extern double      (nearbyint)(double);
1646 +extern float       (nearbyintf)(float);
1647 +extern long double (nearbyintl)(long double);
1648 +extern double      (nextafter)(double, double);
1649 +extern float       (nextafterf)(float, float);
1650 +extern long double (nextafterl)(long double, long double);
1651 +extern double      (nexttoward)(double, long double);
1652 +extern float       (nexttowardf)(float, long double);
1653 +extern long double (nexttowardl)(long double, long double);
1654 +extern double      (pow)(double, double);
1655 +extern float       (powf)(float, float);
1656 +extern long double (powl)(long double, long double);
1657 +extern double      (remainder)(double, double);
1658 +extern float       (remainderf)(float, float);
1659 +extern long double (remainderl)(long double, long double);
1660 +extern double      (remquo)(double, double, int *);
1661 +extern float       (remquof)(float, float, int *);
1662 +extern long double (remquol)(long double, long double, int *);
1663 +extern double      (rint)(double);
1664 +extern float       (rintf)(float);
1665 +extern long double (rintl)(long double);
1666 +extern double      (round)(double);
1667 +extern float       (roundf)(float);
1668 +extern long double (roundl)(long double);
1669 +extern double      (scalbln)(double, long);
1670 +extern float       (scalblnf)(float, long);
1671 +extern long double (scalblnl)(long double, long);
1672 +extern double      (scalbn)(double, int);
1673 +extern float       (scalbnf)(float, int);
1674 +extern long double (scalbnl)(long double, int);
1675 +extern double      (sin)(double);
1676 +extern float       (sinf)(float);
1677 +extern double      (sinh)(double);
1678 +extern float       (sinhf)(float);
1679 +extern long double (sinhl)(long double);
1680 +extern long double (sinl)(long double);
1681 +extern double      (sqrt)(double);
1682 +extern float       (sqrtf)(float);
1683 +extern long double (sqrtl)(long double);
1684 +extern double      (tan)(double);
1685 +extern float       (tanf)(float);
1686 +extern double      (tanh)(double);
1687 +extern float       (tanhf)(float);
1688 +extern long double (tanhl)(long double);
1689 +extern long double (tanl)(long double);
1690 +extern double      (tgamma)(double);
1691 +extern float       (tgammaf)(float);
1692 +extern long double (tgammal)(long double);
1693 +extern double      (trunc)(double);
1694 +extern float       (truncf)(float);
1695 +extern long double (truncl)(long double);
1696 +extern double      (y0)(double);		/* XSI extension */
1697 +extern double      (y1)(double);		/* XSI extension */
1698 +extern double      (yn)(int, double);	/* XSI extension */
1699 +
1700 +#if defined(__cplusplus)
1701 +}
1702 +#endif
1703 +#endif
1704 --- cephes-2.8/patches/Makefile_bsd.orig	2010-07-26 08:25:54.660310527 +1000
1705 +++ cephes-2.8/patches/Makefile_bsd	2010-07-26 08:25:54.662310466 +1000
1706 @@ -0,0 +1,77 @@
1707 +# FreeBSD makefile for cephes.
1708 +
1709 +# Build tools
1710 +CC ?= gcc
1711 +LD ?= ld
1712 +CP ?= cp
1713 +INSTALL ?= install
1714 +
1715 +# Intermediate (ar) libraries
1716 +LIBS=c9x-complex/libmc.a double/libmd.a ldouble/libml.a single/libmf.a
1717 +
1718 +all: libm.so
1719 +
1720 +install: libm.so complex.h math.h
1721 +	${INSTALL} -C -m 644 complex.h math.h "${SAGE_LOCAL}/include"
1722 +	${INSTALL} -C -m 755 libm.so "${SAGE_LOCAL}/lib"
1723 +
1724 +check:
1725 +	cd c9x-complex && ${MAKE} "CC=${CC}" check
1726 +	cd double && ${MAKE} "CC=${CC}" check
1727 +	cd ldouble && ${MAKE} "CC=${CC}" check
1728 +	cd single && ${MAKE} "CC=${CC}" check
1729 +#	cd c9x-complex && ${MAKE} "LIBS=-L.. -rpath .. -lm" "CC=${CC}" check
1730 +#	cd double && ${MAKE} "LIBS=-L.. -rpath .. -lm" "CC=${CC}" check
1731 +#	cd ldouble && ${MAKE} "LIBS=-L.. -rpath .. -lm" "CC=${CC}" check
1732 +#	cd single && ${MAKE} "LIBS=-L.. -rpath .. -lm" "CC=${CC}" check
1733 +#	TBD
1734 +
1735 +clean:
1736 +	rm -f libm.so syms.c99 syms.libm syms.wanted
1737 +	cd c9x-complex && ${MAKE} clean
1738 +	cd double && ${MAKE} clean
1739 +	cd ldouble && ${MAKE} clean
1740 +	cd single && ${MAKE} clean
1741 +
1742 +# FreeBSD includes some but not all of the C99 maths functions.  Build
1743 +# a "new" libm.so that uses cephes functions to replace the missing ones
1744 +# (listed in syms.wanted) and then fallback to the base libm.so
1745 +libm.so: ${LIBS} syms.wanted
1746 +	${LD} -shared -o $@ $$(sed 's/^/-u /' syms.wanted) -L/usr/lib -lc -lm \
1747 +	   ${LIBS} -lgcc
1748 +
1749 +# List of symbols defined in the FreeBSD base libc.so and libm.so
1750 +# libc.so is included because some math-related functions are in libc.so
1751 +syms.libm: /usr/lib/libc.so /usr/lib/libm.so
1752 +	nm -Dgp $^ | sed 's/^.* //' | sort -uo $@
1753 +
1754 +# List of symbols defined in C99 math.h and complex.h
1755 +# Doing it this way saves having to maintain a second list
1756 +syms.c99: math.h complex.h
1757 +	sed -ne 's/)(.*//' -e '/^extern/s/^.* (//p' $^ | sort -uo $@
1758 +
1759 +# List of symbols in C99 not defined in FreeBSD
1760 +syms.wanted: syms.libm syms.c99
1761 +	comm -23 syms.c99 syms.libm > $@
1762 +
1763 +math.h: ../patches/math_bsd.h
1764 +	${CP} $^ $@
1765 +
1766 +complex.h: ../patches/complex_bsd.h
1767 +	${CP} $^ $@
1768 +
1769 +c9x-complex/complex.h: ../patches/complex_bsd.h
1770 +	${CP} $^ $@
1771 +
1772 +# Force compilation in PIC mode to allow creation of a shared library
1773 +c9x-complex/libmc.a: c9x-complex/complex.h
1774 +	cd c9x-complex && ${MAKE} "CC=${CC} -DPIC -fpic" libmc.a
1775 +
1776 +double/libmd.a:
1777 +	cd double && ${MAKE} "CC=${CC} -DPIC -fpic" libmd.a
1778 +
1779 +ldouble/libml.a:
1780 +	cd ldouble && ${MAKE} "CC=${CC} -DPIC -fpic" libml.a
1781 +
1782 +single/libmf.a:
1783 +	cd single && ${MAKE} "CC=${CC} -DPIC -fpic" libmf.a
1784 --- cephes-2.8/patches/complex_bsd.h.orig	2010-07-26 08:25:54.654310990 +1000
1785 +++ cephes-2.8/patches/complex_bsd.h	2010-07-26 08:25:54.658310309 +1000
1786 @@ -0,0 +1,131 @@
1787 +/*
1788 +** Replacement <complex.h> merging host version with cephes functions
1789 +*/
1790 +
1791 +/* Start by using host complex file.
1792 + * This has to come before the following protective #ifdef so that
1793 + * #include "complex.h" is correctly handled. */
1794 +#include_next <complex.h>
1795 +
1796 +#ifndef __CEPHES_COMPLEX_H
1797 +#define __CEPHES_COMPLEX_H
1798 +
1799 +#if defined(__cplusplus)
1800 +extern "C" {
1801 +#endif
1802 +
1803 +/* The following content is derived from
1804 + * http://www.opengroup.org/onlinepubs/9699919799/basedefs/complex.h.html
1805 + */
1806 +extern double              (cabs)(double complex);
1807 +extern float               (cabsf)(float complex);
1808 +extern long double         (cabsl)(long double complex);
1809 +extern double complex      (cacos)(double complex);
1810 +extern float complex       (cacosf)(float complex);
1811 +extern double complex      (cacosh)(double complex);
1812 +extern float complex       (cacoshf)(float complex);
1813 +extern long double complex (cacoshl)(long double complex);
1814 +extern long double complex (cacosl)(long double complex);
1815 +extern double complex      (cadd)(double complex a, double complex b); /*ceph*/
1816 +extern double              (carg)(double complex);
1817 +extern float               (cargf)(float complex);
1818 +extern long double         (cargl)(long double complex);
1819 +extern double complex      (casin)(double complex);
1820 +extern float complex       (casinf)(float complex);
1821 +extern double complex      (casinh)(double complex);
1822 +extern float complex       (casinhf)(float complex);
1823 +extern long double complex (casinhl)(long double complex);
1824 +extern long double complex (casinl)(long double complex);
1825 +extern double complex      (catan)(double complex);
1826 +extern float complex       (catanf)(float complex);
1827 +extern double complex      (catanh)(double complex);
1828 +extern float complex       (catanhf)(float complex);
1829 +extern long double complex (catanhl)(long double complex);
1830 +extern long double complex (catanl)(long double complex);
1831 +extern double complex      (ccos)(double complex);
1832 +extern float complex       (ccosf)(float complex);
1833 +extern double complex      (ccosh)(double complex);
1834 +extern float complex       (ccoshf)(float complex);
1835 +extern long double complex (ccoshl)(long double complex);
1836 +extern long double complex (ccosl)(long double complex);
1837 +extern double complex      (ccot)(double complex z);                   /*ceph*/
1838 +extern float complex       (ccotf)(float complex z);                   /*ceph*/
1839 +extern long double complex (ccotl)(long double complex z);             /*ceph*/
1840 +extern double complex      (cdiv)(double complex a, double complex b); /*ceph*/
1841 +extern double complex      (cexp)(double complex);
1842 +extern float complex       (cexpf)(float complex);
1843 +extern long double complex (cexpl)(long double complex);
1844 +extern double complex      (cgamma)(double complex z);                 /*ceph*/
1845 +extern float complex       (cgammaf)(float complex z);                 /*ceph*/
1846 +extern long double complex (cgammal)(long double complex z);           /*ceph*/
1847 +extern double              (cimag)(double complex);
1848 +extern float               (cimagf)(float complex);
1849 +extern long double         (cimagl)(long double complex);
1850 +extern double complex 	   (clgam)(double complex z);                  /*ceph*/
1851 +extern float complex       (clgamf)(float complex z);                  /*ceph*/
1852 +extern long double complex (clgaml)(long double complex z);            /*ceph*/
1853 +extern double complex      (clog)(double complex);
1854 +extern float complex       (clogf)(float complex);
1855 +extern long double complex (clogl)(long double complex);
1856 +extern double complex      (cmul)(double complex a, double complex b); /*ceph*/
1857 +extern double complex      (conj)(double complex);
1858 +extern float complex       (conjf)(float complex);
1859 +extern long double complex (conjl)(long double complex);
1860 +extern double complex      (cpow)(double complex, double complex);
1861 +extern float complex       (cpowf)(float complex, float complex);
1862 +extern long double complex (cpowl)(long double complex, long double complex);
1863 +extern double complex      (cproj)(double complex);
1864 +extern float complex       (cprojf)(float complex);
1865 +extern long double complex (cprojl)(long double complex);
1866 +extern double              (creal)(double complex);
1867 +extern float               (crealf)(float complex);
1868 +extern long double         (creall)(long double complex);
1869 +extern double complex      (csin)(double complex);
1870 +extern float complex       (csinf)(float complex);
1871 +extern double complex      (csinh)(double complex);
1872 +extern float complex       (csinhf)(float complex);
1873 +extern long double complex (csinhl)(long double complex);
1874 +extern long double complex (csinl)(long double complex);
1875 +extern double complex      (csqrt)(double complex);
1876 +extern float complex       (csqrtf)(float complex);
1877 +extern long double complex (csqrtl)(long double complex);
1878 +extern double complex      (csub)(double complex a, double complex b); /*ceph*/
1879 +extern double complex      (ctan)(double complex);
1880 +extern float complex       (ctanf)(float complex);
1881 +extern double complex      (ctanh)(double complex);
1882 +extern float complex       (ctanhf)(float complex);
1883 +extern long double complex (ctanhl)(long double complex);
1884 +extern long double complex (ctanl)(long double complex);
1885 +
1886 +/* macro versions of some of the above functions, from the cephes complex.h */
1887 +/* These are not typed in gcc.  They preseve the type of the argument.  */
1888 +/* Complex conjugate function.  */
1889 +#define conj(x) (~(x))
1890 +/* Function to get imaginary part.  */
1891 +#define cimag(x) (__imag__(x))
1892 +/* Function to get real part.  */
1893 +#define creal(x) (__real__(x))
1894 +
1895 +extern double (atan2)(double, double);
1896 +#define carg(z) (atan2((double)cimag(z), (double)creal(z)))
1897 +
1898 +/* There are float and long double sizes, too.  */
1899 +#define cimagf(x) ((float)__imag__(x))
1900 +#define crealf(x) ((float)__real__(x))
1901 +extern float (atan2f)(float, float);
1902 +#define cargf(z) (atan2f((float)cimag(z), (float)creal(z)))
1903 +
1904 +#define cimagl(x) ((long double)__imag__(x))
1905 +#define creall(x) ((long double)__real__(x))
1906 +extern long double (atan2l)(long double, long double);
1907 +#define cargl(z) (atan2l((long double)cimag(z), (long double)creal(z)))
1908 +
1909 +/* These pragmas can't work without a compiler modification.  */
1910 +#define CX_LIMITED_RANGE_ON
1911 +#define CX_LIMITED_RANGE_OFF
1912 +#define CX_LIMITED_RANGE_DEFAULT CX_LIMITED_RANGE_ON
1913 +
1914 +#if defined(__cplusplus)
1915 +}
1916 +#endif
1917 +#endif
1918 --- cephes-2.8/patches/double/makefile.orig	2010-04-06 19:30:28.000000000 +1000
1919 +++ cephes-2.8/patches/double/makefile	2010-07-26 08:25:54.645313081 +1000
1920 @@ -24,6 +24,12 @@
1921  
1922  all: libmd.a mtst dtestvec monot dcalc # stamp-timing
1923  
1924 +check:  mtst dtestvec monot dcalc
1925 +	./mtst
1926 +	./dtestvec
1927 +	./monot
1928 +	./dcalc
1929 +
1930  stamp-timing: libmd.a mtst time-it
1931  	time-it "mtst > /dev/null"
1932  	touch stamp-timing
1933 spkg/patches/base.patch000644 000314 000000 00000001143 11471023233 015642 0ustar00peterwheel000000 000000 --- spkg/base/sage-spkg.orig	2010-11-17 08:31:11.000000000 +1100
1934 +++ spkg/base/sage-spkg	2010-11-18 06:00:05.191821181 +1100
1935 @@ -79,7 +79,7 @@
1936  fi
1937  export FORCE
1938  
1939 -DELETE_TMP=1
1940 +DELETE_TMP=0
1941  if [ $1 = '-s' -o $1 = '-m' ]; then
1942      DELETE_TMP=0
1943      shift
1944 @@ -279,6 +279,14 @@
1945      fi
1946  fi
1947  
1948 +if [ -f "$SAGE_PACKAGES/patches/$PKG_NAME.patch" ]; then
1949 +    echo "Applying local patches for $PKG_NAME"
1950 +    if ! patch -p0 < "$SAGE_PACKAGES/patches/$PKG_NAME.patch"; then
1951 +	echo "Patching failed"
1952 +	exit 1
1953 +    fi
1954 +fi
1955 +
1956  cd "$PKG_NAME"
1957  if [ ! -f spkg-install ]; then
1958      echo "#!/usr/bin/env bash" > spkg-install
1959 spkg/patches/matplotlib-1.0.0.p0.patch000644 000314 000000 00000001113 11470711274 020054 0ustar00peterwheel000000 000000 --- matplotlib-1.0.0.p0/patches/setupext.py.orig	2010-06-12 05:42:15.000000000 +1000
1960 +++ matplotlib-1.0.0.p0/patches/setupext.py	2010-11-17 18:38:48.656544709 +1100
1961 @@ -68,6 +68,9 @@
1962      'freebsd4' : ['/usr/local', '/usr'],
1963      'freebsd5' : ['/usr/local', '/usr'],
1964      'freebsd6' : ['/usr/local', '/usr'],
1965 +    'freebsd7' : ['/usr/local', '/usr'],
1966 +    'freebsd8' : ['/usr/local', '/usr'],
1967 +    'freebsd9' : ['/usr/local', '/usr'],
1968      'sunos5' : [os.getenv('MPLIB_BASE') or '/usr/local',],
1969      'gnukfreebsd5' : ['/usr/local', '/usr'],
1970      'gnukfreebsd6' : ['/usr/local', '/usr'],
1971 spkg/patches/sage-4.6.1.alpha2.patch000644 000314 000000 00000010643 11471022721 017467 0ustar00peterwheel000000 000000 --- sage-4.6.1.alpha2/sage/misc/freebsd_memory_usage.c.orig	2010-11-17 19:03:49.760266244 +1100
1972 +++ sage-4.6.1.alpha2/sage/misc/freebsd_memory_usage.c	2010-11-17 19:03:49.761266627 +1100
1973 @@ -0,0 +1,30 @@
1974 +#include <sys/types.h>
1975 +#include <fcntl.h>
1976 +#include <kvm.h>
1977 +#include <sys/param.h>
1978 +#include <sys/sysctl.h>
1979 +#include <sys/user.h>
1980 +#include <limits.h>	/* for _POSIX2_LINE_MAX */
1981 +#include <stdio.h>
1982 +#include <unistd.h>
1983 +
1984 +/* Return virtual size of current process in bytes */
1985 +unsigned long long freebsd_virtual_size()
1986 +{
1987 +	static kvm_t	*kvm;
1988 +	char	errbuf[_POSIX2_LINE_MAX];
1989 +	struct kinfo_proc *ki;
1990 +	int	cnt;
1991 +
1992 +	if (!kvm) {
1993 +		kvm = kvm_open(NULL, "/dev/null", NULL, O_RDONLY, errbuf);
1994 +		if (!kvm)
1995 +			return 0;	/* Don't report errors */
1996 +	}
1997 +
1998 +	ki = kvm_getprocs(kvm, KERN_PROC_PID, getpid(), &cnt);
1999 +	if (!ki)
2000 +		return 0;
2001 +
2002 +	return ki->ki_size;
2003 +}
2004 --- sage-4.6.1.alpha2/sage/misc/freebsd_utilities.pyx.orig	2010-11-17 19:03:49.758265757 +1100
2005 +++ sage-4.6.1.alpha2/sage/misc/freebsd_utilities.pyx	2010-11-17 19:03:49.759265861 +1100
2006 @@ -0,0 +1,30 @@
2007 +# freebsd_utilities extension module built only on FreeBSD (see end of module_list.py)
2008 +
2009 +cdef extern from "freebsd_memory_usage.h":
2010 +    cdef unsigned long long freebsd_virtual_size()
2011 +
2012 +def freebsd_memory_usage():
2013 +    r"""
2014 +    On Freebsd, returns the virtual size of the process in bytes.
2015 +    This will match what "top" reports as the VSIZE.
2016 +    Raises on all other platforms
2017 +    
2018 +    EXAMPLES
2019 +        sage: uname = os.uname()
2020 +        sage: if uname[0] == 'FreeBSD':
2021 +        ...       from sage.misc.freebsd_utilities import freebsd_memory_usage
2022 +        ...       memory_usage = freebsd_memory_usage()
2023 +        
2024 +        sage: uname = os.uname()
2025 +        sage: if uname[0] != 'FreeBSD':
2026 +        ...       try:
2027 +        ...           from sage.misc.freebsd_utilities import freebsd_memory_usage
2028 +        ...           memory_usage = freebsd_memory_usage()
2029 +        ...           print "doctest failure!"
2030 +        ...           print "freebsd_memory_usage() not implemented on platform %s"%uname[0]
2031 +        ...       except ImportError:
2032 +        ...           pass
2033 +        
2034 +
2035 +    """
2036 +    return freebsd_virtual_size()
2037 --- sage-4.6.1.alpha2/sage/misc/freebsd_memory_usage.h.orig	2010-11-17 19:03:49.757265654 +1100
2038 +++ sage-4.6.1.alpha2/sage/misc/freebsd_memory_usage.h	2010-11-17 19:03:49.757265654 +1100
2039 @@ -0,0 +1,2 @@
2040 +/* Return virtual size of current process in bytes */
2041 +unsigned long long freebsd_virtual_size(void);
2042 --- sage-4.6.1.alpha2/sage/groups/perm_gps/permgroup_element.pyx.orig	2010-11-02 10:32:34.000000000 +1100
2043 +++ sage-4.6.1.alpha2/sage/groups/perm_gps/permgroup_element.pyx	2010-11-17 19:03:49.756265830 +1100
2044 @@ -75,7 +75,7 @@
2045  from sage.rings.fast_arith cimport arith_llong
2046  cdef arith_llong arith = arith_llong()
2047  cdef extern from *:
2048 -    long long LONG_LONG_MAX
2049 +    long long LLONG_MAX
2050  
2051  #import permgroup_named
2052  
2053 @@ -740,7 +740,7 @@
2054                  order = order.lcm(cycle_len)
2055              else:
2056                  order_c = (order_c * cycle_len) / arith.c_gcd_longlong(order_c, cycle_len)
2057 -                if order_c > LONG_LONG_MAX / (self.n - i):
2058 +                if order_c > LLONG_MAX / (self.n - i):
2059                      order = Integer(order_c)
2060          sage_free(seen)
2061          return int(order_c) if order is None else order
2062 --- sage-4.6.1.alpha2/module_list.py.orig	2010-11-02 09:33:25.000000000 +1100
2063 +++ sage-4.6.1.alpha2/module_list.py	2010-11-17 19:03:49.747266015 +1100
2064 @@ -1639,7 +1639,16 @@
2065                    language = 'c',                                                                                                                                                                                                             
2066                    libraries = ["csage", "stdc++", "cplex"]) 
2067          )
2068 -
2069 + 
2070 +# Only include freebsd_utilities on FreeBSD       
2071 +if UNAME[0] == "FreeBSD":
2072 +    ext_modules.append(
2073 +        Extension('sage.misc.freebsd_utilities',
2074 +            sources = ['sage/misc/freebsd_memory_usage.c',
2075 +                       'sage/misc/freebsd_utilities.pyx'],
2076 +            depends = ['sage/misc/freebsd_memory_usage.h'],
2077 +            libraries = ["kvm"])
2078 +        )
2079  if is_package_installed('cbc'):
2080      ext_modules.append(
2081          Extension("sage.numerical.backends.coin_backend",                                                                                                                                                                                     
2082 spkg/patches/numpy-1.5.0.patch000644 000314 000000 00000001734 11470711275 016556 0ustar00peterwheel000000 000000 --- numpy-1.5.0/src/numpy/distutils/system_info.py.orig	2010-08-25 20:09:41.000000000 +1000
2083 +++ numpy-1.5.0/src/numpy/distutils/system_info.py	2010-11-17 18:38:49.666516267 +1100
2084 @@ -908,12 +908,8 @@
2085      section = 'atlas'
2086      dir_env_var = 'ATLAS'
2087      _lib_names = ['f77blas','cblas']
2088 -    if sys.platform[:7]=='freebsd':
2089 -        _lib_atlas = ['atlas_r']
2090 -        _lib_lapack = ['alapack_r']
2091 -    else:
2092 -        _lib_atlas = ['atlas']
2093 -        _lib_lapack = ['lapack']
2094 +    _lib_atlas = ['atlas']
2095 +    _lib_lapack = ['lapack']
2096  
2097      notfounderror = AtlasNotFoundError
2098  
2099 --- numpy-1.5.0/spkg-install.orig	2010-10-14 01:55:41.000000000 +1100
2100 +++ numpy-1.5.0/spkg-install	2010-11-17 19:12:27.422698525 +1100
2101 @@ -68,6 +68,9 @@
2102  # Program around a bug in SciPY's distutils.
2103  unset CFLAGS
2104  
2105 +# Ensure FreeBSD build finds new, local <math.h>
2106 +[ "$UNAME" = 'FreeBSD' ] && export CPPFLAGS="$CPPFLAGS -I$SAGE_LOCAL/include"
2107 +
2108  python setup.py install ${NUMPY_FCONFIG}
2109  
2110  if [ $? -ne 0 ]; then
2111 spkg/patches/flintqs-20070817.p5.patch000644 000314 000000 00000000631 11420541334 017643 0ustar00peterwheel000000 000000 --- flintqs-20070817.p5/src/TonelliShanks.h~	2007-05-06 08:52:39.000000000 +1000
2112 +++ flintqs-20070817.p5/src/TonelliShanks.h	2010-07-18 19:00:40.901540247 +1000
2113 @@ -19,6 +19,9 @@
2114  
2115  ============================================================================*/
2116  
2117 +#ifdef __FreeBSD__
2118 +#include <stdint.h>
2119 +#endif
2120  #include <stdlib.h>
2121  
2122  // =====================================================================
2123 spkg/patches/x/000755 000314 000000 00000000000 11422364435 014167 5ustar00peterwheel000000 000000 spkg/patches/sage_scripts-4.6.1.alpha2.patch000644 000314 000000 00000001203 11471022721 021226 0ustar00peterwheel000000 000000 --- sage_scripts-4.6.1.alpha2/sage-spkg.orig	2010-11-02 10:06:25.000000000 +1100
2124 +++ sage_scripts-4.6.1.alpha2/sage-spkg	2010-11-17 19:03:50.118258903 +1100
2125 @@ -79,7 +79,7 @@
2126  fi
2127  export FORCE
2128  
2129 -DELETE_TMP=1
2130 +DELETE_TMP=0
2131  if [ $1 = '-s' -o $1 = '-m' ]; then
2132      DELETE_TMP=0
2133      shift
2134 @@ -271,6 +271,14 @@
2135      fi
2136  fi
2137  
2138 +if [ -f "$SAGE_PACKAGES/patches/$PKG_NAME.patch" ]; then
2139 +    echo "Applying local patches for $PKG_NAME"
2140 +    if ! patch -p0 < "$SAGE_PACKAGES/patches/$PKG_NAME.patch"; then
2141 +	echo "Patching failed"
2142 +	exit 1
2143 +    fi
2144 +fi
2145 +
2146  cd "$PKG_NAME"
2147  if [ ! -f spkg-install ]; then
2148      echo "#!/usr/bin/env bash" > spkg-install
2149 spkg/patches/singular-3-1-1-4.p3.patch000644 000314 000000 00000003500 11470711300 017667 0ustar00peterwheel000000 000000 --- singular-3-1-1-4.p3/src/kernel/mod_raw.cc.orig	2009-11-02 21:12:22.000000000 +1100
2150 +++ singular-3-1-1-4.p3/src/kernel/mod_raw.cc	2010-11-17 19:05:58.586640853 +1100
2151 @@ -202,6 +202,10 @@
2152  #define HAVE_ELF_SYSTEM
2153  #endif
2154  
2155 +#ifdef x86_64_freebsd
2156 +#define HAVE_ELF_SYSTEM
2157 +#endif
2158 +
2159  #ifdef sparc64_Linux
2160  #define HAVE_ELF_SYSTEM
2161  #endif
2162 --- singular-3-1-1-4.p3/src/singuname.sh.orig	2009-11-02 21:12:22.000000000 +1100
2163 +++ singular-3-1-1-4.p3/src/singuname.sh	2010-11-17 19:03:53.238169419 +1100
2164 @@ -93,13 +93,18 @@
2165          exit 1
2166      fi
2167  # AMD-Opteron ########################################################
2168 -elif (echo $uname_m | $egrep "x86_64" > $devnull)
2169 +elif (echo $uname_m | $egrep "x86_64|amd64" > $devnull)
2170  then
2171      prefix=x86_64
2172      if (echo $uname_a | $egrep "Linux" > $devnull)
2173      then
2174          echo ${prefix}-Linux
2175          exit 0
2176 +    # FreeBSD ###############
2177 +    elif (echo $uname_a | $egrep "FreeBSD" > $devnull)
2178 +    then
2179 +        echo ${prefix}-freebsd
2180 +        exit 0
2181      else
2182          echo ${prefix}-Unknown
2183          exit 1
2184 --- singular-3-1-1-4.p3/src/Singular/configure.in.orig	2010-02-08 20:01:47.000000000 +1100
2185 +++ singular-3-1-1-4.p3/src/Singular/configure.in	2010-11-17 19:04:50.602554275 +1100
2186 @@ -473,7 +473,7 @@
2187  	        ac_lib_dl=yes
2188  	  fi
2189  	;;
2190 -	ix86-freebsd)
2191 +	*-freebsd)
2192  	  AC_CHECK_LIB(c, dlopen)
2193            if test "$ac_cv_lib_c_dlopen" = yes; then
2194  	  	LD_DYN_FLAGS="-Xlinker -E"
2195 --- singular-3-1-1-4.p3/src/Singular/configure.orig	2010-02-08 20:01:47.000000000 +1100
2196 +++ singular-3-1-1-4.p3/src/Singular/configure	2010-11-17 19:04:50.610555104 +1100
2197 @@ -2378,7 +2378,7 @@
2198  	        ac_lib_dl=yes
2199  	  fi
2200  	;;
2201 -	ix86-freebsd)
2202 +	*-freebsd)
2203  	  echo $ac_n "checking for dlopen in -lc""... $ac_c" 1>&6
2204  echo "configure:2384: checking for dlopen in -lc" >&5
2205  ac_lib_var=`echo c'_'dlopen | sed 'y%./+-%__p_%'`
2206 spkg/patches/atlas-3.8.3.p16.patch000644 000314 000000 00000004216 11470711274 017124 0ustar00peterwheel000000 000000 --- atlas-3.8.3.p16/make_correct_shared.sh.orig	2010-09-08 10:07:19.000000000 +1000
2207 +++ atlas-3.8.3.p16/make_correct_shared.sh	2010-11-17 19:11:01.850107086 +1100
2208 @@ -4,6 +4,8 @@
2209  # fail to build on Linux, and if liblapack.so is built on Solaris, it causes
2210  # problems. 
2211  
2212 +set -e
2213 +
2214  ##############Find the location of f95##########
2215  if [ `./fortran_type.pl` = "g95" ]; then
2216  f95_dir=$SAGE_LOCAL/lib/gcc-lib
2217 @@ -15,9 +17,10 @@
2218  ###############################################
2219  
2220  if [ `uname` = "Linux" ] || [ `uname` = "FreeBSD" ]; then
2221 +    [ "$UNAME" = "FreeBSD" ] && EXTRA=-lgcc_s
2222      if [ `./fortran_type.pl` =  "g95" ]; then
2223  	cd "$SAGE_LOCAL"/lib
2224 -	lapack_command="ld -L"$f95_dir" -L"$SAGE_LOCAL"/lib  -shared -soname liblapack.so -o liblapack.so  --whole-archive liblapack.a --no-whole-archive -lc -lm -lf95"
2225 +	lapack_command="ld -L"$f95_dir" -L"$SAGE_LOCAL"/lib  -shared -soname liblapack.so -o liblapack.so  --whole-archive liblapack.a --no-whole-archive -lc -lm -lf95 $EXTRA"
2226  	f77blas_command="ld -L"$f95_dir" -L"$SAGE_LOCAL"/lib  -shared -soname libf77blas.so -o libf77blas.so  --whole-archive libf77blas.a --no-whole-archive -lc -lm -lf95"
2227  
2228  	echo $lapack_command
2229 @@ -27,7 +30,7 @@
2230      
2231      else
2232  	cd "$SAGE_LOCAL"/lib
2233 -	lapack_command="ld -L"$SAGE_LOCAL"/lib  -shared -soname liblapack.so -o liblapack.so  --whole-archive liblapack.a --no-whole-archive -lc -lm -lgfortran"
2234 +	lapack_command="ld -L"$SAGE_LOCAL"/lib  -shared -soname liblapack.so -o liblapack.so  --whole-archive liblapack.a --no-whole-archive -lc -lm -lgfortran $EXTRA"
2235  	f77blas_command="ld -L"$SAGE_LOCAL"/lib -shared -soname libf77blas.so -o libf77blas.so  --whole-archive libf77blas.a --no-whole-archive -lc -lm -lgfortran"
2236  	echo $lapack_command
2237  	$lapack_command
2238 @@ -39,7 +42,6 @@
2239  
2240  # Build dynamic libraries on Solaris, using the Sun equivalent of the GNU
2241  # options above. Rather than call 'ld', the exact path to 'ld' is given
2242 -# since we know for 100% sure that 'ld' will reside in /usr/ccs/bin
2243  # on Solaris - this is true of both Solaris 10 and OpenSolaris
2244  # I'm not 100% sure if these options are optimal (there might be some
2245  # unnecessary commands, but its the exact equivalent of the GNU 
2246 spkg/patches/gap-4.4.12.p4.patch000644 000314 000000 00000005000 11423107730 016543 0ustar00peterwheel000000 000000 --- gap-4.4.12.p4/patches/sysfiles.c.orig	2010-04-29 01:30:00.000000000 +1000
2247 +++ gap-4.4.12.p4/patches/sysfiles.c	2010-07-26 05:25:58.334562226 +1000
2248 @@ -1524,7 +1524,7 @@
2249  **  to cooked mode before stopping GAP and back to raw mode when continueing.
2250  */
2251  
2252 -#if !SYS_IS_DARWIN && (SYS_BSD || SYS_MACH || HAVE_SGTTY_H)
2253 +#if !SYS_IS_DARWIN && (SYS_BSD || SYS_MACH || HAVE_SGTTY_H) && !HAVE_TERMIOS_H
2254  
2255  #ifndef SYS_SGTTY_H                     /* terminal control functions      */
2256  # include       <sgtty.h>
2257 @@ -2073,7 +2073,7 @@
2258  **
2259  *f  syStopraw( <fid> )  . . . . . . . . . . . . . . . . . . . . . .  BSD/MACH
2260  */
2261 -#if !SYS_IS_DARWIN && (SYS_BSD || SYS_MACH || HAVE_SGTTY_H)
2262 +#if !SYS_IS_DARWIN && (SYS_BSD || SYS_MACH || HAVE_SGTTY_H) && !HAVE_TERMIOS_H
2263  
2264  void syStopraw (
2265      Int                 fid )
2266 @@ -2760,7 +2760,7 @@
2267  **
2268  *f  syEchoch( <ch>, <fid> ) . . . . . . . . . . . . . . . . . . . .  BSD/MACH
2269  */
2270 -#if SYS_BSD || SYS_MACH || HAVE_SGTTY_H
2271 +#if (SYS_BSD || SYS_MACH || HAVE_SGTTY_H) && !HAVE_TERMIOS_H
2272  
2273  void syEchoch (
2274      Int                 ch,
2275 @@ -2786,7 +2786,7 @@
2276  **
2277  *f  syEchoch( <ch>, <fid> ) . . . . . . . . . . . . . . . . . . . . . . . USG
2278  */
2279 -#if SYS_USG || HAVE_TERMIO_H
2280 +#if SYS_USG || HAVE_TERMIO_H || HAVE_TERMIOS_H
2281  
2282  void syEchoch (
2283      Int                 ch,
2284 @@ -2974,7 +2974,7 @@
2285  **
2286  *f  syEchos( <ch>, <fid> )  . . . . . . . . . . . . . . . . . . . .  BSD/MACH
2287  */
2288 -#if SYS_BSD || SYS_MACH || HAVE_SGTTY_H
2289 +#if (SYS_BSD || SYS_MACH || HAVE_SGTTY_H) && !HAVE_TERMIOS_H
2290  
2291  void syEchos (
2292      Char *              str,
2293 @@ -2996,7 +2996,7 @@
2294  **
2295  *f  syEchos( <ch>, <fid> )  . . . . . . . . . . . . . . . . . . . . . . . USG
2296  */
2297 -#if SYS_USG || HAVE_TERMIO_H
2298 +#if SYS_USG || HAVE_TERMIO_H || HAVE_TERMIOS_H
2299  
2300  void syEchos (
2301      Char *              str,
2302 @@ -3149,7 +3149,7 @@
2303  **
2304  *f  SyFputs( <line>, <fid> )  . . . . . . .  BSD/MACH/USG/OS2 EMX/VMS/MAC MPW
2305  */
2306 -#if SYS_BSD||SYS_MACH||SYS_USG||SYS_OS2_EMX||SYS_VMS||SYS_MAC_MPW||HAVE_SGTTY_H||HAVE_TERMIO_H
2307 +#if SYS_BSD||SYS_MACH||SYS_USG||SYS_OS2_EMX||SYS_VMS||SYS_MAC_MPW||HAVE_SGTTY_H||HAVE_TERMIO_H||HAVE_TERMIOS_H
2308  
2309  void SyFputs (
2310      Char *              line,
2311 @@ -3476,7 +3476,7 @@
2312  **  that return odd things rather than waiting for a key
2313  **  
2314  */
2315 -#if SYS_BSD || SYS_MACH || HAVE_SGTTY_H ||SYS_USG || HAVE_TERMIO_H
2316 +#if SYS_BSD || SYS_MACH || HAVE_SGTTY_H ||SYS_USG || HAVE_TERMIO_H || HAVE_TERMIOS_H
2317  
2318  /* In the cygwin environment it is not predictable if text files get the
2319   * '\r' in their line ends filtered out *before* GAP sees them. This leads
2320 spkg/patches/cvxopt-1.1.3.patch000644 000314 000000 00000000656 11471030413 016717 0ustar00peterwheel000000 000000 --- cvxopt-1.1.3/spkg-install.orig	2010-08-02 04:46:46.000000000 +1000
2321 +++ cvxopt-1.1.3/spkg-install	2010-11-18 06:45:30.792086313 +1100
2322 @@ -33,6 +33,10 @@
2323  cp -p patches/setup.py src/src/
2324  
2325  cd src/src
2326 + 
2327 +# Ensure FreeBSD build finds new, local <math.h>
2328 +[ "$UNAME" = 'FreeBSD' ] && export CPPFLAGS="$CPPFLAGS -I$SAGE_LOCAL/include"
2329 +
2330  python setup.py install 
2331  if [ $? -ne 0 ]; then
2332     echo "Error building/installing cvxopt"
2333 spkg/patches/x/matplotlib-0.99.1.p4.patch~000644 000314 000000 00000002633 11413324322 020626 0ustar00peterwheel000000 000000 --- matplotlib-0.99.1.p4/patches/setupext.py~	2009-03-15 17:24:10.279608339 +1100
2334 +++ matplotlib-0.99.1.p4/patches/setupext.py	2009-03-15 21:52:55.397113345 +1100
2335 @@ -45,6 +45,7 @@
2336  import re
2337  import subprocess
2338  ### FOR SAGE
2339 +sage_base = os.environ['SAGE_LOCAL']
2340  sage_inc = os.environ['SAGE_LOCAL'] + '/include/'
2341  sage_lib = os.environ['SAGE_LOCAL'] + '/lib/'
2342  
2343 @@ -57,6 +58,9 @@
2344      'freebsd4' : ['/usr/local', '/usr'],
2345      'freebsd5' : ['/usr/local', '/usr'],
2346      'freebsd6' : ['/usr/local', '/usr'],
2347 +    'freebsd7' : [sage_base, '/usr/local', '/usr'],
2348 +    'freebsd8' : [sage_base, '/usr/local', '/usr'],
2349 +    'freebsd9' : [sage_base, '/usr/local', '/usr'],
2350      'sunos5' : [os.getenv('MPLIB_BASE') or '/usr/local',],
2351      'gnukfreebsd5' : ['/usr/local', '/usr'],
2352      'gnukfreebsd6' : ['/usr/local', '/usr'],
2353 --- matplotlib-0.99.1.p4/src/ttconv/pprdrv.h~	2008-05-08 05:41:26.000000000 +1000
2354 +++ matplotlib-0.99.1.p4/src/ttconv/pprdrv.h	2009-03-19 06:00:07.875942989 +1100
2355 @@ -21,6 +21,7 @@
2356  
2357  #include <vector>
2358  #include <cassert>
2359 +#undef putchar		/* gcc43 is broken */
2360  
2361  /*
2362   * Encapsulates all of the output to write to an arbitrary output
2363 --- matplotlib-0.99.1.p4/src/ttconv/truetype.h~	2008-05-02 04:24:54.000000000 +1000
2364 +++ matplotlib-0.99.1.p4/src/ttconv/truetype.h	2009-03-19 20:13:28.247298109 +1100
2365 @@ -5,6 +5,7 @@
2366   */
2367  
2368  #include <stdio.h>
2369 +#undef putchar	/* Broken g++43 */
2370  
2371  /*
2372  ** ~ppr/src/include/typetype.h
2373 spkg/patches/x/sage-4.5.patch000644 000314 000000 00000012273 11420651606 016435 0ustar00peterwheel000000 000000 --- sage-4.5/module_list.py.orig	2010-07-14 02:37:31.000000000 +1000
2374 +++ sage-4.5/module_list.py	2010-07-18 08:58:05.545416194 +1000
2375 @@ -1606,5 +1606,14 @@
2376                         'sage/misc/darwin_utilities.pyx'],
2377              depends = ['sage/misc/darwin_memory_usage.h'])
2378          )
2379 -        
2380 + 
2381 +# Only include freebsd_utilities on FreeBSD       
2382 +if UNAME[0] == "FreeBSD":
2383 +    ext_modules.append(
2384 +        Extension('sage.misc.freebsd_utilities',
2385 +            sources = ['sage/misc/freebsd_memory_usage.c',
2386 +                       'sage/misc/freebsd_utilities.pyx'],
2387 +            depends = ['sage/misc/freebsd_memory_usage.h'],
2388 +            libraries = ["kvm"])
2389 +        )
2390  
2391 --- sage-4.5/sage/combinat/partitions_c.cc.orig	2010-06-29 02:37:01.000000000 +1000
2392 +++ sage-4.5/sage/combinat/partitions_c.cc	2010-07-18 08:58:05.540418474 +1000
2393 @@ -94,6 +94,11 @@
2394  extern "C" long double coshl (long double);
2395  extern "C" long double sinhl (long double);
2396  #endif
2397 +/* FreeBSD pre-8.x doesn't have sqrtl() et al.  Hack around it for now
2398 + * since this sage code will be changed shortly */
2399 +#if defined(__FreeBSD__) && __FreeBSD__ < 8
2400 +#define sqrtl(x)	sqrt(x)
2401 +#endif
2402  
2403  #include <stdio.h>
2404  #include <cfloat>
2405 --- sage-4.5/sage/groups/perm_gps/permgroup_element.pyx.orig	2010-07-15 01:11:58.000000000 +1000
2406 +++ sage-4.5/sage/groups/perm_gps/permgroup_element.pyx	2010-07-18 08:58:05.548416223 +1000
2407 @@ -75,7 +75,7 @@
2408  from sage.rings.fast_arith cimport arith_llong
2409  cdef arith_llong arith = arith_llong()
2410  cdef extern from *:
2411 -    long long LONG_LONG_MAX
2412 +    long long LLONG_MAX
2413  
2414  #import permgroup_named
2415  
2416 @@ -740,7 +740,7 @@
2417                  order = order.lcm(cycle_len)
2418              else:
2419                  order_c = (order_c * cycle_len) / arith.c_gcd_longlong(order_c, cycle_len)
2420 -                if order_c > LONG_LONG_MAX / (self.n - i):
2421 +                if order_c > LLONG_MAX / (self.n - i):
2422                      order = Integer(order_c)
2423          sage_free(seen)
2424          return int(order_c) if order is None else order
2425 --- sage-4.5/sage/misc/freebsd_memory_usage.h.orig	2010-07-18 08:58:05.534420931 +1000
2426 +++ sage-4.5/sage/misc/freebsd_memory_usage.h	2010-07-18 08:58:05.534420931 +1000
2427 @@ -0,0 +1,2 @@
2428 +/* Return virtual size of current process in bytes */
2429 +unsigned long long freebsd_virtual_size(void);
2430 --- sage-4.5/sage/misc/freebsd_utilities.pyx.orig	2010-07-18 08:58:05.535418519 +1000
2431 +++ sage-4.5/sage/misc/freebsd_utilities.pyx	2010-07-18 08:58:05.536418622 +1000
2432 @@ -0,0 +1,30 @@
2433 +# freebsd_utilities extension module built only on FreeBSD (see end of module_list.py)
2434 +
2435 +cdef extern from "freebsd_memory_usage.h":
2436 +    cdef unsigned long long freebsd_virtual_size()
2437 +
2438 +def freebsd_memory_usage():
2439 +    r"""
2440 +    On Freebsd, returns the virtual size of the process in bytes.
2441 +    This will match what "top" reports as the VSIZE.
2442 +    Raises on all other platforms
2443 +    
2444 +    EXAMPLES
2445 +        sage: uname = os.uname()
2446 +        sage: if uname[0] == 'FreeBSD':
2447 +        ...       from sage.misc.freebsd_utilities import freebsd_memory_usage
2448 +        ...       memory_usage = freebsd_memory_usage()
2449 +        
2450 +        sage: uname = os.uname()
2451 +        sage: if uname[0] != 'FreeBSD':
2452 +        ...       try:
2453 +        ...           from sage.misc.freebsd_utilities import freebsd_memory_usage
2454 +        ...           memory_usage = freebsd_memory_usage()
2455 +        ...           print "doctest failure!"
2456 +        ...           print "freebsd_memory_usage() not implemented on platform %s"%uname[0]
2457 +        ...       except ImportError:
2458 +        ...           pass
2459 +        
2460 +
2461 +    """
2462 +    return freebsd_virtual_size()
2463 --- sage-4.5/sage/misc/freebsd_memory_usage.c.orig	2010-07-18 08:58:05.532418491 +1000
2464 +++ sage-4.5/sage/misc/freebsd_memory_usage.c	2010-07-18 08:58:05.533418314 +1000
2465 @@ -0,0 +1,30 @@
2466 +#include <sys/types.h>
2467 +#include <fcntl.h>
2468 +#include <kvm.h>
2469 +#include <sys/param.h>
2470 +#include <sys/sysctl.h>
2471 +#include <sys/user.h>
2472 +#include <limits.h>	/* for _POSIX2_LINE_MAX */
2473 +#include <stdio.h>
2474 +#include <unistd.h>
2475 +
2476 +/* Return virtual size of current process in bytes */
2477 +unsigned long long freebsd_virtual_size()
2478 +{
2479 +	static kvm_t	*kvm;
2480 +	char	errbuf[_POSIX2_LINE_MAX];
2481 +	struct kinfo_proc *ki;
2482 +	int	cnt;
2483 +
2484 +	if (!kvm) {
2485 +		kvm = kvm_open(NULL, "/dev/null", NULL, O_RDONLY, errbuf);
2486 +		if (!kvm)
2487 +			return 0;	/* Don't report errors */
2488 +	}
2489 +
2490 +	ki = kvm_getprocs(kvm, KERN_PROC_PID, getpid(), &cnt);
2491 +	if (!ki)
2492 +		return 0;
2493 +
2494 +	return ki->ki_size;
2495 +}
2496 --- sage-4.5/sage/ext/fast_eval.pyx.orig	2010-07-15 01:11:58.000000000 +1000
2497 +++ sage-4.5/sage/ext/fast_eval.pyx	2010-07-18 08:58:05.542416445 +1000
2498 @@ -127,13 +127,20 @@
2499      double exp(double)
2500      double log(double)
2501      double log10(double)
2502 -    double log2_ "log2"(double)
2503 +
2504 +IF UNAME_SYSNAME != "FreeBSD":
2505 +    cdef extern from "math.h":
2506 +        double log2_ "log2"(double)
2507  
2508  
2509  # This is only needed on Cygwin since log2 is a macro.
2510  # If we don't do this the cygwin GCC gets very confused.
2511 -cdef inline double log2(double x): 
2512 -    return log2_(x)
2513 +IF UNAME_SYSNAME != "FreeBSD":
2514 +    cdef inline double log2(double x): 
2515 +       return log2_(x)
2516 +ELSE:
2517 +    cdef inline double log2(double x):
2518 +        return 1.442695040888963407359924681*log(x)
2519  
2520  cdef extern from *:
2521      void* memcpy(void* dst, void* src, size_t len)
2522 spkg/patches/x/atlas-3.8.3.p12.patch000644 000314 000000 00000000733 11413325241 017357 0ustar00peterwheel000000 000000 --- atlas-3.8.3.p12/src/CONFIG/src/SpewMakeInc.c~	2009-02-19 05:47:37.000000000 +1100
2523 +++ atlas-3.8.3.p12/src/CONFIG/src/SpewMakeInc.c	2009-03-01 16:24:42.131861605 +1100
2524 @@ -664,6 +664,8 @@
2525           fprintf(fpout, " -melf_i386");
2526        else if (ptrbits == 64)
2527           fprintf(fpout, " -melf_x86_64");
2528 +      if (OS == OSFreeBSD)
2529 +	 fprintf(fpout, "_fbsd");
2530     }
2531     fprintf(fpout, "\n   F77SYSLIB = %s\n", f77lib ? f77lib : "");
2532     fprintf(fpout, "   BC = $(ICC)\n");
2533 spkg/patches/x/prereq-0.7.patch000644 000314 000000 00000003445 11413461144 017011 0ustar00peterwheel000000 000000 --- prereq-0.7/configure~	2010-01-25 11:21:02.000000000 +1100
2534 +++ prereq-0.7/configure	2010-07-03 08:02:51.069528000 +1000
2535 @@ -7377,11 +7377,11 @@
2536            echo ""
2537            echo "$fortran_compiler_string"
2538            echo ""
2539 -          { $as_echo "$as_me:$LINENO: Exiting since the Fortran compiler is not the same" >&5
2540 -$as_echo "$as_me: Exiting since the Fortran compiler is not the same" >&6;}
2541 -          { { $as_echo "$as_me:$LINENO: error: version as the C and C++ compilers" >&5
2542 -$as_echo "$as_me: error: version as the C and C++ compilers" >&2;}
2543 -   { (exit 1); exit 1; }; }
2544 +          { $as_echo "$as_me:$LINENO: WARNING: The Fortran compiler is not the same version as" >&5
2545 +$as_echo "$as_me: WARNING: The Fortran compiler is not the same version as" >&6;}
2546 +          { { $as_echo "$as_me:$LINENO: WARNING: the C and C++ compilers - this may cause problems" >&5
2547 +$as_echo "$as_me: WARNING: the C and C++ compilers - this may cause problems" >&2;}
2548 +   }
2549         else
2550            { $as_echo "$as_me:$LINENO: Excellent, the C, C++ and Fortran compilers are all GCC $GCC_VERSION" >&5
2551  $as_echo "$as_me: Excellent, the C, C++ and Fortran compilers are all GCC $GCC_VERSION" >&6;}
2552 --- prereq-0.7/configure.ac~	2010-01-25 11:20:50.000000000 +1100
2553 +++ prereq-0.7/configure.ac	2010-07-03 07:56:46.883117288 +1000
2554 @@ -444,8 +444,8 @@
2555            echo ""
2556            echo "$fortran_compiler_string"
2557            echo ""
2558 -          AC_MSG_NOTICE([Exiting since the Fortran compiler is not the same])
2559 -          AC_MSG_ERROR([version as the C and C++ compilers])
2560 +          AC_MSG_WARN([The Fortran compiler is not the same version as])
2561 +          AC_MSG_WARN([the C and C++ compilers - this may cause problems])
2562         else
2563            AC_MSG_NOTICE([Excellent, the C, C++ and Fortran compilers are all GCC $GCC_VERSION]) 
2564         fi
2565 spkg/patches/x/gap-4.4.12.p3.patch000644 000314 000000 00000006361 11413324322 017021 0ustar00peterwheel000000 000000 --- gap-4.4.12.p3/src/src/sysfiles.c~	2008-12-19 06:53:56.000000000 +1100
2566 +++ gap-4.4.12.p3/src/src/sysfiles.c	2009-03-21 10:59:43.148561884 +1100
2567 @@ -1523,7 +1523,7 @@
2568  **  to cooked mode before stopping GAP and back to raw mode when continueing.
2569  */
2570  
2571 -#if SYS_BSD || SYS_MACH || HAVE_SGTTY_H
2572 +#if (SYS_BSD || SYS_MACH || HAVE_SGTTY_H) && !HAVE_TERMIOS_H
2573  
2574  #ifndef SYS_SGTTY_H                     /* terminal control functions      */
2575  # include       <sgtty.h>
2576 @@ -2072,7 +2072,7 @@
2577  **
2578  *f  syStopraw( <fid> )  . . . . . . . . . . . . . . . . . . . . . .  BSD/MACH
2579  */
2580 -#if SYS_BSD || SYS_MACH || HAVE_SGTTY_H
2581 +#if (SYS_BSD || SYS_MACH || HAVE_SGTTY_H) && !HAVE_TERMIOS_H
2582  
2583  void syStopraw (
2584      Int                 fid )
2585 @@ -2759,7 +2759,7 @@
2586  **
2587  *f  syEchoch( <ch>, <fid> ) . . . . . . . . . . . . . . . . . . . .  BSD/MACH
2588  */
2589 -#if SYS_BSD || SYS_MACH || HAVE_SGTTY_H
2590 +#if (SYS_BSD || SYS_MACH || HAVE_SGTTY_H) && !HAVE_TERMIOS_H
2591  
2592  void syEchoch (
2593      Int                 ch,
2594 @@ -2785,7 +2785,7 @@
2595  **
2596  *f  syEchoch( <ch>, <fid> ) . . . . . . . . . . . . . . . . . . . . . . . USG
2597  */
2598 -#if SYS_USG || HAVE_TERMIO_H
2599 +#if SYS_USG || HAVE_TERMIO_H || HAVE_TERMIOS_H
2600  
2601  void syEchoch (
2602      Int                 ch,
2603 @@ -2973,7 +2973,7 @@
2604  **
2605  *f  syEchos( <ch>, <fid> )  . . . . . . . . . . . . . . . . . . . .  BSD/MACH
2606  */
2607 -#if SYS_BSD || SYS_MACH || HAVE_SGTTY_H
2608 +#if (SYS_BSD || SYS_MACH || HAVE_SGTTY_H) && !HAVE_TERMIOS_H
2609  
2610  void syEchos (
2611      Char *              str,
2612 @@ -2995,7 +2995,7 @@
2613  **
2614  *f  syEchos( <ch>, <fid> )  . . . . . . . . . . . . . . . . . . . . . . . USG
2615  */
2616 -#if SYS_USG || HAVE_TERMIO_H
2617 +#if SYS_USG || HAVE_TERMIO_H || HAVE_TERMIOS_H
2618  
2619  void syEchos (
2620      Char *              str,
2621 @@ -3148,7 +3148,7 @@
2622  **
2623  *f  SyFputs( <line>, <fid> )  . . . . . . .  BSD/MACH/USG/OS2 EMX/VMS/MAC MPW
2624  */
2625 -#if SYS_BSD||SYS_MACH||SYS_USG||SYS_OS2_EMX||SYS_VMS||SYS_MAC_MPW||HAVE_SGTTY_H||HAVE_TERMIO_H
2626 +#if SYS_BSD||SYS_MACH||SYS_USG||SYS_OS2_EMX||SYS_VMS||SYS_MAC_MPW||HAVE_SGTTY_H||HAVE_TERMIO_H||HAVE_TERMIOS_H
2627  
2628  void SyFputs (
2629      Char *              line,
2630 @@ -3475,7 +3475,7 @@
2631  **  that return odd things rather than waiting for a key
2632  **  
2633  */
2634 -#if SYS_BSD || SYS_MACH || HAVE_SGTTY_H ||SYS_USG || HAVE_TERMIO_H
2635 +#if SYS_BSD || SYS_MACH || HAVE_SGTTY_H ||SYS_USG || HAVE_TERMIO_H || HAVE_TERMIOS_H
2636  
2637  /* In the cygwin environment it is not predictable if text files get the
2638   * '\r' in their line ends filtered out *before* GAP sees them. This leads
2639 --- gap-4.4.12.p3/src/src/iostream.c~	2008-12-19 06:53:56.000000000 +1100
2640 +++ gap-4.4.12.p3/src/src/iostream.c	2009-03-21 10:55:47.375272268 +1100
2641 @@ -287,6 +287,15 @@
2642        return 0;
2643      }
2644    return 1;
2645 +#elif defined(__FreeBSD)
2646 +  if ((*pty = posix_openpt(O_RDWR)) > 0 )
2647 +    {
2648 +      if (grantpt(*pty) || unlockpt(*pty))
2649 +	return 1;
2650 +      strcpy(nametty, ptsname(*pty));
2651 +      return 0;
2652 +    }
2653 +  return 1;
2654  #else
2655  #   ifdef att
2656          if ( (*pty = open( "/dev/ptmx", O_RDWR )) < 0 )
2657 --- gap-4.4.12.p3/src/pkg/guava3.4/src/leonconv.c~	2008-12-19 06:28:19.000000000 +1100
2658 +++ gap-4.4.12.p3/src/pkg/guava3.4/src/leonconv.c	2009-03-21 13:04:53.120884934 +1100
2659 @@ -1,5 +1,7 @@
2660  #include <stdio.h> 
2661 -#if !defined(__APPLE__)
2662 +#if defined(__FreeBSD__)
2663 +#include <stdlib.h>
2664 +#elif !defined(__APPLE__)
2665  #include <malloc.h>
2666  #endif
2667   
2668 spkg/patches/x/gap-4.4.12.p3.patch~000644 000314 000000 00000006367 11272151020 017221 0ustar00peterwheel000000 000000 --- gap-4.4.10.p12/src/src/sysfiles.c~	2008-12-19 06:53:56.000000000 +1100
2669 +++ gap-4.4.10.p12/src/src/sysfiles.c	2009-03-21 10:59:43.148561884 +1100
2670 @@ -1523,7 +1523,7 @@
2671  **  to cooked mode before stopping GAP and back to raw mode when continueing.
2672  */
2673  
2674 -#if SYS_BSD || SYS_MACH || HAVE_SGTTY_H
2675 +#if (SYS_BSD || SYS_MACH || HAVE_SGTTY_H) && !HAVE_TERMIOS_H
2676  
2677  #ifndef SYS_SGTTY_H                     /* terminal control functions      */
2678  # include       <sgtty.h>
2679 @@ -2072,7 +2072,7 @@
2680  **
2681  *f  syStopraw( <fid> )  . . . . . . . . . . . . . . . . . . . . . .  BSD/MACH
2682  */
2683 -#if SYS_BSD || SYS_MACH || HAVE_SGTTY_H
2684 +#if (SYS_BSD || SYS_MACH || HAVE_SGTTY_H) && !HAVE_TERMIOS_H
2685  
2686  void syStopraw (
2687      Int                 fid )
2688 @@ -2759,7 +2759,7 @@
2689  **
2690  *f  syEchoch( <ch>, <fid> ) . . . . . . . . . . . . . . . . . . . .  BSD/MACH
2691  */
2692 -#if SYS_BSD || SYS_MACH || HAVE_SGTTY_H
2693 +#if (SYS_BSD || SYS_MACH || HAVE_SGTTY_H) && !HAVE_TERMIOS_H
2694  
2695  void syEchoch (
2696      Int                 ch,
2697 @@ -2785,7 +2785,7 @@
2698  **
2699  *f  syEchoch( <ch>, <fid> ) . . . . . . . . . . . . . . . . . . . . . . . USG
2700  */
2701 -#if SYS_USG || HAVE_TERMIO_H
2702 +#if SYS_USG || HAVE_TERMIO_H || HAVE_TERMIOS_H
2703  
2704  void syEchoch (
2705      Int                 ch,
2706 @@ -2973,7 +2973,7 @@
2707  **
2708  *f  syEchos( <ch>, <fid> )  . . . . . . . . . . . . . . . . . . . .  BSD/MACH
2709  */
2710 -#if SYS_BSD || SYS_MACH || HAVE_SGTTY_H
2711 +#if (SYS_BSD || SYS_MACH || HAVE_SGTTY_H) && !HAVE_TERMIOS_H
2712  
2713  void syEchos (
2714      Char *              str,
2715 @@ -2995,7 +2995,7 @@
2716  **
2717  *f  syEchos( <ch>, <fid> )  . . . . . . . . . . . . . . . . . . . . . . . USG
2718  */
2719 -#if SYS_USG || HAVE_TERMIO_H
2720 +#if SYS_USG || HAVE_TERMIO_H || HAVE_TERMIOS_H
2721  
2722  void syEchos (
2723      Char *              str,
2724 @@ -3148,7 +3148,7 @@
2725  **
2726  *f  SyFputs( <line>, <fid> )  . . . . . . .  BSD/MACH/USG/OS2 EMX/VMS/MAC MPW
2727  */
2728 -#if SYS_BSD||SYS_MACH||SYS_USG||SYS_OS2_EMX||SYS_VMS||SYS_MAC_MPW||HAVE_SGTTY_H||HAVE_TERMIO_H
2729 +#if SYS_BSD||SYS_MACH||SYS_USG||SYS_OS2_EMX||SYS_VMS||SYS_MAC_MPW||HAVE_SGTTY_H||HAVE_TERMIO_H||HAVE_TERMIOS_H
2730  
2731  void SyFputs (
2732      Char *              line,
2733 @@ -3475,7 +3475,7 @@
2734  **  that return odd things rather than waiting for a key
2735  **  
2736  */
2737 -#if SYS_BSD || SYS_MACH || HAVE_SGTTY_H ||SYS_USG || HAVE_TERMIO_H
2738 +#if SYS_BSD || SYS_MACH || HAVE_SGTTY_H ||SYS_USG || HAVE_TERMIO_H || HAVE_TERMIOS_H
2739  
2740  /* In the cygwin environment it is not predictable if text files get the
2741   * '\r' in their line ends filtered out *before* GAP sees them. This leads
2742 --- gap-4.4.10.p12/src/src/iostream.c~	2008-12-19 06:53:56.000000000 +1100
2743 +++ gap-4.4.10.p12/src/src/iostream.c	2009-03-21 10:55:47.375272268 +1100
2744 @@ -287,6 +287,15 @@
2745        return 0;
2746      }
2747    return 1;
2748 +#elif defined(__FreeBSD)
2749 +  if ((*pty = posix_openpt(O_RDWR)) > 0 )
2750 +    {
2751 +      if (grantpt(*pty) || unlockpt(*pty))
2752 +	return 1;
2753 +      strcpy(nametty, ptsname(*pty));
2754 +      return 0;
2755 +    }
2756 +  return 1;
2757  #else
2758  #   ifdef att
2759          if ( (*pty = open( "/dev/ptmx", O_RDWR )) < 0 )
2760 --- gap-4.4.10.p12/src/pkg/guava3.4/src/leonconv.c~	2008-12-19 06:28:19.000000000 +1100
2761 +++ gap-4.4.10.p12/src/pkg/guava3.4/src/leonconv.c	2009-03-21 13:04:53.120884934 +1100
2762 @@ -1,5 +1,7 @@
2763  #include <stdio.h> 
2764 -#if !defined(__APPLE__)
2765 +#if defined(__FreeBSD__)
2766 +#include <stdlib.h>
2767 +#elif !defined(__APPLE__)
2768  #include <malloc.h>
2769  #endif
2770   
2771 spkg/patches/x/readline-6.0.p2.patch000644 000314 000000 00000002145 11420426422 017607 0ustar00peterwheel000000 000000 --- readline-6.0.p2/spkg-install~	2009-12-09 13:25:17.000000000 +1100
2772 +++ readline-6.0.p2/spkg-install	2009-12-30 08:45:51.286301313 +1100
2773 @@ -245,10 +245,6 @@
2774    # Fix permissions.
2775    chmod 755 "$SAGE_LOCAL"/lib/libreadline.*
2776    chmod 755 "$SAGE_LOCAL"/lib/libhistory.*
2777 -  if [ "$UNAME" = "FreeBSD" ]; then
2778 -    ln -s libreadline.so.6 $"SAGE_LOCAL"/lib/libreadline.so
2779 -    ln -s libhistory.so.6 "$SAGE_LOCAL"/lib/libhistory.so
2780 -  fi
2781    exit 0
2782  else
2783    echo "Readline's build claims to have finished, but files that should have been built weren't."
2784 --- readline-6.0.p2/src/support/shobj-conf~	2009-01-05 06:32:42.000000000 +1100
2785 +++ readline-6.0.p2/src/support/shobj-conf	2009-12-30 08:39:35.831791459 +1100
2786 @@ -132,11 +132,12 @@
2787  	SHOBJ_CFLAGS=-fPIC
2788  	SHOBJ_LD='${CC}'
2789  
2790 -	if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then
2791 +	if [ ! -x /usr/bin/objformat ] || [ "`/usr/bin/objformat`" = "elf" ]; then
2792  		SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
2793  
2794  		SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)'
2795  		SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
2796 +		SHLIB_LIBS='-ltermcap'
2797  	else
2798  		SHOBJ_LDFLAGS='-shared'
2799  
2800 spkg/patches/x/pari-2.3.5.p1.patch000644 000314 000000 00000000754 11413326452 017130 0ustar00peterwheel000000 000000 --- pari-2.3.5.p1/src/config/get_kernel~	2007-03-10 10:49:59.000000000 +1100
2801 +++ pari-2.3.5.p1/src/config/get_kernel	2009-10-28 07:05:55.989406690 +1100
2802 @@ -12,7 +12,7 @@
2803             4) asmarch=ix86;;
2804             8) asmarch=x86_64;;
2805             esac;                        pretty=$arch ;;
2806 -  x86_64)  case "$sizeof_long" in   
2807 +  x86_64|amd64)  case "$sizeof_long" in   
2808             4) asmarch=ix86;;
2809             8) asmarch=x86_64;;
2810             esac;                        pretty='amd64';;
2811 spkg/patches/x/matplotlib-0.99.1.p4.patch~~000644 000314 000000 00000002633 11271726451 021037 0ustar00peterwheel000000 000000 --- matplotlib-0.99.1.p2/patches/setupext.py~	2009-03-15 17:24:10.279608339 +1100
2812 +++ matplotlib-0.99.1.p2/patches/setupext.py	2009-03-15 21:52:55.397113345 +1100
2813 @@ -45,6 +45,7 @@
2814  import re
2815  import subprocess
2816  ### FOR SAGE
2817 +sage_base = os.environ['SAGE_LOCAL']
2818  sage_inc = os.environ['SAGE_LOCAL'] + '/include/'
2819  sage_lib = os.environ['SAGE_LOCAL'] + '/lib/'
2820  
2821 @@ -57,6 +58,9 @@
2822      'freebsd4' : ['/usr/local', '/usr'],
2823      'freebsd5' : ['/usr/local', '/usr'],
2824      'freebsd6' : ['/usr/local', '/usr'],
2825 +    'freebsd7' : [sage_base, '/usr/local', '/usr'],
2826 +    'freebsd8' : [sage_base, '/usr/local', '/usr'],
2827 +    'freebsd9' : [sage_base, '/usr/local', '/usr'],
2828      'sunos5' : [os.getenv('MPLIB_BASE') or '/usr/local',],
2829      'gnukfreebsd5' : ['/usr/local', '/usr'],
2830      'gnukfreebsd6' : ['/usr/local', '/usr'],
2831 --- matplotlib-0.99.1.p2/src/ttconv/pprdrv.h~	2008-05-08 05:41:26.000000000 +1000
2832 +++ matplotlib-0.99.1.p2/src/ttconv/pprdrv.h	2009-03-19 06:00:07.875942989 +1100
2833 @@ -21,6 +21,7 @@
2834  
2835  #include <vector>
2836  #include <cassert>
2837 +#undef putchar		/* gcc43 is broken */
2838  
2839  /*
2840   * Encapsulates all of the output to write to an arbitrary output
2841 --- matplotlib-0.99.1.p2/src/ttconv/truetype.h~	2008-05-02 04:24:54.000000000 +1000
2842 +++ matplotlib-0.99.1.p2/src/ttconv/truetype.h	2009-03-19 20:13:28.247298109 +1100
2843 @@ -5,6 +5,7 @@
2844   */
2845  
2846  #include <stdio.h>
2847 +#undef putchar	/* Broken g++43 */
2848  
2849  /*
2850  ** ~ppr/src/include/typetype.h
2851 

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2010-11-18 18:17:59, 106.5 KB) [[attachment:sage-4.6.1.alpha2.patch]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.