From dff133a2aa003cd88e386a4994a9e60520cd47f8 Mon Sep 17 00:00:00 2001 From: xtraeme Date: Sun, 2 Jul 2006 18:16:53 +0000 Subject: Add support for NetBSD's bluetooth, required by the upcoming package obexapp. Bump PKGREVISION. --- comms/openobex/Makefile | 19 ++++++- comms/openobex/distinfo | 8 ++- comms/openobex/patches/patch-aa | 38 ++++++++++++++ comms/openobex/patches/patch-ab | 12 +++++ comms/openobex/patches/patch-ac | 16 ++++++ comms/openobex/patches/patch-ad | 12 +++++ comms/openobex/patches/patch-ae | 110 ++++++++++++++++++++++++++++++++++++++++ comms/openobex/patches/patch-af | 13 +++++ 8 files changed, 225 insertions(+), 3 deletions(-) create mode 100644 comms/openobex/patches/patch-aa create mode 100644 comms/openobex/patches/patch-ab create mode 100644 comms/openobex/patches/patch-ac create mode 100644 comms/openobex/patches/patch-ad create mode 100644 comms/openobex/patches/patch-ae create mode 100644 comms/openobex/patches/patch-af diff --git a/comms/openobex/Makefile b/comms/openobex/Makefile index 0afbd68ea15..b6d7d3e0606 100644 --- a/comms/openobex/Makefile +++ b/comms/openobex/Makefile @@ -1,8 +1,8 @@ -# $NetBSD: Makefile,v 1.7 2006/03/04 21:29:05 jlam Exp $ +# $NetBSD: Makefile,v 1.8 2006/07/02 18:16:53 xtraeme Exp $ # DISTNAME= openobex-1.0.1 -PKGREVISION= 2 +PKGREVISION= 3 CATEGORIES= comms MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=openobex/} @@ -14,4 +14,19 @@ GNU_CONFIGURE= YES USE_TOOLS+= gmake USE_LIBTOOL= YES +.include "../../mk/bsd.prefs.mk" + +.if (${OPSYS} == "NetBSD" && exists(/usr/include/bluetooth.h)) +SUBST_CLASSES+= bt +SUBST_STAGE.bt= post-patch +SUBST_FILES.bt= configure +SUBST_SED.bt= -e "s|bluetooth/bluetooth.h|bluetooth.h|g" +SUBST_SED.bt+= -e "s|bluetooth/rfcomm.h|netbt/rfcomm.h|g" +SUBST_SED.bt+= -e "s|sockaddr_rc|sockaddr_bt|g" +SUBST_MESSAGE.bt= Fixing bluetooth detection. + +# bacpy() and friends +CPPFLAGS+= -DCOMPAT_BLUEZ +.endif + .include "../../mk/bsd.pkg.mk" diff --git a/comms/openobex/distinfo b/comms/openobex/distinfo index 3315561eb5f..e46fac66d0c 100644 --- a/comms/openobex/distinfo +++ b/comms/openobex/distinfo @@ -1,5 +1,11 @@ -$NetBSD: distinfo,v 1.2 2005/02/23 16:05:30 agc Exp $ +$NetBSD: distinfo,v 1.3 2006/07/02 18:16:53 xtraeme Exp $ SHA1 (openobex-1.0.1.tar.gz) = aa73b3f9e345088e8f1c070e0e727f586820d20e RMD160 (openobex-1.0.1.tar.gz) = 70dc7d2e38b819af0c35ccb26f806b7aa7682b0e Size (openobex-1.0.1.tar.gz) = 211696 bytes +SHA1 (patch-aa) = a73def8cc93d50a023ce76ec30e05163293aea45 +SHA1 (patch-ab) = 172cf62a95b8e278c2539d4339b6bb17354e8cd7 +SHA1 (patch-ac) = 8b9ca12b6c84ab743590dc16689ba672ffb5b46b +SHA1 (patch-ad) = 4a9c02f6e899d1740504ec03bda3301915018ae3 +SHA1 (patch-ae) = c25191fcded6e87d2bcca17a2ae77720c79646a4 +SHA1 (patch-af) = 165602889a3fbc9c3bf98390bbf3d5c85e55bebc diff --git a/comms/openobex/patches/patch-aa b/comms/openobex/patches/patch-aa new file mode 100644 index 00000000000..1ce49a9e904 --- /dev/null +++ b/comms/openobex/patches/patch-aa @@ -0,0 +1,38 @@ +$NetBSD: patch-aa,v 1.1 2006/07/02 18:16:53 xtraeme Exp $ + +--- src/obex_transport.h.orig 2003-10-01 13:17:13.000000000 +0200 ++++ src/obex_transport.h 2006-07-02 18:51:48.000000000 +0200 +@@ -39,7 +39,11 @@ + #ifdef HAVE_IRDA + #include "irda_wrap.h" + #endif /*HAVE_IRDA*/ +-#ifdef HAVE_BLUETOOTH ++ ++#if defined(HAVE_BLUETOOTH) && defined(__NetBSD__) ++#include ++#include ++#elif defined(HAVE_BLUETOOTH) + #include + #include + #endif /*HAVE_BLUETOOTH*/ +@@ -52,7 +56,11 @@ + #endif /*HAVE_IRDA*/ + struct sockaddr_in inet; + #ifdef HAVE_BLUETOOTH ++#ifdef __NetBSD__ ++ struct sockaddr_bt rfcomm; ++#else + struct sockaddr_rc rfcomm; ++#endif + #endif /*HAVE_BLUETOOTH*/ + } saddr_t; + +@@ -76,7 +84,4 @@ + int obex_transport_read(obex_t *self, int count, uint8_t *buf, int buflen); + + +-#endif OBEX_TRANSPORT_H +- +- +- ++#endif /* OBEX_TRANSPORT_H */ diff --git a/comms/openobex/patches/patch-ab b/comms/openobex/patches/patch-ab new file mode 100644 index 00000000000..4b1aacea5d9 --- /dev/null +++ b/comms/openobex/patches/patch-ab @@ -0,0 +1,12 @@ +$NetBSD: patch-ab,v 1.1 2006/07/02 18:16:53 xtraeme Exp $ + +--- src/obex.c.orig 2006-07-02 18:53:03.000000000 +0200 ++++ src/obex.c 2006-07-02 18:53:13.000000000 +0200 +@@ -33,6 +33,7 @@ + #endif + + #include ++#include + #include + #include + diff --git a/comms/openobex/patches/patch-ac b/comms/openobex/patches/patch-ac new file mode 100644 index 00000000000..3fa74e1bd37 --- /dev/null +++ b/comms/openobex/patches/patch-ac @@ -0,0 +1,16 @@ +$NetBSD: patch-ac,v 1.1 2006/07/02 18:16:53 xtraeme Exp $ + +--- src/obex_main.c.orig 2003-10-01 13:17:13.000000000 +0200 ++++ src/obex_main.c 2006-07-02 18:56:16.000000000 +0200 +@@ -46,7 +46,11 @@ + #include + + #ifdef HAVE_BLUETOOTH ++#ifdef __NetBSD__ ++#include ++#else + #include ++#endif /* __NetBSD__ */ + #endif /*HAVE_BLUETOOTH*/ + + #endif /* _WIN32 */ diff --git a/comms/openobex/patches/patch-ad b/comms/openobex/patches/patch-ad new file mode 100644 index 00000000000..74ee19c1b3e --- /dev/null +++ b/comms/openobex/patches/patch-ad @@ -0,0 +1,12 @@ +$NetBSD: patch-ad,v 1.1 2006/07/02 18:16:53 xtraeme Exp $ + +--- src/obex_object.c.orig 2006-07-02 18:56:59.000000000 +0200 ++++ src/obex_object.c 2006-07-02 18:57:10.000000000 +0200 +@@ -33,6 +33,7 @@ + #endif + + #include ++#include + #include + + #include "obex_main.h" diff --git a/comms/openobex/patches/patch-ae b/comms/openobex/patches/patch-ae new file mode 100644 index 00000000000..ac2f5ae66d0 --- /dev/null +++ b/comms/openobex/patches/patch-ae @@ -0,0 +1,110 @@ +$NetBSD: patch-ae,v 1.1 2006/07/02 18:16:53 xtraeme Exp $ + +--- src/btobex.c.orig 2003-10-01 13:17:13.000000000 +0200 ++++ src/btobex.c 2006-07-02 19:24:16.000000000 +0200 +@@ -46,12 +46,16 @@ + #include + #include + ++#ifdef __NetBSD__ ++#include ++#include ++#else + #include + #include ++#endif + + #endif /* _WIN32 */ + +- + #include + #include + +@@ -65,6 +69,15 @@ + void btobex_prepare_connect(obex_t *self, bdaddr_t *src, bdaddr_t *dst, uint8_t channel) + { + #ifndef _WIN32 ++#ifdef __NetBSD__ ++ self->trans.self.rfcomm.bt_family = AF_BLUETOOTH; ++ bacpy(&self->trans.self.rfcomm.bt_bdaddr, src); ++ self->trans.self.rfcomm.bt_channel = 0; ++ ++ self->trans.peer.rfcomm.bt_family = AF_BLUETOOTH; ++ bacpy(&self->trans.peer.rfcomm.bt_bdaddr, dst); ++ self->trans.peer.rfcomm.bt_channel = channel; ++#else + self->trans.self.rfcomm.rc_family = AF_BLUETOOTH; + bacpy(&self->trans.self.rfcomm.rc_bdaddr, src); + self->trans.self.rfcomm.rc_channel = 0; +@@ -72,6 +85,7 @@ + self->trans.peer.rfcomm.rc_family = AF_BLUETOOTH; + bacpy(&self->trans.peer.rfcomm.rc_bdaddr, dst); + self->trans.peer.rfcomm.rc_channel = channel; ++#endif + #endif /* _WIN32 */ + } + +@@ -85,9 +99,15 @@ + { + #ifndef _WIN32 + /* Bind local service */ ++#ifdef __NetBSD__ ++ self->trans.self.rfcomm.bt_family = AF_BLUETOOTH; ++ bacpy(&self->trans.self.rfcomm.bt_bdaddr, src); ++ self->trans.self.rfcomm.bt_channel = channel; ++#else + self->trans.self.rfcomm.rc_family = AF_BLUETOOTH; + bacpy(&self->trans.self.rfcomm.rc_bdaddr, src); + self->trans.self.rfcomm.rc_channel = channel; ++#endif + #endif /* _WIN32 */ + } + +@@ -109,7 +129,11 @@ + } + + if (bind(self->serverfd, (struct sockaddr*) &self->trans.self.rfcomm, ++#ifdef __NetBSD__ ++ sizeof(struct sockaddr_bt))) ++#else + sizeof(struct sockaddr_rc))) ++#endif + { + DEBUG(0, "Error doing bind\n"); + goto out_freesock; +@@ -142,7 +166,11 @@ + int btobex_accept(obex_t *self) + { + #ifndef _WIN32 ++#ifdef __NetBSD__ ++ int addrlen = sizeof(struct sockaddr_bt); ++#else + int addrlen = sizeof(struct sockaddr_rc); ++#endif + //int mtu; + //int len = sizeof(int); + +@@ -181,7 +209,11 @@ + } + + ret = bind(self->fd, (struct sockaddr*) &self->trans.self.rfcomm, ++#ifdef __NetBSD__ ++ sizeof(struct sockaddr_bt)); ++#else + sizeof(struct sockaddr_rc)); ++#endif + + if (ret < 0) { + DEBUG(4, "ret=%d\n", ret); +@@ -189,7 +221,11 @@ + } + + ret = connect(self->fd, (struct sockaddr*) &self->trans.peer.rfcomm, ++#ifdef __NetBSD__ ++ sizeof(struct sockaddr_bt)); ++#else + sizeof(struct sockaddr_rc)); ++#endif + if (ret < 0) { + DEBUG(4, "ret=%d\n", ret); + goto out_freesock; diff --git a/comms/openobex/patches/patch-af b/comms/openobex/patches/patch-af new file mode 100644 index 00000000000..165cb9181a8 --- /dev/null +++ b/comms/openobex/patches/patch-af @@ -0,0 +1,13 @@ +$NetBSD: patch-af,v 1.1 2006/07/02 18:16:53 xtraeme Exp $ + +--- src/obex.h.orig 2006-07-02 19:31:28.000000000 +0200 ++++ src/obex.h 2006-07-02 19:31:36.000000000 +0200 +@@ -51,7 +51,7 @@ + typedef void* obex_object_t; + typedef void (*obex_event_t)(obex_t *handle, obex_object_t *obj, int mode, int event, int obex_cmd, int obex_rsp); + // This is to workaround compilation without Bluetooth support. - Jean II +-#ifndef SOL_RFCOMM ++#ifdef SOL_RFCOMM + typedef char* bdaddr_t; + #endif + -- cgit v1.2.3