Files
packages/net/coredns/Makefile
T
Alexandru Ardelean 3b680cc166 coredns: fix netlink compat for wgsd plugin
wgsd (WireGuard Service Discovery plugin) pulls in
golang.zx2c4.com/wireguard/wgctrl -> mdlayher/genetlink v1.2.0 ->
mdlayher/netlink v1.6.2. This version of netlink calls
mdlayher/socket's Sendmsg/Recvmsg with the old API signatures
(pre-context.Context, single-return-value Sendmsg), but coredns
itself requires mdlayher/socket v0.5.1 which changed these
signatures to include context.Context and return (int, error).

Add a go get step that upgrades netlink to v1.7.2 after the wgsd
plugin dependencies are pulled in, ensuring the build uses a
netlink version compatible with socket v0.5.x.

Should fix:
  https://downloads.openwrt.org/snapshots/faillogs/i386_pentium-mmx/packages/coredns/compile.txt

```
../../../../../dl/go-mod-cache/github.com/mdlayher/netlink@v1.6.2/conn_linux.go:105:9: too many return values
	have (int, error)
	want (error)
../../../../../dl/go-mod-cache/github.com/mdlayher/netlink@v1.6.2/conn_linux.go:105:35: not enough arguments in call to c.s.Sendmsg
	have ([]byte, nil, *"golang.org/x/sys/unix".SockaddrNetlink, number)
	want (context.Context, []byte, []byte, "golang.org/x/sys/unix".Sockaddr, int)
../../../../../dl/go-mod-cache/github.com/mdlayher/netlink@v1.6.2/conn_linux.go:116:9: too many return values
	have (int, error)
	want (error)
../../../../../dl/go-mod-cache/github.com/mdlayher/netlink@v1.6.2/conn_linux.go:116:33: not enough arguments in call to c.s.Sendmsg
	have ([]byte, nil, *"golang.org/x/sys/unix".SockaddrNetlink, number)
	want (context.Context, []byte, []byte, "golang.org/x/sys/unix".Sockaddr, int)
../../../../../dl/go-mod-cache/github.com/mdlayher/netlink@v1.6.2/conn_linux.go:127:42: not enough arguments in call to c.s.Recvmsg
	have ([]byte, nil, number)
	want (context.Context, []byte, []byte, int)
../../../../../dl/go-mod-cache/github.com/mdlayher/netlink@v1.6.2/conn_linux.go:142:41: not enough arguments in call to c.s.Recvmsg
	have ([]byte, nil, number)
	want (context.Context, []byte, []byte, int)
github.com/aws/aws-sdk-go-v2/aws/protocol/query
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding
github.com/aws/smithy-go/private/requestcompression
```

Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
2026-04-29 06:42:29 +03:00

123 lines
4.1 KiB
Makefile

include $(TOPDIR)/rules.mk
PKG_NAME:=coredns
PKG_VERSION:=1.14.3
PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/coredns/coredns.git
PKG_MIRROR_HASH:=9d4304f736454b719a55c910a3b906010be51c1a4adba67f9fde23394ffdba41
PKG_SOURCE_VERSION:=v$(PKG_VERSION)
PKG_LICENSE:=Apache-2.0
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Vladimir Ermakov <vooon341@gmail.com>
PKG_CPE_ID:=cpe:/a:coredns.io:coredns
PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1
PKG_BUILD_FLAGS:=no-mips16
GO_PKG:=github.com/coredns/coredns
GO_PKG_EXCLUDES:=test
GO_PKG_LDFLAGS_X:= \
github.com/coredns/coredns/coremain.GitCommit=v$(PKG_VERSION) \
github.com/coredns/coredns/coremain.gitTag=v$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
include ../../lang/golang/golang-package.mk
define Package/coredns
SECTION:=net
CATEGORY:=Network
SUBMENU:=IP Addresses and Names
TITLE:=CoreDNS
URL:=https://coredns.io
DEPENDS:=$(GO_ARCH_DEPENDS) +COREDNS_PLUGIN_WGSD:kmod-wireguard
MENU:=1
endef
define Package/coredns/description
CoreDNS is a fast and flexible DNS server.
The key word here is flexible: with CoreDNS you are able to do what you want
with your DNS data by utilizing plugins.
endef
define Package/coredns/config
source "$(SOURCE)/Config.in"
endef
define Package/coredns/conffiles
/etc/config/coredns
/etc/Corefile
/etc/coredns/
endef
define configure-plugin
$(if $(filter y,$(1)),\
grep -q '^$(2):' "$(PKG_BUILD_DIR)/plugin.cfg" || echo "$(2):$(3)" >> "$(PKG_BUILD_DIR)/plugin.cfg",\
$(SED) '/^$(2):/d' "$(PKG_BUILD_DIR)/plugin.cfg")
endef
define Build/Configure
$(call GoPackage/Build/Configure,$(1))
# NOTE: allow to disable unneded heavy plugin
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_GEOIP),geoip,geoip)
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_TLS),tls,tls)
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_QUIC),quic,quic)
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_ROUTE53),route53,route53)
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_AZURE),azure,azure)
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_CLOUDDNS),clouddns,clouddns)
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_K8S_EXTERNAL),k8s_external,k8s_external)
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_KUBERNETES),kubernetes,kubernetes)
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_ETCD),etcd,etcd)
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_GRPC),grpc,grpc)
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_PROXYPROTO),proxyproto,proxyproto)
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_ON),on,github.com/coredns/caddy/onevent)
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_NOMAD),nomad,nomad)
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_WGSD),wgsd,github.com/jwhited/wgsd)
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_NETBOX),netbox,github.com/oz123/coredns-netbox-plugin)
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_FANOUT),fanout,github.com/networkservicemesh/fanout)
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_FINALIZE),finalize,github.com/tmeckel/coredns-finalizer)
cd $(PKG_BUILD_DIR); \
$(GO_GENERAL_BUILD_CONFIG_VARS) \
$(GO_PKG_BUILD_CONFIG_VARS) \
go generate coredns.go
# NOTE: custom plugins needs go get to pull new dependencies
ifeq ($(CONFIG_COREDNS_REQUIRE_GO_GET),y)
cd $(PKG_BUILD_DIR); \
$(GO_GENERAL_BUILD_CONFIG_VARS) \
$(GO_PKG_BUILD_CONFIG_VARS) \
$(GO_PKG_VARS) \
go get ./...
endif
ifeq ($(CONFIG_COREDNS_PLUGIN_WGSD),y)
# wgsd -> wgctrl -> genetlink -> netlink v1.6.2 is incompatible with
# socket v0.5.x (Sendmsg/Recvmsg gained context.Context); pin to v1.7.2
cd $(PKG_BUILD_DIR); \
$(GO_GENERAL_BUILD_CONFIG_VARS) \
$(GO_PKG_BUILD_CONFIG_VARS) \
$(GO_PKG_VARS) \
go get github.com/mdlayher/netlink@v1.7.2
endif
endef
define Package/coredns/install
$(call GoPackage/Package/Install/Bin,$(1))
$(INSTALL_DIR) $(1)/etc/
$(INSTALL_CONF) $(CURDIR)/files/Corefile $(1)/etc/Corefile
$(INSTALL_DIR) $(1)/etc/config/
$(INSTALL_CONF) $(CURDIR)/files/coredns.conf $(1)/etc/config/coredns
$(INSTALL_DIR) $(1)/etc/init.d/
$(INSTALL_BIN) $(CURDIR)/files/coredns.init $(1)/etc/init.d/coredns
$(INSTALL_DIR) $(1)/etc/coredns/zones/
endef
$(eval $(call BuildPackage,coredns))