python-freebsd.patch (6ee2a585) python-freebsd.patch (4ad7762f)
1diff -ruN misc/Python-2.7.8/Lib/plat-freebsd9/IN.py misc/build/Python-2.7.8/Lib/plat-freebsd9/IN.py
2--- misc/Python-2.7.8/Lib/plat-freebsd9/IN.py 1969-12-31 19:00:00.000000000 -0500
3+++ misc/build/Python-2.7.8/Lib/plat-freebsd9/IN.py 2016-01-01 17:38:35.922764464 -0500
1diff -ruN misc/Python-2.7.9/Lib/plat-freebsd9/IN.py misc/build/Python-2.7.9/Lib/plat-freebsd9/IN.py
2--- misc/Python-2.7.9/Lib/plat-freebsd9/IN.py 1969-12-31 19:00:00.000000000 -0500
3+++ misc/build/Python-2.7.9/Lib/plat-freebsd9/IN.py 2016-01-01 17:38:35.922764464 -0500
4@@ -0,0 +1,612 @@
5+# Generated by h2py from /usr/include/netinet/in.h
6+
7+# Included from sys/cdefs.h
8+__GNUCLIKE_ASM = 3
9+__GNUCLIKE_ASM = 2
10+__GNUCLIKE___TYPEOF = 1
11+__GNUCLIKE___OFFSETOF = 1

--- 597 unchanged lines hidden (view full) ---

609+IPV6CTL_ISATAPRTR = 43
610+IPV6CTL_MCAST_PMTU = 44
611+IPV6CTL_STEALTH = 45
612+ICMPV6CTL_ND6_ONLINKNSRFC4861 = 47
613+IPV6CTL_NO_RADR = 48
614+IPV6CTL_NORBIT_RAIF = 49
615+IPV6CTL_RFC6204W3 = 50
616+IPV6CTL_MAXID = 51
4@@ -0,0 +1,612 @@
5+# Generated by h2py from /usr/include/netinet/in.h
6+
7+# Included from sys/cdefs.h
8+__GNUCLIKE_ASM = 3
9+__GNUCLIKE_ASM = 2
10+__GNUCLIKE___TYPEOF = 1
11+__GNUCLIKE___OFFSETOF = 1

--- 597 unchanged lines hidden (view full) ---

609+IPV6CTL_ISATAPRTR = 43
610+IPV6CTL_MCAST_PMTU = 44
611+IPV6CTL_STEALTH = 45
612+ICMPV6CTL_ND6_ONLINKNSRFC4861 = 47
613+IPV6CTL_NO_RADR = 48
614+IPV6CTL_NORBIT_RAIF = 49
615+IPV6CTL_RFC6204W3 = 50
616+IPV6CTL_MAXID = 51
617diff -ruN misc/Python-2.7.8/Lib/plat-freebsd9/regen misc/build/Python-2.7.8/Lib/plat-freebsd9/regen
618--- misc/Python-2.7.8/Lib/plat-freebsd9/regen 1969-12-31 19:00:00.000000000 -0500
619+++ misc/build/Python-2.7.8/Lib/plat-freebsd9/regen 2016-01-01 17:38:35.922764464 -0500
617diff -ruN misc/Python-2.7.9/Lib/plat-freebsd9/regen misc/build/Python-2.7.9/Lib/plat-freebsd9/regen
618--- misc/Python-2.7.9/Lib/plat-freebsd9/regen 1969-12-31 19:00:00.000000000 -0500
619+++ misc/build/Python-2.7.9/Lib/plat-freebsd9/regen 2016-01-01 17:38:35.922764464 -0500
620@@ -0,0 +1,3 @@
621+#! /bin/sh
622+set -v
623+python ../../Tools/scripts/h2py.py -i '(u_long)' /usr/include/netinet/in.h
620@@ -0,0 +1,3 @@
621+#! /bin/sh
622+set -v
623+python ../../Tools/scripts/h2py.py -i '(u_long)' /usr/include/netinet/in.h
624diff -ruN misc/Python-2.7.8/Lib/test/test_threading.py misc/build/Python-2.7.8/Lib/test/test_threading.py
625--- misc/Python-2.7.8/Lib/test/test_threading.py 2014-06-29 21:05:37.000000000 -0500
626+++ misc/build/Python-2.7.8/Lib/test/test_threading.py 2016-01-01 17:38:35.923764731 -0500
624diff -ruN misc/Python-2.7.9/Lib/test/test_threading.py misc/build/Python-2.7.9/Lib/test/test_threading.py
625--- misc/Python-2.7.9/Lib/test/test_threading.py 2014-06-29 21:05:37.000000000 -0500
626+++ misc/build/Python-2.7.9/Lib/test/test_threading.py 2016-01-01 17:38:35.923764731 -0500
627@@ -486,7 +486,7 @@
628 # #12316 and #11870), and fork() from a worker thread is known to trigger
629 # problems with some operating systems (issue #3863): skip problematic tests
630 # on platforms known to behave badly.
631- platforms_to_skip = ('freebsd4', 'freebsd5', 'freebsd6', 'netbsd5',
632+ platforms_to_skip = ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8', 'freebsd9', 'netbsd5',
633 'os2emx')
634
635 def _run_and_join(self, script):
627@@ -486,7 +486,7 @@
628 # #12316 and #11870), and fork() from a worker thread is known to trigger
629 # problems with some operating systems (issue #3863): skip problematic tests
630 # on platforms known to behave badly.
631- platforms_to_skip = ('freebsd4', 'freebsd5', 'freebsd6', 'netbsd5',
632+ platforms_to_skip = ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8', 'freebsd9', 'netbsd5',
633 'os2emx')
634
635 def _run_and_join(self, script):
636diff -ruN misc/Python-2.7.8/Modules/_ctypes/libffi/configure misc/build/Python-2.7.8/Modules/_ctypes/libffi/configure
637--- misc/Python-2.7.8/Modules/_ctypes/libffi/configure 2014-06-29 21:05:40.000000000 -0500
638+++ misc/build/Python-2.7.8/Modules/_ctypes/libffi/configure 2016-01-01 17:38:35.931765818 -0500
639@@ -6889,7 +6889,7 @@
640 rm -rf conftest*
641 ;;
642
643-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
644+amd64-*-freebsd*|x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
645 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
646 # Find out which ABI we are using.
647 echo 'int i;' > conftest.$ac_ext
648@@ -13459,6 +13459,9 @@
649 powerpc64-*-freebsd*)
650 TARGET=POWERPC; TARGETDIR=powerpc
651 ;;
652+ powerpc64-*-freebsd*)
653+ TARGET=POWERPC; TARGETDIR=powerpc
654+ ;;
655 powerpc*-*-rtems*)
656 TARGET=POWERPC; TARGETDIR=powerpc
657 ;;
658diff -ruN misc/Python-2.7.8/Modules/fcntlmodule.c misc/build/Python-2.7.8/Modules/fcntlmodule.c
659--- misc/Python-2.7.8/Modules/fcntlmodule.c 2014-06-29 21:05:43.000000000 -0500
660+++ misc/build/Python-2.7.8/Modules/fcntlmodule.c 2016-01-01 17:42:35.865747022 -0500
636diff -ruN misc/Python-2.7.9/Modules/fcntlmodule.c misc/build/Python-2.7.9/Modules/fcntlmodule.c
637--- misc/Python-2.7.9/Modules/fcntlmodule.c 2014-06-29 21:05:43.000000000 -0500
638+++ misc/build/Python-2.7.9/Modules/fcntlmodule.c 2016-01-01 17:42:35.865747022 -0500
661@@ -98,20 +98,15 @@
662 {
663 #define IOCTL_BUFSZ 1024
664 int fd;
665- /* In PyArg_ParseTuple below, we use the unsigned non-checked 'I'
666+ /* In PyArg_ParseTuple below, we use the unsigned non-checked 'k'
667 format for the 'code' parameter because Python turns 0x8000000
668 into either a large positive number (PyLong or PyInt on 64-bit

--- 35 unchanged lines hidden (view full) ---

704 PyErr_Clear();
705 arg = 0;
706 if (!PyArg_ParseTuple(args,
707- "O&I|i;ioctl requires a file or file descriptor,"
708+ "O&k|i;ioctl requires a file or file descriptor,"
709 " an integer and optionally an integer or buffer argument",
710 conv_descriptor, &fd, &code, &arg)) {
711 return NULL;
639@@ -98,20 +98,15 @@
640 {
641 #define IOCTL_BUFSZ 1024
642 int fd;
643- /* In PyArg_ParseTuple below, we use the unsigned non-checked 'I'
644+ /* In PyArg_ParseTuple below, we use the unsigned non-checked 'k'
645 format for the 'code' parameter because Python turns 0x8000000
646 into either a large positive number (PyLong or PyInt on 64-bit

--- 35 unchanged lines hidden (view full) ---

682 PyErr_Clear();
683 arg = 0;
684 if (!PyArg_ParseTuple(args,
685- "O&I|i;ioctl requires a file or file descriptor,"
686+ "O&k|i;ioctl requires a file or file descriptor,"
687 " an integer and optionally an integer or buffer argument",
688 conv_descriptor, &fd, &code, &arg)) {
689 return NULL;
712diff -ruN misc/Python-2.7.8/Modules/fcntlmodule.c.rej misc/build/Python-2.7.8/Modules/fcntlmodule.c.rej
713--- misc/Python-2.7.8/Modules/fcntlmodule.c.rej 1969-12-31 19:00:00.000000000 -0500
714+++ misc/build/Python-2.7.8/Modules/fcntlmodule.c.rej 2016-01-01 17:38:35.933764047 -0500
715@@ -0,0 +1,24 @@
716+@@ -97,20 +97,15 @@
717+ {
718+ #define IOCTL_BUFSZ 1024
719+ int fd;
720+- /* In PyArg_ParseTuple below, we use the unsigned non-checked 'I'
721++ /* In PyArg_ParseTuple below, we use the unsigned non-checked 'k'
722+ format for the 'code' parameter because Python turns 0x8000000
723+ into either a large positive number (PyLong or PyInt on 64-bit
724+ platforms) or a negative number on others (32-bit PyInt)
725+ whereas the system expects it to be a 32bit bit field value
726+ regardless of it being passed as an int or unsigned long on
727+- various platforms. See the termios.TIOCSWINSZ constant across
728+- platforms for an example of thise.
729+-
730+- If any of the 64bit platforms ever decide to use more than 32bits
731+- in their unsigned long ioctl codes this will break and need
732+- special casing based on the platform being built on.
733++ various platforms.
734+ */
735+- unsigned int code;
736++ unsigned long code;
737+ int arg;
738+ int ret;
739+ char *str;
740diff -ruN misc/Python-2.7.8/Python/thread_pthread.h misc/build/Python-2.7.8/Python/thread_pthread.h
741--- misc/Python-2.7.8/Python/thread_pthread.h 2014-06-29 21:05:47.000000000 -0500
742+++ misc/build/Python-2.7.8/Python/thread_pthread.h 2016-01-01 17:38:35.933764047 -0500
690diff -ruN misc/Python-2.7.9/Python/thread_pthread.h misc/build/Python-2.7.9/Python/thread_pthread.h
691--- misc/Python-2.7.9/Python/thread_pthread.h 2014-06-29 21:05:47.000000000 -0500
692+++ misc/build/Python-2.7.9/Python/thread_pthread.h 2016-01-01 17:38:35.933764047 -0500
743@@ -38,13 +38,18 @@
744 #endif
745 #endif
746
747+#ifdef __FreeBSD__
748+#include <osreldate.h>
749+#endif
750+

--- 37 unchanged lines hidden (view full) ---

788@@ -201,6 +208,7 @@
789 (void *)arg
790 );
791
792+ SET_THREAD_SIGMASK(SIG_SETMASK, &oset, NULL);
793 #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
794 pthread_attr_destroy(&attrs);
795 #endif
693@@ -38,13 +38,18 @@
694 #endif
695 #endif
696
697+#ifdef __FreeBSD__
698+#include <osreldate.h>
699+#endif
700+

--- 37 unchanged lines hidden (view full) ---

738@@ -201,6 +208,7 @@
739 (void *)arg
740 );
741
742+ SET_THREAD_SIGMASK(SIG_SETMASK, &oset, NULL);
743 #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
744 pthread_attr_destroy(&attrs);
745 #endif
796diff -ruN misc/Python-2.7.8/configure misc/build/Python-2.7.8/configure
797--- misc/Python-2.7.8/configure 2014-06-29 21:05:48.000000000 -0500
798+++ misc/build/Python-2.7.8/configure 2016-01-01 17:41:32.541753889 -0500
799@@ -5347,7 +5347,7 @@
746diff -ruN misc/Python-2.7.9/configure misc/build/Python-2.7.9/configure
747--- misc/Python-2.7.9/configure 2014-06-29 21:05:48.000000000 -0500
748+++ misc/build/Python-2.7.9/configure 2016-01-01 17:41:32.541753889 -0500
749@@ -5355,7 +5355,7 @@
800 ;;
801 SunOS*)
802 LDLIBRARY='libpython$(VERSION).so'
803- BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
804+ BLDLIBRARY=-R\'\$\$ORIGIN\'' -L. -lpython$(VERSION)'
805 RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
806 INSTSONAME="$LDLIBRARY".$SOVERSION
807 ;;
750 ;;
751 SunOS*)
752 LDLIBRARY='libpython$(VERSION).so'
753- BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
754+ BLDLIBRARY=-R\'\$\$ORIGIN\'' -L. -lpython$(VERSION)'
755 RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
756 INSTSONAME="$LDLIBRARY".$SOVERSION
757 ;;
808@@ -5355,11 +5355,6 @@
758@@ -5363,11 +5363,6 @@
809 LDLIBRARY='libpython$(VERSION).so'
810 BLDLIBRARY='-L. -lpython$(VERSION)'
811 RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
812- case $ac_sys_system in
813- FreeBSD*)
814- SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
815- ;;
816- esac
817 INSTSONAME="$LDLIBRARY".$SOVERSION
818 ;;
819 hp*|HP*)
759 LDLIBRARY='libpython$(VERSION).so'
760 BLDLIBRARY='-L. -lpython$(VERSION)'
761 RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
762- case $ac_sys_system in
763- FreeBSD*)
764- SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
765- ;;
766- esac
767 INSTSONAME="$LDLIBRARY".$SOVERSION
768 ;;
769 hp*|HP*)
820diff -ruN misc/Python-2.7.8/configure.rej misc/build/Python-2.7.8/configure.rej
821--- misc/Python-2.7.8/configure.rej 1969-12-31 19:00:00.000000000 -0500
822+++ misc/build/Python-2.7.8/configure.rej 2016-01-01 17:38:35.943764550 -0500
823@@ -0,0 +1,21 @@
824+@@ -4916,7 +4916,7 @@
825+ ;;
826+ SunOS*)
827+ LDLIBRARY='libpython$(VERSION).so'
828+- BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
829++ BLDLIBRARY=-R\'\$\$ORIGIN\'' -L. -lpython$(VERSION)'
830+ RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
831+ INSTSONAME="$LDLIBRARY".$SOVERSION
832+ ;;
833+@@ -4924,11 +4924,6 @@
834+ LDLIBRARY='libpython$(VERSION).so'
835+ BLDLIBRARY='-L. -lpython$(VERSION)'
836+ RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
837+- case $ac_sys_system in
838+- FreeBSD*)
839+- SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
840+- ;;
841+- esac
842+ INSTSONAME="$LDLIBRARY".$SOVERSION
843+ ;;
844+ hp*|HP*)
845diff -ruN misc/Python-2.7.8/setup.py misc/build/Python-2.7.8/setup.py
846--- misc/Python-2.7.8/setup.py 2014-06-29 21:05:48.000000000 -0500
847+++ misc/build/Python-2.7.8/setup.py 2016-01-01 17:38:35.945765223 -0500
848@@ -1551,7 +1551,7 @@
770diff -ruN misc/Python-2.7.9/setup.py misc/build/Python-2.7.9/setup.py
771--- misc/Python-2.7.9/setup.py 2014-06-29 21:05:48.000000000 -0500
772+++ misc/build/Python-2.7.9/setup.py 2016-01-01 17:38:35.945765223 -0500
773@@ -1553,7 +1553,7 @@
849 macros = dict()
850 libraries = []
851
852- elif host_platform in ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8'):
853+ elif host_platform in ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8', 'freebsd9'):
854 # FreeBSD's P1003.1b semaphore support is very experimental
855 # and has many known problems. (as of June 2008)
856 macros = dict()
774 macros = dict()
775 libraries = []
776
777- elif host_platform in ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8'):
778+ elif host_platform in ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8', 'freebsd9'):
779 # FreeBSD's P1003.1b semaphore support is very experimental
780 # and has many known problems. (as of June 2008)
781 macros = dict()
857@@ -1603,7 +1603,7 @@
782@@ -1605,7 +1605,7 @@
858 missing.append('linuxaudiodev')
859
860 if (host_platform in ('linux2', 'freebsd4', 'freebsd5', 'freebsd6',
861- 'freebsd7', 'freebsd8')
862+ 'freebsd7', 'freebsd8', 'freebsd9')
863 or host_platform.startswith("gnukfreebsd")):
864 exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) )
865 else:
783 missing.append('linuxaudiodev')
784
785 if (host_platform in ('linux2', 'freebsd4', 'freebsd5', 'freebsd6',
786- 'freebsd7', 'freebsd8')
787+ 'freebsd7', 'freebsd8', 'freebsd9')
788 or host_platform.startswith("gnukfreebsd")):
789 exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) )
790 else: