public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Jason Donenfeld" <zx2c4@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: net-misc/wireguard/
Date: Wed,  2 Nov 2016 11:32:20 +0000 (UTC)	[thread overview]
Message-ID: <1478086339.2eacdb091f9a5d84db6413d83e9a1a9a35f88dbf.zx2c4@gentoo> (raw)

commit:     2eacdb091f9a5d84db6413d83e9a1a9a35f88dbf
Author:     Jason A. Donenfeld <zx2c4 <AT> gentoo <DOT> org>
AuthorDate: Wed Nov  2 11:31:36 2016 +0000
Commit:     Jason Donenfeld <zx2c4 <AT> gentoo <DOT> org>
CommitDate: Wed Nov  2 11:32:19 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2eacdb09

net-misc/wireguard: add kmod-src option

Package-Manager: portage-2.3.2

 net-misc/wireguard/metadata.xml                  |  4 ++++
 net-misc/wireguard/wireguard-0.0.20161102.ebuild | 24 ++++++++++++++++++++----
 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 915f002..aa8747f 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 642325b..b6e88c4 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 642325b..b6e88c4 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"


             reply	other threads:[~2016-11-02 11:32 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-02 11:32 Jason Donenfeld [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-02-23 15:31 [gentoo-commits] repo/gentoo:master commit in: net-misc/wireguard/ Jason Donenfeld
2017-02-14 11:01 Jason Donenfeld
2017-02-13 21:09 Jason Donenfeld
2017-01-15 12:20 Jason Donenfeld
2017-01-05  3:03 Jason Donenfeld
2017-01-04 19:54 Jason Donenfeld
2016-12-30 17:06 Jason Donenfeld
2016-12-23 20:17 Jason Donenfeld
2016-12-18 17:40 Jason Donenfeld
2016-12-16 16:16 Jason Donenfeld
2016-12-09 21:00 Jason Donenfeld
2016-12-06 18:55 Jason Donenfeld
2016-11-29 22:19 Jason Donenfeld
2016-11-16 20:50 Jason Donenfeld
2016-11-16 15:58 Jason Donenfeld
2016-11-10 20:37 Jason Donenfeld
2016-11-07 13:42 Jason Donenfeld
2016-11-06  1:59 Jason Donenfeld
2016-11-04 16:03 Jason Donenfeld
2016-11-03 10:51 Jason Donenfeld
2016-11-02 11:36 Jason Donenfeld
2016-11-02 10:57 Jason Donenfeld
2016-10-25 13:13 Aaron Bauman
2016-10-14 16:07 Jason Donenfeld
2016-09-30 23:36 Jason Donenfeld
2016-08-08 16:01 Jason Donenfeld
2016-07-26 15:15 Jason Donenfeld
2016-07-25 23:16 Jason Donenfeld
2016-07-22 19:20 Jason Donenfeld
2016-07-21  9:46 Jason Donenfeld
2016-07-15 14:44 Jason Donenfeld
2016-07-11 10:21 Jason Donenfeld
2016-07-08 14:38 Jason Donenfeld
2016-07-08 11:45 Jason Donenfeld
2016-07-08 11:35 Jason Donenfeld
2016-07-01  2:48 Jason Donenfeld
2016-06-30 18:41 Jason Donenfeld
2016-06-30  2:19 Jason Donenfeld
2016-06-29 14:59 Jason Donenfeld
2016-06-29  2:43 Jason Donenfeld

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1478086339.2eacdb091f9a5d84db6413d83e9a1a9a35f88dbf.zx2c4@gentoo \
    --to=zx2c4@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox