bb5d6141523512da462fea70a0f2fbc9858255e1
[feed/packages.git] / net / nebula / Makefile
1 # Copyright 2021-2023 Stan Grishin (stangri@melmac.ca)
2 # This is free software, licensed under the MIT License.
3
4 include $(TOPDIR)/rules.mk
5
6 PKG_NAME:=nebula
7 PKG_VERSION:=1.8.2
8 PKG_RELEASE:=1
9
10 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
11 PKG_SOURCE_URL:=https://codeload.github.com/slackhq/nebula/tar.gz/v$(PKG_VERSION)?
12 PKG_HASH:=203713c58d0ec8a10df2f605af791a77a33f825454911ac3a5313ced591547fd
13
14 PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca>
15 PKG_LICENSE:=MIT
16 PKG_LICENSE_FILES:=LICENSE
17
18 PKG_BUILD_DEPENDS:=golang/host
19 PKG_BUILD_PARALLEL:=1
20 PKG_BUILD_FLAGS:=no-mips16
21
22 GO_PKG:=github.com/slackhq/nebula
23 GO_PKG_BUILD_PKG:= \
24 github.com/slackhq/nebula/cmd/nebula \
25 github.com/slackhq/nebula/cmd/nebula-cert
26 GO_PKG_LDFLAGS_X:=\
27 main.Build=$(PKG_VERSION)
28
29 include $(INCLUDE_DIR)/package.mk
30 include ../../lang/golang/golang-package.mk
31
32 define Package/nebula
33 SECTION:=net
34 CATEGORY:=Network
35 TITLE:=nebula
36 URL:=https://docs.openwrt.melmac.net/nebula/
37 DEPENDS:=$(GO_ARCH_DEPENDS) +kmod-tun
38 endef
39
40 define Package/nebula-cert
41 SECTION:=net
42 CATEGORY:=Network
43 TITLE:=nebula-cert
44 URL:=https://docs.openwrt.melmac.net/nebula/
45 DEPENDS:=$(GO_ARCH_DEPENDS)
46 endef
47
48 define Package/nebula-proto
49 SECTION:=net
50 CATEGORY:=Network
51 TITLE:=nebula-proto
52 URL:=https://docs.openwrt.melmac.net/nebula/
53 DEPENDS:=nebula
54 DEPENDS+=+!BUSYBOX_DEFAULT_AWK:gawk
55 DEPENDS+=+!BUSYBOX_DEFAULT_GREP:grep
56 DEPENDS+=+!BUSYBOX_DEFAULT_SED:sed
57 PKGARCH:=all
58 endef
59
60 define Package/nebula-service
61 SECTION:=net
62 CATEGORY:=Network
63 TITLE:=nebula-service
64 URL:=https://docs.openwrt.melmac.net/nebula/
65 DEPENDS:=nebula
66 DEPENDS+=+!BUSYBOX_DEFAULT_AWK:gawk
67 DEPENDS+=+!BUSYBOX_DEFAULT_SED:sed
68 CONFLICTS:=nebula-proto
69 PKGARCH:=all
70 endef
71
72 define Build/Compile
73 $(call GoPackage/Build/Compile)
74 endef
75
76 define Package/nebula/description
77 Nebula is a scalable overlay networking tool with a focus on performance, simplicity
78 and security. It lets you seamlessly connect computers anywhere in the world.
79 This package contains only nebula binary. Unless you want to start nebula manually,
80 you may want to also install *either* 'nebula-service' *or* 'nebula-proto' package.
81 endef
82
83 define Package/nebula-cert/description
84 Nebula is a scalable overlay networking tool with a focus on performance, simplicity
85 and security. It lets you seamlessly connect computers anywhere in the world.
86 This package contains only nebula-cert binary.
87 endef
88
89 define Package/nebula-proto/description
90 Nebula is a scalable overlay networking tool with a focus on performance, simplicity
91 and security. It lets you seamlessly connect computers anywhere in the world.
92 This package contains only OpenWrt protocol/interface support for nebula.
93 endef
94
95 define Package/nebula-service/description
96 Nebula is a scalable overlay networking tool with a focus on performance, simplicity
97 and security. It lets you seamlessly connect computers anywhere in the world.
98 This package contains only OpenWrt-specific init.d script for nebula.
99 endef
100
101 define Package/nebula/install
102 $(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
103 $(INSTALL_DIR) $(1)/usr/sbin
104 $(INSTALL_DIR) $(1)/lib/upgrade/keep.d
105 $(INSTALL_DIR) $(1)/usr/share/doc/nebula
106 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/nebula $(1)/usr/sbin/
107 $(INSTALL_DATA) $(PKG_BUILD_DIR)/LICENSE $(1)/usr/share/doc/nebula/LICENSE
108 $(INSTALL_DATA) ./files/nebula.upgrade $(1)/lib/upgrade/keep.d/nebula
109 endef
110
111 define Package/nebula-cert/install
112 $(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
113 $(INSTALL_DIR) $(1)/usr/sbin
114 $(INSTALL_DIR) $(1)/lib/upgrade/keep.d
115 $(INSTALL_DIR) $(1)/usr/share/doc/nebula-cert
116 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/nebula-cert $(1)/usr/sbin/
117 $(INSTALL_DATA) $(PKG_BUILD_DIR)/LICENSE $(1)/usr/share/doc/nebula-cert/LICENSE
118 $(INSTALL_DATA) ./files/nebula.upgrade $(1)/lib/upgrade/keep.d/nebula-cert
119 endef
120
121 define Package/nebula-proto/install
122 $(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
123 $(INSTALL_DIR) $(1)/lib/netifd/proto
124 $(INSTALL_BIN) ./files/nebula.proto $(1)/lib/netifd/proto/nebula.sh
125 $(SED) "s|^\(readonly PKG_VERSION\).*|\1='$(PKG_VERSION)-$(PKG_RELEASE)'|" $(1)/lib/netifd/proto/nebula.sh
126 endef
127
128 define Package/nebula-service/install
129 $(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
130 $(INSTALL_DIR) $(1)/etc/init.d
131 $(INSTALL_BIN) ./files/nebula.init $(1)/etc/init.d/nebula
132 $(SED) "s|^\(readonly PKG_VERSION\).*|\1='$(PKG_VERSION)-$(PKG_RELEASE)'|" $(1)/etc/init.d/nebula
133 endef
134
135 $(eval $(call GoBinPackage,nebula))
136 $(eval $(call BuildPackage,nebula))
137
138 $(eval $(call GoBinPackage,nebula-cert))
139 $(eval $(call BuildPackage,nebula-cert))
140
141 $(eval $(call BuildPackage,nebula-proto))
142
143 $(eval $(call BuildPackage,nebula-service))