summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Knoblich <stkn@gentoo.org>2005-06-25 09:00:56 +0000
committerStefan Knoblich <stkn@gentoo.org>2005-06-25 09:00:56 +0000
commitb3054e94707854e49aac3663c1b5ef8facd6e756 (patch)
tree42d713255959194819221fab934e9f6999aae388 /net-misc/zaptel
parentVersion bump (diff)
downloadgentoo-2-b3054e94707854e49aac3663c1b5ef8facd6e756.tar.gz
gentoo-2-b3054e94707854e49aac3663c1b5ef8facd6e756.tar.bz2
gentoo-2-b3054e94707854e49aac3663c1b5ef8facd6e756.zip
Version bump
(Portage version: 2.0.51.22-r1)
Diffstat (limited to 'net-misc/zaptel')
-rw-r--r--net-misc/zaptel/ChangeLog9
-rw-r--r--net-misc/zaptel/files/digest-zaptel-1.0.83
-rw-r--r--net-misc/zaptel/files/zaptel-1.0.8-gentoo.diff101
-rw-r--r--net-misc/zaptel/files/zaptel-bristuff-0.2.0-RC8h.patch191
-rw-r--r--net-misc/zaptel/zaptel-1.0.8.ebuild227
5 files changed, 530 insertions, 1 deletions
diff --git a/net-misc/zaptel/ChangeLog b/net-misc/zaptel/ChangeLog
index e0e4ab048a4d..edd7882c7bbc 100644
--- a/net-misc/zaptel/ChangeLog
+++ b/net-misc/zaptel/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for net-misc/zaptel
# Copyright 2000-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/zaptel/ChangeLog,v 1.46 2005/06/25 07:01:38 stkn Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-misc/zaptel/ChangeLog,v 1.47 2005/06/25 08:56:54 stkn Exp $
+
+*zaptel-1.0.8 (25 Jun 2005)
+
+ 25 Jun 2005; Stefan Knoblich <stkn@gentoo.org>
+ +files/zaptel-1.0.8-gentoo.diff, +files/zaptel-bristuff-0.2.0-RC8h.patch,
+ +zaptel-1.0.8.ebuild:
+ Version bump.
24 Jun 2005; Stefan Knoblich <stkn@gentoo.org> -zaptel-1.0.0.ebuild,
-zaptel-1.0.1.ebuild, -zaptel-1.0.2.ebuild:
diff --git a/net-misc/zaptel/files/digest-zaptel-1.0.8 b/net-misc/zaptel/files/digest-zaptel-1.0.8
new file mode 100644
index 000000000000..00993bd0e2ed
--- /dev/null
+++ b/net-misc/zaptel/files/digest-zaptel-1.0.8
@@ -0,0 +1,3 @@
+MD5 5553225a5c536231d9d7d23112d1bd11 zaptel-1.0.8.tar.gz 326128
+MD5 3b264a75b1a17735572920655bf1a0f8 bristuff-0.2.0-RC8h.tar.gz 150270
+MD5 cc91bd69d6e880f89a1f95a27aa714c9 zaphfc_0.2.0-RC8a_florz-6.diff.gz 10428
diff --git a/net-misc/zaptel/files/zaptel-1.0.8-gentoo.diff b/net-misc/zaptel/files/zaptel-1.0.8-gentoo.diff
new file mode 100644
index 000000000000..bff270eae84c
--- /dev/null
+++ b/net-misc/zaptel/files/zaptel-1.0.8-gentoo.diff
@@ -0,0 +1,101 @@
+--- zaptel-1.0.8/Makefile.orig 2005-06-25 09:53:46.537475736 +0200
++++ zaptel-1.0.8/Makefile 2005-06-25 10:00:40.082607320 +0200
+@@ -13,13 +13,13 @@
+ # (assuming He's running Linux -- which we all know He must).
+ #
+ HOSTCC=gcc
+-KINCLUDES=$(shell if [ -d /usr/src/linux-2.4/include ]; then echo /usr/src/linux-2.4/include ; else echo /usr/src/linux/include ; fi)
++KINCLUDES=/usr/src/linux/include
+
+-CFLAGS+=-I. -O4 -g -Wall -DBUILDING_TONEZONE #-DTONEZONE_DRIVER
++CFLAGS+=-I. -g -Wall -DBUILDING_TONEZONE #-DTONEZONE_DRIVER
+ CFLAGS+=$(shell if uname -m | grep -q ppc; then echo "-fsigned-char"; fi)
+ CFLAGS+=$(shell if uname -m | grep -q x86_64; then echo "-m64"; fi)
+ LCFLAGS=-fPIC $(CFLAGS) -DBUILDING_TONEZONE
+-KFLAGS+=-I/usr/src/linux-2.4/include -O6
++KFLAGS+=-I/usr/src/linux/include -O6
+ KFLAGS+=-DMODULE -D__KERNEL__ -DEXPORT_SYMTAB -I/usr/src/linux/drivers/net \
+ -Wall -I. -Wstrict-prototypes -fomit-frame-pointer -I/usr/src/linux/drivers/net/wan -I /usr/src/linux/include -I/usr/src/linux/include/net
+ KFLAGS+=$(shell if [ -f $(KINCLUDES)/linux/modversions.h ] ; then echo "-DMODVERSIONS -include $(KINCLUDES)/linux/modversions.h" ; fi)
+@@ -38,8 +38,8 @@
+ CONFIG_FILE=$(INSTALL_PREFIX)/etc/zaptel.conf
+ CFLAGS+=-DZAPTEL_CONFIG=\"$(CONFIG_FILE)\"
+
+-BUILDVER=$(shell if uname -r | grep -q ^2.6; then echo "linux26"; else echo "linux24"; fi)
+-MODCONF=$(shell if [ -d $(ROOT_PREFIX)/etc/modprobe.d ]; then echo "$(ROOT_PREFIX)/etc/modprobe.d/zaptel"; elif [ -d $(ROOT_PREFIX)/etc/modutils ]; then echo "$(ROOT_PREFIX)/etc/modutils/zaptel"; elif [ -f $(ROOT_PREFIX)/etc/modprobe.conf ]; then echo "$(ROOT_PREFIX)/etc/modprobe.conf"; elif [ -f $(ROOT_PREFIX)/etc/modules.conf ]; then echo "$(ROOT_PREFIX)/etc/modules.conf"; else echo $(ROOT_PREFIX)/etc/conf.modules ; fi)
++BUILDVER?=$(shell if uname -r | grep -q ^2.6; then echo "linux26"; else echo "linux24"; fi)
++MODCONF=$(INSTALL_PREFIX)/etc/modules.d/zaptel
+
+ ifeq (${BUILDVER},linux24)
+ #We only support DEVFS in linux 2.4 kernels, since its considered obsolete post 2.4
+@@ -58,7 +58,7 @@
+ TZOBJS=zonedata.lo tonezone.lo
+ LIBTONEZONE=libtonezone.so.1.0
+ MODULES=zaptel tor2 torisa wcusb wcfxo wcfxs \
+- ztdynamic ztd-eth wct1xxp wct4xxp wcte11xp # ztdummy
++ ztdynamic ztd-eth wct1xxp wct4xxp wcte11xp ztdummy
+ #MODULES+=wcfxsusb
+
+ MODULESO=$(shell for x in $(MODULES); do echo "$$x.o "; done )
+@@ -71,7 +71,7 @@
+ PRIMARY=torisa
+ #PRIMARY=wcfxo
+ PWD=$(shell pwd)
+-KERNEL_SOURCE?=/lib/modules/`uname -r`/build
++KERNEL_SOURCE?=/usr/src/linux
+
+ all: $(BUILDVER) $(LIBTONEZONE)
+
+@@ -262,7 +262,7 @@
+ @echo "**** If you are running udev, read README.udev"
+ endif
+
+-install: all devices
++install: devices
+ install -D -m 755 ztcfg $(INSTALL_PREFIX)/sbin/ztcfg
+ if [ -f sethdlc-new ]; then \
+ install -D -m 755 sethdlc-new $(INSTALL_PREFIX)/sbin/sethdlc; \
+@@ -288,42 +288,22 @@
+ fi
+
+ install -D -m 755 $(LIBTONEZONE) $(INSTALL_PREFIX)/usr/lib/$(LIBTONEZONE)
+- if [ -x /usr/sbin/sestatus ] && (/usr/sbin/sestatus | grep "SELinux status:" | grep -q "enabled") ; then restorecon -v $(INSTALL_PREFIX)/usr/lib/$(LIBTONEZONE); fi
+ install -D -m 644 zaptel.h $(INSTALL_PREFIX)/usr/include/linux/zaptel.h
+ install -D -m 644 torisa.h $(INSTALL_PREFIX)/usr/include/linux/torisa.h
+ install -D -m 644 tonezone.h $(INSTALL_PREFIX)/usr/include/tonezone.h
+ ( cd $(INSTALL_PREFIX)/usr/lib ; rm -f libtonezone.so ; ln -sf $(LIBTONEZONE) libtonezone.so )
+- [ `id -u` = 0 ] && /sbin/ldconfig || :
+ if [ -f $(MODCONF) ]; then mv -f $(MODCONF) $(MODCONF).bak ; fi
+- cat $(MODCONF).bak | grep -v "alias char-major-250" | \
+- grep -v "post-install torisa /sbin/ztcfg" | \
+- grep -v "post-install wcfxsusb /sbin/ztcfg" | \
+- grep -v "post-install wcfxs /sbin/ztcfg" > $(MODCONF) || true
++ if [ ! -d `dirname $(MODCONF)` ]; then install -d -m 755 `dirname $(MODCONF)` ; fi
+ if ! grep "options torisa" $(MODCONF); then \
+ echo "options torisa base=$(BASEADDR)" >> $(MODCONF); \
+ fi
+ if ! grep "alias char-major-196" $(MODCONF); then \
+ echo "alias char-major-196 $(PRIMARY)" >> $(MODCONF); \
+ fi
+- for x in $(MODULES); do \
+- if ! grep "post-install $$x" $(MODCONF); then \
+- if ! grep "install $$x " $(MODCONF); then \
+- if [ "$$x" != "zaptel" ] ; then \
+- if [ -f zaptel.ko ]; then echo "install $$x /sbin/modprobe --ignore-install $$x && /sbin/ztcfg" >> $(MODCONF); \
+- else echo "post-install $$x /sbin/ztcfg" >> $(MODCONF); \
+- fi; \
+- fi; \
+- fi; \
+- fi; \
+- done
+ if ! grep "alias wctdm" $(MODCONF); then \
+ echo "alias wctdm wcfxs" >> $(MODCONF); \
+ fi \
+
+- if [ -d /etc/modutils ]; then \
+- /sbin/update-modules ; \
+- fi
+- [ `id -u` = 0 ] && /sbin/depmod -a || :
+ [ -f $(CONFIG_FILE) ] || install -D -m 644 zaptel.conf.sample $(CONFIG_FILE)
+
+ config:
diff --git a/net-misc/zaptel/files/zaptel-bristuff-0.2.0-RC8h.patch b/net-misc/zaptel/files/zaptel-bristuff-0.2.0-RC8h.patch
new file mode 100644
index 000000000000..0b0925b7d501
--- /dev/null
+++ b/net-misc/zaptel/files/zaptel-bristuff-0.2.0-RC8h.patch
@@ -0,0 +1,191 @@
+diff -ur zaptel-1.0.8.orig/Makefile zaptel-1.0.8/Makefile
+--- zaptel-1.0.8.orig/Makefile 2005-05-12 04:26:49.000000000 +0200
++++ zaptel-1.0.8/Makefile 2005-06-24 10:41:08.498991496 +0200
+@@ -343,7 +343,7 @@
+
+ clean:
+ rm -f torisatool makefw tor2fw.h
+- rm -f zttool
++ rm -f zttool ztspeed zttest ztmonitor
+ rm -f *.o ztcfg tzdriver sethdlc sethdlc-new
+ rm -f $(TZOBJS) $(LIBTONEZONE) *.lo
+ rm -f *.ko *.mod.c .*o.cmd
+@@ -351,3 +351,4 @@
+ rm -f libtonezone*
+ rm -f tor2ee
+ rm -f core
++ rm -rf .tmp_versions
+diff -ur zaptel-1.0.8.orig/zaptel.c zaptel-1.0.8/zaptel.c
+--- zaptel-1.0.8.orig/zaptel.c 2005-06-15 23:31:22.000000000 +0200
++++ zaptel-1.0.8/zaptel.c 2005-06-24 10:41:08.000000000 +0200
+@@ -4851,11 +4851,40 @@
+ *(txb++) = fasthdlc_tx_run_nocheck(&ms->txhdlc);
+ }
+ bytes -= left;
++#ifdef CONFIG_ZAPATA_BRI_DCHANS
++ } else if (ms->flags & ZT_FLAG_BRIDCHAN) {
++ /*
++ * Let's get this right, we want to transmit complete frames only.
++ * The card driver will do the dirty HDLC work for us.
++ * txb (transmit buffer) is supposed to be big enough to store one frame
++ * we will make this as big as the D fifo (1KB or 2KB)
++ */
++
++ /* there are 'left' bytes in the user buffer left to transmit */
++ left = ms->writen[ms->outwritebuf] - ms->writeidx[ms->outwritebuf] - 2;
++ if (left > ms->maxbytes2transmit) {
++ memcpy(txb, buf + ms->writeidx[ms->outwritebuf], ms->maxbytes2transmit);
++ ms->writeidx[ms->outwritebuf] += ms->maxbytes2transmit;
++ txb += ms->maxbytes2transmit;
++ ms->bytes2transmit = ms->maxbytes2transmit;
++ ms->eoftx = 0;
++ } else {
++ memcpy(txb, buf + ms->writeidx[ms->outwritebuf], left);
++ ms->writeidx[ms->outwritebuf] += left + 2;
++ txb += left;
++ ms->bytes2transmit = left;
++ ms->eoftx = 1;
++ }
++ bytes = 0;
++#endif
+ } else {
+ memcpy(txb, buf + ms->writeidx[ms->outwritebuf], left);
+ ms->writeidx[ms->outwritebuf]+=left;
+ txb += left;
+ bytes -= left;
++#if defined(CONFIG_ZAPATA_BRI_DCHANS)
++ ms->bytes2transmit=ZT_CHUNKSIZE;
++#endif
+ }
+ /* Check buffer status */
+ if (ms->writeidx[ms->outwritebuf] >= ms->writen[ms->outwritebuf]) {
+@@ -4900,6 +4929,17 @@
+ /* Transmit a flag if this is an HDLC channel */
+ if (ms->flags & ZT_FLAG_HDLC)
+ fasthdlc_tx_frame_nocheck(&ms->txhdlc);
++#if defined(CONFIG_ZAPATA_BRI_DCHANS)
++ if(ms->flags & ZT_FLAG_BRIDCHAN) {
++ // if (ms->bytes2transmit > 0) {
++ // txb += 2;
++ // ms->bytes2transmit -= 2;
++ bytes=0;
++ ms->eoftx = 1;
++// printk(KERN_CRIT "zaptel EOF(%d) bytes2transmit %d\n",ms->eoftx,ms->bytes2transmit);
++ // }
++ }
++#endif
+ #ifdef CONFIG_ZAPATA_NET
+ if (ms->flags & ZT_FLAG_NETDEV)
+ netif_wake_queue(ztchan_to_dev(ms));
+@@ -4910,7 +4950,7 @@
+ tasklet_schedule(&ms->ppp_calls);
+ }
+ #endif
+- }
++ }
+ } else if (ms->curtone && !(ms->flags & ZT_FLAG_PSEUDO)) {
+ left = ms->curtone->tonesamples - ms->tonep;
+ if (left > bytes)
+@@ -4948,8 +4988,17 @@
+ } else if (ms->flags & ZT_FLAG_CLEAR) {
+ /* Clear channels should idle with 0xff for the sake
+ of silly PRI's that care about idle B channels */
++#if defined(CONFIG_ZAPATA_BRI_DCHANS)
++ // ms->bytes2transmit=0;
++#endif
+ memset(txb, 0xff, bytes);
+ bytes = 0;
++#if defined(CONFIG_ZAPATA_BRI_DCHANS)
++ } else if(ms->flags & ZT_FLAG_BRIDCHAN) {
++ // ms->bytes2transmit = ZT_CHUNKSIZE - bytes;
++ bytes = 0;
++ if (ms->bytes2transmit > 0) printk(KERN_CRIT "bytes2transmit %d\n",ms->bytes2transmit);
++#endif
+ } else {
+ memset(txb, ZT_LIN2X(0, ms), bytes); /* Lastly we use silence on telephony channels */
+ bytes = 0;
+@@ -5648,6 +5697,13 @@
+ int left, x;
+
+ int bytes = ZT_CHUNKSIZE;
++#if defined(CONFIG_ZAPATA_BRI_DCHANS)
++ if (ms->flags & ZT_FLAG_BRIDCHAN) {
++ bytes = ms->bytes2receive;
++ if (bytes < 1) return;
++// printk(KERN_CRIT "bytes2receive %d\n",ms->bytes2receive);
++ }
++#endif
+
+ while(bytes) {
+ #if defined(CONFIG_ZAPATA_NET) || defined(CONFIG_ZAPATA_PPP)
+@@ -5706,6 +5762,19 @@
+ }
+ }
+ }
++#ifdef CONFIG_ZAPATA_BRI_DCHANS
++ } else if (ms->flags & ZT_FLAG_BRIDCHAN) {
++ memcpy(buf + ms->readidx[ms->inreadbuf], rxb, left);
++ rxb += left;
++ ms->readidx[ms->inreadbuf] += left;
++ bytes -= left;
++ if (ms->eofrx == 1) {
++ eof=1;
++ }
++// printk(KERN_CRIT "receiving %d bytes\n",ms->bytes2receive);
++ ms->bytes2receive = 0;
++ ms->eofrx = 0;
++#endif
+ } else {
+ /* Not HDLC */
+ memcpy(buf + ms->readidx[ms->inreadbuf], rxb, left);
+diff -ur zaptel-1.0.8.orig/zaptel.h zaptel-1.0.8/zaptel.h
+--- zaptel-1.0.8.orig/zaptel.h 2005-06-15 23:31:22.000000000 +0200
++++ zaptel-1.0.8/zaptel.h 2005-06-24 10:41:08.511989520 +0200
+@@ -956,6 +956,13 @@
+ int do_ppp_error;
+ struct sk_buff_head ppp_rq;
+ #endif
++#ifdef CONFIG_ZAPATA_BRI_DCHANS
++ int bytes2receive;
++ int maxbytes2transmit; /* size of the tx buffer in the card driver */
++ int bytes2transmit;
++ int eofrx;
++ int eoftx;
++#endif
+ spinlock_t lock;
+ char name[40]; /* Name */
+ /* Specified by zaptel */
+@@ -1030,7 +1037,7 @@
+ int txbufpolicy; /* Buffer policy */
+ int rxbufpolicy; /* Buffer policy */
+ int txdisable; /* Disable transmitter */
+- int rxdisable; /* Disable receiver */
++ int rxdisable; /* Disable receiver */
+
+
+ /* Tone zone stuff */
+@@ -1193,6 +1200,10 @@
+ #define ZT_FLAG_T1PPP (1 << 15)
+ #define ZT_FLAG_SIGFREEZE (1 << 16) /* Freeze signalling */
+
++#if defined(CONFIG_ZAPATA_BRI_DCHANS)
++#define ZT_FLAG_BRIDCHAN (1 << 17)
++#endif
++
+ struct zt_span {
+ spinlock_t lock;
+ void *pvt; /* Private stuff */
+diff -ur zaptel-1.0.8.orig/zconfig.h zaptel-1.0.8/zconfig.h
+--- zaptel-1.0.8.orig/zconfig.h 2005-01-02 01:19:57.000000000 +0100
++++ zaptel-1.0.8/zconfig.h 2005-06-24 10:41:08.000000000 +0200
+@@ -127,4 +127,10 @@
+ */
+ /* #define TDM_REVH_MATCHALL */
+
++/*
++ * Uncomment the following for BRI D channels
++ *
++ */
++#define CONFIG_ZAPATA_BRI_DCHANS
++
+ #endif
diff --git a/net-misc/zaptel/zaptel-1.0.8.ebuild b/net-misc/zaptel/zaptel-1.0.8.ebuild
new file mode 100644
index 000000000000..5d5d593a0783
--- /dev/null
+++ b/net-misc/zaptel/zaptel-1.0.8.ebuild
@@ -0,0 +1,227 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/zaptel/zaptel-1.0.8.ebuild,v 1.1 2005/06/25 08:56:54 stkn Exp $
+
+IUSE="devfs26 bri florz"
+
+inherit toolchain-funcs eutils linux-mod
+
+BRI_VERSION="0.2.0-RC8h"
+FLORZ_VERSION="0.2.0-RC8a_florz-6"
+
+DESCRIPTION="Drivers for Digium and ZapataTelephony cards"
+HOMEPAGE="http://www.asterisk.org"
+SRC_URI="ftp://ftp.asterisk.org/pub/telephony/zaptel/zaptel-${PV}.tar.gz
+ bri? ( http://www.junghanns.net/asterisk/downloads/bristuff-${BRI_VERSION}.tar.gz )
+ florz? ( http://zaphfc.florz.dyndns.org/zaphfc_${FLORZ_VERSION}.diff.gz )"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="~x86 ~ppc ~amd64"
+
+DEPEND="virtual/libc
+ virtual/linux-sources
+ >=dev-libs/newt-0.50.0"
+
+pkg_setup() {
+ linux-mod_pkg_setup
+
+ # show an nice warning message about zaptel not supporting devfs on 2.6
+ if kernel_is 2 6 && linux_chkconfig_present DEVFS_FS ; then
+ echo
+ einfo "You're using a 2.6 kernel with DEVFS."
+ einfo "The Zaptel drivers won't work unless you either:"
+ einfo " * switch to udev"
+ einfo " * write a script that re-creates the necessary device nodes for you"
+ einfo " * enable the devfs26 useflag (see below)"
+ einfo ""
+ einfo "There's an experimental patch which adds devfs support when using linux-2.6, but:"
+ einfo " 1. It's an ugly hack atm and needs a cleanup..."
+ einfo " 2. I was only abled to test loding / unloading with the ztd-eth driver..."
+ einfo " 3. I _really_ don't know if it works with real hardware..."
+ einfo " 4. It disables udev support to avoid conflicts"
+ eerror " 5. And more important: This is not officially supported by Digium / the Asterisk project!"
+ einfo ""
+ einfo "If you're still interested, abort now (ctrl+c) and enable the devfs26 USE-flag"
+ einfo "Feedback and bug-reports should go to: stkn@gentoo.org"
+ einfo "You have been warned!"
+ echo
+ einfo "Sleeping 20 Seconds..."
+ epause 20
+ fi
+}
+
+src_unpack() {
+ unpack ${A}
+
+ cd ${S}
+ # >= 1.0.7 requires new patch (-modulesd patch renamed to -gentoo)
+ epatch ${FILESDIR}/${PN}-1.0.8-gentoo.diff
+
+ # devfs support
+ if use devfs26; then
+ einfo "Enabling experimental devfs support for linux-2.6..."
+ epatch ${FILESDIR}/${PN}-1.0.4-experimental-devfs26.diff
+
+ # disable udev
+ sed -i -e "s:#define[\t ]\+\(CONFIG_ZAP_UDEV\):#undef \1:" \
+ zconfig.h
+ fi
+
+ # apply patch for gcc-3.4.x if that's the compiler in use...
+ # fixes (#76707)
+ if use x86 && [[ `gcc-fullversion` = "3.4.3" ]]; then
+ epatch ${FILESDIR}/${PN}-1.0.4-gcc34.patch
+ fi
+
+ # try to apply bristuff patch
+ if use bri; then
+ einfo "Patching zaptel w/ BRI stuff (${BRI_VERSION})"
+ epatch ${FILESDIR}/zaptel-bristuff-${BRI_VERSION}.patch
+
+ cd ${WORKDIR}/bristuff-${BRI_VERSION}
+
+ if use florz; then
+ einfo "Using florz patches (${FLORZ_VERSION}) for zaphfc"
+
+ # remove as soon as there's a new florz patch available
+ sed -i -e "s:zaptel-1\.0\.7:zaptel-1.0.8:g" \
+ ${WORKDIR}/zaphfc_${FLORZ_VERSION}.diff
+
+ epatch ${WORKDIR}/zaphfc_${FLORZ_VERSION}.diff
+ fi
+
+ # patch includes
+ sed -i -e "s:^#include.*zaptel\.h.*:#include <zaptel.h>:" \
+ qozap/qozap.c \
+ zaphfc/zaphfc.c \
+ cwain/cwain.c
+
+ # patch makefiles
+ sed -i -e "s:^ZAP[\t ]*=.*:ZAP=-I${S}:" \
+ -e "s:^MODCONF=.*:MODCONF=/etc/modules.d/zaptel:" \
+ -e "s:linux-2.6:linux:g" \
+ qozap/Makefile \
+ zaphfc/Makefile \
+ cwain/Makefile
+
+ sed -i -e "s:^\(CFLAGS+=-I. \).*:\1 \$(ZAP):" \
+ zaphfc/Makefile
+ fi
+
+ # replace `uname -r` with ${KV_FULL} in all Makefiles
+ find ${WORKDIR} -iname "Makefile" -exec sed -i -e "s:\`uname -r\`:${KV_FULL}:g" {} \;
+}
+
+src_compile() {
+ # TODO: bristuff modules
+
+ set_arch_to_kernel
+ make KERNEL_SOURCE=/usr/src/linux || die
+
+ if use bri; then
+ cd ${WORKDIR}/bristuff-${BRI_VERSION}
+ make -C qozap || die
+ make -C zaphfc || die
+ make -C cwain || die
+ fi
+ set_arch_to_portage
+}
+
+src_install() {
+ make INSTALL_PREFIX=${D} install || die
+
+ dodoc ChangeLog README README.udev README.Linux26 README.fxsusb zaptel.init
+ dodoc zaptel.conf.sample LICENSE zaptel.sysconfig
+
+ # additional tools
+ dobin ztmonitor ztspeed zttest
+
+ if use bri; then
+ einfo "Installing bri"
+ cd ${WORKDIR}/bristuff-${BRI_VERSION}
+
+ insinto /lib/modules/${KV_FULL}/misc
+ doins qozap/qozap.${KV_OBJ}
+ doins zaphfc/zaphfc.${KV_OBJ}
+ doins cwain/cwain.${KV_OBJ}
+
+ # install example configs for octoBRI and quadBRI
+ insinto /etc
+ doins qozap/zaptel.conf.octoBRI
+ newins qozap/zaptel.conf zaptel.conf.quadBRI
+ newins zaphfc/zaptel.conf zaptel.conf.zaphfc
+
+ insinto /etc/asterisk
+ doins qozap/zapata.conf.octoBRI
+ newins qozap/zapata.conf zapata.conf.quadBRI
+ newins zaphfc/zapata.conf zapata.conf.zaphfc
+
+ docinto bristuff
+ dodoc CHANGES INSTALL
+
+ docinto bristuff/qozap
+ dodoc qozap/LICENSE qozap/TODO qozap/*.conf*
+
+ docinto bristuff/zaphfc
+ dodoc zaphfc/LICENSE zaphfc/*.conf
+
+ docinto bristuff/cwain
+ dodoc cwain/TODO cwain/LICENSE
+ fi
+
+ # install init script
+ newinitd ${FILESDIR}/zaptel.rc6 zaptel
+ newconfd ${FILESDIR}/zaptel.confd zaptel
+
+ # install devfsd rule file
+ insinto /etc/devfs.d
+ newins ${FILESDIR}/zaptel.devfsd zaptel
+
+ # install udev rule file
+ insinto /etc/udev/rules.d
+ newins ${FILESDIR}/zaptel.udevd 10-zaptel.rules
+
+ # fix permissions if there's no udev / devfs around
+ if [[ -d ${D}/dev/zap ]]; then
+ chown -R root:dialout ${D}/dev/zap
+ chmod -R u=rwX,g=rwX,o= ${D}/dev/zap
+ fi
+}
+
+pkg_postinst() {
+ linux-mod_pkg_postinst
+
+ if use devfs26; then
+ ewarn "*** Warning! ***"
+ ewarn "Devfs support for linux-2.6 is experimental and not"
+ ewarn "supported by digium or the asterisk project!"
+ echo
+ ewarn "Send bug-reports to: stkn@gentoo.org"
+ fi
+
+ echo
+ einfo "Use the /etc/init.d/zaptel script to load zaptel.conf settings on startup!"
+ echo
+
+ if use bri; then
+ einfo "Bristuff configs have been merged as:"
+ einfo ""
+ einfo "${ROOT}etc/"
+ einfo " zaptel.conf.zaphfc"
+ einfo " zaptel.conf.quadBRI"
+ einfo " zaptel.conf.octoBRI"
+ einfo ""
+ einfo "${ROOT}etc/asterisk/"
+ einfo " zapata.conf.zaphfc"
+ einfo " zapata.conf.quadBRI"
+ einfo " zapata.conf.octoBRI"
+ echo
+ fi
+
+ # fix permissions if there's no udev / devfs around
+ if [[ -d ${ROOT}/dev/zap ]]; then
+ chown -R root:dialout ${ROOT}/dev/zap
+ chmod -R u=rwX,g=rwX,o= ${ROOT}/dev/zap
+ fi
+}