dante: adopt package
authorDavid Yang <mmyangfl@gmail.com>
Wed, 23 Jun 2021 15:07:33 +0000 (23:07 +0800)
committerDavid Yang <mmyangfl@gmail.com>
Wed, 23 Jun 2021 19:44:23 +0000 (03:44 +0800)
Give this package more love by adopting it :)

Changes since 1.4.1-4:
  * change maintainer to me
  * update to 1.4.3
  + add example config files sockd.conf and socks.conf
  + add service file for sockd
  * update 200-fix-RTLD_NEXT.patch
  - remove merged 210-deactivate-sched_setscheduler.patch
  * fix Autoconf build file

Signed-off-by: David Yang <mmyangfl@gmail.com>
net/dante/Makefile [new file with mode: 0644]
net/dante/files/sockd.init [new file with mode: 0755]
net/dante/patches/100-fix-autoconf-checkerrno.patch [new file with mode: 0644]
net/dante/patches/200-fix-RTLD_NEXT.patch [new file with mode: 0644]

diff --git a/net/dante/Makefile b/net/dante/Makefile
new file mode 100644 (file)
index 0000000..4bf4125
--- /dev/null
@@ -0,0 +1,136 @@
+#
+# Copyright (C) 2011 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=dante
+PKG_VERSION:=1.4.3
+PKG_RELEASE:=$(AUTORELEASE)
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.inet.no/dante/files/
+PKG_HASH:=418a065fe1a4b8ace8fbf77c2da269a98f376e7115902e76cda7e741e4846a5d
+
+PKG_MAINTAINER:=David Yang <mmyangfl@gmail.com>
+PKG_LICENSE:=BSD-4-Clause
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+CONFIGURE_ARGS += \
+       --without-upnp \
+       --without-pam \
+       --disable-libwrap
+
+CONFIGURE_VARS += \
+       ac_cv_search_pam_start="" \
+       ac_cv_func_sched_setscheduler=no
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.{a,so*,la} $(1)/usr/lib/
+endef
+
+
+define Package/dante/default
+  TITLE:=Dante SOCKS
+  URL:=http://www.inet.no/dante/
+endef
+
+define Package/dante/default/description
+Dante is a circuit-level firewall/proxy that can be used to provide convenient
+and secure network connectivity, requiring only that the server Dante runs on
+has external network connectivity. Dante is used daily by Fortune 100 companies
+and large international organizations, either as a standard SOCKS server or as
+a "reverse proxy".
+endef
+
+define Package/libsocks
+  $(call Package/dante/default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE+= Library
+  ABI_VERSION:=0
+endef
+
+define Package/libsocks/description
+$(call Package/dante/default/description)
+This package provides the shared libsocks library.
+endef
+
+define Package/libsocks/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsocks.so.* $(1)/usr/lib/
+endef
+
+
+define Package/sockd
+  $(call Package/dante/default)
+  SUBMENU:=Web Servers/Proxies
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE+= Daemon
+endef
+
+define Package/sockd/description
+$(call Package/dante/default/description)
+This package provides the Dante sockd daemon.
+endef
+
+define Package/sockd/conffiles
+       /etc/sockd.conf
+endef
+
+define Package/sockd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/sockd $(1)/usr/sbin/
+
+       $(INSTALL_DIR) $(1)/etc
+       $(CP) $(PKG_BUILD_DIR)/example/sockd.conf $(1)/etc/
+
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/sockd.init $(1)/etc/init.d/sockd
+endef
+
+
+define Package/socksify
+  $(call Package/dante/default)
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Web Servers/Proxies
+  TITLE+= Client
+endef
+
+define Package/socksify/description
+$(call Package/dante/default/description)
+This package provides the Dante socksify client.
+endef
+
+define Package/socksify/conffiles
+       /etc/socks.conf
+endef
+
+define Package/socksify/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/socksify $(1)/usr/bin/
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdsocks.so* $(1)/usr/lib/
+
+       $(INSTALL_DIR) $(1)/etc
+       $(CP) $(PKG_BUILD_DIR)/example/socks.conf $(1)/etc/
+endef
+
+
+$(eval $(call BuildPackage,libsocks))
+$(eval $(call BuildPackage,sockd))
+$(eval $(call BuildPackage,socksify))
diff --git a/net/dante/files/sockd.init b/net/dante/files/sockd.init
new file mode 100755 (executable)
index 0000000..4fdb6b6
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2019 OpenWrt.org
+
+USE_PROCD=1
+
+START=90
+STOP=10
+
+PROG=/usr/sbin/sockd
+USER="root"
+GROUP="root"
+PIDFILE=/var/run/sockd.pid
+CONFFILE=/etc/sockd.conf
+
+. /lib/functions.sh
+
+
+start_service() {
+       procd_open_instance
+       procd_set_param command "$PROG" -f "$CONFFILE" -p "$PIDFILE"
+       procd_set_param user "$USER"
+       procd_set_param pidfile "$PIDFILE"
+       procd_close_instance
+}
diff --git a/net/dante/patches/100-fix-autoconf-checkerrno.patch b/net/dante/patches/100-fix-autoconf-checkerrno.patch
new file mode 100644 (file)
index 0000000..c44df1a
--- /dev/null
@@ -0,0 +1,40 @@
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -1106,6 +1106,8 @@ changequote([, ])dnl
+ dnl test function that tries to determine if a specified errno error exists
+ m4_define([checkerrno],
+  [AC_MSG_CHECKING(for errno symbol $3)
++  saved_cppflags="$CPPFLAGS"
++  CPPFLAGS="$CPPFLAGS -P"
+   AC_PREPROC_IFELSE(
+        [AC_LANG_PROGRAM([[#include <errno.h>]],
+                         [[
+@@ -1117,7 +1119,8 @@ errnoval: $3
+        [AC_MSG_RESULT([OK])
+         $1="$$1 $3"
+         cat conftest.i | grep errnoval: >>$2],
+-       [AC_MSG_RESULT([no])])])
++       [AC_MSG_RESULT([no])])
++  CPPFLAGS="$saved_cppflags"])
+ AC_DEFUN([L_CHECKERRNO],
+  [checkerrno($@)])
+@@ -1127,6 +1130,8 @@ dnl error exists
+ dnl test function that tries to determine if a specified errno error exists
+ m4_define([checkgaierror],
+  [AC_MSG_CHECKING(for getaddrinfo() error $3)
++  saved_cppflags="$CPPFLAGS"
++  CPPFLAGS="$CPPFLAGS -P"
+   AC_PREPROC_IFELSE(
+        [AC_LANG_PROGRAM([[
+ #include <sys/types.h>
+@@ -1142,7 +1147,8 @@ gaierrval: $3
+         $1="$$1 $3"
+         AC_DEFINE(HAVE_ERR_$3, 1, [$3 gai error found])
+         cat conftest.i | grep gaierrval: >>$2],
+-       [AC_MSG_RESULT([no])])])
++       [AC_MSG_RESULT([no])])
++  CPPFLAGS="$saved_cppflags"])
+ AC_DEFUN([L_CHECKGAIERROR],
+  [checkgaierror($@)])
diff --git a/net/dante/patches/200-fix-RTLD_NEXT.patch b/net/dante/patches/200-fix-RTLD_NEXT.patch
new file mode 100644 (file)
index 0000000..59bdbe1
--- /dev/null
@@ -0,0 +1,38 @@
+--- a/dlib/interposition.c
++++ b/dlib/interposition.c
+@@ -93,13 +93,13 @@ write$NOCANCEL(HAVE_PROT_WRITE_1, HAVE_P
+ #endif /* HAVE_DARWIN */
+-#ifndef __USE_GNU
+-#define __USE_GNU /* XXX for RTLD_NEXT on Linux */
+-#endif /* !__USE_GNU */
+-
+ #include <dlfcn.h>
++#ifndef RTLD_NEXT
++#define RTLD_NEXT  ((void *) -1l)
++#endif
++
+ #ifdef __COVERITY__
+ /*
+  * Coverity naturally has no idea what the function sys_foo calls does,
+--- a/lib/address.c
++++ b/lib/address.c
+@@ -48,11 +48,12 @@
+ #include "upnp.h"
+-#ifndef __USE_GNU
+-#define __USE_GNU /* XXX for RTLD_NEXT on Linux */
+-#endif /* !__USE_GNU */
+ #include <dlfcn.h>
++#ifndef RTLD_NEXT
++#define RTLD_NEXT  ((void *) -1l)
++#endif
++
+ static const char rcsid[] =
+ "$Id: address.c,v 1.288.4.4.6.4 2020/11/11 17:02:23 karls Exp $";