diff options
author | Jason A. Donenfeld <zx2c4@gentoo.org> | 2016-11-02 12:31:36 +0100 |
---|---|---|
committer | Jason A. Donenfeld <zx2c4@gentoo.org> | 2016-11-02 12:32:19 +0100 |
commit | 2eacdb091f9a5d84db6413d83e9a1a9a35f88dbf (patch) | |
tree | 385824eca0169ec38aca7aadb3f3ae7ef45c55ec /net-misc/wireguard | |
parent | kde-frameworks/kcoreaddons: backport additional commits from upstream to reso... (diff) | |
download | gentoo-2eacdb091f9a5d84db6413d83e9a1a9a35f88dbf.tar.gz gentoo-2eacdb091f9a5d84db6413d83e9a1a9a35f88dbf.tar.bz2 gentoo-2eacdb091f9a5d84db6413d83e9a1a9a35f88dbf.zip |
net-misc/wireguard: add kmod-src option
Package-Manager: portage-2.3.2
Diffstat (limited to 'net-misc/wireguard')
-rw-r--r-- | net-misc/wireguard/metadata.xml | 4 | ||||
-rw-r--r-- | net-misc/wireguard/wireguard-0.0.20161102.ebuild | 24 | ||||
-rw-r--r-- | net-misc/wireguard/wireguard-9999.ebuild | 24 |
3 files changed, 44 insertions, 8 deletions
diff --git a/net-misc/wireguard/metadata.xml b/net-misc/wireguard/metadata.xml index 915f00227065..aa8747ffda2a 100644 --- a/net-misc/wireguard/metadata.xml +++ b/net-misc/wireguard/metadata.xml @@ -5,4 +5,8 @@ <email>zx2c4@gentoo.org</email> <name>Jason A. Donenfeld</name> </maintainer> + <use> + <flag name="kmod-src">Do not compile the kernel module. Instead install the kernel module source code to /usr/src/wireguard.</flag> + <flag name="debug">Enable verbose debug reporting in dmesg of various WireGuard peer and device information.</flag> + </use> </pkgmetadata> diff --git a/net-misc/wireguard/wireguard-0.0.20161102.ebuild b/net-misc/wireguard/wireguard-0.0.20161102.ebuild index 642325b241fb..b6e88c437892 100644 --- a/net-misc/wireguard/wireguard-0.0.20161102.ebuild +++ b/net-misc/wireguard/wireguard-0.0.20161102.ebuild @@ -21,7 +21,7 @@ fi LICENSE="GPL-2" SLOT="0" -IUSE="debug" +IUSE="debug kmod-src" DEPEND="net-libs/libmnl" RDEPEND="${DEPEND}" @@ -33,27 +33,43 @@ WARNING_PADATA="If you're running a multicore system you likely should enable CO WARNING_IP6_NF_IPTABLES="If your kernel has CONFIG_IPV6, you need CONFIG_IP6_NF_IPTABLES; otherwise WireGuard will not insert." pkg_setup() { + use kmod-src && return linux-mod_pkg_setup kernel_is -lt 4 1 0 && die "This version of ${PN} requires Linux >= 4.1" } src_compile() { use debug && BUILD_PARAMS="CONFIG_WIREGUARD_DEBUG=y ${BUILD_PARAMS}" - linux-mod_src_compile + use kmod-src || linux-mod_src_compile emake RUNSTATEDIR="${EPREFIX}/run" -C src/tools } src_install() { dodoc README.md dodoc -r contrib/examples - linux-mod_src_install emake DESTDIR="${D}" PREFIX="${EPREFIX}/usr" -C src/tools install + if use kmod-src; then + dodir /usr/src + rm -r "${WORKDIR}"/*/src/tools || die + mv "${WORKDIR}"/*/src "${ED}"usr/src/wireguard || die + else + linux-mod_src_install + fi insinto /$(get_libdir)/netifrc/net newins "${FILESDIR}"/wireguard-openrc.sh wireguard.sh } pkg_postinst() { - linux-mod_pkg_postinst + if use kmod-src; then + einfo + einfo "You have enabled the kmod-src USE flag. This means that sources" + einfo "are installed to ${ROOT}usr/src/wireguard instead of having the" + einfo "kernel module compiled. You will need to compile the module" + einfo "yourself. Most likely, you don't want this USE flag." + einfo + else + linux-mod_pkg_postinst + fi ewarn ewarn "This software is experimental and has not yet been released." ewarn "As such, it may contain significant issues. Please do not file" diff --git a/net-misc/wireguard/wireguard-9999.ebuild b/net-misc/wireguard/wireguard-9999.ebuild index 642325b241fb..b6e88c437892 100644 --- a/net-misc/wireguard/wireguard-9999.ebuild +++ b/net-misc/wireguard/wireguard-9999.ebuild @@ -21,7 +21,7 @@ fi LICENSE="GPL-2" SLOT="0" -IUSE="debug" +IUSE="debug kmod-src" DEPEND="net-libs/libmnl" RDEPEND="${DEPEND}" @@ -33,27 +33,43 @@ WARNING_PADATA="If you're running a multicore system you likely should enable CO WARNING_IP6_NF_IPTABLES="If your kernel has CONFIG_IPV6, you need CONFIG_IP6_NF_IPTABLES; otherwise WireGuard will not insert." pkg_setup() { + use kmod-src && return linux-mod_pkg_setup kernel_is -lt 4 1 0 && die "This version of ${PN} requires Linux >= 4.1" } src_compile() { use debug && BUILD_PARAMS="CONFIG_WIREGUARD_DEBUG=y ${BUILD_PARAMS}" - linux-mod_src_compile + use kmod-src || linux-mod_src_compile emake RUNSTATEDIR="${EPREFIX}/run" -C src/tools } src_install() { dodoc README.md dodoc -r contrib/examples - linux-mod_src_install emake DESTDIR="${D}" PREFIX="${EPREFIX}/usr" -C src/tools install + if use kmod-src; then + dodir /usr/src + rm -r "${WORKDIR}"/*/src/tools || die + mv "${WORKDIR}"/*/src "${ED}"usr/src/wireguard || die + else + linux-mod_src_install + fi insinto /$(get_libdir)/netifrc/net newins "${FILESDIR}"/wireguard-openrc.sh wireguard.sh } pkg_postinst() { - linux-mod_pkg_postinst + if use kmod-src; then + einfo + einfo "You have enabled the kmod-src USE flag. This means that sources" + einfo "are installed to ${ROOT}usr/src/wireguard instead of having the" + einfo "kernel module compiled. You will need to compile the module" + einfo "yourself. Most likely, you don't want this USE flag." + einfo + else + linux-mod_pkg_postinst + fi ewarn ewarn "This software is experimental and has not yet been released." ewarn "As such, it may contain significant issues. Please do not file" |