aboutsummaryrefslogtreecommitdiffstats
path: root/misc/dahdi-kmod
diff options
context:
space:
mode:
authorfjoe <fjoe@FreeBSD.org>2010-03-03 20:45:47 +0800
committerfjoe <fjoe@FreeBSD.org>2010-03-03 20:45:47 +0800
commit37233dca241ad03a916e33dc68671e37c555c1dd (patch)
tree88937d76cc81a3b629a6ec40f8545bf7bf742960 /misc/dahdi-kmod
parentd31330b5554ba78bca0ff215f885da286f7ee7e4 (diff)
downloadfreebsd-ports-gnome-37233dca241ad03a916e33dc68671e37c555c1dd.tar.gz
freebsd-ports-gnome-37233dca241ad03a916e33dc68671e37c555c1dd.tar.zst
freebsd-ports-gnome-37233dca241ad03a916e33dc68671e37c555c1dd.zip
Initial version of dahdi-freebsd (and dahdi-tools) port.
DAHDi (Digium/Asterisk Hardware Device Interface) is the open source device interface technology used to control Digium and other telephony interface cards. WWW: http://www.asterisk.org/dahdi/ Feature safe: yes
Diffstat (limited to 'misc/dahdi-kmod')
-rw-r--r--misc/dahdi-kmod/Makefile61
-rw-r--r--misc/dahdi-kmod/distinfo3
-rw-r--r--misc/dahdi-kmod/files/dahdi.in56
-rw-r--r--misc/dahdi-kmod/files/patch-tools-Makefile40
-rw-r--r--misc/dahdi-kmod/files/patch-tools-dahdi_monitor.c14
-rw-r--r--misc/dahdi-kmod/files/patch-tools-tonezone.c25
-rw-r--r--misc/dahdi-kmod/pkg-descr5
-rw-r--r--misc/dahdi-kmod/pkg-plist39
8 files changed, 243 insertions, 0 deletions
diff --git a/misc/dahdi-kmod/Makefile b/misc/dahdi-kmod/Makefile
new file mode 100644
index 000000000000..3a194c0de06b
--- /dev/null
+++ b/misc/dahdi-kmod/Makefile
@@ -0,0 +1,61 @@
+# Ports collection makefile for: dahdi
+# Date created: 3 Mar 2010
+# Whom: Maxim Khon <fjoe@FreeBSD.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= dahdi
+PORTVERSION= ${DAHDI_VERSION:S/-//g}
+CATEGORIES= misc kld
+MASTER_SITES= ${MASTER_SITE_LOCAL}
+MASTER_SITE_SUBDIR= fjoe
+DISTNAME= ${PORTNAME}-freebsd-complete-${DAHDI_VERSION}+${DAHDI_TOOLS_VERSION}
+
+MAINTAINER= fjoe@FreeBSD.org
+COMMENT= Digium/Asterisk Hardware Device Interface
+
+BUILD_DEPENDS= gmake:${PORTSDIR}/devel/gmake
+LIB_DEPENDS= newt.52:${PORTSDIR}/devel/newt
+
+DAHDI_VERSION= 2.2.1-rc1
+DAHDI_TOOLS_VERSION= 2.2.1
+
+NO_PACKAGE= Should be in sync with the kernel to work correctly
+GNU_CONFIGURE= yes
+CONFIGURE_ARGS= --with-dahdi=../freebsd --sysconfdir=${PREFIX}/etc --with-newt=${LOCALBASE}
+CONFIGURE_ENV= WGET=/usr/bin/fetch
+USE_LDCONFIG= yes
+USE_RC_SUBR= dahdi
+
+ONLY_FOR_ARCHS= i386 amd64
+CONFLICTS= zaptel-[0-9]*
+
+MAN8= dahdi_cfg.8\
+ dahdi_monitor.8\
+ dahdi_scan.8\
+ dahdi_test.8\
+ dahdi_tool.8\
+ fxotune.8
+
+.include <bsd.port.pre.mk>
+
+pre-everything::
+ @if [ ! -f /usr/src/sys/Makefile ]; then \
+ ${ECHO_MSG} ">> The zaptel port needs FreeBSD kernel source code to compile."; \
+ ${ECHO_MSG} ">> Please install FreeBSD kernel source code in /usr/src/sys."; \
+ ${FALSE}; \
+ fi
+
+post-patch:
+ ${REINPLACE_CMD} -e 's,/etc,${PREFIX}/etc,g'\
+ ${WRKSRC}/tools/dahdi_cfg.c ${WRKSRC}/tools/fxotune.c\
+ ${WRKSRC}/tools/doc/dahdi_cfg.8 ${WRKSRC}/tools/doc/fxotune.8
+
+pre-su-install:
+ @${MKDIR} ${PREFIX}/lib/dahdi
+
+post-install:
+ @${TOUCH} ${PREFIX}/lib/dahdi/linker.hints
+
+.include <bsd.port.post.mk>
diff --git a/misc/dahdi-kmod/distinfo b/misc/dahdi-kmod/distinfo
new file mode 100644
index 000000000000..1d28c93948c7
--- /dev/null
+++ b/misc/dahdi-kmod/distinfo
@@ -0,0 +1,3 @@
+MD5 (dahdi-freebsd-complete-2.2.1-rc1+2.2.1.tar.gz) = 9f415b27c6fe69717b2346ca6fd28171
+SHA256 (dahdi-freebsd-complete-2.2.1-rc1+2.2.1.tar.gz) = 64884ea20574d03b15588a645300243bed4bf915b2b838f19eb5e13d2a15cbf6
+SIZE (dahdi-freebsd-complete-2.2.1-rc1+2.2.1.tar.gz) = 1936791
diff --git a/misc/dahdi-kmod/files/dahdi.in b/misc/dahdi-kmod/files/dahdi.in
new file mode 100644
index 000000000000..15f6d43e741c
--- /dev/null
+++ b/misc/dahdi-kmod/files/dahdi.in
@@ -0,0 +1,56 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: dahdi
+# REQUIRE: NETWORKING
+# KEYWORD: shutdown
+# BEFORE: asterisk
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# dahdi_enable (bool): YES/NO (default: NO)
+# dahdi_modules (list of strings): dahdi modules to load at boot (default: dahdi)
+# Valid modules are: dahdi, wct4xxp, wcb4xxp
+#
+# Example:
+#
+# dahdi_enable="YES"
+# dahdi_modules="wct4xxp"
+#
+
+. %%RC_SUBR%%
+
+name="dahdi"
+start_cmd="dahdi_start"
+stop_cmd="dahdi_stop"
+load_rc_config $name
+
+kmod_dir=%%PREFIX%%/lib/dahdi
+dahdi_modules=${dahdi_modules:-dahdi}
+# reverse list
+dahdi_modules_unload=""
+for m in ${dahdi_modules}; do
+ dahdi_modules_unload="$m ${dahdi_modules_unload}"
+done
+
+dahdi_start()
+{
+ echo -n " ${name}"
+
+ for m in ${dahdi_modules}; do
+ kldload ${kmod_dir}/$m.ko || exit 1
+ done
+ %%PREFIX%%/sbin/dahdi_cfg
+}
+
+dahdi_stop()
+{
+ echo -n " ${name}"
+ for m in ${dahdi_modules_unload}; do
+ kldunload $m
+ done
+}
+
+run_rc_command "$1"
diff --git a/misc/dahdi-kmod/files/patch-tools-Makefile b/misc/dahdi-kmod/files/patch-tools-Makefile
new file mode 100644
index 000000000000..4cd89f5d414f
--- /dev/null
+++ b/misc/dahdi-kmod/files/patch-tools-Makefile
@@ -0,0 +1,40 @@
+--- tools/Makefile.orig 2009-11-04 22:36:21.000000000 +0600
++++ tools/Makefile 2010-03-03 17:36:39.000000000 +0600
+@@ -27,7 +27,7 @@
+ endif
+
+ SUBDIRS_UTILS_ALL:= ppp
+-SUBDIRS_UTILS := xpp
++#SUBDIRS_UTILS := xpp
+
+ OPTFLAGS=-O2
+ CFLAGS+=-I. $(OPTFLAGS) -g -fPIC -Wall -DBUILDING_TONEZONE #-DTONEZONE_DRIVER
+@@ -229,13 +229,13 @@
+ install -d $(DESTDIR)$(MAN_DIR)
+ install -m 644 $(MAN_PAGES) $(DESTDIR)$(MAN_DIR)/
+ endif
+-ifeq (,$(wildcard $(DESTDIR)$(CONFIG_FILE)))
+- $(INSTALL) -D -m 644 system.conf.sample $(DESTDIR)$(CONFIG_FILE)
+-endif
++ $(INSTALL) -d -m755 $(DESTDIR)$(CONFIG_DIR)
++ $(INSTALL) -m 644 system.conf.sample $(DESTDIR)$(CONFIG_DIR)
+
+ install-libs: libs
+- $(INSTALL) -D -m 755 $(LTZ_A) $(DESTDIR)$(LIB_DIR)/$(LTZ_A)
+- $(INSTALL) -D -m 755 $(LTZ_SO) $(DESTDIR)$(LIB_DIR)/$(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER)
++ $(INSTALL) -d -m755 $(DESTDIR)$(LIB_DIR)
++ $(INSTALL) -m 755 $(LTZ_A) $(DESTDIR)$(LIB_DIR)/$(LTZ_A)
++ $(INSTALL) -m 755 $(LTZ_SO) $(DESTDIR)$(LIB_DIR)/$(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER)
+ ifeq (,$(DESTDIR))
+ if [ `id -u` = 0 ]; then \
+ /sbin/ldconfig || : ;\
+@@ -260,7 +260,8 @@
+ /sbin/restorecon -v $(DESTDIR)$(LIB_DIR)/$(LTZ_SO)
+ endif
+ endif
+- $(INSTALL) -D -m 644 tonezone.h $(DESTDIR)$(INC_DIR)/tonezone.h
++ $(INSTALL) -d -m755 $(DESTDIR)$(INC_DIR)
++ $(INSTALL) -m 644 tonezone.h $(DESTDIR)$(INC_DIR)/tonezone.h
+
+ install-utils-subdirs:
+ @for dir in $(SUBDIRS_UTILS); do \
diff --git a/misc/dahdi-kmod/files/patch-tools-dahdi_monitor.c b/misc/dahdi-kmod/files/patch-tools-dahdi_monitor.c
new file mode 100644
index 000000000000..b175aaf1199f
--- /dev/null
+++ b/misc/dahdi-kmod/files/patch-tools-dahdi_monitor.c
@@ -0,0 +1,14 @@
+--- tools/dahdi_monitor.c.orig 2009-04-21 20:44:58.000000000 +0700
++++ tools/dahdi_monitor.c 2010-03-03 17:24:25.000000000 +0600
+@@ -40,7 +40,11 @@
+ #include <dahdi/user.h>
+ #include "dahdi_tools_version.h"
+
++#if defined(__FreeBSD__)
++#include <sys/soundcard.h>
++#else
+ #include <linux/soundcard.h>
++#endif
+
+ /*
+ * defines for file handle numbers
diff --git a/misc/dahdi-kmod/files/patch-tools-tonezone.c b/misc/dahdi-kmod/files/patch-tools-tonezone.c
new file mode 100644
index 000000000000..66bb1c0034b9
--- /dev/null
+++ b/misc/dahdi-kmod/files/patch-tools-tonezone.c
@@ -0,0 +1,25 @@
+--- tools/tonezone.c.orig 2008-08-06 06:43:02.000000000 +0700
++++ tools/tonezone.c 2010-03-03 17:24:01.000000000 +0600
+@@ -46,6 +46,10 @@
+ #define CLIP 32635
+ #define BIAS 0x84
+
++#ifndef ENODATA
++#define ENODATA EINVAL
++#endif
++
+ struct tone_zone *tone_zone_find(char *country)
+ {
+ struct tone_zone *z;
+@@ -440,7 +444,11 @@
+ dump_tone_zone(h, MAX_SIZE - space);
+ #endif
+
++#if defined(__FreeBSD__)
++ if ((res = ioctl(fd, DAHDI_LOADZONE, &h))) {
++#else
+ if ((res = ioctl(fd, DAHDI_LOADZONE, h))) {
++#endif
+ fprintf(stderr, "ioctl(DAHDI_LOADZONE) failed: %s\n", strerror(errno));
+ return res;
+ }
diff --git a/misc/dahdi-kmod/pkg-descr b/misc/dahdi-kmod/pkg-descr
new file mode 100644
index 000000000000..d6703144bc6e
--- /dev/null
+++ b/misc/dahdi-kmod/pkg-descr
@@ -0,0 +1,5 @@
+DAHDi (Digium/Asterisk Hardware Device Interface) is the open source
+device interface technology used to control Digium and other telephony
+interface cards.
+
+WWW: http://www.asterisk.org/dahdi/
diff --git a/misc/dahdi-kmod/pkg-plist b/misc/dahdi-kmod/pkg-plist
new file mode 100644
index 000000000000..f8493bbaa221
--- /dev/null
+++ b/misc/dahdi-kmod/pkg-plist
@@ -0,0 +1,39 @@
+etc/dahdi/system.conf.sample
+include/dahdi/compat/types.h
+include/dahdi/tonezone.h
+include/dahdi/user.h
+include/dahdi/wctdm_user.h
+lib/dahdi/dahdi.ko
+lib/dahdi/dahdi_dummy.ko
+lib/dahdi/dahdi_dynamic.ko
+lib/dahdi/dahdi_dynamic_eth.ko
+lib/dahdi/dahdi_dynamic_ethmf.ko
+lib/dahdi/dahdi_dynamic_loc.ko
+lib/dahdi/dahdi_echocan_jpah.ko
+lib/dahdi/dahdi_echocan_kb1.ko
+lib/dahdi/dahdi_echocan_mg2.ko
+lib/dahdi/dahdi_echocan_sec.ko
+lib/dahdi/dahdi_echocan_sec2.ko
+lib/dahdi/dahdi_fw_oct6114_064.ko
+lib/dahdi/dahdi_fw_oct6114_128.ko
+lib/dahdi/linker.hints
+lib/dahdi/ng_dahdi_netdev.ko
+lib/dahdi/wcb4xxp.ko
+lib/dahdi/wct4xxp.ko
+lib/libtonezone.a
+lib/libtonezone.so
+lib/libtonezone.so.1
+lib/libtonezone.so.1.0
+lib/libtonezone.so.2
+lib/libtonezone.so.2.0
+sbin/dahdi_cfg
+sbin/dahdi_monitor
+sbin/dahdi_scan
+sbin/dahdi_speed
+sbin/dahdi_test
+sbin/dahdi_tool
+sbin/fxotune
+@dirrm lib/dahdi
+@dirrm include/dahdi/compat
+@dirrm include/dahdi
+@dirrmtry etc/dahdi