diff options
author | Sam James <sam@gentoo.org> | 2023-12-27 21:15:22 +0000 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2023-12-27 21:16:21 +0000 |
commit | 21c2b7afc6cf22dbb9448c3adf04fed88949a274 (patch) | |
tree | dc7d7cfda3e3a64b11e7697c5b2fe7b0216155cc /net-misc | |
parent | Revert "net-misc/dahdi: treeclean" (diff) | |
download | gentoo-21c2b7afc6cf22dbb9448c3adf04fed88949a274.tar.gz gentoo-21c2b7afc6cf22dbb9448c3adf04fed88949a274.tar.bz2 gentoo-21c2b7afc6cf22dbb9448c3adf04fed88949a274.zip |
Revert "net-misc/dahdi-tools: treeclean"
This reverts commit b195f220594513e94954633d2c754ddd1f253fd7.
Removal date was not yet met & there are plans to possibly resurrect dahdi,
per the bug.
Bug: https://bugs.gentoo.org/914477
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'net-misc')
-rw-r--r-- | net-misc/dahdi-tools/Manifest | 2 | ||||
-rw-r--r-- | net-misc/dahdi-tools/dahdi-tools-3.1.0-r2.ebuild | 70 | ||||
-rw-r--r-- | net-misc/dahdi-tools/dahdi-tools-3.1.0-r4.ebuild | 74 | ||||
-rw-r--r-- | net-misc/dahdi-tools/dahdi-tools-3.2.0.ebuild | 73 | ||||
-rw-r--r-- | net-misc/dahdi-tools/files/dahdi-autoconf.conf2 | 40 | ||||
-rw-r--r-- | net-misc/dahdi-tools/files/dahdi-autoconf.init-3.1.0-r4 | 271 | ||||
-rw-r--r-- | net-misc/dahdi-tools/files/dahdi-autoconf.init2 | 225 | ||||
-rw-r--r-- | net-misc/dahdi-tools/files/dahdi-nondigium-blacklist.patch | 12 | ||||
-rw-r--r-- | net-misc/dahdi-tools/files/dahdi-tools-3.1.0-cplusplusexternc.patch | 26 | ||||
-rw-r--r-- | net-misc/dahdi-tools/files/dahdi-tools-3.1.0-execinfo.patch | 40 | ||||
-rw-r--r-- | net-misc/dahdi-tools/files/dahdi-tools-3.1.0-fno-common.patch | 39 | ||||
-rw-r--r-- | net-misc/dahdi-tools/files/dahdi-tools-3.1.0-parallel-make-no-config.patch | 19 | ||||
-rw-r--r-- | net-misc/dahdi-tools/files/dahdi-tools-3.2.0-lto.patch | 61 | ||||
-rw-r--r-- | net-misc/dahdi-tools/files/dahdi.init2 | 36 | ||||
-rw-r--r-- | net-misc/dahdi-tools/metadata.xml | 18 |
15 files changed, 1006 insertions, 0 deletions
diff --git a/net-misc/dahdi-tools/Manifest b/net-misc/dahdi-tools/Manifest new file mode 100644 index 000000000000..39bdb6ec81be --- /dev/null +++ b/net-misc/dahdi-tools/Manifest @@ -0,0 +1,2 @@ +DIST dahdi-tools-3.1.0.tar.gz 607449 BLAKE2B aa8ef197cbdecf5c892386aa1c25c940ed3f7c24884f588dcca975d34ee7b4c41722d2529fa305d7568d03302e10e6eb4d5df36a899315e05bf243163500b22d SHA512 e0e5bf24e4834ca39ef7dc1af1bb7ef26bd258a8b2cb2406a7e1ffed25b4b1d44a5fce41d97c5ad7fc6ebb66f965759d2b49ffa6d89845786f43eadb89ff4694 +DIST dahdi-tools-3.2.0.tar.gz 729392 BLAKE2B 77667a16fd18fa5b6ffd67d9bd267c4ea5e6ff3841938de64704b7e6f1818b23feff196701c62ceb0a56c677614b4c2a4d4d1f4f533020559e8b3b3c12785bf5 SHA512 29df9a768c6db872bd51926dac11178400a03e2e1d0771ae163433ce300af71691f5c7a60f8756c0e6cef8a43f1331944cb4e44393f04a0ff8dee19bc9e7cf16 diff --git a/net-misc/dahdi-tools/dahdi-tools-3.1.0-r2.ebuild b/net-misc/dahdi-tools/dahdi-tools-3.1.0-r2.ebuild new file mode 100644 index 000000000000..49903c27e61a --- /dev/null +++ b/net-misc/dahdi-tools/dahdi-tools-3.1.0-r2.ebuild @@ -0,0 +1,70 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit autotools bash-completion-r1 perl-functions udev + +DESCRIPTION="Userspace tools to configure the kernel modules from net-misc/dahdi" +HOMEPAGE="https://www.asterisk.org" +SRC_URI="https://downloads.asterisk.org/pub/telephony/${PN}/releases/${P}.tar.gz" + +LICENSE="LGPL-2.1" +SLOT="0" +KEYWORDS="amd64 ~arm ~arm64 ~ppc ~ppc64 x86" +IUSE="ppp" +PATCHES=( + "${FILESDIR}/dahdi-nondigium-blacklist.patch" + "${FILESDIR}/dahdi-tools-3.1.0-parallel-make-no-config.patch" + "${FILESDIR}/dahdi-tools-3.1.0-fno-common.patch" + "${FILESDIR}/dahdi-tools-3.1.0-execinfo.patch" + "${FILESDIR}/dahdi-tools-3.1.0-cplusplusexternc.patch" +) + +DEPEND="dev-libs/newt + net-misc/dahdi + sys-kernel/linux-headers + virtual/libusb:0 + ppp? ( net-dialup/ppp:= )" +RDEPEND="${DEPEND} + dev-lang/perl:= + dev-perl/CGI" +BDEPEND="dev-lang/perl + sys-apps/file" + +src_prepare() { + default + eautoreconf +} + +src_configure() { + econf $(use_with ppp) --with-perllib="$(perl_get_vendorlib)" + sed -re 's/ -Werror($|[[:space:]])//' -i xpp/oct612x/Makefile.in || die "sed to eliminate -Werror failed." + sed -re '/[[:space:]]*-Werror[[:space:]]*\\$/ d' -i xpp/xtalk/Makefile || die "sed to eliminate -Werror failed." +} + +src_install() { + local bashcompdir="$(get_bashcompdir)" + local bashcmd bashcmdtarget + + emake DESTDIR="${ED}" bashcompdir="${bashcompdir}" udevrulesdir="$(get_udevdir)/rules.d" install + emake DESTDIR="${ED}" install-config + + dosbin patgen pattest patlooptest hdlcstress hdlctest hdlcgen hdlcverify timertest + + # install init scripts + newinitd "${FILESDIR}"/dahdi.init2 dahdi + newinitd "${FILESDIR}"/dahdi-autoconf.init2 dahdi-autoconf + newconfd "${FILESDIR}"/dahdi-autoconf.conf2 dahdi-autoconf + + bashcomp_alias dahdi $(sed -nre 's/^complete -F .* //p' "${ED}${bashcompdir}/dahdi" || + die "Error parsing dahdi bash completion file for commands") + + rm "${ED}"/usr/$(get_libdir)/libtonezone.a || die "Unable to remove static libs from install." + # Delete *if* the libtool file exists, bug #778380 + find "${ED}" -name '*.la' -delete || die +} + +pkg_postinst() { + udev_reload +} diff --git a/net-misc/dahdi-tools/dahdi-tools-3.1.0-r4.ebuild b/net-misc/dahdi-tools/dahdi-tools-3.1.0-r4.ebuild new file mode 100644 index 000000000000..4ccf762c64d7 --- /dev/null +++ b/net-misc/dahdi-tools/dahdi-tools-3.1.0-r4.ebuild @@ -0,0 +1,74 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit autotools bash-completion-r1 perl-functions udev + +DESCRIPTION="Userspace tools to configure the kernel modules from net-misc/dahdi" +HOMEPAGE="https://www.asterisk.org" +SRC_URI="https://downloads.asterisk.org/pub/telephony/${PN}/releases/${P}.tar.gz" + +LICENSE="LGPL-2.1" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86" +IUSE="ppp" +PATCHES=( + "${FILESDIR}/dahdi-nondigium-blacklist.patch" + "${FILESDIR}/dahdi-tools-3.1.0-parallel-make-no-config.patch" + "${FILESDIR}/dahdi-tools-3.1.0-fno-common.patch" + "${FILESDIR}/dahdi-tools-3.1.0-execinfo.patch" + "${FILESDIR}/dahdi-tools-3.1.0-cplusplusexternc.patch" +) + +DEPEND="dev-libs/newt + net-misc/dahdi + sys-kernel/linux-headers + virtual/libusb:0 + ppp? ( net-dialup/ppp:= )" +RDEPEND="${DEPEND} + dev-lang/perl:= + dev-perl/CGI" +BDEPEND="dev-lang/perl + sys-apps/file" + +src_prepare() { + default + eautoreconf +} + +src_configure() { + econf $(use_with ppp) --with-perllib="$(perl_get_vendorlib)" + sed -re 's/ -Werror($|[[:space:]])//' -i xpp/oct612x/Makefile.in || die "sed to eliminate -Werror failed." + sed -re '/[[:space:]]*-Werror[[:space:]]*\\$/ d' -i xpp/xtalk/Makefile || die "sed to eliminate -Werror failed." +} + +src_install() { + local bashcompdir="$(get_bashcompdir)" + local bashcmd bashcmdtarget + + emake DESTDIR="${ED}" bashcompdir="${bashcompdir}" udevrulesdir="$(get_udevdir)/rules.d" install + emake DESTDIR="${ED}" install-config + + dosbin patgen pattest patlooptest hdlcstress hdlctest hdlcgen hdlcverify timertest + + # install init scripts + newinitd "${FILESDIR}"/dahdi.init2 dahdi + newinitd "${FILESDIR}"/dahdi-autoconf.init-3.1.0-r4 dahdi-autoconf + newconfd "${FILESDIR}"/dahdi-autoconf.conf2 dahdi-autoconf + + bashcomp_alias dahdi $(sed -nre 's/^complete -F .* //p' "${ED}${bashcompdir}/dahdi" || + die "Error parsing dahdi bash completion file for commands") + + rm "${ED}"/usr/$(get_libdir)/libtonezone.a || die "Unable to remove static libs from install." + # Delete *if* the libtool file exists, bug #778380 + find "${ED}" -name '*.la' -delete || die +} + +pkg_postinst() { + udev_reload +} + +pkg_postrm() { + udev_reload +} diff --git a/net-misc/dahdi-tools/dahdi-tools-3.2.0.ebuild b/net-misc/dahdi-tools/dahdi-tools-3.2.0.ebuild new file mode 100644 index 000000000000..773d22263bd4 --- /dev/null +++ b/net-misc/dahdi-tools/dahdi-tools-3.2.0.ebuild @@ -0,0 +1,73 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools bash-completion-r1 perl-functions udev + +DESCRIPTION="Userspace tools to configure the kernel modules from net-misc/dahdi" +HOMEPAGE="https://www.asterisk.org" +SRC_URI="https://downloads.asterisk.org/pub/telephony/${PN}/releases/${P}.tar.gz" + +LICENSE="LGPL-2.1" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86" +IUSE="ppp" +PATCHES=( + "${FILESDIR}/dahdi-nondigium-blacklist.patch" + "${FILESDIR}/dahdi-tools-3.1.0-parallel-make-no-config.patch" + "${FILESDIR}/dahdi-tools-3.1.0-execinfo.patch" + "${FILESDIR}/dahdi-tools-3.1.0-cplusplusexternc.patch" + "${FILESDIR}/dahdi-tools-3.2.0-lto.patch" +) + +DEPEND="dev-libs/newt + net-misc/dahdi + sys-kernel/linux-headers + virtual/libusb:1 + ppp? ( net-dialup/ppp:= )" +RDEPEND="${DEPEND} + dev-lang/perl:= + dev-perl/CGI" +BDEPEND="dev-lang/perl + sys-apps/file" + +src_prepare() { + default + eautoreconf +} + +src_configure() { + econf $(use_with ppp) --with-perllib="$(perl_get_vendorlib)" + sed -re 's/ -Werror($|[[:space:]])//' -i xpp/oct612x/Makefile.in || die "sed to eliminate -Werror failed." + sed -re '/[[:space:]]*-Werror[[:space:]]*\\$/ d' -i xpp/xtalk/Makefile || die "sed to eliminate -Werror failed." +} + +src_install() { + local bashcompdir="$(get_bashcompdir)" + local bashcmd bashcmdtarget + + emake DESTDIR="${ED}" bashcompdir="${bashcompdir}" udevrulesdir="$(get_udevdir)/rules.d" install + emake DESTDIR="${ED}" install-config + + dosbin patgen pattest patlooptest hdlcstress hdlctest hdlcgen hdlcverify timertest + + # install init scripts + newinitd "${FILESDIR}"/dahdi.init2 dahdi + newinitd "${FILESDIR}"/dahdi-autoconf.init-3.1.0-r4 dahdi-autoconf + newconfd "${FILESDIR}"/dahdi-autoconf.conf2 dahdi-autoconf + + bashcomp_alias dahdi $(sed -nre 's/^complete -F .* //p' "${ED}${bashcompdir}/dahdi" || + die "Error parsing dahdi bash completion file for commands") + + # Delete *if* the libtool file exists, bug #778380 + find "${ED}" -name '*.la' -delete || die +} + +pkg_postinst() { + udev_reload +} + +pkg_postrm() { + udev_reload +} diff --git a/net-misc/dahdi-tools/files/dahdi-autoconf.conf2 b/net-misc/dahdi-tools/files/dahdi-autoconf.conf2 new file mode 100644 index 000000000000..a46545231911 --- /dev/null +++ b/net-misc/dahdi-tools/files/dahdi-autoconf.conf2 @@ -0,0 +1,40 @@ +# Global settings +# Set this to your country code. +DAHDI_ZONE=za +DAHDI_ECHOCAN=oslec # mg2,jpah,kb1,sec,sec2 (there may be more, we recommend oslec) + +# Settings for analog +#Analog signal types, one of: +# ks - KewlStart (recommended, default) +# ls - LoopStart +# gs - GroundStart + +# Signalling to be used on FXO ports +DAHDI_FXO_SIGNALLING=ks + +# Signalling to be used on FXS ports +DAHDI_FXS_SIGNALLING=ks + +# Whether or not to echocan: +DAHDI_FXO_ECHOCAN=yes +DAHDI_FXS_ECHOCAN=yes + +# These settings will be used for BRI cards. +# Known options: B8ZS,AMI,HDB3 +DAHDI_BRI_CODING=AMI + +# Known options: ESF,D4,CCS,CRC4 +DAHDI_BRI_FRAMING=CCS + +# Our experience is that it's not required (still defaults to yes) +DAHDI_BRI_NT_ECHOCAN=yes +DAHDI_BRI_TE_ECHOCAN=yes + +# These settings are for PRI cards. Note that only E1 currently supported. +DAHDI_E1_CPE_ECHOCAN=yes +DAHDI_E1_NET_ECHOCAN=yes + +# PRI will default to CPE mode (remote end provides signalling). +# If you really want to provide signalling set the appropriate spans +# here (eg, set span 1 to NET mode). +#PRI_SPAN_1_NET=yes diff --git a/net-misc/dahdi-tools/files/dahdi-autoconf.init-3.1.0-r4 b/net-misc/dahdi-tools/files/dahdi-autoconf.init-3.1.0-r4 new file mode 100644 index 000000000000..73ab07b8904f --- /dev/null +++ b/net-misc/dahdi-tools/files/dahdi-autoconf.init-3.1.0-r4 @@ -0,0 +1,271 @@ +#!/sbin/openrc-run +# Copyright 1999-2011 Ultimate Linux Solutions CC +# Distributed under the terms of the GNU General Public License v2 + +depend() { + before dahdi +} + +dahdi_load_modules() { + local hwlist loc status mod mod_vname pciid desc + + hwlist=$(/usr/sbin/dahdi_hardware) + + if [ -z "${hwlist}" ]; then + einfo "No digium hardware found." + ebegin "Loading module dahdi_dummy" + /sbin/modprobe dahdi_dummy + eend $? + return + fi + + echo "${hwlist}" | while read loc mod pciid desc; do + status="${mod:${#mod}-1:1}" + mod="${mod%[+-]}" + mod_vname="mod_${mod}" + + einfo "Found $desc at $loc (module: $mod)" + + if [ "${status}" = "-" -a "${!mod_vname-notloaded}" = "notloaded" ]; then + ebegin "Loading module $mod" + /sbin/modprobe $mod + eend + + [ $? -eq 0 ] && eval "$mod_vname=loaded" + fi + done +} + +dahdi_module_unload() { + local mod=$1 s + [ -d /sys/module/${mod} ] || return 0 + + for s in $(find /sys/module/${mod}/holders -type l); do + dahdi_module_unload $(basename $s) + done + + ebegin "Removing dahdi module: $mod" + /sbin/rmmod $mod + eend $? +} + +dahdi_gen_fxo_config() { + local port=$1 + + echo "fxs${DAHDI_FXO_SIGNALLING-ks}=${port}" + [ "${DAHDI_FXO_ECHOCAN-yes}" = yes ] && echo "echocanceller=${DAHDI_ECHOCAN-mg2},${port}" +} + +dahdi_gen_fxs_config() { + local port=$1 + + echo "fxo${DAHDI_FXO_SIGNALLING-ks}=${port}" + [ "${DAHDI_FXS_ECHOCAN-yes}" = yes ] && echo "echocanceller=${DAHDI_ECHOCAN-mg2},${port}" +} + +dahdi_gen_bri_te_config() { + span=$1 + port=$2 + basechan=$3 + + echo "span=${span},${port},0,${DAHDI_BRI_FRAMING-CSS},${DAHDI_BRI_CODING-AMI}" + echo "bchan=${basechan}-$(( basechan + 1 ))" + echo "hardhdlc=$(( basechan + 2 ))" + [ "${DAHDI_BRI_TE_ECHOCAN-yes}" = yes ] && echo "echocanceller=${DAHDI_ECHOCAN-mg2},${basechan}-$(( basechan + 1 ))" +} + +dahdi_gen_bri_nt_config() { + span=$1 + port=$2 + basechan=$3 + + echo "span=${span},0,0,${DAHDI_BRI_FRAMING-CSS},${DAHDI_BRI_CODING-AMI}" + echo "bchan=${basechan}-$(( basechan + 1 ))" + echo "hardhdlc=$(( basechan + 2 ))" + [ "${DAHDI_BRI_NT_ECHOCAN-yes}" = yes ] && echo "echocanceller=${DAHDI_ECHOCAN-mg2},${basechan}-$(( basechan + 1 ))" +} + +dahdi_gen_e1_cpe_config() { + span=$1 + port=$2 + basechan=$3 + + echo "span=${span},${port},0,${DAHDI_E1_FRAMING-CCS},${DAHDI_E1_CODING-HDB3,CRC4}" + bchans="${basechan}-$(( basechan + 14 )),$(( basechan + 16 ))-$(( basechan + 30 ))" + echo "bchan=${bchans}" + echo "dchan=$(( basechan + 15 ))" + [ "${DAHDI_E1_CPE_ECHOCAN-yes}" = yes ] && echo "echocanceller=${DAHDI_ECHOCAN-mg2},${bchans}" +} + +dahdi_gen_e1_net_config() { + span=$1 + port=$2 + basechan=$3 + + echo "span=${span},0,0,${DAHDI_E1_FRAMING-CCS},${DAHDI_E1_CODING-HDB3,CRC4}" + bchans="${basechan}-$(( basechan + 14 )),$(( basechan + 16 ))-$(( basechan + 30 ))" + echo "bchan=${bchans}" + echo "dchan=$(( basechan + 15 ))" + [ "${DAHDI_E1_NET_ECHOCAN-yes}" = yes ] && echo "echocanceller=${DAHDI_ECHOCAN-mg2},${bchans}" +} + +dahdi_gen_t1_cpe_config() { + span=$1 + port=$2 + basechan=$3 + + echo "span=${span},${port},0,${DAHDI_T1_FRAMING-ESF},${DAHDI_T1_CODING-B8ZS}" + bchans="${basechan}-$(( basechan + 22 ))" + echo "bchan=${bchans}" + echo "dchan=$(( basechan + 23 ))" + [ "${DAHDI_T1_CPE_ECHOCAN-yes}" = yes ] && echo "echocanceller=${DAHDI_ECHOCAN-mg2},${bchans}" +} + +dahdi_gen_t1_net_config() { + span=$1 + port=$2 + basechan=$3 + + echo "span=${span},0,0,${DAHDI_T1_FRAMING-ESF},${DAHDI_T1_CODING-B8ZS}" + bchans="${basechan}-$(( basechan + 22 ))" + echo "bchan=${bchans}" + echo "dchan=$(( basechan + 23 ))" + [ "${DAHDI_T1_NET_ECHOCAN-yes}" = yes ] && echo "echocanceller=${DAHDI_ECHOCAN-mg2},${bchans}" +} + +dahdi_conf_span() { + local span=$1 + local type=$2 + local desc=$3 + local port=$4 + local basechan=$5 + local vname="PRI_SPAN_${span}_NET" + local cfunc="dahdi_gen_" + + # Analog we need to deal with on a port-by-port basis. + [ "${type}" = "analog" ] && return 0 + + echo "" + echo "# ${desc}" + + case "${type}" in + digital-TE) + cfunc="${cfunc}bri_te" + ;; + digital-NT) + cfunc="${cfunc}bri_nt" + ;; + digital-[TE]1) + cfunc="${cfunc}$(echo "${type##*-}" | tr 'TE' 'te')" + # Use CPE by default. Unfortunately there is no easy + # way to detect CPE vs NET as far as I know and specifying + # in a config that you want NET mode seems the sanest way. + if yesno "${vname}"; then + cfunc="${cfunc}_net" + else + cfunc="${cfunc}_cpe" + fi + ;; + *) + echo "# Don't know how to configure this (type=${type})." + echo "# Please file a bug on bugs.gentoo.org and add jaco@uls.co.za as CC." + return 1 + ;; + esac + + "${cfunc}_config" "${span}" "${port}" "${basechan}" +} + +dahdi_gen_config() { + local type manufacturer devicetype basechan aport atype + local span= + local tfile="$(mktemp)" + local sfile="$(mktemp)" + local plocation="" + local isdnport=0 + + /usr/sbin/dahdi_scan > "${sfile}" + exec 3<"${sfile}" + exec 4>"${tfile}" + + echo "# Automatically dahdi-autoconf generated file ($(date))." >&4 + echo "# This file WILL get regenerated whenever you restart dahdi-autoconf." >&4 + + while read LINE <&3; do + case "$LINE" in + \[*\]) + if [ -n "${span}" ]; then + ebegin "Configuring ${manufacturer} ${devicetype} (${name})" + dahdi_conf_span "${span}" "${type}" "${manufacturer} ${devicetype} (${name})" "${isdnport}" "${basechan}" >&4 + eend $? + fi + span="${LINE%?}" + span="${span#?}" + ;; + type=*|manufacturer=*|devicetype=*|basechan=*|name=*) + eval "${LINE%%=*}='${LINE#*=}'" + ;; + location=*) + eval "${LINE%%=*}='${LINE#*=}'" + if [ "${location}" = "${plocation}" ]; then + isdnport=$(( isdnport + 1 )) + else + plocation="${location}" + isdnport=1 + fi + ;; + port=*) + # For analog cards only. + aport="${LINE#*=}"; aport="${aport%,*}" + atype="${LINE#*,}" + if [ "${aport}" -eq "${basechan}" ]; then + echo "" >&4 + echo "# ${manufacturer} ${devicetype} (${name})" >&4 + fi + case "${atype}" in + FXO) + dahdi_gen_fxo_config $aport >&4 + ;; + FXS) + dahdi_gen_fxs_config $aport >&4 + ;; + esac + ;; + esac + done + + if [ -n "${span}" ]; then + ebegin "Configuring ${manufacturer} ${devicetype} (${name})" + dahdi_conf_span "${span}" "${type}" "${manufacturer} ${devicetype} (${name})" "${isdnport}" "${basechan}" >&4 + eend $? + fi + + echo "" >&4 + echo "loadzone = ${DAHDI_ZONE}" >&4 + echo "defaultzone = ${DAHDI_ZONE}" >&4 + echo "## END OF AUTOCONFIGURED FILE ##" >&4 + + exec 3<&- + exec 4<&- + + rm -f "${sfile}" + [ -r /etc/dahdi/system.conf ] && mv /etc/dahdi/system.conf /etc/dahdi/system.conf.bck + mv "${tfile}" /etc/dahdi/system.conf +} + +start() { + dahdi_load_modules + + if [ ! -r /dev/dahdi/ctl ]; then + eerror "No DAHDI compatible cards detected." + return 1 + fi + + ebegin "Generating DAHDI Configuration" + dahdi_gen_config + eend $? +} + +stop() { + dahdi_module_unload dahdi +} diff --git a/net-misc/dahdi-tools/files/dahdi-autoconf.init2 b/net-misc/dahdi-tools/files/dahdi-autoconf.init2 new file mode 100644 index 000000000000..9e3de84bac26 --- /dev/null +++ b/net-misc/dahdi-tools/files/dahdi-autoconf.init2 @@ -0,0 +1,225 @@ +#!/sbin/openrc-run +# Copyright 1999-2011 Ultimate Linux Solutions CC +# Distributed under the terms of the GNU General Public License v2 + +depend() { + before dahdi +} + +dahdi_load_modules() { + local hwlist loc status mod mod_vname pciid desc + + hwlist=$(/usr/sbin/dahdi_hardware) + + if [ -z "${hwlist}" ]; then + einfo "No digium hardware found." + ebegin "Loading module dahdi_dummy" + /sbin/modprobe dahdi_dummy + eend $? + return + fi + + echo "${hwlist}" | while read loc mod pciid desc; do + status="${mod:${#mod}-1:1}" + mod="${mod%[+-]}" + mod_vname="mod_${mod}" + + einfo "Found $desc at $loc (module: $mod)" + + if [ "${status}" = "-" -a "${!mod_vname-notloaded}" = "notloaded" ]; then + ebegin "Loading module $mod" + /sbin/modprobe $mod + eend + + [ $? -eq 0 ] && eval "$mod_vname=loaded" + fi + done +} + +dahdi_module_unload() { + local mod=$1 s + [ -d /sys/module/${mod} ] || return 0 + + for s in $(find /sys/module/${mod}/holders -type l); do + dahdi_module_unload $(basename $s) + done + + ebegin "Removing dahdi module: $mod" + /sbin/rmmod $mod + eend $? +} + +dahdi_gen_fxo_config() { + local port=$1 + + echo "fxs${DAHDI_FXO_SIGNALLING-ks}=${port}" + [ "${DAHDI_FXO_ECHOCAN-yes}" = yes ] && echo "echocanceller=${DAHDI_ECHOCAN-mg2},${port}" +} + +dahdi_gen_fxs_config() { + local port=$1 + + echo "fxo${DAHDI_FXO_SIGNALLING-ks}=${port}" + [ "${DAHDI_FXS_ECHOCAN-yes}" = yes ] && echo "echocanceller=${DAHDI_ECHOCAN-mg2},${port}" +} + +dahdi_gen_bri_te_config() { + span=$1 + port=$2 + basechan=$3 + + echo "span=${span},${port},0,${DAHDI_BRI_FRAMING-CSS},${DAHDI_BRI_CODING-AMI}" + echo "bchan=${basechan}-$(( basechan + 1 ))" + echo "hardhdlc=$(( basechan + 2 ))" + [ "${DAHDI_BRI_TE_ECHOCAN-yes}" = yes ] && echo "echocanceller=${DAHDI_ECHOCAN-mg2},${basechan}-$(( basechan + 1 ))" +} + +dahdi_gen_bri_nt_config() { + span=$1 + port=$2 + basechan=$3 + + echo "span=${span},0,0,${DAHDI_BRI_FRAMING-CSS},${DAHDI_BRI_CODING-AMI}" + echo "bchan=${basechan}-$(( basechan + 1 ))" + echo "hardhdlc=$(( basechan + 2 ))" + [ "${DAHDI_BRI_NT_ECHOCAN-yes}" = yes ] && echo "echocanceller=${DAHDI_ECHOCAN-mg2},${basechan}-$(( basechan + 1 ))" +} + +dahdi_gen_e1_cpe_config() { + span=$1 + port=$2 + basechan=$3 + + echo "span=${span},${port},0,${DAHDI_E1_FRAMING-CCS},${DAHDI_E1_CODING-HDB3,CRC4}" + bchans="${basechan}-$(( basechan + 14 )),$(( basechan + 16 ))-$(( basechan + 30 ))" + echo "bchan=${bchans}" + echo "dchan=$(( basechan + 15 ))" + [ "${DAHDI_E1_CPE_ECHOCAN-yes}" = yes ] && echo "echocanceller=${DAHDI_ECHOCAN-mg2},${bchans}" +} + +dahdi_gen_e1_net_config() { + span=$1 + port=$2 + basechan=$3 + + echo "span=${span},0,0,${DAHDI_E1_FRAMING-CCS},${DAHDI_E1_CODING-HDB3,CRC4}" + bchans="${basechan}-$(( basechan + 14 )),$(( basechan + 16 ))-$(( basechan + 30 ))" + echo "bchan=${bchans}" + echo "dchan=$(( basechan + 15 ))" + [ "${DAHDI_E1_NET_ECHOCAN-yes}" = yes ] && echo "echocanceller=${DAHDI_ECHOCAN-mg2},${bchans}" +} + +dahdi_conf_span() { + local span=$1 + local type=$2 + local desc=$3 + local port=$4 + local basechan=$5 + local vname="" + + # Analog we need to deal with on a port-by-port basis. + [ "${type}" = "analog" ] && return 0 + + echo -e "\n# ${desc}" + case "${type}" in + digital-TE) + dahdi_gen_bri_te_config "${span}" "${port}" "${basechan}" + ;; + digital-NT) + dahdi_gen_bri_nt_config "${span}" "${port}" "${basechan}" + ;; + digital-E1) + # Use CPE by default. Unfortunately there is no easy + # way to detect CPE vs NET as far as I know and specifying + # in a config that you want NET mode seems the sanest way. + vname="PRI_SPAN_${span}_NET" + if [[ "${!vname}" = [Yy][Ee][Ss] ]]; then + dahdi_gen_e1_net_config "${span}" "${port}" "${basechan}" + else + dahdi_gen_e1_cpe_config "${span}" "${port}" "${basechan}" + fi + ;; + *) + echo "# Don't know how to configure this (type=${type})." + echo "# Please file a bug on bugs.gentoo.org and add jaco@uls.co.za as CC." + ;; + esac +} + +dahdi_gen_config() { + local type manufacturer devicetype basechan aport atype + local span= + local tfile="$(mktemp)" + local sfile="$(mktemp)" + local plocation="" + local isdnport=0 + + /usr/sbin/dahdi_scan > "${sfile}" + exec 3<"${sfile}" + + echo "# Automatically dahdi-autoconf generated file ($(date))." >> "${tfile}" + echo "# This file WILL get regenerated whenever you restart dahdi-autoconf." >> "${tfile}" + + while read LINE <&3; do + case "$LINE" in + [[]*[]]) + [ -n "${span}" ] && dahdi_conf_span "${span}" "${type}" "${manufacturer} ${devicetype} (${name})" "${isdnport}" "${basechan}" >> "${tfile}" + span="${LINE%?}" + span="${span#?}" + ;; + type=*|manufacturer=*|devicetype=*|basechan=*|name=*) + eval "${LINE%%=*}='${LINE#*=}'" + ;; + location=*) + eval "${LINE%%=*}='${LINE#*=}'" + if [ "${location}" == "${plocation}" ]; then + (( ++isdnport )) + else + plocation="${location}" + isdnport=1 + fi + ;; + port=*) + # For analog cards only. + aport="${LINE#*=}"; aport="${aport%,*}" + atype="${LINE#*,}" + [ "${aport}" -eq "${basechan}" ] && echo -e "\n# ${manufacturer} ${devicetype} (${name})" >> "${tfile}" + case "${atype}" in + FXO) + dahdi_gen_fxo_config $aport >> "${tfile}" + ;; + FXS) + dahdi_gen_fxs_config $aport >> "${tfile}" + ;; + esac + ;; + esac + done + + [ -n "${span}" ] && dahdi_conf_span "${span}" "${type}" "${manufacturer} ${devicetype} (${name})" "${isdnport}" "${basechan}" >> "${tfile}" + + echo -e "\nloadzone = ${DAHDI_ZONE}\ndefaultzone = ${DAHDI_ZONE}\n## END OF AUTOCONFIGURED FILE ##" >> "${tfile}" + + exec 3<&- + + rm -f "${sfile}" + mv /etc/dahdi/system.conf /etc/dahdi/system.conf.bck + mv "${tfile}" /etc/dahdi/system.conf +} + +start() { + dahdi_load_modules + + if [ ! -r /dev/dahdi/ctl ]; then + eerror "No DAHDI compatible cards detected." + return 1 + fi + + ebegin "Generating DAHDI Configuration" + dahdi_gen_config + eend $? +} + +stop() { + dahdi_module_unload dahdi +} diff --git a/net-misc/dahdi-tools/files/dahdi-nondigium-blacklist.patch b/net-misc/dahdi-tools/files/dahdi-nondigium-blacklist.patch new file mode 100644 index 000000000000..3df8f166a56c --- /dev/null +++ b/net-misc/dahdi-tools/files/dahdi-nondigium-blacklist.patch @@ -0,0 +1,12 @@ +diff -uNr dahdi-tools-2.8.0.ORIG/blacklist.sample dahdi-tools-2.8.0/blacklist.sample +--- dahdi-tools-2.8.0/blacklist.sample.ORIG 2009-04-02 10:34:32.000000000 +0200 ++++ dahdi-tools-2.8.0/blacklist.sample 2010-05-24 20:46:05.000000000 +0200 +@@ -14,6 +14,8 @@ + blacklist wcb4xxp + blacklist wcaxx + blacklist wcte43x ++blacklist wcopenpci ++blacklist zaphfc + + # Some mISDN drivers may try to attach to cards supported by DAHDI. If you + # have a card which is *not* supported by DAHDI but supported by one of the diff --git a/net-misc/dahdi-tools/files/dahdi-tools-3.1.0-cplusplusexternc.patch b/net-misc/dahdi-tools/files/dahdi-tools-3.1.0-cplusplusexternc.patch new file mode 100644 index 000000000000..37d1402c404f --- /dev/null +++ b/net-misc/dahdi-tools/files/dahdi-tools-3.1.0-cplusplusexternc.patch @@ -0,0 +1,26 @@ +diff --git a/./dahdi-tools-3.1.0/xpp/hexfile.h.o b/./dahdi-tools-3.1.0/xpp/hexfile.h +index 33ff50d..3d03f98 100644 +--- a/xpp/hexfile.h ++++ b/xpp/hexfile.h +@@ -70,7 +70,9 @@ struct hexdata { + }; + + +-__BEGIN_DECLS ++#ifdef __cpluplus ++extern "C" { ++#endif + + typedef void (*parse_hexfile_report_func_t)(int level, const char *msg, ...) + #ifdef __GNUC__ +@@ -86,6 +88,9 @@ int dump_hexfile2(struct hexdata *hexdata, const char *outfile, uint8_t maxwidth + void dump_binary(struct hexdata *hexdata, const char *outfile); + void gen_hexline(const uint8_t *data, uint16_t addr, size_t len, FILE *output); + int bsd_checksum(struct hexdata *hexdata); +-__END_DECLS ++ ++#ifdef __cpluplus ++} ++#endif + + #endif diff --git a/net-misc/dahdi-tools/files/dahdi-tools-3.1.0-execinfo.patch b/net-misc/dahdi-tools/files/dahdi-tools-3.1.0-execinfo.patch new file mode 100644 index 000000000000..b222a85d8cb9 --- /dev/null +++ b/net-misc/dahdi-tools/files/dahdi-tools-3.1.0-execinfo.patch @@ -0,0 +1,40 @@ +--- a/configure.ac 2020-03-28 22:28:35.614340050 +0200 ++++ b/configure.ac 2020-03-28 22:28:55.084181570 +0200 +@@ -161,6 +161,7 @@ + # Checks for header files. + AC_CHECK_HEADERS([sys/soundcard.h linux/soundcard.h]) + AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netinet/in.h stdint.h stdlib.h string.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h syslog.h unistd.h]) ++AC_CHECK_HEADERS([execinfo.h]) + + # Checks for typedefs, structures, and compiler characteristics. + AC_C_INLINE +--- a/xpp/xtalk/debug.c 2020-03-28 22:41:43.507810560 +0200 ++++ b/xpp/xtalk/debug.c 2020-03-28 22:41:10.538087608 +0200 +@@ -27,8 +27,10 @@ + #include <stdarg.h> + #include <syslog.h> +-#include <execinfo.h> + #include <xtalk/debug.h> + #include <autoconfig.h> ++#ifdef HAVE_EXECINFO_H ++#include <execinfo.h> ++#endif + + int verbose = LOG_INFO; + int debug_mask; +@@ -61,6 +63,7 @@ + /* from glibc info(1) */ + void print_backtrace(FILE *fp) + { ++#ifdef HAVE_EXECINFO_H + void *array[10]; + size_t size; + char **strings; +@@ -71,4 +74,7 @@ + for (i = 0; i < size; i++) + fprintf(fp, "%s\n", strings[i]); + free(strings); ++#else ++ fprintf(fp, "backtrace information only available if execinfo.h is available.\n"); ++#endif + } diff --git a/net-misc/dahdi-tools/files/dahdi-tools-3.1.0-fno-common.patch b/net-misc/dahdi-tools/files/dahdi-tools-3.1.0-fno-common.patch new file mode 100644 index 000000000000..3ca5bd2aa09b --- /dev/null +++ b/net-misc/dahdi-tools/files/dahdi-tools-3.1.0-fno-common.patch @@ -0,0 +1,39 @@ +diff --git a/xpp/mpptalk.c b/xpp/mpptalk.c +index fdb34f1..8fb3687 100644 +--- a/xpp/mpptalk.c ++++ b/xpp/mpptalk.c +@@ -237,7 +237,7 @@ union XTALK_PDATA(MPP) { + MEMBER(MPP, TWS_PORT_GET_REPLY); + MEMBER(MPP, TWS_PWR_GET); + MEMBER(MPP, TWS_PWR_GET_REPLY); +-} PACKED members; ++} PACKED; + + /* + * Statuses +diff --git a/xpp/xtalk/xtalk_raw.c b/xpp/xtalk/xtalk_raw.c +index 49e47d5..251a502 100644 +--- a/xpp/xtalk/xtalk_raw.c ++++ b/xpp/xtalk/xtalk_raw.c +@@ -48,7 +48,7 @@ CMD_DEF(XTALK, ACK, + + union XTALK_PDATA(XTALK) { + MEMBER(XTALK, ACK); +-} PACKED members; ++} PACKED; + + const struct xtalk_protocol xtalk_raw_proto = { + .name = "XTALK-RAW", +diff --git a/xpp/xtalk/xtalk_sync.c b/xpp/xtalk/xtalk_sync.c +index 18a5cad..ffa79d2 100644 +--- a/xpp/xtalk/xtalk_sync.c ++++ b/xpp/xtalk/xtalk_sync.c +@@ -60,7 +60,7 @@ union XTALK_PDATA(XTALK) { + MEMBER(XTALK, ACK); + MEMBER(XTALK, PROTO_GET); + MEMBER(XTALK, PROTO_GET_REPLY); +-} PACKED members; ++} PACKED; + + const struct xtalk_protocol xtalk_sync_proto = { + .name = "XTALK-SYNC", diff --git a/net-misc/dahdi-tools/files/dahdi-tools-3.1.0-parallel-make-no-config.patch b/net-misc/dahdi-tools/files/dahdi-tools-3.1.0-parallel-make-no-config.patch new file mode 100644 index 000000000000..9575966435e7 --- /dev/null +++ b/net-misc/dahdi-tools/files/dahdi-tools-3.1.0-parallel-make-no-config.patch @@ -0,0 +1,19 @@ +--- dahdi-tools-3.1.0/Makefile.am.o 2020-01-09 12:23:37.943059915 +0200 ++++ dahdi-tools-3.1.0/Makefile.am 2020-01-09 12:23:58.863036654 +0200 +@@ -1,7 +1,7 @@ + ACLOCAL_AMFLAGS = -I m4 + + LEGACY_MAKE = \ +- $(MAKE) -f $(srcdir)/Makefile.legacy \ ++ +$(MAKE) -f $(srcdir)/Makefile.legacy \ + top_srcdir=$(top_srcdir) \ + srcdir=$(srcdir) + +@@ -131,7 +131,6 @@ + install -m644 init.conf.sample $(DESTDIR)$(dahdiconfdir)/init.conf + install -m644 blacklist.sample $(DESTDIR)$(sysconfdir)/modprobe.d/dahdi-blacklist.conf + install -m644 modprobe.conf.sample $(DESTDIR)$(sysconfdir)/modprobe.d/dahdi.conf +- $(LEGACY_MAKE) config + + dahdiconfdir = @sysconfdir@/dahdi + dahdiconf_DATA = \ diff --git a/net-misc/dahdi-tools/files/dahdi-tools-3.2.0-lto.patch b/net-misc/dahdi-tools/files/dahdi-tools-3.2.0-lto.patch new file mode 100644 index 000000000000..75f6c1a93eee --- /dev/null +++ b/net-misc/dahdi-tools/files/dahdi-tools-3.2.0-lto.patch @@ -0,0 +1,61 @@ +From bc45d96413902e0ded093908bc3a02410d799e24 Mon Sep 17 00:00:00 2001 +From: Jaco Kroon <jaco@uls.co.za> +Date: Thu, 11 May 2023 17:28:02 +0200 +Subject: [PATCH] Fix compilation with LTO. + +--- + xpp/echo_loader.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/xpp/echo_loader.c b/xpp/echo_loader.c +index 827f6ef..adfb1f4 100644 +--- a/xpp/echo_loader.c ++++ b/xpp/echo_loader.c +@@ -409,7 +409,7 @@ UINT32 Oct6100UserGetTime(tPOCT6100_GET_TIME f_pTime) + struct timeval tv; + unsigned long long total_usecs; + unsigned int mask = ~0; +- ++ + gettimeofday(&tv, 0); + total_usecs = (((unsigned long long)(tv.tv_sec)) * 1000000) + + (((unsigned long long)(tv.tv_usec))); +@@ -564,7 +564,7 @@ UINT32 Oct6100UserDriverReadBurstApi(tPOCT6100_READ_BURST_PARAMS f_pBurstParams) + return cOCT6100_ERR_OK; + } + +-inline int get_ver(struct astribank *astribank) ++static inline int get_ver(struct astribank *astribank) + { + return spi_send(astribank, 0, 0, 1, 1); + } +@@ -647,7 +647,7 @@ UINT32 init_octasic(char *filename, struct astribank *astribank, struct span_spe + /* General parameters */ + OpenChip.fEnableChannelRecording = TRUE; + +- /* Chip ID.*/ ++ /* Chip ID.*/ + OpenChip.ulUserChipId = 1; + + /* Set the max number of accesses to 1024 to speed things up */ +@@ -775,7 +775,7 @@ UINT32 init_octasic(char *filename, struct astribank *astribank, struct span_spe + ChannelOpen.VqeConfig.fRinDcOffsetRemoval = TRUE; + ChannelOpen.VqeConfig.fSinDcOffsetRemoval = TRUE; + +- ChannelOpen.VqeConfig.ulComfortNoiseMode = cOCT6100_COMFORT_NOISE_NORMAL; ++ ChannelOpen.VqeConfig.ulComfortNoiseMode = cOCT6100_COMFORT_NOISE_NORMAL; + /* cOCT6100_COMFORT_NOISE_NORMAL + cOCT6100_COMFORT_NOISE_EXTENDED, + cOCT6100_COMFORT_NOISE_OFF, +@@ -824,7 +824,7 @@ UINT32 init_octasic(char *filename, struct astribank *astribank, struct span_spe + ChannelOpen.VqeConfig.fRinDcOffsetRemoval = TRUE; + ChannelOpen.VqeConfig.fSinDcOffsetRemoval = TRUE; + +- ChannelOpen.VqeConfig.ulComfortNoiseMode = cOCT6100_COMFORT_NOISE_NORMAL; ++ ChannelOpen.VqeConfig.ulComfortNoiseMode = cOCT6100_COMFORT_NOISE_NORMAL; + /* cOCT6100_COMFORT_NOISE_NORMAL + cOCT6100_COMFORT_NOISE_EXTENDED, + cOCT6100_COMFORT_NOISE_OFF, +-- +2.39.3 + diff --git a/net-misc/dahdi-tools/files/dahdi.init2 b/net-misc/dahdi-tools/files/dahdi.init2 new file mode 100644 index 000000000000..d3abf3c4e61e --- /dev/null +++ b/net-misc/dahdi-tools/files/dahdi.init2 @@ -0,0 +1,36 @@ +#!/sbin/openrc-run +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +depend() { + need net +} + +checkconfig() { + if [ ! -f /etc/dahdi/system.conf ]; then + eerror "/etc/dahdi/system.conf not found. Nothing to do." + return 1 + fi + + return 0 +} + +start() { + checkconfig || return 1 + + ebegin "Starting DAHDI" + /usr/sbin/dahdi_cfg + eend $? + + if [ $? -eq 0 -a -r /etc/fxotune.conf ]; then + ebegin "Loading DAHDI fxotune.conf" + /usr/sbin/fxotune -s + eend $? + fi +} + +stop() { + ebegin "Stopping DAHDI" + /usr/sbin/dahdi_cfg -s + eend +} diff --git a/net-misc/dahdi-tools/metadata.xml b/net-misc/dahdi-tools/metadata.xml new file mode 100644 index 000000000000..41312228e19d --- /dev/null +++ b/net-misc/dahdi-tools/metadata.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person" proxied="yes"> + <email>jaco@uls.co.za</email> + <name>Jaco Kroon</name> + </maintainer> + <maintainer type="project" proxied="proxy"> + <email>proxy-maint@gentoo.org</email> + <name>Proxy Maintainers</name> + </maintainer> + <use> + <flag name="ppp">Enables PPP/DAHDIRAS support</flag> + </use> + <upstream> + <remote-id type="github">asterisk/dahdi-tools</remote-id> + </upstream> +</pkgmetadata> |