# Copyright 1999-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 inherit git-r3 linux-info linux-mod-r1 DESCRIPTION="ncpfs kernel module for Linux 4.18+" HOMEPAGE=" https://github.com/EnzephaloN/ncpfs-module https://github.com/pasis/ipx " LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64" CONFIG_CHECK="NET" PATCHES=( "${FILESDIR}/ncpfs-module-readd-ipx.patch" ) NCPFS_REPO_URI="https://github.com/EnzephaloN/ncpfs-module.git" IPX_REPO_URI="https://github.com/pasis/ipx.git" pkg_setup() { linux-mod-r1_pkg_setup } src_unpack() { local ncpfs_branch="master" if kernel_is gt 4 18 0; then ncpfs_branch="kernel_4.19" fi if kernel_is gt 4 20 0; then ncpfs_branch="kernel_4.20" fi if kernel_is gt 5 2 0; then ncpfs_branch="kernel_5.2" fi if kernel_is gt 5 6 0; then ncpfs_branch="kernel_5.6" fi if kernel_is gt 5 12 0; then ncpfs_branch="kernel_5.12" fi if kernel_is gt 5 15 0; then ncpfs_branch="kernel_5.15" fi if kernel_is gt 5 19 0; then ncpfs_branch="kernel_5.19" fi if kernel_is gt 6 3 0; then ncpfs_branch="kernel_6.3" fi if kernel_is gt 6 5 0; then ncpfs_branch="kernel_6.5" fi if kernel_is gt 6 6 0; then ncpfs_branch="kernel_6.6" fi if kernel_is gt 6 8 0; then ncpfs_branch="kernel_6.8" fi if kernel_is gt 6 12 0; then ncpfs_branch="kernel_6.12" fi if kernel_is gt 6 14 0; then ncpfs_branch="kernel_6.14" fi if kernel_is gt 6 16 0; then ncpfs_branch="master" fi git-r3_fetch "${NCPFS_REPO_URI}" "refs/heads/${ncpfs_branch}" "${PN}-ncpfs" || die git-r3_checkout "${NCPFS_REPO_URI}" "${S}" "${PN}-ncpfs" || die git-r3_fetch "${IPX_REPO_URI}" "refs/heads/master" "${PN}-ipx" || die git-r3_checkout "${IPX_REPO_URI}" "${WORKDIR}/ipx" "${PN}-ipx" || die } src_prepare() { default mkdir -p "${S}/linux" "${S}/net" || die cp "${WORKDIR}/ipx/linux/ipx.h" "${S}/linux/ipx.h" || die cp "${WORKDIR}/ipx/net/ipx.h" "${S}/net/ipx.h" || die } src_compile() { local modlist=( ncpfs=ncpfs:${S}:${S}:all ) local modargs=( KDIR="${KV_OUT_DIR}" M="${S}" ) linux-mod-r1_src_compile } src_install() { linux-mod-r1_src_install }