Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/rofl0r/proxychains-ng.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrofl0r <retnyg@gmx.net>2014-07-22 16:32:27 +0400
committerrofl0r <retnyg@gmx.net>2014-07-22 16:32:27 +0400
commit6143266edd86c3a37027bc512458bfad37434e72 (patch)
tree2a0c3ec26fbf5284cb6457c6bd1c300fda753797
parentcd4aee19977bb204fc550b54788f4094ae5e61ea (diff)
use musl's install.sh rather than doing workarounds for BSD install
-rw-r--r--Makefile25
-rwxr-xr-xconfigure2
-rwxr-xr-xtools/install.sh64
3 files changed, 80 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index d0788eb..5aa99ac 100644
--- a/Makefile
+++ b/Makefile
@@ -33,7 +33,7 @@ RANLIB = $(CROSS_COMPILE)ranlib
LDSO_SUFFIX = so
LD_SET_SONAME = -Wl,-soname=
-INSTALL_FLAGS = -D -m
+INSTALL = ./tools/install.sh
LDSO_PATHNAME = libproxychains4.$(LDSO_SUFFIX)
@@ -41,6 +41,7 @@ SHARED_LIBS = $(LDSO_PATHNAME)
ALL_LIBS = $(SHARED_LIBS)
PXCHAINS = proxychains4
ALL_TOOLS = $(PXCHAINS)
+ALL_CONFIGS = src/proxychains.conf
-include config.mak
@@ -50,14 +51,20 @@ CFLAGS_MAIN=-DLIB_DIR=\"$(libdir)\" -DSYSCONFDIR=\"$(sysconfdir)\" -DDLL_NAME=\"
all: $(ALL_LIBS) $(ALL_TOOLS)
-install-config: src/proxychains.conf
- install -d $(DESTDIR)$(sysconfdir)
- install $(INSTALL_FLAGS) 644 src/proxychains.conf $(DESTDIR)$(sysconfdir)/
+install: install-libs install-tools
-install: $(ALL_LIBS) $(ALL_TOOLS)
- install -d $(DESTDIR)$(bindir)/ $(DESTDIR)$(libdir)/
- install $(INSTALL_FLAGS) 755 $(ALL_TOOLS) $(DESTDIR)$(bindir)/
- install $(INSTALL_FLAGS) 644 $(ALL_LIBS) $(DESTDIR)$(libdir)/
+$(DESTDIR)$(bindir)/%: %
+ $(INSTALL) -D -m 755 $< $@
+
+$(DESTDIR)$(libdir)/%: %
+ $(INSTALL) -D -m 644 $< $@
+
+$(DESTDIR)$(sysconfdir)/%: %
+ $(INSTALL) -D -m 644 $< $@
+
+install-libs: $(ALL_LIBS:%=$(DESTDIR)$(libdir)/%)
+install-tools: $(ALL_TOOLS:%=$(DESTDIR)$(bindir)/%)
+install-config: $(ALL_CONFIGS:src/%=$(DESTDIR)$(sysconfdir)/%)
clean:
rm -f $(ALL_LIBS)
@@ -80,4 +87,4 @@ $(ALL_TOOLS): $(OBJS)
$(CC) src/main.o src/common.o -o $(PXCHAINS)
-.PHONY: all clean install install-config
+.PHONY: all clean install install-config install-libs install-tools
diff --git a/configure b/configure
index c644b59..784fadb 100755
--- a/configure
+++ b/configure
@@ -99,11 +99,9 @@ if ismac ; then
echo LDFLAGS+=-arch i386 -arch x86_64>>config.mak
fi
echo LD_SET_SONAME=-Wl,-install_name,>>config.mak
- echo INSTALL_FLAGS=-m>>config.mak
elif isbsd ; then
echo LIBDL=>>config.mak
echo "CFLAGS+=-DIS_BSD">>config.mak
- echo INSTALL_FLAGS=-m>>config.mak
fi
echo "Done, now run make && make install"
diff --git a/tools/install.sh b/tools/install.sh
new file mode 100755
index 000000000..d913b60
--- /dev/null
+++ b/tools/install.sh
@@ -0,0 +1,64 @@
+#!/bin/sh
+#
+# This is an actually-safe install command which installs the new
+# file atomically in the new location, rather than overwriting
+# existing files.
+#
+
+usage() {
+printf "usage: %s [-D] [-l] [-m mode] src dest\n" "$0" 1>&2
+exit 1
+}
+
+mkdirp=
+symlink=
+mode=755
+
+while getopts Dlm: name ; do
+case "$name" in
+D) mkdirp=yes ;;
+l) symlink=yes ;;
+m) mode=$OPTARG ;;
+?) usage ;;
+esac
+done
+shift $(($OPTIND - 1))
+
+test "$#" -eq 2 || usage
+src=$1
+dst=$2
+tmp="$dst.tmp.$$"
+
+case "$dst" in
+*/) printf "%s: %s ends in /\n", "$0" "$dst" 1>&2 ; exit 1 ;;
+esac
+
+set -C
+set -e
+
+if test "$mkdirp" ; then
+umask 022
+case "$2" in
+*/*) mkdir -p "${dst%/*}" ;;
+esac
+fi
+
+trap 'rm -f "$tmp"' EXIT INT QUIT TERM HUP
+
+umask 077
+
+if test "$symlink" ; then
+ln -s "$1" "$tmp"
+else
+cat < "$1" > "$tmp"
+chmod "$mode" "$tmp"
+fi
+
+mv -f "$tmp" "$2"
+test -d "$2" && {
+rm -f "$2/$tmp"
+printf "%s: %s is a directory\n" "$0" "$dst" 1>&2
+exit 1
+}
+
+exit 0