DIST gentoo-dahdi-patchset-1.2.0.tar.bz2 103096 BLAKE2B 8c832d97a50985aa763ff38699c0c77d2898dd3e2d0c35c47a1459029606fc5b5e2d077c4c5968cb47a007edfa0a18ed634a2f24891225cf8195e44c66640b3e SHA512 b700a31bb670146d5e8a5745deb8a62a6d3b0a65e1532d1ac8c5effa32c4f5ce0986f441eec5c41d94554e04723e71f0063a1f2700e6d2280b7bc7ba1f7f7b04
DIST gentoo-dahdi-patchset-1.2.3.tar.bz2 103028 BLAKE2B ced190c538a358614ceeafc55bbfa9e3d619b82a461fb59631e46320b3fe7d018e9ce4483c0d61cc39625beb856578c6f3af2fb6a8a6ddc421034da6e7c56213 SHA512 f98170a3a98445f84586805b330ce6ed7e3a89d36162e9aef6c7cfb2c1bffbac5bde82764352b519b0684b4b19a7157696d633fccd66d0949e0cc74ab17a0517
DIST gentoo-dahdi-patchset-1.2.4.tar.bz2 110136 BLAKE2B 2a07b3e5d71e30db339fee5d0e0489dad69c0c0a536daaafe24080f3d548153f980fe549126963aa4d9fbe2c9b17b54db840c452dcb0ce0f7f3a95392e362d80 SHA512 e16d6277764b6e8c9a79712f1e0c7e2d30877ce467b55fc4bf19d89025d6155eac6accf748ffd680c6dd111ebe45a40c311cebaf85f4feeb047a37889c948210
+DIST gentoo-dahdi-patchset-3.1.0-r1.tar.bz2 104172 BLAKE2B a4d1310ba7d8cd835f28ed2c4877c2aa6f5bf4870c4b3cf809921ebfcf99b2d2fa88d1a90ad7f0d9e84995340eb8468dcaa1399e28a00572b512ee8ad6061750 SHA512 940b295578fa0aef8480c031ea28c07f3dba6bfaf5a572dd23fc5d9f696509dcf95bb738990feaa554d0a72c28f88c9acae042679bca602d27ba1eb2805f9ef5
DIST gentoo-dahdi-patchset-3.1.0.tar.bz2 2224 BLAKE2B f07b8a1ecf7996d9e970248216b3ceacd991ecfe4e6e9cbf408c47e7e29e827a5ebedd399d611bc7c286309095c109d30d6c7f03ed4c95c8e89ba816ed59e002 SHA512 ed88dcf023238a8cea33fc32957ec28a237eafd0315fd5b73bfcabb95ef5aa304a94ce38a6233f37810162cfc9467876128003e818145a6942e7133a68243d42
DIST jnet-dahdi-drivers-1.0.14.tar.gz 64860 BLAKE2B c8bbb007cd1a76d02b758af35d1d6a26d5617018ad1de8c69dd9bdf7d781d66b85031706efe55edb32eec1d00f3877fe8a2edd4f9899f367824875cd5fe93984 SHA512 419352897d39bae6b51ee302723de6ca3c8041546a1273fa0691cf169e16f37fc730f3033fed4e5f564dce6dcc097e93f609208af8c38d03b9aee96b95037d66
--- /dev/null
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit flag-o-matic linux-mod toolchain-funcs
+
+MY_P="${P/dahdi/dahdi-linux}"
+JNET=1.0.14
+GENTOO=3.1.0-r1
+S="${WORKDIR}/${MY_P}"
+
+JNET_DRIVERS="cwain qozap ztgsm"
+
+DESCRIPTION="Kernel modules for Digium compatible hardware (formerly known as Zaptel)"
+HOMEPAGE="https://www.asterisk.org"
+SRC_URI="https://downloads.asterisk.org/pub/telephony/dahdi-linux/releases/${MY_P}.tar.gz
+ https://www.junghanns.net/downloads/jnet-dahdi-drivers-${JNET}.tar.gz
+ https://downloads.uls.co.za/gentoo/dahdi/gentoo-dahdi-patchset-${GENTOO}.tar.bz2
+ https://downloads.digium.com/pub/telephony/firmware/releases/dahdi-fwload-vpmadt032-1.25.0.tar.gz
+ https://downloads.digium.com/pub/telephony/firmware/releases/dahdi-fw-a4a-a0017.tar.gz
+ https://downloads.digium.com/pub/telephony/firmware/releases/dahdi-fw-a4b-d001e.tar.gz
+ https://downloads.digium.com/pub/telephony/firmware/releases/dahdi-fw-a8a-1d0017.tar.gz
+ https://downloads.digium.com/pub/telephony/firmware/releases/dahdi-fw-a8b-1f001e.tar.gz
+ https://downloads.digium.com/pub/telephony/firmware/releases/dahdi-fw-hx8-2.06.tar.gz
+ https://downloads.digium.com/pub/telephony/firmware/releases/dahdi-fw-oct6114-032-1.05.01.tar.gz
+ https://downloads.digium.com/pub/telephony/firmware/releases/dahdi-fw-oct6114-064-1.05.01.tar.gz
+ https://downloads.digium.com/pub/telephony/firmware/releases/dahdi-fw-oct6114-128-1.05.01.tar.gz
+ https://downloads.digium.com/pub/telephony/firmware/releases/dahdi-fw-oct6114-256-1.05.01.tar.gz
+ https://downloads.digium.com/pub/telephony/firmware/releases/dahdi-fw-tc400m-MR6.12.tar.gz
+ https://downloads.digium.com/pub/telephony/firmware/releases/dahdi-fw-te133-7a001e.tar.gz
+ https://downloads.digium.com/pub/telephony/firmware/releases/dahdi-fw-te134-780017.tar.gz
+ https://downloads.digium.com/pub/telephony/firmware/releases/dahdi-fw-te435-13001e.tar.gz
+ https://downloads.digium.com/pub/telephony/firmware/releases/dahdi-fw-te436-10017.tar.gz
+ https://downloads.digium.com/pub/telephony/firmware/releases/dahdi-fw-te820-1.76.tar.gz
+ https://downloads.digium.com/pub/telephony/firmware/releases/dahdi-fw-vpmoct032-1.12.0.tar.gz
+"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
+IUSE="flash oslec"
+
+DEPEND=""
+RDEPEND=""
+
+PATCHES=( "${WORKDIR}/dahdi-patchset" )
+
+CONFIG_CHECK="MODULES ~CRC_CCITT"
+
+pkg_pretend() {
+ use oslec && CONFIG_CHECK+=" ECHO"
+ check_extra_config
+}
+
+src_unpack() {
+ unpack ${A}
+ # Copy the firmware tarballs over, the makefile will try and download them otherwise
+ for file in ${A} ; do
+ [[ "${file}" = dahdi-fw* ]] || continue
+ cp "${DISTDIR}"/${file} "${MY_P}"/drivers/dahdi/firmware/ ||
+ die "Error copying ${file} to ${S}/${MY_P}/drivers/dahdi/firmware/"
+ done
+ # But without the .bin's it'll still fall over and die, so copy those too.
+ mv *.bin "${MY_P}"/drivers/dahdi/firmware/ ||
+ die "Error moving firmware files into the right folders."
+
+ for drv in ${JNET_DRIVERS}; do
+ ln "${WORKDIR}/jnet-dahdi-drivers-${JNET}/${drv}/${drv}.c" "${MY_P}/drivers/dahdi/" ||
+ die "Error linking ${drv}.c from jnet to DAHDI."
+ ln "${WORKDIR}/jnet-dahdi-drivers-${JNET}/${drv}/${drv}.h" "${MY_P}/drivers/dahdi/" ||
+ die "Error linking ${drv}.h from jnet to DAHDI."
+ done
+}
+
+src_prepare() {
+ if use flash; then
+ sed -i -e "s:/\* #define FXSFLASH \*/:#define FXSFLASH:" include/dahdi/dahdi_config.h ||
+ die "Failed to define FXSFLASH"
+ sed -i -e "s:/\* #define SHORT_FLASH_TIME \*/:#define SHORT_FLASH_TIME:" \
+ include/dahdi/dahdi_config.h || die "Failed to define SHORT_FLASH_TIME"
+ fi
+ if use oslec; then
+ sed -i -e 's:^#include .*oslec[.]h:#include "/usr/src/linux/drivers/misc/echo/oslec.h:' \
+ drivers/dahdi/dahdi_echocan_oslec.c || die "Failed to prepare oslec source files."
+ fi
+ default
+}
+
+src_compile() {
+ unset ARCH
+ emake V=1 CC="$(tc-getCC)" LD="$(tc-getLD)" KSRC="${KV_OUT_DIR}" \
+ DAHDI_MODULES_EXTRA="${JNET_DRIVERS// /.o }.o$(usex oslec " dahdi_echocan_oslec.o" "")" \
+ LDFLAGS="$(raw-ldflags)" all
+}
+
+src_install() {
+ einfo "Installing kernel module"
+ emake V=1 CC="$(tc-getCC)" LD="$(tc-getLD)" KSRC="${KV_OUT_DIR}" DESTDIR="${D}" \
+ DAHDI_MODULES_EXTRA="${JNET_DRIVERS// /.o }.o$(usex oslec " dahdi_echocan_oslec.o" "")" \
+ LDFLAGS="$(raw-ldflags)" install
+
+ rm -r "${ED}"/lib/modules/*/modules.* || die "Error removing bogus modules"
+}