pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/net/tsocks tsocks: Add support for Darwin.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/c7edc65251dc
branches:  trunk
changeset: 441824:c7edc65251dc
user:      jperkin <jperkin%pkgsrc.org@localhost>
date:      Wed Nov 11 16:22:54 2020 +0000

description:
tsocks: Add support for Darwin.

Uses different variable names and .dylib instead of .so, taken from the
MacPorts version of this script.  Bump PKGREVISION.

diffstat:

 net/tsocks/Makefile        |  17 ++++++++++++-----
 net/tsocks/files/tsocks.sh |  28 +++++++++++++++++-----------
 2 files changed, 29 insertions(+), 16 deletions(-)

diffs (96 lines):

diff -r 116a6890c5dc -r c7edc65251dc net/tsocks/Makefile
--- a/net/tsocks/Makefile       Wed Nov 11 16:13:51 2020 +0000
+++ b/net/tsocks/Makefile       Wed Nov 11 16:22:54 2020 +0000
@@ -1,8 +1,7 @@
-# $NetBSD: Makefile,v 1.21 2020/03/20 11:58:11 nia Exp $
-#
+# $NetBSD: Makefile,v 1.22 2020/11/11 16:22:54 jperkin Exp $
 
 DISTNAME=      tsocks-1.8beta5
-PKGREVISION=   3
+PKGREVISION=   4
 CATEGORIES=    net
 MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=tsocks/}
 
@@ -22,12 +21,20 @@
 
 EGDIR=                 ${PREFIX}/share/examples/tsocks
 
+.include "../../mk/bsd.prefs.mk"
+
 SUBST_CLASSES+=                tsocks
 SUBST_STAGE.tsocks=    post-configure
 SUBST_MESSAGE.tsocks=  Generating tsocks wrapper script.
 SUBST_FILES.tsocks=    tsocks
-SUBST_VARS.tsocks=     SH
-SUBST_VARS.tsocks+=    PREFIX
+SUBST_VARS.tsocks=     PREFIX SH
+.if ${OPSYS} == "Darwin"
+SUBST_SED.tsocks=      -e 's,@PRELOAD_VAR@,DYLD_INSERT_LIBRARIES,g'
+SUBST_SED.tsocks+=     -e 's,@SOEXT@,dylib,g'
+.else
+SUBST_SED.tsocks=      -e 's,@PRELOAD_VAR@,LD_PRELOAD,g'
+SUBST_SED.tsocks+=     -e 's,@SOEXT@,so,g'
+.endif
 
 INSTALLATION_DIRS+=    ${EGDIR}
 
diff -r 116a6890c5dc -r c7edc65251dc net/tsocks/files/tsocks.sh
--- a/net/tsocks/files/tsocks.sh        Wed Nov 11 16:13:51 2020 +0000
+++ b/net/tsocks/files/tsocks.sh        Wed Nov 11 16:22:54 2020 +0000
@@ -1,6 +1,6 @@
-#! @SH@
+#!@SH@
 
-libtsocks="@PREFIX@/lib/libtsocks.so"
+libtsocks="@PREFIX@/lib/libtsocks.@SOEXT@"
 
 usage() {
        echo "usage:"
@@ -10,23 +10,26 @@
 }
 
 tsocks_on() {
-       case $LD_PRELOAD in
+       case $@PRELOAD_VAR@ in
        *"$libtsocks"*)
                ;;
-       "")     LD_PRELOAD="$libtsocks"
+       "")     @PRELOAD_VAR@="$libtsocks"
                ;;
-       *)      LD_PRELOAD="$LD_PRELOAD $libtsocks"
+       *)      @PRELOAD_VAR@="$@PRELOAD_VAR@ $libtsocks"
                ;;
        esac
-       export LD_PRELOAD
+       export @PRELOAD_VAR@
+       if [ "@PRELOAD_VAR@" = "DYLD_INSERT_LIBRARIES" ]; then
+               export DYLD_FORCE_FLAT_NAMESPACE=1
+       fi
 }
 
 tsocks_off() {
-       LD_PRELOAD=`echo $LD_PRELOAD | sed 's,$libtsocks[ :]?,,'`
-       if [ "$LD_PRELOAD" ]; then
-               export LD_PRELOAD
+       @PRELOAD_VAR@=`echo $@PRELOAD_VAR@ | sed 's,$libtsocks[ :]?,,'`
+       if [ "$@PRELOAD_VAR@" ]; then
+               export @PRELOAD_VAR@
        else
-               unset LD_PRELOAD
+               unset @PRELOAD_VAR@
        fi
 }
 
@@ -43,7 +46,10 @@
        ;;
 
 show | sh)
-       echo "LD_PRELOAD=\"$LD_PRELOAD\""
+       echo "@PRELOAD_VAR@=\"$@PRELOAD_VAR@\""
+       if [ "@PRELOAD_VAR@" = "DYLD_INSERT_LIBRARIES" ]; then
+               echo "DYLD_FORCE_FLAT_NAMESPACE=${DYLD_FORCE_FLAT_NAMESPACE}"
+       fi
        ;;
 -h | -?)
        usage



Home | Main Index | Thread Index | Old Index