n2n/packages/openwrt/Makefile

101 lines
2.4 KiB
Makefile
Raw Normal View History

2019-07-06 18:40:23 +02:00
#
2021-03-30 13:17:46 +02:00
# Copyright (C) 2021 - ntop.org and contributors
2019-07-06 18:40:23 +02:00
#
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
2021-11-18 22:28:50 +01:00
PKG_VERSION:=HEAD
2019-07-06 18:40:23 +02:00
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
2021-11-18 22:28:50 +01:00
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
2019-07-06 18:40:23 +02:00
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
2021-06-18 12:46:48 +02:00
DEPENDS+=+libcap
2019-07-06 18:40:23 +02:00
endef
define Package/n2n-edge
$(call Package/n2n/Default)
TITLE+= client (edge node)
2021-06-14 16:15:49 +02:00
DEPENDS+=+kmod-tun
2019-07-06 18:40:23 +02:00
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
2021-11-18 22:28:50 +01:00
( cd $(PKG_BUILD_DIR); \
./autogen.sh; \
LDFLAGS=--static ./configure )
2019-07-06 18:40:23 +02:00
endef
define Package/n2n-edge/conffiles
/etc/n2n/edge.conf
2019-07-06 18:40:23 +02:00
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
2019-07-06 18:40:23 +02:00
endef
define Package/n2n-supernode/conffiles
/etc/n2n/supernode.conf
2019-07-06 18:40:23 +02:00
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
2019-07-06 18:40:23 +02:00
endef
$(eval $(call BuildPackage,n2n-edge))
$(eval $(call BuildPackage,n2n-supernode))