yggdrasil-go-0.4.0.ebuild 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. # Copyright 2021 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=7
  4. inherit go-module linux-info systemd fcaps
  5. EGO_SUM=(
  6. "github.com/Arceliar/ironwood v0.0.0-20210619124114-6ad55cae5031"
  7. "github.com/Arceliar/ironwood v0.0.0-20210619124114-6ad55cae5031/go.mod"
  8. "github.com/Arceliar/phony v0.0.0-20210209235338-dde1a8dca979"
  9. "github.com/Arceliar/phony v0.0.0-20210209235338-dde1a8dca979/go.mod"
  10. "github.com/VividCortex/ewma v1.1.1/go.mod"
  11. "github.com/VividCortex/ewma v1.2.0"
  12. "github.com/VividCortex/ewma v1.2.0/go.mod"
  13. "github.com/cheggaaa/pb/v3 v3.0.8"
  14. "github.com/cheggaaa/pb/v3 v3.0.8/go.mod"
  15. "github.com/fatih/color v1.10.0/go.mod"
  16. "github.com/fatih/color v1.12.0"
  17. "github.com/fatih/color v1.12.0/go.mod"
  18. "github.com/gologme/log v1.2.0"
  19. "github.com/gologme/log v1.2.0/go.mod"
  20. "github.com/hashicorp/go-syslog v1.0.0"
  21. "github.com/hashicorp/go-syslog v1.0.0/go.mod"
  22. "github.com/hjson/hjson-go v3.1.0+incompatible"
  23. "github.com/hjson/hjson-go v3.1.0+incompatible/go.mod"
  24. "github.com/kardianos/minwinsvc v1.0.0"
  25. "github.com/kardianos/minwinsvc v1.0.0/go.mod"
  26. "github.com/lxn/walk v0.0.0-20210112085537-c389da54e794/go.mod"
  27. "github.com/lxn/win v0.0.0-20210218163916-a377121e959e/go.mod"
  28. "github.com/mattn/go-colorable v0.1.8"
  29. "github.com/mattn/go-colorable v0.1.8/go.mod"
  30. "github.com/mattn/go-isatty v0.0.12/go.mod"
  31. "github.com/mattn/go-isatty v0.0.13"
  32. "github.com/mattn/go-isatty v0.0.13/go.mod"
  33. "github.com/mattn/go-runewidth v0.0.12/go.mod"
  34. "github.com/mattn/go-runewidth v0.0.13"
  35. "github.com/mattn/go-runewidth v0.0.13/go.mod"
  36. "github.com/mitchellh/mapstructure v1.4.1"
  37. "github.com/mitchellh/mapstructure v1.4.1/go.mod"
  38. "github.com/rivo/uniseg v0.1.0/go.mod"
  39. "github.com/rivo/uniseg v0.2.0"
  40. "github.com/rivo/uniseg v0.2.0/go.mod"
  41. "github.com/vishvananda/netlink v1.1.0"
  42. "github.com/vishvananda/netlink v1.1.0/go.mod"
  43. "github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod"
  44. "github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f"
  45. "github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f/go.mod"
  46. "golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod"
  47. "golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod"
  48. "golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod"
  49. "golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf/go.mod"
  50. "golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a"
  51. "golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod"
  52. "golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod"
  53. "golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod"
  54. "golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod"
  55. "golang.org/x/net v0.0.0-20210610132358-84b48f89b13b"
  56. "golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod"
  57. "golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod"
  58. "golang.org/x/sys v0.0.0-20190606203320-7fc4e5ec1444/go.mod"
  59. "golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod"
  60. "golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod"
  61. "golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod"
  62. "golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod"
  63. "golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod"
  64. "golang.org/x/sys v0.0.0-20201018230417-eeed37f84f13/go.mod"
  65. "golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod"
  66. "golang.org/x/sys v0.0.0-20210309040221-94ec62e08169/go.mod"
  67. "golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod"
  68. "golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod"
  69. "golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod"
  70. "golang.org/x/sys v0.0.0-20210611083646-a4fc73990273"
  71. "golang.org/x/sys v0.0.0-20210611083646-a4fc73990273/go.mod"
  72. "golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod"
  73. "golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod"
  74. "golang.org/x/text v0.3.0/go.mod"
  75. "golang.org/x/text v0.3.3/go.mod"
  76. "golang.org/x/text v0.3.6/go.mod"
  77. "golang.org/x/text v0.3.7-0.20210503195748-5c7c50ebbd4f"
  78. "golang.org/x/text v0.3.7-0.20210503195748-5c7c50ebbd4f/go.mod"
  79. "golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod"
  80. "golang.zx2c4.com/wireguard v0.0.0-20210510202332-9844c74f67ec/go.mod"
  81. "golang.zx2c4.com/wireguard v0.0.0-20210604143328-f9b48a961cd2"
  82. "golang.zx2c4.com/wireguard v0.0.0-20210604143328-f9b48a961cd2/go.mod"
  83. "golang.zx2c4.com/wireguard/windows v0.3.14"
  84. "golang.zx2c4.com/wireguard/windows v0.3.14/go.mod"
  85. )
  86. go-module_set_globals
  87. DESCRIPTION="An experiment in scalable routing as an encrypted IPv6 overlay network"
  88. HOMEPAGE="https://yggdrasil-network.github.io/"
  89. SRC_URI="
  90. https://github.com/${PN%%-*}-network/${PN}/archive/v${PV}.tar.gz
  91. -> ${P}.tar.gz
  92. ${EGO_SUM_SRC_URI}
  93. "
  94. LICENSE="LGPL-3 MIT Apache-2.0 BSD ZLIB"
  95. SLOT="0"
  96. KEYWORDS="amd64 arm arm64 ppc64 ~riscv ~s390 x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris"
  97. IUSE="+static"
  98. RESTRICT="mirror"
  99. RDEPEND="
  100. acct-user/${PN%-*}
  101. acct-group/${PN%-*}
  102. "
  103. FILECAPS=(
  104. cap_net_admin,cap_net_raw+eip "usr/bin/${PN%-*}"
  105. )
  106. pkg_setup() {
  107. linux-info_pkg_setup
  108. if ! linux_config_exists; then
  109. eerror "Unable to check your kernel for TUN support"
  110. else
  111. CONFIG_CHECK="~TUN"
  112. ERROR_TUN="Your kernel lacks TUN support."
  113. fi
  114. }
  115. go_info() {
  116. set -- go build -v -x "${@:?}"
  117. einfo "${*}"
  118. "${@}" || die
  119. }
  120. src_compile() {
  121. local cmd=''
  122. local src="github.com/yggdrasil-network/yggdrasil-go/src/version"
  123. local ldflags="-X ${src}.buildName=${P} -X ${src}.buildVersion=v${PV}"
  124. use static && {
  125. export CGO_ENABLED=0
  126. ldflags+=' -extldflags "-static"'
  127. }
  128. for cmd in "${PN%-*}"{,ctl}; do
  129. go_info -ldflags="${ldflags}" -o "${cmd}" "./cmd/${cmd}"
  130. done
  131. }
  132. src_install() {
  133. dobin yggdrasil{,ctl}
  134. systemd_dounit "contrib/systemd/${PN%-*}.service"
  135. doinitd "contrib/openrc/${PN%-*}"
  136. einstalldocs
  137. }
  138. pkg_postinst() {
  139. local issue=''
  140. fcaps_pkg_postinst
  141. einfo "runit service: https://notabug.org/dm9pZCAq/etcfiles/src/master/sv/${PN%-*}"
  142. einfo "which can run ${PN%-*} as non-root user"
  143. einfo "you can see how it's done there to do so for yours init system"
  144. einfo 'contributing patches here to do so for systemd and openrc are appreciated'
  145. einfo
  146. einfo 'also, related upstream issues:'
  147. for issue in 8{0{2..4},16}; do
  148. einfo " > https://github.com/yggdrasil-network/yggdrasil-go/issues/${issue}"
  149. done
  150. }