diff -ruN lang/python27.orig/Makefile lang/python27/Makefile --- lang/python27.orig/Makefile 2015-03-13 22:04:29.000000000 +0100 +++ lang/python27/Makefile 2015-03-04 12:28:33.000000000 +0100 @@ -105,6 +105,10 @@ PLIST_SUB+= NO_NIS="" .endif +.if defined(WITH_OPENSSL_PORT) +CONFIGURE_ARGS+= CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib +.endif + post-patch: @${REINPLACE_CMD} -e \ 's,/usr/doc/python-docs-,${PREFIX}/share/doc/python,g' \ diff -ruN lang/python27.orig/files/patch-Doc__library__fcntl.rst lang/python27/files/patch-Doc__library__fcntl.rst --- lang/python27.orig/files/patch-Doc__library__fcntl.rst 2015-03-13 22:04:29.000000000 +0100 +++ lang/python27/files/patch-Doc__library__fcntl.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,10 +0,0 @@ ---- ./Doc/library/fcntl.rst.orig 2014-07-03 21:53:41.473098625 +1000 -+++ ./Doc/library/fcntl.rst 2014-07-03 21:54:04.342833056 +1000 -@@ -50,7 +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. - Additional constants of interest for use as the *op* argument can be - found in the :mod:`termios` module, under the same names as used in - the relevant C header files. diff -ruN lang/python27.orig/files/patch-Doc_library_fcntl.rst lang/python27/files/patch-Doc_library_fcntl.rst --- lang/python27.orig/files/patch-Doc_library_fcntl.rst 1970-01-01 01:00:00.000000000 +0100 +++ lang/python27/files/patch-Doc_library_fcntl.rst 2015-03-13 13:45:06.000000000 +0100 @@ -0,0 +1,10 @@ +--- Doc/library/fcntl.rst.orig 2014-12-10 15:59:27 UTC ++++ Doc/library/fcntl.rst +@@ -50,7 +50,6 @@ The module defines the following functio + 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. + Additional constants of interest for use as the *op* argument can be + found in the :mod:`termios` module, under the same names as used in + the relevant C header files. diff -ruN lang/python27.orig/files/patch-Lib__distutils__unixccompiler.py lang/python27/files/patch-Lib__distutils__unixccompiler.py --- lang/python27.orig/files/patch-Lib__distutils__unixccompiler.py 2015-03-13 22:04:29.000000000 +0100 +++ lang/python27/files/patch-Lib__distutils__unixccompiler.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,15 +0,0 @@ -# Description: Some python extensions can't be compiled with clang 3.4 -# Issue ID: http://bugs.python.org/issue20767 -# Submitted by: antoine - ---- ./Lib/distutils/unixccompiler.py.orig 2013-11-10 07:36:40.000000000 +0000 -+++ ./Lib/distutils/unixccompiler.py 2014-02-19 15:41:48.000000000 +0000 -@@ -228,6 +228,8 @@ - if sys.platform[:6] == "darwin": - # MacOSX's linker doesn't understand the -R flag at all - return "-L" + dir -+ elif sys.platform[:7] == "freebsd": -+ return "-Wl,-rpath=" + dir - elif sys.platform[:5] == "hp-ux": - if self._is_gcc(compiler): - return ["-Wl,+s", "-L" + dir] diff -ruN lang/python27.orig/files/patch-Lib_distutils_command_build__scripts.py lang/python27/files/patch-Lib_distutils_command_build__scripts.py --- lang/python27.orig/files/patch-Lib_distutils_command_build__scripts.py 1970-01-01 01:00:00.000000000 +0100 +++ lang/python27/files/patch-Lib_distutils_command_build__scripts.py 2015-03-13 22:19:31.000000000 +0100 @@ -0,0 +1,17 @@ +# Description: A non-invasive partial backport of the Python3 distutils behaviour. +# This allows Python's scripts to be properly suffixed (similar to Python 3.x) on +# installation. +# Submitted by: mva + +--- Lib/distutils/command/build_scripts.py.orig 2014-12-10 15:59:34 UTC ++++ Lib/distutils/command/build_scripts.py +@@ -126,6 +126,9 @@ class build_scripts (Command): + file, oldmode, newmode) + os.chmod(file, newmode) + ++ # XXX should we modify self.outfiles? ++ return outfiles ++ + # copy_scripts () + + # class build_scripts diff -ruN lang/python27.orig/files/patch-Lib_distutils_command_build_scripts.py lang/python27/files/patch-Lib_distutils_command_build_scripts.py --- lang/python27.orig/files/patch-Lib_distutils_command_build_scripts.py 2015-03-13 22:04:29.000000000 +0100 +++ lang/python27/files/patch-Lib_distutils_command_build_scripts.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -# Description: A non-invasive partial backport of the Python3 distutils behaviour. -# This allows Python's scripts to be properly suffixed (similar to Python 3.x) on -# installation. -# Submitted by: mva - ---- Lib/distutils/command/build_scripts.py.orig 2014-07-26 11:52:20.000000000 +0200 -+++ Lib/distutils/command/build_scripts.py 2014-07-26 11:52:56.000000000 +0200 -@@ -126,6 +126,9 @@ - file, oldmode, newmode) - os.chmod(file, newmode) - -+ # XXX should we modify self.outfiles? -+ return outfiles -+ - # copy_scripts () - - # class build_scripts diff -ruN lang/python27.orig/files/patch-Lib_distutils_unixccompiler.py lang/python27/files/patch-Lib_distutils_unixccompiler.py --- lang/python27.orig/files/patch-Lib_distutils_unixccompiler.py 1970-01-01 01:00:00.000000000 +0100 +++ lang/python27/files/patch-Lib_distutils_unixccompiler.py 2015-03-13 22:19:31.000000000 +0100 @@ -0,0 +1,15 @@ +# Description: Some python extensions can't be compiled with clang 3.4 +# Issue ID: http://bugs.python.org/issue20767 +# Submitted by: antoine + +--- Lib/distutils/unixccompiler.py.orig 2014-12-10 15:59:34 UTC ++++ Lib/distutils/unixccompiler.py +@@ -228,6 +228,8 @@ class UnixCCompiler(CCompiler): + if sys.platform[:6] == "darwin": + # MacOSX's linker doesn't understand the -R flag at all + return "-L" + dir ++ elif sys.platform[:7] == "freebsd": ++ return "-Wl,-rpath=" + dir + elif sys.platform[:5] == "hp-ux": + if self._is_gcc(compiler): + return ["-Wl,+s", "-L" + dir] diff -ruN lang/python27.orig/files/patch-Lib_socket.py lang/python27/files/patch-Lib_socket.py --- lang/python27.orig/files/patch-Lib_socket.py 1970-01-01 01:00:00.000000000 +0100 +++ lang/python27/files/patch-Lib_socket.py 2015-03-13 22:19:31.000000000 +0100 @@ -0,0 +1,26 @@ +# Fix build with LibreSSL (does not have RAND_egd) +# PR192511, http://bugs.python.org/issue21356 +# Submitted by: spil.oss@gmail.org + +--- Lib/socket.py.orig 2014-12-10 15:59:40 UTC ++++ Lib/socket.py +@@ -67,7 +67,6 @@ else: + from _ssl import SSLError as sslerror + from _ssl import \ + RAND_add, \ +- RAND_egd, \ + RAND_status, \ + SSL_ERROR_ZERO_RETURN, \ + SSL_ERROR_WANT_READ, \ +@@ -78,6 +77,11 @@ else: + SSL_ERROR_WANT_CONNECT, \ + SSL_ERROR_EOF, \ + SSL_ERROR_INVALID_ERROR_CODE ++ try: ++ from _ssl import RAND_egd ++ # LibreSSL does not provide RAND_egd ++ except ImportError: ++ pass + + import os, sys, warnings + diff -ruN lang/python27.orig/files/patch-Lib_ssl.py lang/python27/files/patch-Lib_ssl.py --- lang/python27.orig/files/patch-Lib_ssl.py 1970-01-01 01:00:00.000000000 +0100 +++ lang/python27/files/patch-Lib_ssl.py 2015-03-13 22:19:31.000000000 +0100 @@ -0,0 +1,19 @@ +# Fix build with LibreSSL (does not have RAND_egd) +# PR192511, http://bugs.python.org/issue21356 +# Submitted by: spil.oss@gmail.org + +--- Lib/ssl.py.orig 2014-12-10 15:59:40 UTC ++++ Lib/ssl.py +@@ -106,7 +106,11 @@ from _ssl import CERT_NONE, CERT_OPTIONA + from _ssl import (VERIFY_DEFAULT, VERIFY_CRL_CHECK_LEAF, VERIFY_CRL_CHECK_CHAIN, + VERIFY_X509_STRICT) + from _ssl import txt2obj as _txt2obj, nid2obj as _nid2obj +-from _ssl import RAND_status, RAND_egd, RAND_add ++from _ssl import RAND_status, RAND_add ++try: ++ from _ssl import RAND_egd ++except ImportError: ++ pass + + def _import_symbols(prefix): + for n in dir(_ssl): diff -ruN lang/python27.orig/files/patch-Lib_test_test__ssl.py lang/python27/files/patch-Lib_test_test__ssl.py --- lang/python27.orig/files/patch-Lib_test_test__ssl.py 1970-01-01 01:00:00.000000000 +0100 +++ lang/python27/files/patch-Lib_test_test__ssl.py 2015-03-13 22:19:31.000000000 +0100 @@ -0,0 +1,18 @@ +# Fix build with LibreSSL (does not have RAND_egd) +# PR192511, http://bugs.python.org/issue21356 +# Submitted by: spil.oss@gmail.org + +--- Lib/test/test_ssl.py.orig 2014-12-10 15:59:47 UTC ++++ Lib/test/test_ssl.py +@@ -169,8 +169,9 @@ class BasicSocketTests(unittest.TestCase + sys.stdout.write("\n RAND_status is %d (%s)\n" + % (v, (v and "sufficient randomness") or + "insufficient randomness")) +- self.assertRaises(TypeError, ssl.RAND_egd, 1) +- self.assertRaises(TypeError, ssl.RAND_egd, 'foo', 1) ++ if hasattr(ssl, 'RAND_egd'): ++ self.assertRaises(TypeError, ssl.RAND_egd, 1) ++ self.assertRaises(TypeError, ssl.RAND_egd, 'foo', 1) + ssl.RAND_add("this is a random string", 75.0) + + def test_parse_cert(self): diff -ruN lang/python27.orig/files/patch-Makefile.pre.in lang/python27/files/patch-Makefile.pre.in --- lang/python27.orig/files/patch-Makefile.pre.in 2015-03-13 22:04:29.000000000 +0100 +++ lang/python27/files/patch-Makefile.pre.in 2015-03-13 22:19:31.000000000 +0100 @@ -1,12 +1,12 @@ # Description: Link scripts in the same way Python3 does # Submitted by: mva ---- Makefile.pre.in.orig 2014-06-30 04:05:39.000000000 +0200 -+++ Makefile.pre.in 2014-07-26 11:09:46.000000000 +0200 -@@ -868,6 +868,12 @@ - (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python2.pc) - -rm -f $(DESTDIR)$(LIBPC)/python.pc - (cd $(DESTDIR)$(LIBPC); $(LN) -s python2.pc python.pc) +--- Makefile.pre.in.orig 2014-12-10 15:59:50 UTC ++++ Makefile.pre.in +@@ -900,6 +900,12 @@ bininstall: altbininstall + (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python2.pc) + -rm -f $(DESTDIR)$(LIBPC)/python.pc + (cd $(DESTDIR)$(LIBPC); $(LN) -s python2.pc python.pc) + -rm -f $(DESTDIR)$(BINDIR)/idle + (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle2) + -rm -f $(DESTDIR)$(BINDIR)/pydoc diff -ruN lang/python27.orig/files/patch-Modules-_ctypes-libffi-configure lang/python27/files/patch-Modules-_ctypes-libffi-configure --- lang/python27.orig/files/patch-Modules-_ctypes-libffi-configure 2015-03-13 22:04:29.000000000 +0100 +++ lang/python27/files/patch-Modules-_ctypes-libffi-configure 1970-01-01 01:00:00.000000000 +0100 @@ -1,11 +0,0 @@ ---- Modules/_ctypes/libffi/configure.orig 2014-12-16 08:10:12.000000000 +0100 -+++ Modules/_ctypes/libffi/configure 2014-12-16 08:10:40.000000000 +0100 -@@ -7526,7 +7526,7 @@ - rm -rf conftest* - ;; - --x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ -+amd64-*-freebsd*|x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ - s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out what ABI is being produced by ac_compile, and set linker - # options accordingly. Note that the listed cases only cover the diff -ruN lang/python27.orig/files/patch-Modules___ctypes__libffi__src__arm__ffi.c lang/python27/files/patch-Modules___ctypes__libffi__src__arm__ffi.c --- lang/python27.orig/files/patch-Modules___ctypes__libffi__src__arm__ffi.c 2015-03-13 22:04:29.000000000 +0100 +++ lang/python27/files/patch-Modules___ctypes__libffi__src__arm__ffi.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,36 +0,0 @@ -# Description: Fix _ctypes abort on import for FreeBSD/ARM. This is an issue -# for anything !apple that is using the libcompiler_rt provided by clang on arm -# PR: ports/149167 ports/184517 -# Patch by: cognet@ (to be upstreamed @ LLVM) - ---- ./Modules/_ctypes/libffi/src/arm/ffi.c.orig 2013-11-10 18:36:41.000000000 +1100 -+++ ./Modules/_ctypes/libffi/src/arm/ffi.c 2013-12-03 18:05:51.461078888 +1100 -@@ -33,6 +33,11 @@ - - #include - -+#if defined(__FreeBSD__) && defined(__arm__) -+#include -+#include -+#endif -+ - /* Forward declares. */ - static int vfp_type_p (ffi_type *); - static void layout_vfp_args (ffi_cif *); -@@ -582,6 +587,16 @@ - - #else - -+#if defined(__FreeBSD__) && defined(__arm__) -+#define __clear_cache(start, end) do { \ -+ struct arm_sync_icache_args ua; \ -+ \ -+ ua.addr = (uintptr_t)(start); \ -+ ua.len = (char *)(end) - (char *)start; \ -+ sysarch(ARM_SYNC_ICACHE, &ua); \ -+ } while (0); -+#endif -+ - #define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \ - ({ unsigned char *__tramp = (unsigned char*)(TRAMP); \ - unsigned int __fun = (unsigned int)(FUN); \ diff -ruN lang/python27.orig/files/patch-Modules___ctypes_libffi_configure lang/python27/files/patch-Modules___ctypes_libffi_configure --- lang/python27.orig/files/patch-Modules___ctypes_libffi_configure 1970-01-01 01:00:00.000000000 +0100 +++ lang/python27/files/patch-Modules___ctypes_libffi_configure 2015-03-13 13:45:06.000000000 +0100 @@ -0,0 +1,11 @@ +--- Modules/_ctypes/libffi/configure.orig 2014-12-10 15:59:51 UTC ++++ Modules/_ctypes/libffi/configure +@@ -7526,7 +7526,7 @@ mips64*-*linux*) + rm -rf conftest* + ;; + +-x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ ++amd64-*-freebsd*|x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ + s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. Note that the listed cases only cover the diff -ruN lang/python27.orig/files/patch-Modules___ctypes_libffi_src_arm_ffi.c lang/python27/files/patch-Modules___ctypes_libffi_src_arm_ffi.c --- lang/python27.orig/files/patch-Modules___ctypes_libffi_src_arm_ffi.c 1970-01-01 01:00:00.000000000 +0100 +++ lang/python27/files/patch-Modules___ctypes_libffi_src_arm_ffi.c 2015-03-13 22:19:31.000000000 +0100 @@ -0,0 +1,36 @@ +# Description: Fix _ctypes abort on import for FreeBSD/ARM. This is an issue +# for anything !apple that is using the libcompiler_rt provided by clang on arm +# PR: ports/149167 ports/184517 +# Patch by: cognet@ (to be upstreamed @ LLVM) + +--- Modules/_ctypes/libffi/src/arm/ffi.c.orig 2014-12-10 15:59:52 UTC ++++ Modules/_ctypes/libffi/src/arm/ffi.c +@@ -33,6 +33,11 @@ + + #include + ++#if defined(__FreeBSD__) && defined(__arm__) ++#include ++#include ++#endif ++ + /* Forward declares. */ + static int vfp_type_p (ffi_type *); + static void layout_vfp_args (ffi_cif *); +@@ -751,6 +756,16 @@ ffi_closure_free (void *ptr) + + #else + ++#if defined(__FreeBSD__) && defined(__arm__) ++#define __clear_cache(start, end) do { \ ++ struct arm_sync_icache_args ua; \ ++ \ ++ ua.addr = (uintptr_t)(start); \ ++ ua.len = (char *)(end) - (char *)start; \ ++ sysarch(ARM_SYNC_ICACHE, &ua); \ ++ } while (0); ++#endif ++ + #define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \ + ({ unsigned char *__tramp = (unsigned char*)(TRAMP); \ + unsigned int __fun = (unsigned int)(FUN); \ diff -ruN lang/python27.orig/files/patch-Modules___ssl.c lang/python27/files/patch-Modules___ssl.c --- lang/python27.orig/files/patch-Modules___ssl.c 1970-01-01 01:00:00.000000000 +0100 +++ lang/python27/files/patch-Modules___ssl.c 2015-03-13 22:19:31.000000000 +0100 @@ -0,0 +1,33 @@ +# Fix build with LibreSSL (does not have RAND_egd) +# PR192511, http://bugs.python.org/issue21356 +# Submitted by: spil.oss@gmail.org + +--- Modules/_ssl.c.orig 2014-12-10 15:59:53 UTC ++++ Modules/_ssl.c +@@ -3301,6 +3301,7 @@ Returns 1 if the OpenSSL PRNG has been s + It is necessary to seed the PRNG with RAND_add() on some platforms before\n\ + using the ssl() function."); + ++#ifdef HAVE_RAND_EGD + static PyObject * + PySSL_RAND_egd(PyObject *self, PyObject *arg) + { +@@ -3326,6 +3327,7 @@ PyDoc_STRVAR(PySSL_RAND_egd_doc, + Queries the entropy gather daemon (EGD) on the socket named by 'path'.\n\ + Returns number of bytes read. Raises SSLError if connection to EGD\n\ + fails or if it does not provide enough data to seed PRNG."); ++#endif /* HAVE_RAND_EGD */ + + #endif /* HAVE_OPENSSL_RAND */ + +@@ -3720,8 +3722,10 @@ static PyMethodDef PySSL_methods[] = { + #ifdef HAVE_OPENSSL_RAND + {"RAND_add", PySSL_RAND_add, METH_VARARGS, + PySSL_RAND_add_doc}, ++#ifdef HAVE_RAND_EGD + {"RAND_egd", PySSL_RAND_egd, METH_VARARGS, + PySSL_RAND_egd_doc}, ++#endif /* HAVE_RAND_EGD */ + {"RAND_status", (PyCFunction)PySSL_RAND_status, METH_NOARGS, + PySSL_RAND_status_doc}, + #endif diff -ruN lang/python27.orig/files/patch-Modules__fcntlmodule.c lang/python27/files/patch-Modules__fcntlmodule.c --- lang/python27.orig/files/patch-Modules__fcntlmodule.c 2015-03-13 22:04:29.000000000 +0100 +++ lang/python27/files/patch-Modules__fcntlmodule.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,53 +0,0 @@ ---- ./Modules/fcntlmodule.c.orig 2014-07-03 21:57:10.429953240 +1000 -+++ ./Modules/fcntlmodule.c 2014-07-03 21:59:36.517210444 +1000 -@@ -98,20 +98,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 this. -- -- 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; -@@ -119,7 +114,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; -@@ -170,7 +165,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, -@@ -192,7 +187,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 -ruN lang/python27.orig/files/patch-Modules_fcntlmodule.c lang/python27/files/patch-Modules_fcntlmodule.c --- lang/python27.orig/files/patch-Modules_fcntlmodule.c 1970-01-01 01:00:00.000000000 +0100 +++ lang/python27/files/patch-Modules_fcntlmodule.c 2015-03-13 13:45:06.000000000 +0100 @@ -0,0 +1,53 @@ +--- Modules/fcntlmodule.c.orig 2014-12-10 15:59:54 UTC ++++ Modules/fcntlmodule.c +@@ -98,20 +98,15 @@ fcntl_ioctl(PyObject *self, PyObject *ar + { + #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 this. +- +- 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; +@@ -119,7 +114,7 @@ fcntl_ioctl(PyObject *self, PyObject *ar + 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; +@@ -170,7 +165,7 @@ fcntl_ioctl(PyObject *self, PyObject *ar + } + + 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, +@@ -192,7 +187,7 @@ fcntl_ioctl(PyObject *self, PyObject *ar + 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 -ruN lang/python27.orig/files/patch-configure lang/python27/files/patch-configure --- lang/python27.orig/files/patch-configure 1970-01-01 01:00:00.000000000 +0100 +++ lang/python27/files/patch-configure 2015-03-13 22:19:31.000000000 +0100 @@ -0,0 +1,85 @@ +# Description: do not define __BSD_VISIBLE/_XOPEN_SOURCE/_POSIX_C_SOURCE +# in include/python2.7/pyconfig.h +# Submitted by: antoine + +# Fix build with LibreSSL (does not have RAND_egd) +# PR192511, http://bugs.python.org/issue21356 +# Submitted by: spil.oss@gmail.org + +--- configure.orig 2015-03-13 12:32:09 UTC ++++ configure +@@ -2919,13 +2919,6 @@ + + + # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables +-# certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable +-# them. +- +-$as_echo "#define __BSD_VISIBLE 1" >>confdefs.h +- +- +-# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables + # u_int on Irix 5.3. Defining _BSD_TYPES brings it back. + + $as_echo "#define _BSD_TYPES 1" >>confdefs.h +@@ -3293,9 +3286,8 @@ + # but used in struct sockaddr.sa_family. Reported by Tim Rice. + SCO_SV/3.2) + define_xopen_source=no;; +- # On FreeBSD 4, the math functions C89 does not cover are never defined +- # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them. +- FreeBSD/4.*) ++ # On FreeBSD, defining _XOPEN_SOURCE to 600 requests a strict environment. ++ FreeBSD/*) + define_xopen_source=no;; + # On MacOS X 10.2, a bug in ncurses.h means that it craps out if + # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which +@@ -8534,6 +8534,48 @@ _ACEOF + fi + # Dynamic linking for HP-UX + ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RAND_egd in -lcrypto" >&5 ++$as_echo_n "checking for RAND_egd in -lcrypto... " >&6; } ++if ${ac_cv_lib_crypto_RAND_egd+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ ac_check_lib_save_LIBS=$LIBS ++LIBS="-lcrypto $LIBS" ++cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++/* Override any GCC internal prototype to avoid an error. ++ Use char because int might match the return type of a GCC ++ builtin and then its argument prototype would still apply. */ ++#ifdef __cplusplus ++extern "C" ++#endif ++char RAND_egd (); ++int ++main () ++{ ++return RAND_egd (); ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_link "$LINENO"; then : ++ ac_cv_lib_crypto_RAND_egd=yes ++else ++ ac_cv_lib_crypto_RAND_egd=no ++fi ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext ++LIBS=$ac_check_lib_save_LIBS ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_RAND_egd" >&5 ++$as_echo "$ac_cv_lib_crypto_RAND_egd" >&6; } ++if test "x$ac_cv_lib_crypto_RAND_egd" = xyes; then : ++ ++$as_echo "#define HAVE_RAND_EGD 1" >>confdefs.h ++ ++fi ++ + # only check for sem_init if thread support is requested + if test "$with_threads" = "yes" -o -z "$with_threads"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sem_init" >&5 diff -ruN lang/python27.orig/files/patch-configure.ac lang/python27/files/patch-configure.ac --- lang/python27.orig/files/patch-configure.ac 1970-01-01 01:00:00.000000000 +0100 +++ lang/python27/files/patch-configure.ac 2015-03-13 22:59:42.237707150 +0100 @@ -0,0 +1,45 @@ +# Description: do not define __BSD_VISIBLE/_XOPEN_SOURCE/_POSIX_C_SOURCE +# in include/python2.7/pyconfig.h +# Submitted by: antoine + +# Fix build with LibreSSL (does not have RAND_egd) +# PR192511, http://bugs.python.org/issue21356 +# Submitted by: spil.oss@gmail.org + +--- configure.ac.orig 2015-03-13 12:32:09 UTC ++++ configure.ac +@@ -88,11 +88,6 @@ + AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features]) + + # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables +-# certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable +-# them. +-AC_DEFINE(__BSD_VISIBLE, 1, [Define on FreeBSD to activate all library features]) +- +-# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables + # u_int on Irix 5.3. Defining _BSD_TYPES brings it back. + AC_DEFINE(_BSD_TYPES, 1, [Define on Irix to enable u_int]) + +@@ -426,9 +421,8 @@ + # but used in struct sockaddr.sa_family. Reported by Tim Rice. + SCO_SV/3.2) + define_xopen_source=no;; +- # On FreeBSD 4, the math functions C89 does not cover are never defined +- # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them. +- FreeBSD/4.*) ++ # On FreeBSD, defining _XOPEN_SOURCE to 600 requests a strict environment. ++ FreeBSD/*) + define_xopen_source=no;; + # On MacOS X 10.2, a bug in ncurses.h means that it craps out if + # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which +@@ -2216,6 +2216,10 @@ AC_MSG_RESULT($SHLIBS) + AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV + AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX + ++AC_CHECK_LIB(crypto, RAND_egd, ++ AC_DEFINE(HAVE_RAND_EGD, 1, ++ [Define if the libcrypto has RAND_egd])) ++ + # only check for sem_init if thread support is requested + if test "$with_threads" = "yes" -o -z "$with_threads"; then + AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris diff -ruN lang/python27.orig/files/patch-pr192365 lang/python27/files/patch-pr192365 --- lang/python27.orig/files/patch-pr192365 2015-03-13 22:04:29.000000000 +0100 +++ lang/python27/files/patch-pr192365 1970-01-01 01:00:00.000000000 +0100 @@ -1,58 +0,0 @@ -# Description: do not define __BSD_VISIBLE/_XOPEN_SOURCE/_POSIX_C_SOURCE -# in include/python2.7/pyconfig.h -# Submitted by: antoine - ---- configure.orig 2014-09-06 14:42:50 UTC -+++ configure -@@ -2919,13 +2919,6 @@ - - - # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables --# certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable --# them. -- --$as_echo "#define __BSD_VISIBLE 1" >>confdefs.h -- -- --# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables - # u_int on Irix 5.3. Defining _BSD_TYPES brings it back. - - $as_echo "#define _BSD_TYPES 1" >>confdefs.h -@@ -3293,9 +3286,8 @@ - # but used in struct sockaddr.sa_family. Reported by Tim Rice. - SCO_SV/3.2) - define_xopen_source=no;; -- # On FreeBSD 4, the math functions C89 does not cover are never defined -- # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them. -- FreeBSD/4.*) -+ # On FreeBSD, defining _XOPEN_SOURCE to 600 requests a strict environment. -+ FreeBSD/*) - define_xopen_source=no;; - # On MacOS X 10.2, a bug in ncurses.h means that it craps out if - # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which ---- configure.ac.orig 2014-09-06 14:42:50 UTC -+++ configure.ac -@@ -88,11 +88,6 @@ - AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features]) - - # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables --# certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable --# them. --AC_DEFINE(__BSD_VISIBLE, 1, [Define on FreeBSD to activate all library features]) -- --# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables - # u_int on Irix 5.3. Defining _BSD_TYPES brings it back. - AC_DEFINE(_BSD_TYPES, 1, [Define on Irix to enable u_int]) - -@@ -426,9 +421,8 @@ - # but used in struct sockaddr.sa_family. Reported by Tim Rice. - SCO_SV/3.2) - define_xopen_source=no;; -- # On FreeBSD 4, the math functions C89 does not cover are never defined -- # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them. -- FreeBSD/4.*) -+ # On FreeBSD, defining _XOPEN_SOURCE to 600 requests a strict environment. -+ FreeBSD/*) - define_xopen_source=no;; - # On MacOS X 10.2, a bug in ncurses.h means that it craps out if - # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which diff -ruN lang/python27.orig/files/patch-pyconfig.h.in lang/python27/files/patch-pyconfig.h.in --- lang/python27.orig/files/patch-pyconfig.h.in 1970-01-01 01:00:00.000000000 +0100 +++ lang/python27/files/patch-pyconfig.h.in 2015-03-13 22:19:31.000000000 +0100 @@ -0,0 +1,16 @@ +# Fix build with LibreSSL (does not have RAND_egd) +# PR192511, http://bugs.python.org/issue21356 +# Submitted by: spil.oss@gmail.org + +--- pyconfig.h.in.orig 2014-12-10 16:00:01 UTC ++++ pyconfig.h.in +@@ -544,6 +544,9 @@ + /* Define to 1 if you have the `putenv' function. */ + #undef HAVE_PUTENV + ++/* Define if the libcrypto has RAND_egd */ ++#undef HAVE_RAND_EGD ++ + /* Define to 1 if you have the `readlink' function. */ + #undef HAVE_READLINK + diff -ruN lang/python27.orig/files/patch-setup.py lang/python27/files/patch-setup.py --- lang/python27.orig/files/patch-setup.py 2015-03-13 22:04:29.000000000 +0100 +++ lang/python27/files/patch-setup.py 2015-03-13 22:19:31.000000000 +0100 @@ -5,9 +5,9 @@ # Description: ossaudiodev detection fix backport ---- setup.py.orig 2014-06-30 04:05:48.000000000 +0200 -+++ setup.py 2014-07-26 14:51:29.000000000 +0200 -@@ -15,6 +15,7 @@ +--- setup.py.orig 2014-12-10 16:00:01 UTC ++++ setup.py +@@ -15,6 +15,7 @@ from distutils.core import Extension, se from distutils.command.build_ext import build_ext from distutils.command.install import install from distutils.command.install_lib import install_lib @@ -15,7 +15,7 @@ from distutils.spawn import find_executable cross_compiling = "_PYTHON_HOST_PLATFORM" in os.environ -@@ -33,7 +34,7 @@ +@@ -33,7 +34,7 @@ host_platform = get_platform() COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS")) # This global variable is used to hold the list of modules to be disabled. @@ -24,7 +24,7 @@ def add_dir_to_list(dirlist, dir): """Add the directory 'dir' to the list 'dirlist' (at the front) if -@@ -1212,7 +1213,7 @@ +@@ -1214,7 +1215,7 @@ class PyBuildExt(build_ext): sysroot = macosx_sdk_root() f = os.path.join(sysroot, f[1:]) @@ -33,7 +33,7 @@ data = open(f).read() m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data) if m is not None: -@@ -1551,7 +1552,7 @@ +@@ -1553,7 +1554,7 @@ class PyBuildExt(build_ext): macros = dict() libraries = [] @@ -42,7 +42,7 @@ # FreeBSD's P1003.1b semaphore support is very experimental # and has many known problems. (as of June 2008) macros = dict() -@@ -1602,9 +1603,10 @@ +@@ -1604,9 +1605,10 @@ class PyBuildExt(build_ext): else: missing.append('linuxaudiodev') @@ -56,7 +56,7 @@ exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) ) else: missing.append('ossaudiodev') -@@ -2176,6 +2178,22 @@ +@@ -2178,6 +2180,22 @@ class PyBuildInstallLib(install_lib): def is_chmod_supported(self): return hasattr(os, 'chmod') @@ -79,7 +79,7 @@ SUMMARY = """ Python is an interpreted, interactive, object-oriented programming language. It is often compared to Tcl, Perl, Scheme or Java. -@@ -2221,7 +2239,9 @@ +@@ -2223,7 +2241,9 @@ def main(): platforms = ["Many"], # Build info @@ -90,7 +90,7 @@ 'install_lib':PyBuildInstallLib}, # The struct module is defined here, because build_ext won't be # called unless there's at least one extension module defined. -@@ -2229,8 +2249,7 @@ +@@ -2231,8 +2251,7 @@ def main(): # Scripts to install scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle',