summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPav Lucistnik <pav@FreeBSD.org>2004-03-23 19:57:59 +0000
committerPav Lucistnik <pav@FreeBSD.org>2004-03-23 19:57:59 +0000
commitcae842bacf2b26e4674d7c2c6d46cc91f05493ac (patch)
tree5ffde29db73b3158aebf997caf8da34daaee6f76
parent- only shared libraries should be build with -fPIC on amd64 and ia64 (diff)
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 <mad@madpilot.net>
-rw-r--r--comms/Makefile1
-rw-r--r--comms/openobex/Makefile23
-rw-r--r--comms/openobex/distinfo1
-rw-r--r--comms/openobex/files/patch-aclocal.m438
-rw-r--r--comms/openobex/files/patch-configure.in10
-rw-r--r--comms/openobex/files/patch-ltmain.sh42
-rw-r--r--comms/openobex/files/patch-src-btobex.c110
-rw-r--r--comms/openobex/files/patch-src-netbuf.h11
-rw-r--r--comms/openobex/files/patch-src-obex.c26
-rw-r--r--comms/openobex/files/patch-src-obex.h11
-rw-r--r--comms/openobex/files/patch-src-obex_const.h11
-rw-r--r--comms/openobex/files/patch-src-obex_main.c26
-rw-r--r--comms/openobex/files/patch-src-obex_transport.h36
-rw-r--r--comms/openobex/pkg-descr8
-rw-r--r--comms/openobex/pkg-plist9
15 files changed, 363 insertions, 0 deletions
diff --git a/comms/Makefile b/comms/Makefile
index 27458ba5325e..35750400b7a8 100644
--- a/comms/Makefile
+++ b/comms/Makefile
@@ -43,6 +43,7 @@
SUBDIR += mlan3
SUBDIR += mserver
SUBDIR += mwavem
+ SUBDIR += openobex
SUBDIR += p5-Device-Modem
SUBDIR += p5-Device-SerialPort
SUBDIR += plp
diff --git a/comms/openobex/Makefile b/comms/openobex/Makefile
new file mode 100644
index 000000000000..deb840867ac0
--- /dev/null
+++ b/comms/openobex/Makefile
@@ -0,0 +1,23 @@
+# New ports collection makefile for: openobex
+# Date created: 15 March 2004
+# Whom: Guido Falsi <mad@madpilot.net>
+#
+# $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 <bsd.port.mk>
diff --git a/comms/openobex/distinfo b/comms/openobex/distinfo
new file mode 100644
index 000000000000..6bb73508a4c3
--- /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 000000000000..594e05c9896a
--- /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 <netgraph/.../ng_btsocket.h>, ac_cv_have_sockaddr_rfcomm,
++ [AC_TRY_COMPILE([#include <sys/types.h>
++ #include <sys/socket.h>
++ #include <bitstring.h>
++ #include <netgraph/bluetooth/include/ng_hci.h>
++ #include <netgraph/bluetooth/include/ng_l2cap.h>
++ #include <netgraph/bluetooth/include/ng_btsocket.h>],
++ [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 000000000000..a88c8db60f1a
--- /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 000000000000..8f7f0ee0ed86
--- /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 000000000000..ec549aa4d707
--- /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 <netinet/in.h>
+ #include <sys/socket.h>
+
++#ifdef HAVE_BLUETOOTH_NETGRAPH
++#include <bluetooth.h>
++#else /*HAVE_BLUETOOTH_NETGRAPH*/
+ #include <bluetooth/bluetooth.h>
+ #include <bluetooth/rfcomm.h>
++#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 000000000000..cdf1d0c31600
--- /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 <stdint.h>
++#include <sys/types.h>
+
+ 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 000000000000..9091c8e6c917
--- /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 000000000000..59d2835dbbb9
--- /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 <stdint.h>
++#include <sys/types.h>
+
+ #ifdef _WIN32
+ #include <winsock.h>
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 000000000000..a1c522b023ef
--- /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 <stdint.h>
+-
+ 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 000000000000..174b0e933385
--- /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 <stdio.h>
+
+ #ifdef HAVE_BLUETOOTH
++#ifdef HAVE_BLUETOOTH_NETGRAPH
++#include <bluetooth.h>
++#else /*HAVE_BLUETOOTH_NETGRAPH*/
+ #include <bluetooth/bluetooth.h>
++#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 000000000000..19157b1a42bc
--- /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 <bluetooth.h>
++#else /*HAVE_BLUETOOTH_NETGRAPH*/
+ #include <bluetooth/bluetooth.h>
+ #include <bluetooth/rfcomm.h>
++#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 000000000000..59e1960fde87
--- /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 <mad@madpilot.net>
diff --git a/comms/openobex/pkg-plist b/comms/openobex/pkg-plist
new file mode 100644
index 000000000000..cc752871c2be
--- /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