From 6983f6eb3e91543c6ce26b8ff39d25297a552576 Mon Sep 17 00:00:00 2001 From: pav Date: Tue, 23 Mar 2004 19:57:59 +0000 Subject: Add openobex, a library for OBEX (Object Exchange), a protocol to exchange a data over infrared and Bluetooth. This port is adapted to work with FreeBSD Bluetooth stack. PR: ports/64596 Submitted by: Guido Falsi --- comms/openobex/Makefile | 23 +++++ comms/openobex/distinfo | 1 + comms/openobex/files/patch-aclocal.m4 | 38 ++++++++ comms/openobex/files/patch-configure.in | 10 +++ comms/openobex/files/patch-ltmain.sh | 42 +++++++++ comms/openobex/files/patch-src-btobex.c | 110 ++++++++++++++++++++++++ comms/openobex/files/patch-src-netbuf.h | 11 +++ comms/openobex/files/patch-src-obex.c | 26 ++++++ comms/openobex/files/patch-src-obex.h | 11 +++ comms/openobex/files/patch-src-obex_const.h | 11 +++ comms/openobex/files/patch-src-obex_main.c | 26 ++++++ comms/openobex/files/patch-src-obex_transport.h | 36 ++++++++ comms/openobex/pkg-descr | 8 ++ comms/openobex/pkg-plist | 9 ++ 14 files changed, 362 insertions(+) create mode 100644 comms/openobex/Makefile create mode 100644 comms/openobex/distinfo create mode 100644 comms/openobex/files/patch-aclocal.m4 create mode 100644 comms/openobex/files/patch-configure.in create mode 100644 comms/openobex/files/patch-ltmain.sh create mode 100644 comms/openobex/files/patch-src-btobex.c create mode 100644 comms/openobex/files/patch-src-netbuf.h create mode 100644 comms/openobex/files/patch-src-obex.c create mode 100644 comms/openobex/files/patch-src-obex.h create mode 100644 comms/openobex/files/patch-src-obex_const.h create mode 100644 comms/openobex/files/patch-src-obex_main.c create mode 100644 comms/openobex/files/patch-src-obex_transport.h create mode 100644 comms/openobex/pkg-descr create mode 100644 comms/openobex/pkg-plist (limited to 'comms/openobex') diff --git a/comms/openobex/Makefile b/comms/openobex/Makefile new file mode 100644 index 0000000..deb8408 --- /dev/null +++ b/comms/openobex/Makefile @@ -0,0 +1,23 @@ +# New ports collection makefile for: openobex +# Date created: 15 March 2004 +# Whom: Guido Falsi +# +# $FreeBSD$ +# + +PORTNAME= openobex +PORTVERSION= 1.0.1 +CATEGORIES= comms net +MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} +MASTER_SITE_SUBDIR= ${PORTNAME} + +MAINTAINER= mad@madpilot.net +COMMENT= Open source implementation of the OBEX protocol + +WANT_AUTOCONF_VER= 213 +WANT_AUTOMAKE_VER= 14 +USE_GMAKE= yes +WANT_LIBTOOL_VER= 14 +INSTALLS_SHLIB= yes + +.include diff --git a/comms/openobex/distinfo b/comms/openobex/distinfo new file mode 100644 index 0000000..6bb7350 --- /dev/null +++ b/comms/openobex/distinfo @@ -0,0 +1 @@ +MD5 (openobex-1.0.1.tar.gz) = 3742666bb98259face76be49b73ea89d diff --git a/comms/openobex/files/patch-aclocal.m4 b/comms/openobex/files/patch-aclocal.m4 new file mode 100644 index 0000000..594e05c9 --- /dev/null +++ b/comms/openobex/files/patch-aclocal.m4 @@ -0,0 +1,38 @@ +--- aclocal.m4.orig Mon Mar 22 16:19:39 2004 ++++ aclocal.m4 Mon Mar 22 16:22:51 2004 +@@ -67,6 +67,35 @@ + BLUETOOTH_HOOK([],failure) + ]) + ++dnl adding a check for FreeBSD blutooth netgraph support. ++ ++AC_DEFUN([FREEBSD_BLUETOOTH_HOOK],[ ++ AC_MSG_CHECKING([for the FreeBSD/netgraph bluetooth support]) ++ echo ++ AC_CACHE_CHECK(for the struct sockaddr_rfcomm in , ac_cv_have_sockaddr_rfcomm, ++ [AC_TRY_COMPILE([#include ++ #include ++ #include ++ #include ++ #include ++ #include ], ++ [struct sockaddr_rfcomm rc;], ++ ac_cv_have_sockaddr_rfcomm=yes, ++ ac_cv_have_sockaddr_rfcomm=no)]) ++ ++ if test $ac_cv_have_sockaddr_rfcomm = yes; then ++ AC_DEFINE(HAVE_BLUETOOTH) ++ AC_DEFINE(HAVE_BLUETOOTH_NETGRAPH,1,[Compile on FreeBSD]) ++ USE_BLUETOOTH="yes" ++ AC_CHECK_LIB(bluetooth, bt_aton, ++ [LIBS="$LIBS -lbluetooth" AC_DEFINE(HAVE_BT_ATON,1,[Define to 1 if you have the \`bt_aton' function.])]) ++ fi ++]) ++ ++AC_DEFUN([FREEBSD_BLUETOOTH_CHECK], [ ++ FREEBSD_BLUETOOTH_HOOK([],failure) ++]) ++ + # Do all the work for Automake. This macro actually does too much -- + # some checks are only needed if your package does certain things. + # But this isn't really a big deal. diff --git a/comms/openobex/files/patch-configure.in b/comms/openobex/files/patch-configure.in new file mode 100644 index 0000000..a88c8db --- /dev/null +++ b/comms/openobex/files/patch-configure.in @@ -0,0 +1,10 @@ +--- configure.in.orig Sun Mar 7 17:07:07 2004 ++++ configure.in Sun Mar 7 17:07:20 2004 +@@ -39,6 +39,7 @@ + + IRDA_CHECK + BLUETOOTH_CHECK ++FREEBSD_BLUETOOTH_CHECK + + dnl Configure debug facilities + AC_ARG_WITH(debug,[ --with-debug=level Debug level], diff --git a/comms/openobex/files/patch-ltmain.sh b/comms/openobex/files/patch-ltmain.sh new file mode 100644 index 0000000..8f7f0ee --- /dev/null +++ b/comms/openobex/files/patch-ltmain.sh @@ -0,0 +1,42 @@ +--- ltmain.sh.orig Wed Oct 1 13:17:13 2003 ++++ ltmain.sh Mon Mar 22 10:54:43 2004 +@@ -1037,8 +1037,16 @@ + continue + ;; + ++ -pthread) ++ compile_command="$compile_command -pthread" ++ finalize_command="$finalize_command -pthread" ++ compiler_flags="$compiler_flags -pthread" ++ continue ++ ;; ++ + -module) + module=yes ++ build_old_libs=no + continue + ;; + +@@ -2408,6 +2416,9 @@ + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; ++ *-*-freebsd*) ++ # FreeBSD doesn't need this... ++ ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then +@@ -4175,10 +4186,12 @@ + fi + + # Install the pseudo-library for information purposes. ++ if /usr/bin/false; then + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + instname="$dir/$name"i + $show "$install_prog $instname $destdir/$name" + $run eval "$install_prog $instname $destdir/$name" || exit $? ++ fi + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" diff --git a/comms/openobex/files/patch-src-btobex.c b/comms/openobex/files/patch-src-btobex.c new file mode 100644 index 0000000..ec549aa --- /dev/null +++ b/comms/openobex/files/patch-src-btobex.c @@ -0,0 +1,110 @@ +--- src/btobex.c.orig Mon Mar 22 18:31:43 2004 ++++ src/btobex.c Mon Mar 22 18:44:46 2004 +@@ -46,8 +46,12 @@ + #include + #include + ++#ifdef HAVE_BLUETOOTH_NETGRAPH ++#include ++#else /*HAVE_BLUETOOTH_NETGRAPH*/ + #include + #include ++#endif /*HAVE_BLUETOOTH_NETGRAPH*/ + + #endif /* _WIN32 */ + +@@ -65,6 +69,15 @@ + void btobex_prepare_connect(obex_t *self, bdaddr_t *src, bdaddr_t *dst, uint8_t channel) + { + #ifndef _WIN32 ++#ifdef HAVE_BLUETOOTH_NETGRAPH ++ self->trans.self.rfcomm.rfcomm_family = AF_BLUETOOTH; ++ bacpy(&self->trans.self.rfcomm.rfcomm_bdaddr, src); ++ self->trans.self.rfcomm.rfcomm_channel = 0; ++ ++ self->trans.peer.rfcomm.rfcomm_family = AF_BLUETOOTH; ++ bacpy(&self->trans.peer.rfcomm.rfcomm_bdaddr, dst); ++ self->trans.peer.rfcomm.rfcomm_channel = channel; ++#else /*HAVE_BLUETOOTH_NETGRAPH*/ + 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 /*HAVE_BLUETOOTH_NETGRAPH*/ + #endif /* _WIN32 */ + } + +@@ -85,9 +99,15 @@ + { + #ifndef _WIN32 + /* Bind local service */ ++#ifdef HAVE_BLUETOOTH_NETGRAPH ++ self->trans.self.rfcomm.rfcomm_family = AF_BLUETOOTH; ++ bacpy(&self->trans.self.rfcomm.rfcomm_bdaddr, src); ++ self->trans.self.rfcomm.rfcomm_channel = channel; ++#else /*HAVE_BLUETOOTH_NETGRAPH*/ + self->trans.self.rfcomm.rc_family = AF_BLUETOOTH; + bacpy(&self->trans.self.rfcomm.rc_bdaddr, src); + self->trans.self.rfcomm.rc_channel = channel; ++#endif /*HAVE_BLUETOOTH_NETGRAPH*/ + #endif /* _WIN32 */ + } + +@@ -108,9 +128,15 @@ + return -1; + } + ++#ifdef HAVE_BLUETOOTH_NETGRAPH ++ if (bind(self->serverfd, (struct sockaddr*) &self->trans.self.rfcomm, ++ sizeof(struct sockaddr_rfcomm))) ++ { ++#else /*HAVE_BLUETOOTH_NETGRAPH*/ + if (bind(self->serverfd, (struct sockaddr*) &self->trans.self.rfcomm, + sizeof(struct sockaddr_rc))) + { ++#endif /*HAVE_BLUETOOTH_NETGRAPH*/ + DEBUG(0, "Error doing bind\n"); + goto out_freesock; + } +@@ -142,7 +168,11 @@ + int btobex_accept(obex_t *self) + { + #ifndef _WIN32 ++#ifdef HAVE_BLUETOOTH_NETGRAPH ++ int addrlen = sizeof(struct sockaddr_rfcomm); ++#else /*HAVE_BLUETOOTH_NETGRAPH*/ + int addrlen = sizeof(struct sockaddr_rc); ++#endif /*HAVE_BLUETOOTH_NETGRAPH*/ + //int mtu; + //int len = sizeof(int); + +@@ -180,16 +210,26 @@ + return -1; + } + ++#ifdef HAVE_BLUETOOTH_NETGRAPH ++ ret = bind(self->fd, (struct sockaddr*) &self->trans.self.rfcomm, ++ sizeof(struct sockaddr_rfcomm)); ++#else /*HAVE_BLUETOOTH_NETGRAPH*/ + ret = bind(self->fd, (struct sockaddr*) &self->trans.self.rfcomm, + sizeof(struct sockaddr_rc)); ++#endif /*HAVE_BLUETOOTH_NETGRAPH*/ + + if (ret < 0) { + DEBUG(4, "ret=%d\n", ret); + goto out_freesock; + } + ++#ifdef HAVE_BLUETOOTH_NETGRAPH ++ ret = connect(self->fd, (struct sockaddr*) &self->trans.peer.rfcomm, ++ sizeof(struct sockaddr_rfcomm)); ++#else /*HAVE_BLUETOOTH_NETGRAPH*/ + ret = connect(self->fd, (struct sockaddr*) &self->trans.peer.rfcomm, + sizeof(struct sockaddr_rc)); ++#endif /*HAVE_BLUETOOTH_NETGRAPH*/ + if (ret < 0) { + DEBUG(4, "ret=%d\n", ret); + goto out_freesock; diff --git a/comms/openobex/files/patch-src-netbuf.h b/comms/openobex/files/patch-src-netbuf.h new file mode 100644 index 0000000..cdf1d0c --- /dev/null +++ b/comms/openobex/files/patch-src-netbuf.h @@ -0,0 +1,11 @@ +--- src/netbuf.h.orig Wed Oct 1 13:17:13 2003 ++++ src/netbuf.h Mon Mar 22 10:47:07 2004 +@@ -37,7 +37,7 @@ + #ifndef G_NETBUF_H + #define G_NETBUF_H + +-#include ++#include + + typedef struct _slist_t{ + void *data; diff --git a/comms/openobex/files/patch-src-obex.c b/comms/openobex/files/patch-src-obex.c new file mode 100644 index 0000000..9091c8e --- /dev/null +++ b/comms/openobex/files/patch-src-obex.c @@ -0,0 +1,26 @@ +--- src/obex.c.orig Mon Mar 22 18:16:53 2004 ++++ src/obex.c Mon Mar 22 18:21:35 2004 +@@ -990,7 +990,11 @@ + + #ifdef HAVE_BLUETOOTH + if(src == NULL) ++#ifdef HAVE_BLUETOOTH_NETGRAPH ++ src = NG_HCI_BDADDR_ANY; ++#else /*HAVE_BLUETOOTH_NETGRAPH*/ + src = BDADDR_ANY; ++#endif /*HAVE_BLUETOOTH_NETGRAPH*/ + btobex_prepare_listen(self, src, channel); + return obex_transport_listen(self); + #else +@@ -1019,7 +1023,11 @@ + + #ifdef HAVE_BLUETOOTH + if(src == NULL) ++#ifdef HAVE_BLUETOOTH_NETGRAPH ++ src = NG_HCI_BDADDR_ANY; ++#else /*HAVE_BLUETOOTH_NETGRAPH*/ + src = BDADDR_ANY; ++#endif /*HAVE_BLUETOOTH_NETGRAPH*/ + btobex_prepare_connect(self, src, dst, channel); + return obex_transport_connect_request(self); + #else diff --git a/comms/openobex/files/patch-src-obex.h b/comms/openobex/files/patch-src-obex.h new file mode 100644 index 0000000..59d2835 --- /dev/null +++ b/comms/openobex/files/patch-src-obex.h @@ -0,0 +1,11 @@ +--- src/obex.h.orig Wed Oct 1 13:17:13 2003 ++++ src/obex.h Mon Mar 22 11:11:11 2004 +@@ -30,7 +30,7 @@ + #ifndef OBEX_H + #define OBEX_H + +-#include ++#include + + #ifdef _WIN32 + #include diff --git a/comms/openobex/files/patch-src-obex_const.h b/comms/openobex/files/patch-src-obex_const.h new file mode 100644 index 0000000..a1c522b --- /dev/null +++ b/comms/openobex/files/patch-src-obex_const.h @@ -0,0 +1,11 @@ +--- src/obex_const.h.orig Wed Oct 1 13:17:13 2003 ++++ src/obex_const.h Mon Mar 22 10:44:58 2004 +@@ -30,8 +30,6 @@ + #ifndef OBEX_CONST_H + #define OBEX_CONST_H + +-#include +- + typedef union { + uint32_t bq4; + uint8_t bq1; diff --git a/comms/openobex/files/patch-src-obex_main.c b/comms/openobex/files/patch-src-obex_main.c new file mode 100644 index 0000000..174b0e9 --- /dev/null +++ b/comms/openobex/files/patch-src-obex_main.c @@ -0,0 +1,26 @@ +--- src/obex_main.c.orig Mon Mar 22 18:25:05 2004 ++++ src/obex_main.c Mon Mar 22 18:27:55 2004 +@@ -46,7 +46,11 @@ + #include + + #ifdef HAVE_BLUETOOTH ++#ifdef HAVE_BLUETOOTH_NETGRAPH ++#include ++#else /*HAVE_BLUETOOTH_NETGRAPH*/ + #include ++#endif /*HAVE_BLUETOOTH_NETGRAPH*/ + #endif /*HAVE_BLUETOOTH*/ + + #endif /* _WIN32 */ +@@ -79,7 +83,11 @@ + + #ifdef HAVE_BLUETOOTH + if (domain == AF_BLUETOOTH) ++#ifdef HAVE_BLUETOOTH_NETGRAPH ++ proto = BLUETOOTH_PROTO_RFCOMM; ++#else /*HAVE_BLUETOOTH_NETGRAPH*/ + proto = BTPROTO_RFCOMM; ++#endif /*HAVE_BLUETOOTH_NETGRAPH*/ + #endif /*HAVE_BLUETOOTH*/ + + fd = socket(domain, SOCK_STREAM, proto); diff --git a/comms/openobex/files/patch-src-obex_transport.h b/comms/openobex/files/patch-src-obex_transport.h new file mode 100644 index 0000000..19157b1 --- /dev/null +++ b/comms/openobex/files/patch-src-obex_transport.h @@ -0,0 +1,36 @@ +--- src/obex_transport.h.orig Mon Mar 22 18:02:08 2004 ++++ src/obex_transport.h Mon Mar 22 18:05:08 2004 +@@ -40,8 +40,12 @@ + #include "irda_wrap.h" + #endif /*HAVE_IRDA*/ + #ifdef HAVE_BLUETOOTH ++#ifdef HAVE_BLUETOOTH_NETGRAPH ++#include ++#else /*HAVE_BLUETOOTH_NETGRAPH*/ + #include + #include ++#endif /*HAVE_BLUETOOTH_NETGRAPH*/ + #endif /*HAVE_BLUETOOTH*/ + + #include "obex_main.h" +@@ -52,7 +56,11 @@ + #endif /*HAVE_IRDA*/ + struct sockaddr_in inet; + #ifdef HAVE_BLUETOOTH ++#ifdef HAVE_BLUETOOTH_NETGRAPH ++ struct sockaddr_rfcomm rfcomm; ++#else /*HAVE_BLUETOOTH_NETGRAPH*/ + struct sockaddr_rc rfcomm; ++#endif /*HAVE_BLUETOOTH_NETGRAPH*/ + #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/pkg-descr b/comms/openobex/pkg-descr new file mode 100644 index 0000000..59e1960 --- /dev/null +++ b/comms/openobex/pkg-descr @@ -0,0 +1,8 @@ +The overall goal of this project is to make an open source +implementation of the Object Exchange (OBEX) protocol. OBEX is a +session protocol and can best be described as a binary HTTP protocol. +It's used mainly for Infrared and Bluetooth communication. + +WWW: http://openobex.sourceforge.net/ + +- Guido Falsi diff --git a/comms/openobex/pkg-plist b/comms/openobex/pkg-plist new file mode 100644 index 0000000..cc75287 --- /dev/null +++ b/comms/openobex/pkg-plist @@ -0,0 +1,9 @@ +bin/openobex-config +include/openobex/obex.h +include/openobex/obex_const.h +lib/libopenobex-1.0.so +lib/libopenobex-1.0.so.1 +lib/libopenobex.a +lib/libopenobex.so +share/aclocal/openobex.m4 +@dirrm include/openobex -- cgit v1.1