aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstephen <stephen@FreeBSD.org>2014-01-30 09:00:13 +0800
committerstephen <stephen@FreeBSD.org>2014-01-30 09:00:13 +0800
commit108f5fa1ab7237c31b43ad6ce47e1610b3896db0 (patch)
treeb68b2cb24718f944fe7595e3ed44c6988abcc3c4
parentea492849148bcbcb302b89a0b77a272947899c1c (diff)
downloadfreebsd-ports-gnome-108f5fa1ab7237c31b43ad6ce47e1610b3896db0.tar.gz
freebsd-ports-gnome-108f5fa1ab7237c31b43ad6ce47e1610b3896db0.tar.zst
freebsd-ports-gnome-108f5fa1ab7237c31b43ad6ce47e1610b3896db0.zip
- Update to 6.0. This was quite an overhaul since the directory structure
greatly changed. - Provide support for FreeBSD-10.
-rw-r--r--math/sage/Makefile77
-rw-r--r--math/sage/distinfo4
-rw-r--r--math/sage/files/patch-build_pkgs_cephes_spkg-install11
-rw-r--r--math/sage/files/patch-build_pkgs_eclib_fbsd-patch-src_libsrc_eclib_interface.h13
-rw-r--r--math/sage/files/patch-build_pkgs_maxima_fbsd-patch-src_interfaces_xmaxima_Makefile.in23
-rw-r--r--math/sage/files/patch-build_pkgs_mpir_patches_configure.patch1187
-rw-r--r--math/sage/files/patch-build_pkgs_ncurses_fbsd-patch-src_configure14
-rw-r--r--math/sage/files/patch-build_pkgs_numpy_fbsd-patch-src_numpy_distutils_system_info.py16
-rw-r--r--math/sage/files/patch-build_pkgs_ppl_fbsd-patch-src_demos_ppl_lpsol_ppl_lpsol.c14
-rw-r--r--math/sage/files/patch-build_pkgs_pycrypto_fbsd-patch-src.libtom.tomcrypt_pk.h (renamed from math/sage/files/spkg-patch-pycrypto_-_patches_src.libtom.tomcrypt_pk.h)2
-rw-r--r--math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Doc_library_fcntl.rst14
-rw-r--r--math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Modules__ctypes_libffi_configure24
-rw-r--r--math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Modules_fcntlmodule.c56
-rw-r--r--math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Python_thread_pthread.h58
-rw-r--r--math/sage/files/patch-build_pkgs_python_fbsd-patch-src_setup.py100
-rw-r--r--math/sage/files/patch-build_pkgs_sympow_fbsd-patch-src_disk.c14
-rw-r--r--math/sage/files/patch-src_bin_sage-spkg32
-rw-r--r--math/sage/files/patch-src_doc_common_builder.py (renamed from math/sage/files/spkg-patch-sage_-_doc_common_builder.py)4
-rw-r--r--math/sage/files/spkg-patch-cephes_-_spkg-install11
-rw-r--r--math/sage/files/spkg-patch-eclib_-_src_libsrc_eclib_interface.h10
-rw-r--r--math/sage/files/spkg-patch-maxima_-_src_interfaces_xmaxima_Makefile.in20
-rw-r--r--math/sage/files/spkg-patch-ncurses_-_src_configure11
-rw-r--r--math/sage/files/spkg-patch-numpy_-_src_numpy_distutils_system_info.py13
-rw-r--r--math/sage/files/spkg-patch-ppl_-_src_demos_ppl_lpsol_ppl_lpsol.c11
-rw-r--r--math/sage/files/spkg-patch-pycrypto_-_spkg-install11
-rw-r--r--math/sage/files/spkg-patch-python_-_src_Doc_library_fcntl.rst11
-rw-r--r--math/sage/files/spkg-patch-python_-_src_Modules__ctypes_libffi_configure21
-rw-r--r--math/sage/files/spkg-patch-python_-_src_Modules_fcntlmodule.c53
-rw-r--r--math/sage/files/spkg-patch-python_-_src_Python_thread_pthread.h55
-rw-r--r--math/sage/files/spkg-patch-python_-_src_setup.py97
-rw-r--r--math/sage/files/spkg-patch-sympow_-_src_disk.c11
-rw-r--r--math/sage/pkg-descr3
32 files changed, 1613 insertions, 388 deletions
diff --git a/math/sage/Makefile b/math/sage/Makefile
index 168ce7d474f2..56a3b6a5b2cb 100644
--- a/math/sage/Makefile
+++ b/math/sage/Makefile
@@ -2,19 +2,20 @@
# $FreeBSD$
PORTNAME= sage
-PORTVERSION= 5.13
+PORTVERSION= 6.0
CATEGORIES= math
MASTER_SITES= http://boxen.math.washington.edu/home/sagemath/sage-mirror/src/ \
http://mirrors.xmission.com/sage/src/ \
http://www-ftp.lip6.fr/pub/math/sagemath/src/ \
http://www.sagemath.org/src-old/
-PKGNAMESUFFIX= -math
EXTRACT_SUFX= .tar
MAINTAINER= stephen@FreeBSD.org
COMMENT= Open source Mathematics software
-BUILD_DEPENDS= bash:${PORTSDIR}/shells/bash
+BUILD_DEPENDS= bash:${PORTSDIR}/shells/bash \
+ convert:${PORTSDIR}/graphics/ImageMagick \
+ ffmpeg:${PORTSDIR}/multimedia/ffmpeg
LIB_DEPENDS= atlas:${PORTSDIR}/math/atlas \
lapack:${PORTSDIR}/math/lapack \
jpeg:${PORTSDIR}/graphics/jpeg
@@ -26,7 +27,9 @@ RUN_DEPENDS= bash:${PORTSDIR}/shells/bash
OPTIONS_DEFINE_amd64= 387
387_DESC= Use 387 instead of SSE FPU
+# Keep NO_SAGE set, since otherwise the resulting package is huge.
NO_STAGE= yes
+
.include <bsd.port.options.mk>
PLIST_FILES= bin/sage
@@ -36,6 +39,7 @@ USE_TK= yes
USE_GMAKE= yes
USE_TEX= latex:build
USES= iconv
+MAKE_JOBS_SAFE= yes
LDFLAGS:= -Wl,-rpath=${WRKSRC}/local/lib ${LDFLAGS}
FFLAGS+= -Wl,-rpath=${WRKSRC}/local/lib ${FPM_FLAG}
CFLAGS+= -Wl,-rpath=${WRKSRC}/local/lib ${FPM_FLAG}
@@ -66,6 +70,8 @@ LATEST_LINK= sage-math # Conflicts with graphics/sage.
MAKE_ARGS+= ARCH="${AR}"
post-patch:
+ ${REINPLACE_CMD} 's/$$MAKE $$gettext/$$MAKE PTHREAD_LIBS=${PTHREAD_LIBS} $$gettext/' ${WRKSRC}/build/pkgs/git/spkg-install
+
# Create the wrappers for the compiler invocations.
@${MKDIR} ${WRKSRC}/local/bin
@${LN} -s -f ${LOCALBASE}/bin/gmake ${WRKSRC}/local/bin/make
@@ -84,44 +90,6 @@ post-patch:
${FILESDIR}/gcc.in > ${WRKSRC}/local/bin/gfortran
@${CHMOD} +x ${WRKSRC}/local/bin/gfortran
-# Apply the patches to the appropriate xz'ed tarballs contained in
-# ${WRKSRC}/spkg/standard. The names of the patches are
-# spkg-${GENERIC_NAME_OF_TARBALL}_-_${NAME_OF_PATCH}.
-# The actual name of the tarball will be deduced from the second line of the
-# patch.
-
- @${MKDIR} ${WRKSRC}/tmp
- @${RM} -rf ${WRKSRC}/tmp/*
- @for p in ${FILESDIR}/spkg-patch-*; do \
- q=$${p#*/spkg-patch-}; \
- original_name=$${q%_-_*}; \
- actual_name=`cat $$p | ${HEAD} -2 | ${TAIL} -1 | ${SED} -e 's/+++ //' -e 's|/.*||'`; \
- if ! [ -e ${WRKSRC}/spkg/standard/$$actual_name.spkg ]; then \
- ${ECHO_MSG} "$$actual_name not found."; \
- exit 1; \
- fi; \
- tarballs="$$tarballs $$original_name|$$actual_name"; \
- done ;\
- tarballs=`${PRINTF} "%s\n" $$tarballs | ${SORT} -u`; \
- \
- cd ${WRKSRC}/tmp || exit 1; \
- for t in $$tarballs; do \
- original_name=$${t%|*}; actual_name=$${t#*|}; \
- f=${WRKSRC}/spkg/standard/$$actual_name.spkg; \
- if [ -e $$f-orig ]; then \
- ${MV} $$f-orig $$f; \
- fi; \
- ${TAR} -xf $$f; \
- ${ECHO_MSG} "Patching $$actual_name:"; \
- for p in ${FILESDIR}/spkg-patch-$${original_name}_-_*; do \
- ${ECHO_MSG} " applying $${p#*_-_}" ; \
- ${PATCH} < $$p 2>/dev/null || exit 1; \
- done; \
- ${MV} $$f $$f-orig; \
- ${TAR} -cyf $$f $$actual_name; \
- ${RM} -rf $$actual_name; \
- done
-
post-build:
${RM} -rf ${WRKSRC}/tmp/.sage
${CHMOD} -R a+rX ${WRKSRC}
@@ -130,18 +98,31 @@ check regression-test test: build
@${ECHO_MSG} This test can also be performed after installation by typing \"sage -testall\".
@${ECHO_MSG}
cd ${WRKSRC} && ${SETENV} DOT_SAGE=${WRKSRC}/tmp/.sage ./sage -testall
- ${RM} -f ${WRKSRC}/python.core
+ ${RM} -f ${WRKSRC}/python*.core
INSTALL_SAGE_DIR= ${PREFIX}/${PORTNAME}-${PORTVERSION}
+pre-install:
+ @${ECHO_MSG}
+ @${ECHO_MSG} \# Instead of doing \"make install\", you can simply perform the commands:
+ @${ECHO_MSG}
+ @${ECHO_MSG} ${MV} ${WRKSRC} ${PREFIX}/.
+ @${ECHO_MSG}
+ @${ECHO_MSG} \# The next four lines are only needed if you want sage in ${PREFIX}/bin.
+ @${ECHO_MSG}
+ @${ECHO_MSG} "${SED} -e \"s+#SAGE_ROOT.*+SAGE_ROOT=${INSTALL_SAGE_DIR}+\" \\"
+ @${ECHO_MSG} " ${INSTALL_SAGE_DIR}/sage > ${PREFIX}/bin/sage"
+ @${ECHO_MSG} ${CHOWN} ${BINOWN}:${BINGRP} ${PREFIX}/bin/sage
+ @${ECHO_MSG} ${CHMOD} ${BINMODE} ${PREFIX}/bin/sage
+ @${ECHO_MSG}
+ @${ECHO_MSG} \# The next line will provide write protection for sage.
+ @${ECHO_MSG} ${CHOWN} -hR ${BINOWN}:${BINGRP} ${INSTALL_SAGE_DIR}
+ @${ECHO_MSG}
+ @sleep 60
+
do-install:
cd ${WRKDIR} && ${FIND} -s ${WRKSRC} | \
- ${GREP} -v '^${WRKSRC}/spkg/standard/' | \
- ${GREP} -v '^${WRKSRC}/spkg/optional/' | \
- ${GREP} -v '^${WRKSRC}/spkg/logs/' | \
- ${GREP} -v '^${WRKSRC}/spkg/build/' | \
+ ${GREP} -v '^${WRKSRC}/upstream/' | \
${GREP} -v '^${WRKSRC}/tmp' | \
- ${GREP} -v -E '^${WRKSRC}/[^\/]+\.log$$' | \
- ${GREP} -v '^${WRKSRC}/Makefile' | \
${SED} -e 's#${WRKDIR}/##' | \
${CPIO} -pmud -R ${BINOWN}:${BINGRP} ${PREFIX}
${ECHO_CMD} | ${SETENV} DOT_SAGE=${INSTALL_SAGE_DIR}/tmp/.sage ${INSTALL_SAGE_DIR}/sage
diff --git a/math/sage/distinfo b/math/sage/distinfo
index 269b32daf85b..baedd168cdc9 100644
--- a/math/sage/distinfo
+++ b/math/sage/distinfo
@@ -1,2 +1,2 @@
-SHA256 (sage-5.13.tar) = 6e62495954bdc1c397fa1b7658b2825b4e6d1c26ac12b842a15eab61a5dabc97
-SIZE (sage-5.13.tar) = 361799680
+SHA256 (sage-6.0.tar) = 40a76473efa1c725ccfb3955bf5b95ea4578cc654f079b0f92fad4f4243302df
+SIZE (sage-6.0.tar) = 404654517
diff --git a/math/sage/files/patch-build_pkgs_cephes_spkg-install b/math/sage/files/patch-build_pkgs_cephes_spkg-install
new file mode 100644
index 000000000000..f819a1d92690
--- /dev/null
+++ b/math/sage/files/patch-build_pkgs_cephes_spkg-install
@@ -0,0 +1,11 @@
+--- build/pkgs/cephes/spkg-install-orig 2013-03-30 20:48:35.000000000 +0000
++++ build/pkgs/cephes/spkg-install 2013-03-30 20:48:57.000000000 +0000
+@@ -24,6 +24,8 @@
+ fi
+ done
+
++sed -i .orig 's|.*printf|//&1|' */mtherr.c
++
+ echo "Building Cephes..."
+ $MAKE
+ if [ $? -ne 0 ]; then
diff --git a/math/sage/files/patch-build_pkgs_eclib_fbsd-patch-src_libsrc_eclib_interface.h b/math/sage/files/patch-build_pkgs_eclib_fbsd-patch-src_libsrc_eclib_interface.h
new file mode 100644
index 000000000000..6d40c4ffe160
--- /dev/null
+++ b/math/sage/files/patch-build_pkgs_eclib_fbsd-patch-src_libsrc_eclib_interface.h
@@ -0,0 +1,13 @@
+--- /dev/null 2014-01-29 03:00:00.000000000 +0000
++++ build/pkgs/eclib/fbsd-patch-src_libsrc_eclib_interface.h 2014-01-29 03:01:19.000000000 +0000
+@@ -0,0 +1,10 @@
++--- src/libsrc/eclib/interface.h-orig 2013-04-26 23:46:24.000000000 +0000
+++++ src/libsrc/eclib/interface.h 2013-04-26 23:47:09.000000000 +0000
++@@ -48,6 +48,7 @@
++ #include <iterator>
++ using namespace std;
++ #include "templates.h"
+++#include <stdint.h>
++
++ #ifndef MININT
++ #define MININT numeric_limits<int>::min()
diff --git a/math/sage/files/patch-build_pkgs_maxima_fbsd-patch-src_interfaces_xmaxima_Makefile.in b/math/sage/files/patch-build_pkgs_maxima_fbsd-patch-src_interfaces_xmaxima_Makefile.in
new file mode 100644
index 000000000000..68baa306ced4
--- /dev/null
+++ b/math/sage/files/patch-build_pkgs_maxima_fbsd-patch-src_interfaces_xmaxima_Makefile.in
@@ -0,0 +1,23 @@
+--- /dev/null 2014-01-29 03:00:00.000000000 +0000
++++ build/pkgs/maxima/fbsd-patch-src_interfaces_xmaxima_Makefile.in 2014-01-29 03:01:19.000000000 +0000
+@@ -0,0 +1,20 @@
++--- src/interfaces/xmaxima/Makefile.in-orig 2013-05-09 02:26:31.000000000 +0000
+++++ src/interfaces/xmaxima/Makefile.in 2013-05-09 02:30:12.000000000 +0000
++@@ -624,14 +624,10 @@
++ tclIndex:: $(TKSOURCES)
++ echo "source ../ObjTcl/Object.tcl; auto_mkindex . $(TKSOURCES)" | $(TCLSH)
++
++-# Create Tkmaxima/tclIndex if tclsh is available. Otherwise, create empty file
++-# to satisfy make.
+++# Create empty Tkmaxima/tclIndex, because attempting to create it using tclsh
+++# seems to soak up huge amounts of resources.
++ Tkmaxima/tclIndex: $(TKSOURCES)
++- $(TCLSH) < /dev/null > /dev/null 2>&1 && \
++- (cd Tkmaxima ; \
++- echo "source ../ObjTcl/Object.tcl; auto_mkindex . $(ALLFILES)" | \
++- $(TCLSH)) || \
++- touch Tkmaxima/tclIndex
+++ touch Tkmaxima/tclIndex
++
++ FORCE:
++ # Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/math/sage/files/patch-build_pkgs_mpir_patches_configure.patch b/math/sage/files/patch-build_pkgs_mpir_patches_configure.patch
new file mode 100644
index 000000000000..9711e10edf34
--- /dev/null
+++ b/math/sage/files/patch-build_pkgs_mpir_patches_configure.patch
@@ -0,0 +1,1187 @@
+--- build/pkgs/mpir/patches/configure.patch-orig 2014-01-29 21:20:07.000000000 +0000
++++ build/pkgs/mpir/patches/configure.patch 2014-01-29 21:21:10.000000000 +0000
+@@ -1,6 +1,6 @@
+-diff -dru src/acinclude.m4 b/acinclude.m4
+---- src/acinclude.m4 2011-07-27 00:59:54.000000000 -0700
+-+++ b/acinclude.m4 2012-06-19 12:53:56.000000000 -0700
++diff -ur src/acinclude.m4 b/acinclude.m4
++--- src/acinclude.m4 2014-01-29 21:06:09.000000000 +0000
+++++ b/acinclude.m4 2014-01-29 21:06:23.000000000 +0000
+ @@ -519,31 +519,45 @@
+ int cmov () { return (n >= 0 ? n : 0); }
+ ])
+@@ -57,52 +57,49 @@
+ ])
+
+ # __builtin_alloca is not available everywhere, check it exists before
+-diff -dru src/configure.in b/configure.in
+---- src/configure.in 2012-03-08 23:21:29.000000000 -0800
+-+++ b/configure.in 2012-06-19 12:53:56.000000000 -0700
+-@@ -1918,16 +1918,6 @@
++Only in b: acinclude.m4.orig
++diff -ur src/aclocal.m4 b/aclocal.m4
++--- src/aclocal.m4 2014-01-29 21:06:09.000000000 +0000
+++++ b/aclocal.m4 2012-10-03 20:07:32.000000000 +0000
++@@ -2421,7 +2421,7 @@
++ shlibpath_var=LD_LIBRARY_PATH
++ ;;
++
++-freebsd1.*)
+++freebsd1*)
++ dynamic_linker=no
++ ;;
++
++@@ -2432,7 +2432,7 @@
++ objformat=`/usr/bin/objformat`
++ else
++ case $host_os in
++- freebsd[[123]].*) objformat=aout ;;
+++ freebsd[[123]]*) objformat=aout ;;
++ *) objformat=elf ;;
++ esac
+ fi
+- fi
+-
+--# The dead hand of AC_REQUIRE makes AC_PROG_LIBTOOL expand and execute
+--# AC_PROG_F77, even when F77 is not in the selected with_tags. This is
+--# probably harmless, but it's unsightly and bloats our configure, so pretend
+--# AC_PROG_F77 has been expanded already.
+--#
+--# FIXME: Rumour has it libtool will one day provide a way for a configure.in
+--# to say what it wants from among supported languages etc.
+--#
+--AC_PROVIDE([AC_PROG_F77])
+--
+- AC_PROG_LIBTOOL
+-
+- # Generate an error here if attempting to build both shared and static when
+-diff -dru src/yasm/Makefile.in b/yasm/Makefile.in
+---- src/yasm/Makefile.in 2012-03-10 23:16:35.000000000 -0800
+-+++ b/yasm/Makefile.in 2012-06-19 12:53:56.000000000 -0700
+-@@ -3747,7 +3747,8 @@
+- check-am: all-am
+- $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+- $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+--check:
+-+check: $(BUILT_SOURCES)
+-+ $(MAKE) $(AM_MAKEFLAGS) check-recursive
+- all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(MANS) $(HEADERS) config.h \
+- all-local
+- installdirs: installdirs-recursive
+-@@ -3755,7 +3756,8 @@
+- for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man7dir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(modincludedir)" "$(DESTDIR)$(includedir)"; do \
+- test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+- done
+--install:
+-+install: $(BUILT_SOURCES)
+-+ $(MAKE) $(AM_MAKEFLAGS) install-recursive
+- install-exec: install-exec-recursive
+- install-data: install-data-recursive
+- uninstall: uninstall-recursive
+-diff -dru src/configure b/configure
+---- src/configure 2012-06-19 12:53:56.000000000 -0700
+-+++ b/configure 2012-03-10 01:07:26.000000000 -0800
++@@ -5129,7 +5129,7 @@
++ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
++ ;;
++
++- freebsd1.*)
+++ freebsd1*)
++ _LT_TAGVAR(ld_shlibs, $1)=no
++ ;;
++
++@@ -6152,7 +6152,7 @@
++ esac
++ ;;
++
++- freebsd[[12]].*)
+++ freebsd[[12]]*)
++ # C++ shared libraries reported to be fairly broken before
++ # switch to ELF
++ _LT_TAGVAR(ld_shlibs, $1)=no
++diff -ur src/configure b/configure
++--- src/configure 2014-01-29 21:06:09.000000000 +0000
+++++ b/configure 2014-01-29 21:06:23.000000000 +0000
+ @@ -2069,52 +2069,6 @@
+
+ } # ac_fn_cxx_try_link
+@@ -156,7 +153,7 @@
+ # ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
+ # ---------------------------------------------
+ # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
+-@@ -5311,11 +5265,13 @@
++@@ -5313,11 +5267,13 @@
+ on AIX 4.3 under "-maix64 -mpowerpc64 -mcpu=630". The -mcpu=630
+ option causes gcc to incorrectly select the 32-bit libgcc.a, not
+ the 64-bit one, and consequently it misses out on the __fixunsdfdi
+@@ -174,7 +171,7 @@
+ EOF
+ echo "Test compile: double -> ulong conversion" >&5
+ gmp_compile="$cc $cflags $cppflags conftest.c >&5"
+-@@ -5359,7 +5315,6 @@
++@@ -5361,7 +5317,6 @@
+
+
+
+@@ -182,7 +179,7 @@
+ if test "$gmp_prog_cc_works" = yes; then
+ # remove anything that might look like compiler output to our "||" expression
+ rm -f conftest* a.out b.out a.exe a_out.exe
+-@@ -5367,10 +5322,10 @@
++@@ -5369,10 +5324,10 @@
+ /* The following provokes an error from hppa gcc 2.95 under -mpa-risc-2-0 if
+ the assembler doesn't know hppa 2.0 instructions. fneg is a 2.0
+ instruction, and a negation like this comes out using it. */
+@@ -196,7 +193,7 @@
+ EOF
+ echo "Test compile: double negation" >&5
+ gmp_compile="$cc $cflags $cppflags conftest.c >&5"
+-@@ -5414,7 +5369,6 @@
++@@ -5416,7 +5371,6 @@
+
+
+
+@@ -204,7 +201,7 @@
+ if test "$gmp_prog_cc_works" = yes; then
+ # remove anything that might look like compiler output to our "||" expression
+ rm -f conftest* a.out b.out a.exe a_out.exe
+-@@ -5423,10 +5377,10 @@
++@@ -5425,10 +5379,10 @@
+ (cvtsd2ss) which will provoke an error if the assembler doesn't recognise
+ those instructions. Not sure how much of the gmp code will come out
+ wanting sse2, but it's easiest to reject an option we know is bad. */
+@@ -218,7 +215,7 @@
+ EOF
+ echo "Test compile: double -> float conversion" >&5
+ gmp_compile="$cc $cflags $cppflags conftest.c >&5"
+-@@ -5470,6 +5424,59 @@
++@@ -5472,6 +5426,59 @@
+
+
+
+@@ -278,7 +275,7 @@
+
+ # __builtin_alloca is not available everywhere, check it exists before
+ # seeing that it works
+-@@ -6572,11 +6579,13 @@
++@@ -6574,11 +6581,13 @@
+ on AIX 4.3 under "-maix64 -mpowerpc64 -mcpu=630". The -mcpu=630
+ option causes gcc to incorrectly select the 32-bit libgcc.a, not
+ the 64-bit one, and consequently it misses out on the __fixunsdfdi
+@@ -296,7 +293,7 @@
+ EOF
+ echo "Test compile: double -> ulong conversion" >&5
+ gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
+-@@ -6620,7 +6629,6 @@
++@@ -6622,7 +6631,6 @@
+
+
+
+@@ -304,7 +301,7 @@
+ if test "$gmp_prog_cc_works" = yes; then
+ # remove anything that might look like compiler output to our "||" expression
+ rm -f conftest* a.out b.out a.exe a_out.exe
+-@@ -6628,10 +6636,10 @@
++@@ -6630,10 +6638,10 @@
+ /* The following provokes an error from hppa gcc 2.95 under -mpa-risc-2-0 if
+ the assembler doesn't know hppa 2.0 instructions. fneg is a 2.0
+ instruction, and a negation like this comes out using it. */
+@@ -318,7 +315,7 @@
+ EOF
+ echo "Test compile: double negation" >&5
+ gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
+-@@ -6675,7 +6683,6 @@
++@@ -6677,7 +6685,6 @@
+
+
+
+@@ -326,7 +323,7 @@
+ if test "$gmp_prog_cc_works" = yes; then
+ # remove anything that might look like compiler output to our "||" expression
+ rm -f conftest* a.out b.out a.exe a_out.exe
+-@@ -6684,10 +6691,10 @@
++@@ -6686,10 +6693,10 @@
+ (cvtsd2ss) which will provoke an error if the assembler doesn't recognise
+ those instructions. Not sure how much of the gmp code will come out
+ wanting sse2, but it's easiest to reject an option we know is bad. */
+@@ -340,7 +337,7 @@
+ EOF
+ echo "Test compile: double -> float conversion" >&5
+ gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
+-@@ -6731,6 +6738,59 @@
++@@ -6733,6 +6740,59 @@
+
+
+
+@@ -400,7 +397,7 @@
+
+ # __builtin_alloca is not available everywhere, check it exists before
+ # seeing that it works
+-@@ -11689,16 +11749,6 @@
++@@ -11691,16 +11751,6 @@
+ fi
+ fi
+
+@@ -417,7 +414,7 @@
+ case `pwd` in
+ *\ * | *\ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
+-@@ -14582,7 +14632,6 @@
++@@ -14584,7 +14634,6 @@
+
+
+
+@@ -425,7 +422,61 @@
+ # Set options
+
+
+-@@ -21736,2721 +21785,6 @@
++@@ -16358,7 +16407,7 @@
++ hardcode_shlibpath_var=no
++ ;;
++
++- freebsd1.*)
+++ freebsd1*)
++ ld_shlibs=no
++ ;;
++
++@@ -17352,7 +17401,7 @@
++ shlibpath_var=LD_LIBRARY_PATH
++ ;;
++
++-freebsd1.*)
+++freebsd1*)
++ dynamic_linker=no
++ ;;
++
++@@ -17363,7 +17412,7 @@
++ objformat=`/usr/bin/objformat`
++ else
++ case $host_os in
++- freebsd[123].*) objformat=aout ;;
+++ freebsd[123]*) objformat=aout ;;
++ *) objformat=elf ;;
++ esac
++ fi
++@@ -19325,7 +19374,7 @@
++ esac
++ ;;
++
++- freebsd[12].*)
+++ freebsd[12]*)
++ # C++ shared libraries reported to be fairly broken before
++ # switch to ELF
++ ld_shlibs_CXX=no
++@@ -21189,7 +21238,7 @@
++ shlibpath_var=LD_LIBRARY_PATH
++ ;;
++
++-freebsd1.*)
+++freebsd1*)
++ dynamic_linker=no
++ ;;
++
++@@ -21200,7 +21249,7 @@
++ objformat=`/usr/bin/objformat`
++ else
++ case $host_os in
++- freebsd[123].*) objformat=aout ;;
+++ freebsd[123]*) objformat=aout ;;
++ *) objformat=elf ;;
++ esac
++ fi
++@@ -21738,2919 +21787,204 @@
+
+
+
+@@ -463,11 +514,11 @@
+ -
+ -# Source file extension for f77 test sources.
+ -ac_ext=f
+--
++
+ -# Object file extension for compiled f77 test sources.
+ -objext=o
+ -objext_F77=$objext
+--
++
+ -# No sense in running all these tests if we already determined that
+ -# the F77 compiler isn't working. Some variables (like enable_shared)
+ -# are currently assumed to apply to all compilers on this platform,
+@@ -479,44 +530,46 @@
+ - return
+ - end
+ -"
+--
++
+ - # Code to be used in simple link tests
+ - lt_simple_link_test_code="\
+ - program t
+ - end
+ -"
+--
++
+ - # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+--
+--
+--
+--
+--
+--
++
++
++
++
++
++
+ -# If no C compiler was specified, use CC.
+ -LTCC=${LTCC-"$CC"}
+--
+++ ac_config_commands="$ac_config_commands libtool"
++
+ -# If no C compiler flags were specified, use CFLAGS.
+ -LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+--
++
+ -# Allow CC to be a program name with arguments.
+ -compiler=$CC
+--
+--
++
++
+ - # save warnings/boilerplate of simple test code
+ - ac_outfile=conftest.$ac_objext
+ -echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+ -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+ -_lt_compiler_boilerplate=`cat conftest.err`
+ -$RM conftest*
+--
+++# Only expand once:
++
+ - ac_outfile=conftest.$ac_objext
+ -echo "$lt_simple_link_test_code" >conftest.$ac_ext
+ -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+ -_lt_linker_boilerplate=`cat conftest.err`
+ -$RM -r conftest*
+--
+--
++
++
+ - # Allow CC to be a program name with arguments.
+ - lt_save_CC="$CC"
+ - lt_save_GCC=$GCC
+@@ -531,7 +584,16 @@
+ - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ - \-*) ;;
+ - *) break;;
+-- esac
+++# Generate an error here if attempting to build both shared and static when
+++# $libname.a is in $library_names_spec (as mentioned above), rather than
+++# wait for ar or ld to fail.
+++#
+++if test "$enable_shared" = yes && test "$enable_static" = yes; then
+++ case $library_names_spec in
+++ *libname.a*)
+++ as_fn_error $? "cannot create both shared and static libraries on this system, --disable one of the two" "$LINENO" 5
+++ ;;
++ esac
+ -done
+ -cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+ -
+@@ -582,12 +644,27 @@
+ - lt_prog_compiler_wl_F77=
+ -lt_prog_compiler_pic_F77=
+ -lt_prog_compiler_static_F77=
+--
+--
+++fi
++
+++ if test "$enable_static" = yes; then
+++ ENABLE_STATIC_TRUE=
+++ ENABLE_STATIC_FALSE='#'
+++else
+++ ENABLE_STATIC_TRUE='#'
+++ ENABLE_STATIC_FALSE=
+++fi
++
+ - if test "$GCC" = yes; then
+ - lt_prog_compiler_wl_F77='-Wl,'
+ - lt_prog_compiler_static_F77='-static'
+--
+++ if test "$enable_shared" = yes; then
+++ ENABLE_SHARED_TRUE=
+++ ENABLE_SHARED_FALSE='#'
+++else
+++ ENABLE_SHARED_TRUE='#'
+++ ENABLE_SHARED_FALSE=
+++fi
++
+ - case $host_os in
+ - aix*)
+ - # All AIX code is PIC.
+@@ -596,7 +673,7 @@
+ - lt_prog_compiler_static_F77='-Bstatic'
+ - fi
+ - ;;
+--
++
+ - amigaos*)
+ - case $host_cpu in
+ - powerpc)
+@@ -611,11 +688,13 @@
+ - ;;
+ - esac
+ - ;;
+--
++
+ - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ - # PIC is the default for these OSes.
+ - ;;
+--
+++# Many of these library and header checks are for the benefit of
+++# supplementary programs. libmpir doesn't use anything too weird.
++
+ - mingw* | cygwin* | pw32* | os2* | cegcc*)
+ - # This hack is so that the source file can tell whether it is being
+ - # built for inclusion in a dll (and should export symbols for example).
+@@ -623,19 +702,43 @@
+ - # (--disable-auto-import) libraries
+ - lt_prog_compiler_pic_F77='-DDLL_EXPORT'
+ - ;;
+--
+++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+++$as_echo_n "checking for ANSI C header files... " >&6; }
+++if ${ac_cv_header_stdc+:} false; then :
+++ $as_echo_n "(cached) " >&6
+++else
+++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+++/* end confdefs.h. */
+++#include <stdlib.h>
+++#include <stdarg.h>
+++#include <string.h>
+++#include <float.h>
++
+ - darwin* | rhapsody*)
+ - # PIC is the default on this platform
+ - # Common symbols not allowed in MH_DYLIB files
+ - lt_prog_compiler_pic_F77='-fno-common'
+ - ;;
+--
+++int
+++main ()
+++{
++
+ - haiku*)
+ - # PIC is the default for Haiku.
+ - # The "-static" flag exists, but is broken.
+ - lt_prog_compiler_static_F77=
+ - ;;
+--
+++ ;
+++ return 0;
+++}
+++_ACEOF
+++if ac_fn_c_try_compile "$LINENO"; then :
+++ ac_cv_header_stdc=yes
+++else
+++ ac_cv_header_stdc=no
+++fi
+++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++
+ - hpux*)
+ - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+ - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
+@@ -649,36 +752,57 @@
+ - ;;
+ - esac
+ - ;;
+--
+++if test $ac_cv_header_stdc = yes; then
+++ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+++/* end confdefs.h. */
+++#include <string.h>
++
+ - interix[3-9]*)
+ - # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ - # Instead, we relocate shared libraries at runtime.
+ - ;;
+--
+++_ACEOF
+++if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+++ $EGREP "memchr" >/dev/null 2>&1; then :
++
+ - msdosdjgpp*)
+ - # Just because we use GCC doesn't mean we suddenly get shared libraries
+ - # on systems that don't support them.
+ - lt_prog_compiler_can_build_shared_F77=no
+ - enable_shared=no
+ - ;;
+--
+++else
+++ ac_cv_header_stdc=no
+++fi
+++rm -f conftest*
++
+ - *nto* | *qnx*)
+ - # QNX uses GNU C++, but need to define -shared option too, otherwise
+ - # it will coredump.
+ - lt_prog_compiler_pic_F77='-fPIC -shared'
+ - ;;
+--
+++fi
++
+ - sysv4*MP*)
+ - if test -d /usr/nec; then
+ - lt_prog_compiler_pic_F77=-Kconform_pic
+ - fi
+ - ;;
+--
+++if test $ac_cv_header_stdc = yes; then
+++ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+++/* end confdefs.h. */
+++#include <stdlib.h>
++
+ - *)
+ - lt_prog_compiler_pic_F77='-fPIC'
+ - ;;
+ - esac
+--
+++_ACEOF
+++if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+++ $EGREP "free" >/dev/null 2>&1; then :
++
+ - case $cc_basename in
+ - nvcc*) # Cuda Compiler Driver 2.2
+ - lt_prog_compiler_wl_F77='-Xlinker '
+@@ -697,13 +821,18 @@
+ - lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp'
+ - fi
+ - ;;
+--
+++else
+++ ac_cv_header_stdc=no
+++fi
+++rm -f conftest*
++
+ - mingw* | cygwin* | pw32* | os2* | cegcc*)
+ - # This hack is so that the source file can tell whether it is being
+ - # built for inclusion in a dll (and should export symbols for example).
+ - lt_prog_compiler_pic_F77='-DDLL_EXPORT'
+ - ;;
+--
+++fi
++
+ - hpux9* | hpux10* | hpux11*)
+ - lt_prog_compiler_wl_F77='-Wl,'
+ - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+@@ -719,13 +848,45 @@
+ - # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ - lt_prog_compiler_static_F77='${wl}-a ${wl}archive'
+ - ;;
+--
+++if test $ac_cv_header_stdc = yes; then
+++ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+++ if test "$cross_compiling" = yes; then :
+++ :
+++else
+++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+++/* end confdefs.h. */
+++#include <ctype.h>
+++#include <stdlib.h>
+++#if ((' ' & 0x0FF) == 0x020)
+++# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+++# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+++#else
+++# define ISLOWER(c) \
+++ (('a' <= (c) && (c) <= 'i') \
+++ || ('j' <= (c) && (c) <= 'r') \
+++ || ('s' <= (c) && (c) <= 'z'))
+++# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+++#endif
++
+ - irix5* | irix6* | nonstopux*)
+ - lt_prog_compiler_wl_F77='-Wl,'
+ - # PIC (with -KPIC) is the default.
+ - lt_prog_compiler_static_F77='-non_shared'
+ - ;;
+--
+++#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+++int
+++main ()
+++{
+++ int i;
+++ for (i = 0; i < 256; i++)
+++ if (XOR (islower (i), ISLOWER (i))
+++ || toupper (i) != TOUPPER (i))
+++ return 2;
+++ return 0;
+++}
+++_ACEOF
+++if ac_fn_c_try_run "$LINENO"; then :
++
+ - linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ - case $cc_basename in
+ - # old Intel for x86_64 which still supported -KPIC.
+@@ -789,28 +950,51 @@
+ - ;;
+ - esac
+ - ;;
+--
+++else
+++ ac_cv_header_stdc=no
+++fi
+++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+++ conftest.$ac_objext conftest.beam conftest.$ac_ext
+++fi
++
+ - newsos6)
+ - lt_prog_compiler_pic_F77='-KPIC'
+ - lt_prog_compiler_static_F77='-Bstatic'
+ - ;;
+--
+++fi
+++fi
+++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+++$as_echo "$ac_cv_header_stdc" >&6; }
+++if test $ac_cv_header_stdc = yes; then
++
+ - *nto* | *qnx*)
+ - # QNX uses GNU C++, but need to define -shared option too, otherwise
+ - # it will coredump.
+ - lt_prog_compiler_pic_F77='-fPIC -shared'
+ - ;;
+--
+++$as_echo "#define STDC_HEADERS 1" >>confdefs.h
++
+ - osf3* | osf4* | osf5*)
+ - lt_prog_compiler_wl_F77='-Wl,'
+ - # All OSF/1 code is PIC.
+ - lt_prog_compiler_static_F77='-non_shared'
+ - ;;
+--
+++fi
++
+ - rdos*)
+ - lt_prog_compiler_static_F77='-non_shared'
+ - ;;
+--
+++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5
+++$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; }
+++if ${ac_cv_header_time+:} false; then :
+++ $as_echo_n "(cached) " >&6
+++else
+++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+++/* end confdefs.h. */
+++#include <sys/types.h>
+++#include <sys/time.h>
+++#include <time.h>
++
+ - solaris*)
+ - lt_prog_compiler_pic_F77='-KPIC'
+ - lt_prog_compiler_static_F77='-Bstatic'
+@@ -821,13 +1005,33 @@
+ - lt_prog_compiler_wl_F77='-Wl,';;
+ - esac
+ - ;;
+--
+++int
+++main ()
+++{
+++if ((struct tm *) 0)
+++return 0;
+++ ;
+++ return 0;
+++}
+++_ACEOF
+++if ac_fn_c_try_compile "$LINENO"; then :
+++ ac_cv_header_time=yes
+++else
+++ ac_cv_header_time=no
+++fi
+++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+++fi
+++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5
+++$as_echo "$ac_cv_header_time" >&6; }
+++if test $ac_cv_header_time = yes; then
++
+ - sunos4*)
+ - lt_prog_compiler_wl_F77='-Qoption ld '
+ - lt_prog_compiler_pic_F77='-PIC'
+ - lt_prog_compiler_static_F77='-Bstatic'
+ - ;;
+--
+++$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h
++
+ - sysv4 | sysv4.2uw2* | sysv4.3*)
+ - lt_prog_compiler_wl_F77='-Wl,'
+ - lt_prog_compiler_pic_F77='-KPIC'
+@@ -1822,7 +2026,7 @@
+ - hardcode_shlibpath_var_F77=no
+ - ;;
+ -
+-- freebsd1*)
++- freebsd1.*)
+ - ld_shlibs_F77=no
+ - ;;
+ -
+@@ -2610,7 +2814,7 @@
+ - shlibpath_var=LD_LIBRARY_PATH
+ - ;;
+ -
+--freebsd1*)
++-freebsd1.*)
+ - dynamic_linker=no
+ - ;;
+ -
+@@ -2621,7 +2825,7 @@
+ - objformat=`/usr/bin/objformat`
+ - else
+ - case $host_os in
+-- freebsd[123]*) objformat=aout ;;
++- freebsd[123].*) objformat=aout ;;
+ - *) objformat=elf ;;
+ - esac
+ - fi
+@@ -3144,10 +3348,209 @@
+ -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ -ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ -
++-
++-
++-
++-
++-
++-
++-
++-
++-
++-
++- ac_config_commands="$ac_config_commands libtool"
++-
++-
++-
++-
++-# Only expand once:
++-
++-
++-
++-# Generate an error here if attempting to build both shared and static when
++-# $libname.a is in $library_names_spec (as mentioned above), rather than
++-# wait for ar or ld to fail.
++-#
++-if test "$enable_shared" = yes && test "$enable_static" = yes; then
++- case $library_names_spec in
++- *libname.a*)
++- as_fn_error $? "cannot create both shared and static libraries on this system, --disable one of the two" "$LINENO" 5
++- ;;
++- esac
++-fi
++-
++- if test "$enable_static" = yes; then
++- ENABLE_STATIC_TRUE=
++- ENABLE_STATIC_FALSE='#'
++-else
++- ENABLE_STATIC_TRUE='#'
++- ENABLE_STATIC_FALSE=
++-fi
++-
++- if test "$enable_shared" = yes; then
++- ENABLE_SHARED_TRUE=
++- ENABLE_SHARED_FALSE='#'
++-else
++- ENABLE_SHARED_TRUE='#'
++- ENABLE_SHARED_FALSE=
++-fi
++-
++-
++-
++-# Many of these library and header checks are for the benefit of
++-# supplementary programs. libmpir doesn't use anything too weird.
++-
++-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
++-$as_echo_n "checking for ANSI C header files... " >&6; }
++-if ${ac_cv_header_stdc+:} false; then :
++- $as_echo_n "(cached) " >&6
++-else
++- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++-/* end confdefs.h. */
++-#include <stdlib.h>
++-#include <stdarg.h>
++-#include <string.h>
++-#include <float.h>
++-
++-int
++-main ()
++-{
++-
++- ;
++- return 0;
++-}
++-_ACEOF
++-if ac_fn_c_try_compile "$LINENO"; then :
++- ac_cv_header_stdc=yes
++-else
++- ac_cv_header_stdc=no
++-fi
++-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++-
++-if test $ac_cv_header_stdc = yes; then
++- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
++- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++-/* end confdefs.h. */
++-#include <string.h>
++-
++-_ACEOF
++-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
++- $EGREP "memchr" >/dev/null 2>&1; then :
++-
++-else
++- ac_cv_header_stdc=no
++-fi
++-rm -f conftest*
++-
++-fi
++-
++-if test $ac_cv_header_stdc = yes; then
++- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
++- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++-/* end confdefs.h. */
++-#include <stdlib.h>
++-
++-_ACEOF
++-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
++- $EGREP "free" >/dev/null 2>&1; then :
++-
++-else
++- ac_cv_header_stdc=no
++-fi
++-rm -f conftest*
++-
++-fi
++-
++-if test $ac_cv_header_stdc = yes; then
++- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
++- if test "$cross_compiling" = yes; then :
++- :
++-else
++- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++-/* end confdefs.h. */
++-#include <ctype.h>
++-#include <stdlib.h>
++-#if ((' ' & 0x0FF) == 0x020)
++-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
++-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
++-#else
++-# define ISLOWER(c) \
++- (('a' <= (c) && (c) <= 'i') \
++- || ('j' <= (c) && (c) <= 'r') \
++- || ('s' <= (c) && (c) <= 'z'))
++-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
++-#endif
++-
++-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
++-int
++-main ()
++-{
++- int i;
++- for (i = 0; i < 256; i++)
++- if (XOR (islower (i), ISLOWER (i))
++- || toupper (i) != TOUPPER (i))
++- return 2;
++- return 0;
++-}
++-_ACEOF
++-if ac_fn_c_try_run "$LINENO"; then :
++-
++-else
++- ac_cv_header_stdc=no
++-fi
++-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
++- conftest.$ac_objext conftest.beam conftest.$ac_ext
++-fi
++-
++-fi
++-fi
++-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
++-$as_echo "$ac_cv_header_stdc" >&6; }
++-if test $ac_cv_header_stdc = yes; then
++-
++-$as_echo "#define STDC_HEADERS 1" >>confdefs.h
++-
++-fi
++-
++-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5
++-$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; }
++-if ${ac_cv_header_time+:} false; then :
++- $as_echo_n "(cached) " >&6
++-else
++- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++-/* end confdefs.h. */
++-#include <sys/types.h>
++-#include <sys/time.h>
++-#include <time.h>
++-
++-int
++-main ()
++-{
++-if ((struct tm *) 0)
++-return 0;
++- ;
++- return 0;
++-}
++-_ACEOF
++-if ac_fn_c_try_compile "$LINENO"; then :
++- ac_cv_header_time=yes
++-else
++- ac_cv_header_time=no
++-fi
++-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++-fi
++-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5
++-$as_echo "$ac_cv_header_time" >&6; }
++-if test $ac_cv_header_time = yes; then
++-
++-$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h
++-
++-fi
+++fi
+
+
+-
+-@@ -29343,103 +26677,54 @@
++ # Reasons for testing:
++@@ -29345,103 +26679,54 @@
+ postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`'
+ compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`'
+ LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`'
+@@ -3251,7 +3654,7 @@
+
+ LTCC='$LTCC'
+ LTCFLAGS='$LTCFLAGS'
+-@@ -29527,57 +26812,31 @@
++@@ -29529,57 +26814,31 @@
+ postdeps \
+ compiler_lib_search_path \
+ LD_CXX \
+@@ -3310,7 +3713,7 @@
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+-@@ -29609,27 +26868,16 @@
++@@ -29611,27 +26870,16 @@
+ sys_lib_search_path_spec \
+ sys_lib_dlsearch_path_spec \
+ reload_cmds_CXX \
+@@ -3339,7 +3742,7 @@
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+-@@ -29662,8 +26910,6 @@
++@@ -29664,8 +26912,6 @@
+
+
+
+@@ -3348,7 +3751,7 @@
+ _ACEOF
+
+ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+-@@ -30377,7 +27623,7 @@
++@@ -30379,7 +27625,7 @@
+
+
+ # The names of the tagged configurations supported by this script.
+@@ -3357,7 +3760,7 @@
+
+ # ### BEGIN LIBTOOL CONFIG
+
+-@@ -31131,163 +28377,6 @@
++@@ -31133,163 +28379,6 @@
+ # ### END LIBTOOL TAG CONFIG: CXX
+ _LT_EOF
+
+@@ -3521,7 +3924,7 @@
+ ;;
+
+ esac
+-@@ -32366,103 +29455,54 @@
++@@ -32368,103 +29457,54 @@
+ postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`'
+ compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`'
+ LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`'
+@@ -3625,7 +4028,7 @@
+
+ LTCC='$LTCC'
+ LTCFLAGS='$LTCFLAGS'
+-@@ -32550,57 +29590,31 @@
++@@ -32552,57 +29592,31 @@
+ postdeps \
+ compiler_lib_search_path \
+ LD_CXX \
+@@ -3684,7 +4087,7 @@
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+-@@ -32632,27 +29646,16 @@
++@@ -32634,27 +29648,16 @@
+ sys_lib_search_path_spec \
+ sys_lib_dlsearch_path_spec \
+ reload_cmds_CXX \
+@@ -3713,7 +4116,7 @@
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+-@@ -32682,8 +29685,6 @@
++@@ -32684,8 +29687,6 @@
+
+
+
+@@ -3722,7 +4125,7 @@
+ ac_aux_dir='$ac_aux_dir'
+
+
+-@@ -33402,7 +30403,7 @@
++@@ -33404,7 +30405,7 @@
+
+
+ # The names of the tagged configurations supported by this script.
+@@ -3731,7 +4134,7 @@
+
+ # ### BEGIN LIBTOOL CONFIG
+
+-@@ -34156,163 +31157,6 @@
++@@ -34158,163 +31159,6 @@
+ # ### END LIBTOOL TAG CONFIG: CXX
+ _LT_EOF
+
+@@ -3895,7 +4298,7 @@
+ ;;
+
+ esac
+-@@ -35395,103 +32239,54 @@
++@@ -35397,103 +32241,54 @@
+ postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`'
+ compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`'
+ LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`'
+@@ -3999,7 +4402,7 @@
+
+ LTCC='$LTCC'
+ LTCFLAGS='$LTCFLAGS'
+-@@ -35579,57 +32374,31 @@
++@@ -35581,57 +32376,31 @@
+ postdeps \
+ compiler_lib_search_path \
+ LD_CXX \
+@@ -4058,7 +4461,7 @@
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+-@@ -35661,27 +32430,16 @@
++@@ -35663,27 +32432,16 @@
+ sys_lib_search_path_spec \
+ sys_lib_dlsearch_path_spec \
+ reload_cmds_CXX \
+@@ -4087,7 +4490,7 @@
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+-@@ -35711,8 +32469,6 @@
++@@ -35713,8 +32471,6 @@
+
+
+
+@@ -4096,7 +4499,7 @@
+ ac_aux_dir='$ac_aux_dir'
+ ac_aux_dir='$ac_aux_dir'
+
+-@@ -36433,7 +33189,7 @@
++@@ -36435,7 +33191,7 @@
+
+
+ # The names of the tagged configurations supported by this script.
+@@ -4105,7 +4508,7 @@
+
+ # ### BEGIN LIBTOOL CONFIG
+
+-@@ -37187,163 +33943,6 @@
++@@ -37189,163 +33945,6 @@
+ # ### END LIBTOOL TAG CONFIG: CXX
+ _LT_EOF
+
+@@ -4269,3 +4672,75 @@
+ ;;
+
+ esac
++diff -ur src/configure.in b/configure.in
++--- src/configure.in 2012-11-08 22:10:45.000000000 +0000
+++++ b/configure.in 2014-01-29 21:06:23.000000000 +0000
++@@ -1920,16 +1920,6 @@
++ fi
++ fi
++
++-# The dead hand of AC_REQUIRE makes AC_PROG_LIBTOOL expand and execute
++-# AC_PROG_F77, even when F77 is not in the selected with_tags. This is
++-# probably harmless, but it's unsightly and bloats our configure, so pretend
++-# AC_PROG_F77 has been expanded already.
++-#
++-# FIXME: Rumour has it libtool will one day provide a way for a configure.in
++-# to say what it wants from among supported languages etc.
++-#
++-AC_PROVIDE([AC_PROG_F77])
++-
++ AC_PROG_LIBTOOL
++
++ # Generate an error here if attempting to build both shared and static when
++Only in b: configure.in.orig
++Only in b: configure.orig
++diff -ur src/yasm/Makefile.in b/yasm/Makefile.in
++--- src/yasm/Makefile.in 2012-11-08 22:21:05.000000000 +0000
+++++ b/yasm/Makefile.in 2014-01-29 21:06:23.000000000 +0000
++@@ -3747,7 +3747,8 @@
++ check-am: all-am
++ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
++ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
++-check:
+++check: $(BUILT_SOURCES)
+++ $(MAKE) $(AM_MAKEFLAGS) check-recursive
++ all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(MANS) $(HEADERS) config.h \
++ all-local
++ installdirs: installdirs-recursive
++@@ -3755,7 +3756,8 @@
++ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man7dir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(modincludedir)" "$(DESTDIR)$(includedir)"; do \
++ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
++ done
++-install:
+++install: $(BUILT_SOURCES)
+++ $(MAKE) $(AM_MAKEFLAGS) install-recursive
++ install-exec: install-exec-recursive
++ install-data: install-data-recursive
++ uninstall: uninstall-recursive
++Only in b/yasm: Makefile.in.orig
++diff -ur src/yasm/config/config.rpath b/yasm/config/config.rpath
++--- src/yasm/config/config.rpath 2014-01-29 21:06:09.000000000 +0000
+++++ b/yasm/config/config.rpath 2012-10-03 20:07:29.000000000 +0000
++@@ -351,7 +351,7 @@
++ dgux*)
++ hardcode_libdir_flag_spec='-L$libdir'
++ ;;
++- freebsd1.*)
+++ freebsd1*)
++ ld_shlibs=no
++ ;;
++ freebsd2.2*)
++@@ -528,11 +528,11 @@
++ dgux*)
++ library_names_spec='$libname$shrext'
++ ;;
++- freebsd1.*)
+++ freebsd1*)
++ ;;
++ freebsd* | dragonfly*)
++ case "$host_os" in
++- freebsd[123].*)
+++ freebsd[123]*)
++ library_names_spec='$libname$shrext$versuffix' ;;
++ *)
++ library_names_spec='$libname$shrext' ;;
diff --git a/math/sage/files/patch-build_pkgs_ncurses_fbsd-patch-src_configure b/math/sage/files/patch-build_pkgs_ncurses_fbsd-patch-src_configure
new file mode 100644
index 000000000000..72a0bf7a3ef8
--- /dev/null
+++ b/math/sage/files/patch-build_pkgs_ncurses_fbsd-patch-src_configure
@@ -0,0 +1,14 @@
+--- /dev/null 2014-01-29 03:00:00.000000000 +0000
++++ build/pkgs/ncurses/fbsd-patch-src_configure 2014-01-29 03:01:19.000000000 +0000
+@@ -0,0 +1,11 @@
++--- src/configure.orig 2013-08-21 02:51:59.000000000 +0000
+++++ src/configure 2013-08-21 02:53:23.000000000 +0000
++@@ -5719,7 +5719,7 @@
++ cf_cv_shared_soname='`basename $@`'
++ fi
++
++- MK_SHARED_LIB='${LD} -shared -Bshareable -soname=`basename $@` -o $@'
+++ MK_SHARED_LIB='${CC} -shared -Bshareable -soname=`basename $@` -o $@'
++ ;;
++ netbsd*) #(vi
++ CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
diff --git a/math/sage/files/patch-build_pkgs_numpy_fbsd-patch-src_numpy_distutils_system_info.py b/math/sage/files/patch-build_pkgs_numpy_fbsd-patch-src_numpy_distutils_system_info.py
new file mode 100644
index 000000000000..65c42935e4c4
--- /dev/null
+++ b/math/sage/files/patch-build_pkgs_numpy_fbsd-patch-src_numpy_distutils_system_info.py
@@ -0,0 +1,16 @@
+--- /dev/null 2014-01-29 03:00:00.000000000 +0000
++++ build/pkgs/numpy/fbsd-patch-src_numpy_distutils_system_info.py 2014-01-29 03:01:19.000000000 +0000
+@@ -0,0 +1,13 @@
++--- src/numpy/distutils/system_info.py.orig 2013-02-09 21:04:56.000000000 +0000
+++++ src/numpy/distutils/system_info.py 2013-05-27 21:51:12.000000000 +0000
++@@ -983,8 +983,8 @@
++ dir_env_var = 'ATLAS'
++ _lib_names = ['f77blas', 'cblas']
++ if sys.platform[:7] == 'freebsd':
++- _lib_atlas = ['atlas_r']
++- _lib_lapack = ['alapack_r']
+++ _lib_atlas = ['atlas']
+++ _lib_lapack = ['alapack']
++ else:
++ _lib_atlas = ['atlas']
++ _lib_lapack = ['lapack']
diff --git a/math/sage/files/patch-build_pkgs_ppl_fbsd-patch-src_demos_ppl_lpsol_ppl_lpsol.c b/math/sage/files/patch-build_pkgs_ppl_fbsd-patch-src_demos_ppl_lpsol_ppl_lpsol.c
new file mode 100644
index 000000000000..a25b8d03422e
--- /dev/null
+++ b/math/sage/files/patch-build_pkgs_ppl_fbsd-patch-src_demos_ppl_lpsol_ppl_lpsol.c
@@ -0,0 +1,14 @@
+--- /dev/null 2014-01-29 03:00:00.000000000 +0000
++++ build/pkgs/ppl/fbsd-patch-src_demos_ppl_lpsol_ppl_lpsol.c 2014-01-29 03:01:19.000000000 +0000
+@@ -0,0 +1,11 @@
++--- src/demos/ppl_lpsol/ppl_lpsol.c.orig 2013-06-20 17:21:39.000000000 +0000
+++++ src/demos/ppl_lpsol/ppl_lpsol.c 2013-06-20 17:39:44.000000000 +0000
++@@ -534,7 +534,7 @@
++ if (getrlimit(RLIMIT_AS, &t) != 0)
++ fatal("getrlimit failed: %s", strerror(errno));
++
++- if (bytes < t.rlim_cur) {
+++ if (bytes < (unsigned long)(t.rlim_cur)) {
++ t.rlim_cur = bytes;
++ if (setrlimit(RLIMIT_AS, &t) != 0)
++ fatal("setrlimit failed: %s", strerror(errno));
diff --git a/math/sage/files/spkg-patch-pycrypto_-_patches_src.libtom.tomcrypt_pk.h b/math/sage/files/patch-build_pkgs_pycrypto_fbsd-patch-src.libtom.tomcrypt_pk.h
index 908f078cb7ce..8011b5687cf1 100644
--- a/math/sage/files/spkg-patch-pycrypto_-_patches_src.libtom.tomcrypt_pk.h
+++ b/math/sage/files/patch-build_pkgs_pycrypto_fbsd-patch-src.libtom.tomcrypt_pk.h
@@ -1,5 +1,5 @@
--- /dev/null 2012-04-08 01:30:00.000000000 +0000
-+++ pycrypto-2.1.0/patches_src.libtom.tomcrypt_pk.h 2012-04-08 01:30:26.000000000 +0000
++++ build/pkgs/pycrypto/fbsd-patch-src.libtom.tomcrypt_pk.h 2012-04-08 01:30:26.000000000 +0000
@@ -0,0 +1,11 @@
+--- src/src/libtom/tomcrypt_pk.h-orig 2012-01-21 19:43:56.000000000 +0000
++++ src/src/libtom/tomcrypt_pk.h 2012-01-21 19:45:01.000000000 +0000
diff --git a/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Doc_library_fcntl.rst b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Doc_library_fcntl.rst
new file mode 100644
index 000000000000..435f3c7be6c5
--- /dev/null
+++ b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Doc_library_fcntl.rst
@@ -0,0 +1,14 @@
+--- /dev/null 2014-01-29 03:00:00.000000000 +0000
++++ build/pkgs/python/fbsd-patch-src_Doc_library_fcntl.rst 2014-01-29 03:01:19.000000000 +0000
+@@ -0,0 +1,11 @@
++--- src/src/Doc/library/fcntl.rst.orig 2011-06-11 15:46:23.000000000 +0000
+++++ src/Doc/library/fcntl.rst 2012-04-22 00:31:48.000000000 +0000
++@@ -50,8 +50,6 @@
++ operations are typically defined in the library module :mod:`termios` and the
++ argument handling is even more complicated.
++
++- The op parameter is limited to values that can fit in 32-bits.
++-
++ The parameter *arg* can be one of an integer, absent (treated identically to the
++ integer ``0``), an object supporting the read-only buffer interface (most likely
++ a plain Python string) or an object supporting the read-write buffer interface.
diff --git a/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Modules__ctypes_libffi_configure b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Modules__ctypes_libffi_configure
new file mode 100644
index 000000000000..cc44b5ca7aec
--- /dev/null
+++ b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Modules__ctypes_libffi_configure
@@ -0,0 +1,24 @@
+--- /dev/null 2014-01-29 03:00:00.000000000 +0000
++++ build/pkgs/python/fbsd-patch-src_Modules__ctypes_libffi_configure 2014-01-29 03:01:19.000000000 +0000
+@@ -0,0 +1,21 @@
++--- src/src/Modules/_ctypes/libffi/configure.orig 2011-06-11 15:46:26.000000000 +0000
+++++ src/Modules/_ctypes/libffi/configure 2012-04-22 00:23:14.000000000 +0000
++@@ -6289,7 +6289,7 @@
++ rm -rf conftest*
++ ;;
++
++-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+++amd64-*-freebsd*|x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
++ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
++ # Find out which ABI we are using.
++ echo 'int i;' > conftest.$ac_ext
++@@ -11275,6 +11275,9 @@
++ powerpc-*-freebsd*)
++ TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
++ ;;
+++ powerpc64-*-freebsd*)
+++ TARGET=POWERPC; TARGETDIR=powerpc
+++ ;;
++ powerpc*-*-rtems*)
++ TARGET=POWERPC; TARGETDIR=powerpc
++ ;;
diff --git a/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Modules_fcntlmodule.c b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Modules_fcntlmodule.c
new file mode 100644
index 000000000000..f130299e97a2
--- /dev/null
+++ b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Modules_fcntlmodule.c
@@ -0,0 +1,56 @@
+--- /dev/null 2014-01-29 03:00:00.000000000 +0000
++++ build/pkgs/python/fbsd-patch-src_Modules_fcntlmodule.c 2014-01-29 03:01:19.000000000 +0000
+@@ -0,0 +1,53 @@
++--- src/src/Modules/fcntlmodule.c.orig 2011-06-11 15:46:27.000000000 +0000
+++++ src/Modules/fcntlmodule.c 2012-04-22 00:23:34.000000000 +0000
++@@ -97,20 +97,15 @@
++ {
++ #define IOCTL_BUFSZ 1024
++ int fd;
++- /* In PyArg_ParseTuple below, we use the unsigned non-checked 'I'
+++ /* In PyArg_ParseTuple below, we use the unsigned non-checked 'k'
++ format for the 'code' parameter because Python turns 0x8000000
++ into either a large positive number (PyLong or PyInt on 64-bit
++ platforms) or a negative number on others (32-bit PyInt)
++ whereas the system expects it to be a 32bit bit field value
++ regardless of it being passed as an int or unsigned long on
++- various platforms. See the termios.TIOCSWINSZ constant across
++- platforms for an example of thise.
++-
++- If any of the 64bit platforms ever decide to use more than 32bits
++- in their unsigned long ioctl codes this will break and need
++- special casing based on the platform being built on.
+++ various platforms.
++ */
++- unsigned int code;
+++ unsigned long code;
++ int arg;
++ int ret;
++ char *str;
++@@ -118,7 +113,7 @@
++ int mutate_arg = 1;
++ char buf[IOCTL_BUFSZ+1]; /* argument plus NUL byte */
++
++- if (PyArg_ParseTuple(args, "O&Iw#|i:ioctl",
+++ if (PyArg_ParseTuple(args, "O&kw#|i:ioctl",
++ conv_descriptor, &fd, &code,
++ &str, &len, &mutate_arg)) {
++ char *arg;
++@@ -169,7 +164,7 @@
++ }
++
++ PyErr_Clear();
++- if (PyArg_ParseTuple(args, "O&Is#:ioctl",
+++ if (PyArg_ParseTuple(args, "O&ks#:ioctl",
++ conv_descriptor, &fd, &code, &str, &len)) {
++ if (len > IOCTL_BUFSZ) {
++ PyErr_SetString(PyExc_ValueError,
++@@ -191,7 +186,7 @@
++ PyErr_Clear();
++ arg = 0;
++ if (!PyArg_ParseTuple(args,
++- "O&I|i;ioctl requires a file or file descriptor,"
+++ "O&k|i;ioctl requires a file or file descriptor,"
++ " an integer and optionally an integer or buffer argument",
++ conv_descriptor, &fd, &code, &arg)) {
++ return NULL;
diff --git a/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Python_thread_pthread.h b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Python_thread_pthread.h
new file mode 100644
index 000000000000..1a27e404c05f
--- /dev/null
+++ b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Python_thread_pthread.h
@@ -0,0 +1,58 @@
+--- /dev/null 2014-01-29 03:00:00.000000000 +0000
++++ build/pkgs/python/fbsd-patch-src_Python_thread_pthread.h 2014-01-29 03:01:19.000000000 +0000
+@@ -0,0 +1,55 @@
++--- src/src/Python/thread_pthread.h.orig 2011-06-11 15:46:28.000000000 +0000
+++++ src/Python/thread_pthread.h 2012-04-22 00:23:46.000000000 +0000
++@@ -38,13 +38,18 @@
++ #endif
++ #endif
++
+++#ifdef __FreeBSD__
+++#include <osreldate.h>
+++#endif
+++
++ /* The POSIX spec says that implementations supporting the sem_*
++ family of functions must indicate this by defining
++ _POSIX_SEMAPHORES. */
++ #ifdef _POSIX_SEMAPHORES
++ /* On FreeBSD 4.x, _POSIX_SEMAPHORES is defined empty, so
++ we need to add 0 to make it work there as well. */
++-#if (_POSIX_SEMAPHORES+0) == -1
+++#if defined(__FreeBSD__) && __FreeBSD_version < 701104 && \
+++ (_POSIX_SEMAPHORES+0) == -1
++ #define HAVE_BROKEN_POSIX_SEMAPHORES
++ #else
++ #include <semaphore.h>
++@@ -56,7 +61,6 @@
++ in default setting. So the process scope is preferred to get
++ enough number of threads to work. */
++ #ifdef __FreeBSD__
++-#include <osreldate.h>
++ #if __FreeBSD_version >= 500000 && __FreeBSD_version < 504101
++ #undef PTHREAD_SYSTEM_SCHED_SUPPORTED
++ #endif
++@@ -161,6 +165,7 @@
++ {
++ pthread_t th;
++ int status;
+++ sigset_t set, oset;
++ #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
++ pthread_attr_t attrs;
++ #endif
++@@ -189,6 +194,8 @@
++ #if defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
++ pthread_attr_setscope(&attrs, PTHREAD_SCOPE_SYSTEM);
++ #endif
+++ sigfillset(&set);
+++ SET_THREAD_SIGMASK(SIG_BLOCK, &set, &oset);
++
++ status = pthread_create(&th,
++ #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
++@@ -200,6 +207,7 @@
++ (void *)arg
++ );
++
+++ SET_THREAD_SIGMASK(SIG_SETMASK, &oset, NULL);
++ #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
++ pthread_attr_destroy(&attrs);
++ #endif
diff --git a/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_setup.py b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_setup.py
new file mode 100644
index 000000000000..e08155380131
--- /dev/null
+++ b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_setup.py
@@ -0,0 +1,100 @@
+--- /dev/null 2014-01-29 03:00:00.000000000 +0000
++++ build/pkgs/python/fbsd-patch-src_setup.py 2014-01-29 03:01:19.000000000 +0000
+@@ -0,0 +1,97 @@
++--- src/setup.py-orig 2013-03-17 03:13:46.000000000 +0000
+++++ src/setup.py 2013-03-17 03:15:11.000000000 +0000
++@@ -642,7 +642,7 @@
++ # use the same library for the readline and curses modules.
++ if 'curses' in readline_termcap_library:
++ curses_library = readline_termcap_library
++- elif self.compiler.find_library_file(lib_dirs, 'ncursesw'):
+++ elif self.compiler.find_library_file(lib_dirs, 'xxxncursesw'):
++ curses_library = 'ncursesw'
++ elif self.compiler.find_library_file(lib_dirs, 'ncurses'):
++ curses_library = 'ncurses'
++@@ -681,7 +681,7 @@
++ 'termcap'):
++ readline_libs.append('termcap')
++ exts.append( Extension('readline', ['readline.c'],
++- library_dirs=['/usr/lib/termcap'],
+++ library_dirs=['/usr/lib', '/usr/lib/termcap'],
++ extra_link_args=readline_extra_link_args,
++ libraries=readline_libs) )
++ else:
++@@ -1120,7 +1122,7 @@
++ sysroot = macosx_sdk_root()
++ f = os.path.join(sysroot, f[1:])
++
++- if os.path.exists(f) and not db_incs:
+++ if os.path.exists(f):
++ data = open(f).read()
++ m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data)
++ if m is not None:
++@@ -1246,12 +1248,13 @@
++ # provided by the ncurses library.
++ panel_library = 'panel'
++ if curses_library.startswith('ncurses'):
++- if curses_library == 'ncursesw':
+++ if curses_library == 'xxxncursesw':
++ # Bug 1464056: If _curses.so links with ncursesw,
++ # _curses_panel.so must link with panelw.
++ panel_library = 'panelw'
++ curses_libs = [curses_library]
++ exts.append( Extension('_curses', ['_cursesmodule.c'],
+++ library_dirs = ['/usr/lib'],
++ libraries = curses_libs) )
++ elif curses_library == 'curses' and platform != 'darwin':
++ # OSX has an old Berkeley curses, not good enough for
++@@ -1264,6 +1267,7 @@
++ curses_libs = ['curses']
++
++ exts.append( Extension('_curses', ['_cursesmodule.c'],
+++ library_dirs = ['/usr/lib'],
++ libraries = curses_libs) )
++ else:
++ missing.append('_curses')
++@@ -1432,10 +1436,22 @@
++ macros = dict()
++ libraries = []
++
++- elif host_platform in ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8'):
+++ elif host_platform in ('freebsd4', 'freebsd5', 'freebsd6'):
++ # FreeBSD's P1003.1b semaphore support is very experimental
++ # and has many known problems. (as of June 2008)
++- macros = dict()
+++ macros = dict( # FreeBSD 4-6
+++ HAVE_SEM_OPEN=0,
+++ HAVE_SEM_TIMEDWAIT=0,
+++ HAVE_FD_TRANSFER=1,
+++ )
+++ libraries = []
+++
+++ elif host_platform in ('freebsd7', 'freebsd8', 'freebsd9', 'freebsd10'):
+++ macros = dict( # FreeBSD 7+
+++ HAVE_SEM_OPEN=1,
+++ HAVE_SEM_TIMEDWAIT=1,
+++ HAVE_FD_TRANSFER=1,
+++ )
++ libraries = []
++
++ elif host_platform.startswith('openbsd'):
++@@ -1484,7 +1500,7 @@
++ missing.append('linuxaudiodev')
++
++ if (host_platform in ('linux2', 'freebsd4', 'freebsd5', 'freebsd6',
++- 'freebsd7', 'freebsd8')
+++ 'freebsd7', 'freebsd8', 'freebsd9', 'freebsd10')
++ or host_platform.startswith("gnukfreebsd")):
++ exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) )
++ else:
++@@ -2066,9 +2082,7 @@
++ ext_modules=[Extension('_struct', ['_struct.c'])],
++
++ # Scripts to install
++- scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle',
++- 'Tools/scripts/2to3',
++- 'Lib/smtpd.py']
+++ scripts = []
++ )
++
++ # --install-platlib
diff --git a/math/sage/files/patch-build_pkgs_sympow_fbsd-patch-src_disk.c b/math/sage/files/patch-build_pkgs_sympow_fbsd-patch-src_disk.c
new file mode 100644
index 000000000000..a59cb3e0c066
--- /dev/null
+++ b/math/sage/files/patch-build_pkgs_sympow_fbsd-patch-src_disk.c
@@ -0,0 +1,14 @@
+--- /dev/null 2014-01-29 03:00:00.000000000 +0000
++++ build/pkgs/sympow/fbsd-patch-src_disk.c 2014-01-29 03:01:19.000000000 +0000
+@@ -0,0 +1,11 @@
++--- src/disk.c-orig 2012-04-19 02:33:51.000000000 +0000
+++++ src/disk.c 2012-04-19 02:34:22.000000000 +0000
++@@ -39,7 +39,7 @@
++ else if (((sp&3)==0) && CM_CASE) {if (2*ep==sp) S[3]='l'; else S[3]='h';}
++ else {if (2*ep==sp) S[3]='L'; else S[3]='H';}
++ if (HECKE && dv) {TACKS[which]=malloc(dv*sizeof(QD)); TACKON[which]=dv;}
++- else if (dv<=sp/2) TACKON[which]=0;
+++ else if (dv<=sp/2) {TACKS[which]=NULL; TACKON[which]=0;}
++ else {TACKS[which]=malloc((dv-sp/2)*sizeof(QD)); TACKON[which]=dv-sp/2;}
++ S[4]=0; F=fopen("datafiles/param_data","r"); strcpy(U,S);
++ if (ANAL_RANK) {if (dv>0) U[0]='A'; else U[0]='m';}
diff --git a/math/sage/files/patch-src_bin_sage-spkg b/math/sage/files/patch-src_bin_sage-spkg
new file mode 100644
index 000000000000..1533ba10e11f
--- /dev/null
+++ b/math/sage/files/patch-src_bin_sage-spkg
@@ -0,0 +1,32 @@
+--- src/bin/sage-spkg-orig 2014-01-29 17:26:07.000000000 +0000
++++ src/bin/sage-spkg 2014-01-29 17:41:25.000000000 +0000
+@@ -593,6 +593,29 @@
+ exit 1
+ fi
+
++if ls fbsd-patch-* > /dev/null 2>&1; then
++ echo "===> Applying FreeBSD patches"
++ cat fbsd-patch-* | patch -p0 || exit 1
++ echo "===> Done applying FreeBSD patches"
++fi
++
++# Inspired by run-autotools-fixup target in Mk/bsd.port.mk.
++# Work around an issue where FreeBSD 10.0 is detected as FreeBSD 1.x.
++for f in `find src -type f \( -name config.libpath -o \
++ -name config.rpath -o -name configure -o -name libtool.m4 -o \
++ -name ltconfig -o -name libtool -o -name aclocal.m4 -o \
++ -name acinclude.m4 \)` ; do \
++ sed -i.fbsd10bak \
++ -e 's|freebsd1\*)|freebsd1.\*)|g' \
++ -e 's|freebsd\[12\]\*)|freebsd[12].*)|g' \
++ -e 's|freebsd\[123\]\*)|freebsd[123].*)|g' \
++ -e 's|freebsd\[\[12\]\]\*)|freebsd[[12]].*)|g' \
++ -e 's|freebsd\[\[123\]\]\*)|freebsd[[123]].*)|g' \
++ ${f}
++ rm -f ${f}.fbsd10bak
++ echo "===> FreeBSD 10 autotools fix applied to ${f}"; \
++done
++
+ # When there is no spkg-install, assume the "spkg" is a tarball not
+ # specifically made for Sage. Since we want it to be as easy as
+ # possible to install such a package, we "guess" spkg-install.
diff --git a/math/sage/files/spkg-patch-sage_-_doc_common_builder.py b/math/sage/files/patch-src_doc_common_builder.py
index ff9be1cda536..0c52e5a7b9a8 100644
--- a/math/sage/files/spkg-patch-sage_-_doc_common_builder.py
+++ b/math/sage/files/patch-src_doc_common_builder.py
@@ -1,5 +1,5 @@
---- sage-5.8.rc0/doc/common/builder.py-orig 2013-03-17 20:50:38.000000000 +0000
-+++ sage-5.13/doc/common/builder.py 2013-03-17 20:56:42.000000000 +0000
+--- src/doc/common/builder.py-orig 2013-03-17 20:50:38.000000000 +0000
++++ src/doc/common/builder.py 2013-03-17 20:56:42.000000000 +0000
@@ -272,13 +272,16 @@
# build the other documents in parallel
diff --git a/math/sage/files/spkg-patch-cephes_-_spkg-install b/math/sage/files/spkg-patch-cephes_-_spkg-install
deleted file mode 100644
index 237c4ce412cc..000000000000
--- a/math/sage/files/spkg-patch-cephes_-_spkg-install
+++ /dev/null
@@ -1,11 +0,0 @@
---- cephes-2.8.p1/spkg-install-orig 2013-03-30 20:48:35.000000000 +0000
-+++ cephes-2.8.p1/spkg-install 2013-03-30 20:48:57.000000000 +0000
-@@ -24,6 +24,8 @@
- fi
- done
-
-+sed -i .orig 's|.*printf|//&1|' */mtherr.c
-+
- echo "Building Cephes..."
- $MAKE
- if [ $? -ne 0 ]; then
diff --git a/math/sage/files/spkg-patch-eclib_-_src_libsrc_eclib_interface.h b/math/sage/files/spkg-patch-eclib_-_src_libsrc_eclib_interface.h
deleted file mode 100644
index bd8b9851170d..000000000000
--- a/math/sage/files/spkg-patch-eclib_-_src_libsrc_eclib_interface.h
+++ /dev/null
@@ -1,10 +0,0 @@
---- eclib-20120830/src/libsrc/eclib/interface.h-orig 2013-04-26 23:46:24.000000000 +0000
-+++ eclib-20120830/src/libsrc/eclib/interface.h 2013-04-26 23:47:09.000000000 +0000
-@@ -48,6 +48,7 @@
- #include <iterator>
- using namespace std;
- #include "templates.h"
-+#include <stdint.h>
-
- #ifndef MININT
- #define MININT numeric_limits<int>::min()
diff --git a/math/sage/files/spkg-patch-maxima_-_src_interfaces_xmaxima_Makefile.in b/math/sage/files/spkg-patch-maxima_-_src_interfaces_xmaxima_Makefile.in
deleted file mode 100644
index 5d89c5c2cdd9..000000000000
--- a/math/sage/files/spkg-patch-maxima_-_src_interfaces_xmaxima_Makefile.in
+++ /dev/null
@@ -1,20 +0,0 @@
---- maxima-5.29.1.p1/src/interfaces/xmaxima/Makefile.in-orig 2013-05-09 02:26:31.000000000 +0000
-+++ maxima-5.29.1.p3/src/interfaces/xmaxima/Makefile.in 2013-05-09 02:30:12.000000000 +0000
-@@ -624,14 +624,10 @@
- tclIndex:: $(TKSOURCES)
- echo "source ../ObjTcl/Object.tcl; auto_mkindex . $(TKSOURCES)" | $(TCLSH)
-
--# Create Tkmaxima/tclIndex if tclsh is available. Otherwise, create empty file
--# to satisfy make.
-+# Create empty Tkmaxima/tclIndex, because attempting to create it using tclsh
-+# seems to soak up huge amounts of resources.
- Tkmaxima/tclIndex: $(TKSOURCES)
-- $(TCLSH) < /dev/null > /dev/null 2>&1 && \
-- (cd Tkmaxima ; \
-- echo "source ../ObjTcl/Object.tcl; auto_mkindex . $(ALLFILES)" | \
-- $(TCLSH)) || \
-- touch Tkmaxima/tclIndex
-+ touch Tkmaxima/tclIndex
-
- FORCE:
- # Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/math/sage/files/spkg-patch-ncurses_-_src_configure b/math/sage/files/spkg-patch-ncurses_-_src_configure
deleted file mode 100644
index bf9533491792..000000000000
--- a/math/sage/files/spkg-patch-ncurses_-_src_configure
+++ /dev/null
@@ -1,11 +0,0 @@
---- ncurses-5.9/src/configure.orig 2013-08-21 02:51:59.000000000 +0000
-+++ ncurses-5.9.p2/src/configure 2013-08-21 02:53:23.000000000 +0000
-@@ -5719,7 +5719,7 @@
- cf_cv_shared_soname='`basename $@`'
- fi
-
-- MK_SHARED_LIB='${LD} -shared -Bshareable -soname=`basename $@` -o $@'
-+ MK_SHARED_LIB='${CC} -shared -Bshareable -soname=`basename $@` -o $@'
- ;;
- netbsd*) #(vi
- CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
diff --git a/math/sage/files/spkg-patch-numpy_-_src_numpy_distutils_system_info.py b/math/sage/files/spkg-patch-numpy_-_src_numpy_distutils_system_info.py
deleted file mode 100644
index 1db862fcff27..000000000000
--- a/math/sage/files/spkg-patch-numpy_-_src_numpy_distutils_system_info.py
+++ /dev/null
@@ -1,13 +0,0 @@
---- numpy-1.7.0/src/numpy/distutils/system_info.py.orig 2013-02-09 21:04:56.000000000 +0000
-+++ numpy-1.7.0/src/numpy/distutils/system_info.py 2013-05-27 21:51:12.000000000 +0000
-@@ -983,8 +983,8 @@
- dir_env_var = 'ATLAS'
- _lib_names = ['f77blas', 'cblas']
- if sys.platform[:7] == 'freebsd':
-- _lib_atlas = ['atlas_r']
-- _lib_lapack = ['alapack_r']
-+ _lib_atlas = ['atlas']
-+ _lib_lapack = ['alapack']
- else:
- _lib_atlas = ['atlas']
- _lib_lapack = ['lapack']
diff --git a/math/sage/files/spkg-patch-ppl_-_src_demos_ppl_lpsol_ppl_lpsol.c b/math/sage/files/spkg-patch-ppl_-_src_demos_ppl_lpsol_ppl_lpsol.c
deleted file mode 100644
index 6252b9924129..000000000000
--- a/math/sage/files/spkg-patch-ppl_-_src_demos_ppl_lpsol_ppl_lpsol.c
+++ /dev/null
@@ -1,11 +0,0 @@
---- ppl-1.0.p0/src/demos/ppl_lpsol/ppl_lpsol.c.orig 2013-06-20 17:21:39.000000000 +0000
-+++ ppl-1.1pre9.p0/src/demos/ppl_lpsol/ppl_lpsol.c 2013-06-20 17:39:44.000000000 +0000
-@@ -534,7 +534,7 @@
- if (getrlimit(RLIMIT_AS, &t) != 0)
- fatal("getrlimit failed: %s", strerror(errno));
-
-- if (bytes < t.rlim_cur) {
-+ if (bytes < (unsigned long)(t.rlim_cur)) {
- t.rlim_cur = bytes;
- if (setrlimit(RLIMIT_AS, &t) != 0)
- fatal("setrlimit failed: %s", strerror(errno));
diff --git a/math/sage/files/spkg-patch-pycrypto_-_spkg-install b/math/sage/files/spkg-patch-pycrypto_-_spkg-install
deleted file mode 100644
index 902149044e28..000000000000
--- a/math/sage/files/spkg-patch-pycrypto_-_spkg-install
+++ /dev/null
@@ -1,11 +0,0 @@
---- pycrypto-2.1.0/spkg-install-orig 2012-04-08 01:30:47.000000000 +0000
-+++ pycrypto-2.1.0/spkg-install 2012-04-08 01:31:41.000000000 +0000
-@@ -12,6 +12,8 @@
- LDFLAGS="-m64 "; export LDFLAGS
- fi
-
-+patch -p0 < patches_src.libtom.tomcrypt_pk.h
-+
- CFLAGS="-I$SAGE_LOCAL/include -L$SAGE_LOCAL/lib $CFLAGS"
- export CFLAGS
-
diff --git a/math/sage/files/spkg-patch-python_-_src_Doc_library_fcntl.rst b/math/sage/files/spkg-patch-python_-_src_Doc_library_fcntl.rst
deleted file mode 100644
index e1b137fd7791..000000000000
--- a/math/sage/files/spkg-patch-python_-_src_Doc_library_fcntl.rst
+++ /dev/null
@@ -1,11 +0,0 @@
---- python-2.7.3.p0/src/Doc/library/fcntl.rst.orig 2011-06-11 15:46:23.000000000 +0000
-+++ python-2.7.5.p1/src/Doc/library/fcntl.rst 2012-04-22 00:31:48.000000000 +0000
-@@ -50,8 +50,6 @@
- operations are typically defined in the library module :mod:`termios` and the
- argument handling is even more complicated.
-
-- The op parameter is limited to values that can fit in 32-bits.
--
- The parameter *arg* can be one of an integer, absent (treated identically to the
- integer ``0``), an object supporting the read-only buffer interface (most likely
- a plain Python string) or an object supporting the read-write buffer interface.
diff --git a/math/sage/files/spkg-patch-python_-_src_Modules__ctypes_libffi_configure b/math/sage/files/spkg-patch-python_-_src_Modules__ctypes_libffi_configure
deleted file mode 100644
index aa6297bcb94d..000000000000
--- a/math/sage/files/spkg-patch-python_-_src_Modules__ctypes_libffi_configure
+++ /dev/null
@@ -1,21 +0,0 @@
---- python-2.7.3.p0/src/Modules/_ctypes/libffi/configure.orig 2011-06-11 15:46:26.000000000 +0000
-+++ python-2.7.5.p1/src/Modules/_ctypes/libffi/configure 2012-04-22 00:23:14.000000000 +0000
-@@ -6289,7 +6289,7 @@
- rm -rf conftest*
- ;;
-
--x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
-+amd64-*-freebsd*|x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
- s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
- # Find out which ABI we are using.
- echo 'int i;' > conftest.$ac_ext
-@@ -11275,6 +11275,9 @@
- powerpc-*-freebsd*)
- TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
- ;;
-+ powerpc64-*-freebsd*)
-+ TARGET=POWERPC; TARGETDIR=powerpc
-+ ;;
- powerpc*-*-rtems*)
- TARGET=POWERPC; TARGETDIR=powerpc
- ;;
diff --git a/math/sage/files/spkg-patch-python_-_src_Modules_fcntlmodule.c b/math/sage/files/spkg-patch-python_-_src_Modules_fcntlmodule.c
deleted file mode 100644
index 0899c8c93ac4..000000000000
--- a/math/sage/files/spkg-patch-python_-_src_Modules_fcntlmodule.c
+++ /dev/null
@@ -1,53 +0,0 @@
---- python-2.7.3.p0/src/Modules/fcntlmodule.c.orig 2011-06-11 15:46:27.000000000 +0000
-+++ python-2.7.5.p1/src/Modules/fcntlmodule.c 2012-04-22 00:23:34.000000000 +0000
-@@ -97,20 +97,15 @@
- {
- #define IOCTL_BUFSZ 1024
- int fd;
-- /* In PyArg_ParseTuple below, we use the unsigned non-checked 'I'
-+ /* In PyArg_ParseTuple below, we use the unsigned non-checked 'k'
- format for the 'code' parameter because Python turns 0x8000000
- into either a large positive number (PyLong or PyInt on 64-bit
- platforms) or a negative number on others (32-bit PyInt)
- whereas the system expects it to be a 32bit bit field value
- regardless of it being passed as an int or unsigned long on
-- various platforms. See the termios.TIOCSWINSZ constant across
-- platforms for an example of thise.
--
-- If any of the 64bit platforms ever decide to use more than 32bits
-- in their unsigned long ioctl codes this will break and need
-- special casing based on the platform being built on.
-+ various platforms.
- */
-- unsigned int code;
-+ unsigned long code;
- int arg;
- int ret;
- char *str;
-@@ -118,7 +113,7 @@
- int mutate_arg = 1;
- char buf[IOCTL_BUFSZ+1]; /* argument plus NUL byte */
-
-- if (PyArg_ParseTuple(args, "O&Iw#|i:ioctl",
-+ if (PyArg_ParseTuple(args, "O&kw#|i:ioctl",
- conv_descriptor, &fd, &code,
- &str, &len, &mutate_arg)) {
- char *arg;
-@@ -169,7 +164,7 @@
- }
-
- PyErr_Clear();
-- if (PyArg_ParseTuple(args, "O&Is#:ioctl",
-+ if (PyArg_ParseTuple(args, "O&ks#:ioctl",
- conv_descriptor, &fd, &code, &str, &len)) {
- if (len > IOCTL_BUFSZ) {
- PyErr_SetString(PyExc_ValueError,
-@@ -191,7 +186,7 @@
- PyErr_Clear();
- arg = 0;
- if (!PyArg_ParseTuple(args,
-- "O&I|i;ioctl requires a file or file descriptor,"
-+ "O&k|i;ioctl requires a file or file descriptor,"
- " an integer and optionally an integer or buffer argument",
- conv_descriptor, &fd, &code, &arg)) {
- return NULL;
diff --git a/math/sage/files/spkg-patch-python_-_src_Python_thread_pthread.h b/math/sage/files/spkg-patch-python_-_src_Python_thread_pthread.h
deleted file mode 100644
index 944232c92871..000000000000
--- a/math/sage/files/spkg-patch-python_-_src_Python_thread_pthread.h
+++ /dev/null
@@ -1,55 +0,0 @@
---- python-2.7.3.p0/src/Python/thread_pthread.h.orig 2011-06-11 15:46:28.000000000 +0000
-+++ python-2.7.5.p1/src/Python/thread_pthread.h 2012-04-22 00:23:46.000000000 +0000
-@@ -38,13 +38,18 @@
- #endif
- #endif
-
-+#ifdef __FreeBSD__
-+#include <osreldate.h>
-+#endif
-+
- /* The POSIX spec says that implementations supporting the sem_*
- family of functions must indicate this by defining
- _POSIX_SEMAPHORES. */
- #ifdef _POSIX_SEMAPHORES
- /* On FreeBSD 4.x, _POSIX_SEMAPHORES is defined empty, so
- we need to add 0 to make it work there as well. */
--#if (_POSIX_SEMAPHORES+0) == -1
-+#if defined(__FreeBSD__) && __FreeBSD_version < 701104 && \
-+ (_POSIX_SEMAPHORES+0) == -1
- #define HAVE_BROKEN_POSIX_SEMAPHORES
- #else
- #include <semaphore.h>
-@@ -56,7 +61,6 @@
- in default setting. So the process scope is preferred to get
- enough number of threads to work. */
- #ifdef __FreeBSD__
--#include <osreldate.h>
- #if __FreeBSD_version >= 500000 && __FreeBSD_version < 504101
- #undef PTHREAD_SYSTEM_SCHED_SUPPORTED
- #endif
-@@ -161,6 +165,7 @@
- {
- pthread_t th;
- int status;
-+ sigset_t set, oset;
- #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
- pthread_attr_t attrs;
- #endif
-@@ -189,6 +194,8 @@
- #if defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
- pthread_attr_setscope(&attrs, PTHREAD_SCOPE_SYSTEM);
- #endif
-+ sigfillset(&set);
-+ SET_THREAD_SIGMASK(SIG_BLOCK, &set, &oset);
-
- status = pthread_create(&th,
- #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
-@@ -200,6 +207,7 @@
- (void *)arg
- );
-
-+ SET_THREAD_SIGMASK(SIG_SETMASK, &oset, NULL);
- #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
- pthread_attr_destroy(&attrs);
- #endif
diff --git a/math/sage/files/spkg-patch-python_-_src_setup.py b/math/sage/files/spkg-patch-python_-_src_setup.py
deleted file mode 100644
index f776ec7f5c2c..000000000000
--- a/math/sage/files/spkg-patch-python_-_src_setup.py
+++ /dev/null
@@ -1,97 +0,0 @@
---- python-2.7.5.p1/src/setup.py-orig 2013-03-17 03:13:46.000000000 +0000
-+++ python-2.7.5.p1/src/setup.py 2013-03-17 03:15:11.000000000 +0000
-@@ -642,7 +642,7 @@
- # use the same library for the readline and curses modules.
- if 'curses' in readline_termcap_library:
- curses_library = readline_termcap_library
-- elif self.compiler.find_library_file(lib_dirs, 'ncursesw'):
-+ elif self.compiler.find_library_file(lib_dirs, 'xxxncursesw'):
- curses_library = 'ncursesw'
- elif self.compiler.find_library_file(lib_dirs, 'ncurses'):
- curses_library = 'ncurses'
-@@ -681,7 +681,7 @@
- 'termcap'):
- readline_libs.append('termcap')
- exts.append( Extension('readline', ['readline.c'],
-- library_dirs=['/usr/lib/termcap'],
-+ library_dirs=['/usr/lib', '/usr/lib/termcap'],
- extra_link_args=readline_extra_link_args,
- libraries=readline_libs) )
- else:
-@@ -1120,7 +1122,7 @@
- sysroot = macosx_sdk_root()
- f = os.path.join(sysroot, f[1:])
-
-- if os.path.exists(f) and not db_incs:
-+ if os.path.exists(f):
- data = open(f).read()
- m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data)
- if m is not None:
-@@ -1246,12 +1248,13 @@
- # provided by the ncurses library.
- panel_library = 'panel'
- if curses_library.startswith('ncurses'):
-- if curses_library == 'ncursesw':
-+ if curses_library == 'xxxncursesw':
- # Bug 1464056: If _curses.so links with ncursesw,
- # _curses_panel.so must link with panelw.
- panel_library = 'panelw'
- curses_libs = [curses_library]
- exts.append( Extension('_curses', ['_cursesmodule.c'],
-+ library_dirs = ['/usr/lib'],
- libraries = curses_libs) )
- elif curses_library == 'curses' and platform != 'darwin':
- # OSX has an old Berkeley curses, not good enough for
-@@ -1264,6 +1267,7 @@
- curses_libs = ['curses']
-
- exts.append( Extension('_curses', ['_cursesmodule.c'],
-+ library_dirs = ['/usr/lib'],
- libraries = curses_libs) )
- else:
- missing.append('_curses')
-@@ -1432,10 +1436,22 @@
- macros = dict()
- libraries = []
-
-- elif host_platform in ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8'):
-+ elif host_platform in ('freebsd4', 'freebsd5', 'freebsd6'):
- # FreeBSD's P1003.1b semaphore support is very experimental
- # and has many known problems. (as of June 2008)
-- macros = dict()
-+ macros = dict( # FreeBSD 4-6
-+ HAVE_SEM_OPEN=0,
-+ HAVE_SEM_TIMEDWAIT=0,
-+ HAVE_FD_TRANSFER=1,
-+ )
-+ libraries = []
-+
-+ elif host_platform in ('freebsd7', 'freebsd8', 'freebsd9', 'freebsd10'):
-+ macros = dict( # FreeBSD 7+
-+ HAVE_SEM_OPEN=1,
-+ HAVE_SEM_TIMEDWAIT=1,
-+ HAVE_FD_TRANSFER=1,
-+ )
- libraries = []
-
- elif host_platform.startswith('openbsd'):
-@@ -1484,7 +1500,7 @@
- missing.append('linuxaudiodev')
-
- if (host_platform in ('linux2', 'freebsd4', 'freebsd5', 'freebsd6',
-- 'freebsd7', 'freebsd8')
-+ 'freebsd7', 'freebsd8', 'freebsd9', 'freebsd10')
- or host_platform.startswith("gnukfreebsd")):
- exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) )
- else:
-@@ -2066,9 +2082,7 @@
- ext_modules=[Extension('_struct', ['_struct.c'])],
-
- # Scripts to install
-- scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle',
-- 'Tools/scripts/2to3',
-- 'Lib/smtpd.py']
-+ scripts = []
- )
-
- # --install-platlib
diff --git a/math/sage/files/spkg-patch-sympow_-_src_disk.c b/math/sage/files/spkg-patch-sympow_-_src_disk.c
deleted file mode 100644
index 6efde5563398..000000000000
--- a/math/sage/files/spkg-patch-sympow_-_src_disk.c
+++ /dev/null
@@ -1,11 +0,0 @@
---- sympow-1.018.1.p11/src/disk.c-orig 2012-04-19 02:33:51.000000000 +0000
-+++ sympow-1.018.1.p11/src/disk.c 2012-04-19 02:34:22.000000000 +0000
-@@ -39,7 +39,7 @@
- else if (((sp&3)==0) && CM_CASE) {if (2*ep==sp) S[3]='l'; else S[3]='h';}
- else {if (2*ep==sp) S[3]='L'; else S[3]='H';}
- if (HECKE && dv) {TACKS[which]=malloc(dv*sizeof(QD)); TACKON[which]=dv;}
-- else if (dv<=sp/2) TACKON[which]=0;
-+ else if (dv<=sp/2) {TACKS[which]=NULL; TACKON[which]=0;}
- else {TACKS[which]=malloc((dv-sp/2)*sizeof(QD)); TACKON[which]=dv-sp/2;}
- S[4]=0; F=fopen("datafiles/param_data","r"); strcpy(U,S);
- if (ANAL_RANK) {if (dv>0) U[0]='A'; else U[0]='m';}
diff --git a/math/sage/pkg-descr b/math/sage/pkg-descr
index 77e71c3fed6b..75ceb0b9c058 100644
--- a/math/sage/pkg-descr
+++ b/math/sage/pkg-descr
@@ -7,4 +7,7 @@ Mathematica and Matlab.
For instructions on adding optional packages, see files/optional-packages.txt.
+You may want to avoid the command "make install" and instead simply use the
+bin/mv command to move the ${WRKSRC} directory to where-ever you want it.
+
WWW: http://www.sagemath.org/