Attachment 'sage-4.5.patch'

Download

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