1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-18 08:02:48 +00:00

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
This commit is contained in:
Max Khon 2010-03-03 12:45:47 +00:00
parent 7a1b2a3746
commit 804aa478a1
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=250533
17 changed files with 487 additions and 0 deletions

View File

@ -59,6 +59,7 @@
SUBDIR += cstream
SUBDIR += cuecat
SUBDIR += cwish
SUBDIR += dahdi
SUBDIR += datedif
SUBDIR += ddate
SUBDIR += deco

61
misc/dahdi-kmod/Makefile Normal file
View File

@ -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>

3
misc/dahdi-kmod/distinfo Normal file
View File

@ -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

View File

@ -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"

View File

@ -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 \

View File

@ -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

View File

@ -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;
}

View File

@ -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/

39
misc/dahdi-kmod/pkg-plist Normal file
View File

@ -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

61
misc/dahdi/Makefile Normal file
View File

@ -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>

3
misc/dahdi/distinfo Normal file
View File

@ -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

56
misc/dahdi/files/dahdi.in Normal file
View File

@ -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"

View File

@ -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 \

View File

@ -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

View File

@ -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;
}

5
misc/dahdi/pkg-descr Normal file
View File

@ -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/

39
misc/dahdi/pkg-plist Normal file
View File

@ -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