yggdrasil-go-0.5.10.ebuild 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # Copyright 2021-2024 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=8
  4. inherit go-module linux-info systemd fcaps
  5. DESCRIPTION="An experiment in scalable routing as an encrypted IPv6 overlay network"
  6. HOMEPAGE="
  7. https://yggdrasil-network.github.io/
  8. https://github.com/yggdrasil-network/yggdrasil-go
  9. "
  10. SRC_URI="
  11. https://github.com/${PN%%-*}-network/${PN}/archive/v${PV/_rc/rc}.tar.gz -> ${P}.tar.gz
  12. https://github.com/dm9pZCAq/gentoo-go-deps/releases/download/${P}/${P}-deps.tar.xz
  13. "
  14. S="${WORKDIR}/${P/_rc/rc}"
  15. LICENSE="LGPL-3 MIT Apache-2.0 BSD ZLIB"
  16. SLOT="0"
  17. KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~s390 ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris"
  18. RDEPEND="
  19. acct-user/${PN%-*}
  20. acct-group/${PN%-*}
  21. "
  22. BDEPEND=">=dev-lang/go-1.21"
  23. FILECAPS=(
  24. cap_net_admin,cap_net_raw+eip "usr/bin/${PN%-*}"
  25. )
  26. pkg_setup() {
  27. linux-info_pkg_setup
  28. if ! linux_config_exists; then
  29. eerror "Unable to check your kernel for TUN support"
  30. else
  31. CONFIG_CHECK="~TUN"
  32. ERROR_TUN="Your kernel lacks TUN support."
  33. fi
  34. }
  35. src_compile() {
  36. local src_version="github.com/yggdrasil-network/yggdrasil-go/src/version"
  37. local cmd=''
  38. for cmd in "${PN%-*}"{,ctl}; do
  39. CGO_ENABLED=0 ego build -ldflags="
  40. -X ${src_version}.buildName=${P}
  41. -X ${src_version}.buildVersion=v${PV}
  42. -extldflags '-static'
  43. " -o "${cmd}" "./cmd/${cmd}"
  44. done
  45. }
  46. src_install() {
  47. dobin yggdrasil{,ctl}
  48. systemd_dounit "contrib/systemd/${PN%-*}.service"
  49. doinitd "contrib/openrc/${PN%-*}"
  50. einstalldocs
  51. }