Skip to content

Instantly share code, notes, and snippets.

@beelze
Created March 19, 2024 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beelze/9c140972a0694855fc6e979ff861791c to your computer and use it in GitHub Desktop.
Save beelze/9c140972a0694855fc6e979ff861791c to your computer and use it in GitHub Desktop.
--- /etc/scripts/Makefile.unbound.orig 2024-03-16 17:20:55.255464840 +0500
+++ /mnt/bulk/openwrt-build/openwrt/feeds/packages/net/unbound/Makefile 2024-03-19 10:48:20.050069764 +0500
@@ -23,6 +23,7 @@
PKG_BUILD_PARALLEL:=1
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
+PYTHON3_PKG_BUILD:=0
PKG_CONFIG_DEPENDS:=CONFIG_PACKAGE_libunbound_dnscrypt \
CONFIG_PACKAGE_libunbound_ipset \
@@ -33,7 +34,10 @@
CONFIG_PACKAGE_libunbound_subnet \
CONFIG_PACKAGE_libunbound_dnstap
+PKG_BUILD_DEPENDS:=PACKAGE_libunbound_pythonmodule:swig/host
+
include $(INCLUDE_DIR)/package.mk
+include ../../lang/python/python3-package.mk
define Package/unbound/Default
SECTION:=net
@@ -136,7 +140,7 @@
default n
config PACKAGE_libunbound_ipset
bool "Build with IPSET (libmnl) support."
- default y
+ default n
config PACKAGE_libunbound_libevent
bool "Build with expanded network resource (libevent) support."
default y
@@ -160,6 +164,14 @@
CONFIGURE_VARS += UNAME=Linux
+ifneq ($(CONFIG_PACKAGE_libunbound_pythonmodule),)
+TARGET_LDFLAGS += -L$(PYTHON3_LIB_DIR)
+CONFIGURE_VARS += \
+ PYTHON="$(STAGING_DIR_HOSTPKG)/bin/$(PYTHON3)" \
+ PYTHON_LDFLAGS="-L$(PYTHON3_DIR)/lib -lpthread -ldl -lpython$(PYTHON3_VERSION)" \
+ PYTHON_SITE_PKG="$(PYTHON3_PKG_DIR)"
+endif
+
CONFIGURE_ARGS += \
--disable-dsa \
--disable-gost \
@@ -169,7 +181,7 @@
--enable-tfo-server \
--with-libexpat="$(STAGING_DIR)/usr" \
--with-ssl="$(STAGING_DIR)/usr" \
- --with-user=unbound \
+ --with-username=unbound \
--with-run-dir=/var/lib/unbound \
--with-conf-file=/var/lib/unbound/unbound.conf \
--with-pidfile=/var/run/unbound.pid \
@@ -183,7 +195,7 @@
--with-libnghttp2="$(STAGING_DIR)/usr",) \
$(if $(CONFIG_PACKAGE_libunbound_libpthread), \
--with-pthreads,--without-pthreads --without-solaris-threads) \
- $(if $(CONFIG_PACKAGE_libunbound_python),--with-pythonmodule,) \
+ $(if $(CONFIG_PACKAGE_libunbound_pythonmodule),--with-pythonmodule,) \
$(if $(CONFIG_PACKAGE_libunbound_subnet),--enable-subnet,) \
$(if $(CONFIG_PACKAGE_libunbound_dnstap),--enable-dnstap,) \
@@ -229,6 +241,10 @@
$(INSTALL_DATA) ./files/odhcpd.awk $(1)/usr/lib/unbound/odhcpd.awk
$(INSTALL_DATA) ./files/stopping.sh $(1)/usr/lib/unbound/stopping.sh
$(INSTALL_DATA) ./files/unbound.sh $(1)/usr/lib/unbound/unbound.sh
+ifneq ($(CONFIG_PACKAGE_libunbound_pythonmodule),)
+ $(INSTALL_DIR) $(1)/$(PYTHON3_PKG_DIR)
+ $(CP) $(PKG_INSTALL_DIR)/$(PYTHON3_PKG_DIR)/*.py* $(1)/$(PYTHON3_PKG_DIR)
+endif
endef
define Package/libunbound/install
@@ -268,4 +284,3 @@
$(eval $(call BuildPackage,unbound-control))
$(eval $(call BuildPackage,unbound-control-setup))
$(eval $(call BuildPackage,unbound-host))
-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment