pkgsrc/lang/python26/patches/patch-ap
hasso d915f16472 * Make it build on DragonFly.
* Remove rgbimg module from PLIST, it's removed.
* Bump PKGREVISION.
2009-04-24 01:32:50 +00:00

82 lines
2.9 KiB
Text

$NetBSD: patch-ap,v 1.2 2009/04/24 01:32:50 hasso Exp $
--- Modules/socketmodule.c.orig 2009-03-31 21:20:48 +0300
+++ Modules/socketmodule.c 2009-04-20 16:16:04 +0300
@@ -379,7 +379,7 @@ const char *inet_ntop(int af, const void
#define SOCKETCLOSE close
#endif
-#if defined(HAVE_BLUETOOTH_H) || defined(HAVE_BLUETOOTH_BLUETOOTH_H) && !defined(__NetBSD__)
+#if defined(HAVE_BLUETOOTH_H) || defined(HAVE_BLUETOOTH_BLUETOOTH_H) && !defined(__NetBSD__) && !defined(__DragonFly__)
#define USE_BLUETOOTH 1
#if defined(__FreeBSD__)
#define BTPROTO_L2CAP BLUETOOTH_PROTO_L2CAP
@@ -393,11 +393,13 @@ const char *inet_ntop(int af, const void
#define _BT_L2_MEMB(sa, memb) ((sa)->l2cap_##memb)
#define _BT_RC_MEMB(sa, memb) ((sa)->rfcomm_##memb)
#define _BT_HCI_MEMB(sa, memb) ((sa)->hci_##memb)
-#elif defined(__NetBSD__)
+#elif defined(__NetBSD__) || defined(__DragonFly__)
#define sockaddr_l2 sockaddr_bt
#define sockaddr_rc sockaddr_bt
#define sockaddr_hci sockaddr_bt
#define sockaddr_sco sockaddr_bt
+#define SOL_HCI BTPROTO_HCI
+#define HCI_DATA_DIR SO_HCI_DIRECTION
#define _BT_L2_MEMB(sa, memb) ((sa)->bt_##memb)
#define _BT_RC_MEMB(sa, memb) ((sa)->bt_##memb)
#define _BT_HCI_MEMB(sa, memb) ((sa)->bt_##memb)
@@ -1076,9 +1078,13 @@ makesockaddr(int sockfd, struct sockaddr
case BTPROTO_HCI:
{
struct sockaddr_hci *a = (struct sockaddr_hci *) addr;
+#if defined(__NetBSD__) || defined(__DragonFly__)
+ return makebdaddr(&_BT_HCI_MEMB(a, bdaddr));
+#else
PyObject *ret = NULL;
ret = Py_BuildValue("i", _BT_HCI_MEMB(a, dev));
return ret;
+#endif
}
#if !defined(__FreeBSD__)
@@ -1345,12 +1351,25 @@ getsockaddrarg(PySocketSockObject *s, Py
case BTPROTO_HCI:
{
struct sockaddr_hci *addr = (struct sockaddr_hci *)addr_ret;
+#if defined(__NetBSD__) || defined(__DragonFly__)
+ char *straddr = PyString_AsString(args);
+
+ _BT_HCI_MEMB(addr, family) = AF_BLUETOOTH;
+ if (straddr == NULL) {
+ PyErr_SetString(socket_error, "getsockaddrarg: "
+ "wrong format");
+ return 0;
+ }
+ if (setbdaddr(straddr, &_BT_HCI_MEMB(addr, bdaddr)) < 0)
+ return 0;
+#else
_BT_HCI_MEMB(addr, family) = AF_BLUETOOTH;
if (!PyArg_ParseTuple(args, "i", &_BT_HCI_MEMB(addr, dev))) {
PyErr_SetString(socket_error, "getsockaddrarg: "
"wrong format");
return 0;
}
+#endif
*len_ret = sizeof *addr;
return 1;
}
@@ -4564,9 +4583,13 @@ init_socket(void)
PyModule_AddIntConstant(m, "BTPROTO_L2CAP", BTPROTO_L2CAP);
PyModule_AddIntConstant(m, "BTPROTO_HCI", BTPROTO_HCI);
PyModule_AddIntConstant(m, "SOL_HCI", SOL_HCI);
+#if !defined(__NetBSD__) && !defined(__DragonFly__)
PyModule_AddIntConstant(m, "HCI_FILTER", HCI_FILTER);
+#endif
#if !defined(__FreeBSD__)
+#if !defined(__NetBSD__) && !defined(__DragonFly__)
PyModule_AddIntConstant(m, "HCI_TIME_STAMP", HCI_TIME_STAMP);
+#endif
PyModule_AddIntConstant(m, "HCI_DATA_DIR", HCI_DATA_DIR);
PyModule_AddIntConstant(m, "BTPROTO_SCO", BTPROTO_SCO);
#endif