You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
2.4 KiB

#
# Copyright (C) 2021 - ntop.org and contributors
#
include $(TOPDIR)/rules.mk
PKG_NAME:=n2n
Update Openwrt process (#900) * First attempt at a openwrt CI * Fix action - helps if I dont forget the syntax half way through writing it * Try building /this/ branch for the openwrt CI * Try a build with openssl configured * Dont enable the n2n package until we have built the environment - makes errors easier to see and clearly related to n2n * Attempt to speed up the openwrt build * Upload any created ipkg packages * Dont test with openssl for the moment * Attempt to speed up openwrt build using a cache of the build dir * The make defconfig run turns all the built binaries stale, so stop caching them. Also use a real ref for the cache key * Minor text name changes * Address yamllint concerns * Attempt to simplify and document missing parts of the openwrt makefile * Attempt to fix mystery openwrt make error * Rename build job name * Avoid nested checkouts, use two separate dirs for the two checkouts in this build * Move the n2n checkout to earler, allowing us to skip one defconfig run * We are going to need working tags from the n2n repo, so ensure we unbreak the github checkout braindamage * Calculate and save the n2n version string * Prepare the way to pass the correct external vars into the openwrt build * Hook calculated build variables into the openwrt package definition * Update artifacts source to match moved checkout dir * Pass env vars in to the make * Allow version script to be influenced by external vars * It will help if I use the same variable names everywhere * Add more version variable calculation overrides * Configure openwrt to use the external git checkout instead of their create-tar-then-extract dance * Using the correct syntax for ifdef will help significantly * Use as many jobs as we have cpus * As the USE_SOURCE_DIR option allows us to use a full git checkout, we do not need to hack the version.sh to allow overrides * Ensure scripts/version.sh works from anywhere * Remove unneeded variables * Update openwrt build documentation to match the new build process * Catch failure to cd as per shellcheck suggestion * Limit lengthy openwrt builds to manual triggers or on a release * Also run on specially named branches * Break list into separate lines for easier future editing
3 years ago
PKG_VERSION:=HEAD
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
Update Openwrt process (#900) * First attempt at a openwrt CI * Fix action - helps if I dont forget the syntax half way through writing it * Try building /this/ branch for the openwrt CI * Try a build with openssl configured * Dont enable the n2n package until we have built the environment - makes errors easier to see and clearly related to n2n * Attempt to speed up the openwrt build * Upload any created ipkg packages * Dont test with openssl for the moment * Attempt to speed up openwrt build using a cache of the build dir * The make defconfig run turns all the built binaries stale, so stop caching them. Also use a real ref for the cache key * Minor text name changes * Address yamllint concerns * Attempt to simplify and document missing parts of the openwrt makefile * Attempt to fix mystery openwrt make error * Rename build job name * Avoid nested checkouts, use two separate dirs for the two checkouts in this build * Move the n2n checkout to earler, allowing us to skip one defconfig run * We are going to need working tags from the n2n repo, so ensure we unbreak the github checkout braindamage * Calculate and save the n2n version string * Prepare the way to pass the correct external vars into the openwrt build * Hook calculated build variables into the openwrt package definition * Update artifacts source to match moved checkout dir * Pass env vars in to the make * Allow version script to be influenced by external vars * It will help if I use the same variable names everywhere * Add more version variable calculation overrides * Configure openwrt to use the external git checkout instead of their create-tar-then-extract dance * Using the correct syntax for ifdef will help significantly * Use as many jobs as we have cpus * As the USE_SOURCE_DIR option allows us to use a full git checkout, we do not need to hack the version.sh to allow overrides * Ensure scripts/version.sh works from anywhere * Remove unneeded variables * Update openwrt build documentation to match the new build process * Catch failure to cd as per shellcheck suggestion * Limit lengthy openwrt builds to manual triggers or on a release * Also run on specially named branches * Break list into separate lines for easier future editing
3 years ago
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
# These are defaults for compiling without any environmental overrides
# (eg, the github action calculates the correct overrides for each build)
PKG_SOURCE_URL:=https://github.com/ntop/n2n
PKG_SOURCE_VERSION:=dev
PKG_MIRROR_HASH:=skip
# Apply overrides from the build environment
ifdef N2N_PKG_SOURCE_URL
PKG_SOURCE_URL:=$(N2N_PKG_SOURCE_URL)
endif
ifdef N2N_PKG_SOURCE_VERSION
PKG_SOURCE_VERSION:=$(N2N_PKG_SOURCE_VERSION)
endif
ifdef N2N_PKG_VERSION
PKG_VERSION:=$(N2N_PKG_VERSION)
endif
PKG_MAINTAINER:=Emanuele Faranda <faranda@ntop.org>
PKG_LICENSE:=GPL3
# autogen fix
PKG_FIXUP:=autoreconf
include $(INCLUDE_DIR)/package.mk
define Package/n2n/Default
SECTION:=net
CATEGORY:=Network
TITLE:=N2N Peer-to-peer VPN
URL:=http://www.ntop.org/n2n
SUBMENU:=VPN
DEPENDS+=+libcap
endef
define Package/n2n-edge
$(call Package/n2n/Default)
TITLE+= client (edge node)
DEPENDS+=+kmod-tun
endef
define Package/n2n-supernode
$(call Package/n2n/Default)
TITLE+= server (supernode)
endef
define Package/n2n-edge/description
The client node for the N2N infrastructure
endef
define Package/n2n-supernode/description
The supernode for the N2N infrastructure
endef
define Build/Configure
Update Openwrt process (#900) * First attempt at a openwrt CI * Fix action - helps if I dont forget the syntax half way through writing it * Try building /this/ branch for the openwrt CI * Try a build with openssl configured * Dont enable the n2n package until we have built the environment - makes errors easier to see and clearly related to n2n * Attempt to speed up the openwrt build * Upload any created ipkg packages * Dont test with openssl for the moment * Attempt to speed up openwrt build using a cache of the build dir * The make defconfig run turns all the built binaries stale, so stop caching them. Also use a real ref for the cache key * Minor text name changes * Address yamllint concerns * Attempt to simplify and document missing parts of the openwrt makefile * Attempt to fix mystery openwrt make error * Rename build job name * Avoid nested checkouts, use two separate dirs for the two checkouts in this build * Move the n2n checkout to earler, allowing us to skip one defconfig run * We are going to need working tags from the n2n repo, so ensure we unbreak the github checkout braindamage * Calculate and save the n2n version string * Prepare the way to pass the correct external vars into the openwrt build * Hook calculated build variables into the openwrt package definition * Update artifacts source to match moved checkout dir * Pass env vars in to the make * Allow version script to be influenced by external vars * It will help if I use the same variable names everywhere * Add more version variable calculation overrides * Configure openwrt to use the external git checkout instead of their create-tar-then-extract dance * Using the correct syntax for ifdef will help significantly * Use as many jobs as we have cpus * As the USE_SOURCE_DIR option allows us to use a full git checkout, we do not need to hack the version.sh to allow overrides * Ensure scripts/version.sh works from anywhere * Remove unneeded variables * Update openwrt build documentation to match the new build process * Catch failure to cd as per shellcheck suggestion * Limit lengthy openwrt builds to manual triggers or on a release * Also run on specially named branches * Break list into separate lines for easier future editing
3 years ago
( cd $(PKG_BUILD_DIR); \
./autogen.sh; \
./configure )
endef
define Package/n2n-edge/conffiles
/etc/n2n/edge.conf
endef
define Package/n2n-edge/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/edge $(1)/usr/bin/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) $(PKG_BUILD_DIR)/packages/openwrt/etc/init.d/edge $(1)/etc/init.d/edge
$(INSTALL_DIR) $(1)/etc/n2n
$(INSTALL_CONF) $(PKG_BUILD_DIR)/packages/etc/n2n/edge.conf.sample $(1)/etc/n2n/edge.conf
endef
define Package/n2n-supernode/conffiles
/etc/n2n/supernode.conf
endef
define Package/n2n-supernode/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/supernode $(1)/usr/bin/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) $(PKG_BUILD_DIR)/packages/openwrt/etc/init.d/supernode $(1)/etc/init.d/supernode
$(INSTALL_DIR) $(1)/etc/n2n
$(INSTALL_CONF) $(PKG_BUILD_DIR)/packages/etc/n2n/supernode.conf.sample $(1)/etc/n2n/supernode.conf
endef
$(eval $(call BuildPackage,n2n-edge))
$(eval $(call BuildPackage,n2n-supernode))