summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2017-08-31 11:42:13 -0700
committerMax Romanov <max.romanov@nginx.com>2017-08-31 11:42:13 -0700
commitac7218e335f0393330cf3d1c791ccdfa5a04c423 (patch)
tree1e864fe75f90fbb2a3d5796deabfe056f6e0537d
parent6eb4a41364bedc461a58ebe486067ae3abc9aaa1 (diff)
downloadunit-ac7218e335f0393330cf3d1c791ccdfa5a04c423.tar.gz
unit-ac7218e335f0393330cf3d1c791ccdfa5a04c423.tar.bz2
Introducing install & uninstall Makefile targets.
-rw-r--r--auto/help7
-rw-r--r--auto/make34
-rw-r--r--auto/modules/go18
-rw-r--r--auto/modules/php19
-rw-r--r--auto/modules/python19
-rw-r--r--auto/options31
-rw-r--r--auto/save2
-rwxr-xr-xconfigure7
8 files changed, 111 insertions, 26 deletions
diff --git a/auto/help b/auto/help
index d7ea5adc..1a1ae4cd 100644
--- a/auto/help
+++ b/auto/help
@@ -12,9 +12,14 @@ cat << END
--ld-opt=OPTIONS set additional linker options
--prefix=DIRECTORY set prefix for relative pathnames, default: none
+ --bindir=DIRECTORY set user executables directory name
+ default: "$NXT_BINDIR"
+ --sbindir=DIRECTORY set system admin executables directory name
+ default: "$NXT_SBINDIR"
+ --modules=DIRECTORY set modules directory name, default: "$NXT_MODULES"
+
--pid=FILE set pid filename, default: "$NXT_PID"
--log=FILE set log filename, default: "$NXT_LOG"
- --modules=DIRECTORY set modules directory name, default: "$NXT_MODULES"
--control=ADDRESS set address of control API socket
default: "$NXT_CONTROL"
diff --git a/auto/make b/auto/make
index 907a97d0..742df11a 100644
--- a/auto/make
+++ b/auto/make
@@ -20,10 +20,10 @@ NXT_EXEC_LINK = $NXT_EXEC_LINK $NXT_LD_OPT
NXT_SHARED_LOCAL_LINK = $NXT_SHARED_LOCAL_LINK $NXT_LD_OPT
NXT_MODULE_LINK = $NXT_MODULE_LINK $NXT_LD_OPT
-.PHONY: $NXT_BIN
-$NXT_BIN: $NXT_BUILD_DIR/$NXT_BIN
+.PHONY: $NXT_DAEMON
+$NXT_DAEMON: $NXT_BUILD_DIR/$NXT_DAEMON
-all: $NXT_BIN
+all: $NXT_DAEMON
END
@@ -184,9 +184,9 @@ $echo >> $NXT_MAKEFILE
cat << END >> $NXT_MAKEFILE
-$NXT_BUILD_DIR/$NXT_BIN: $NXT_BUILD_DIR/$NXT_LIB_STATIC \\
+$NXT_BUILD_DIR/$NXT_DAEMON: $NXT_BUILD_DIR/$NXT_LIB_STATIC \\
\$(NXT_OBJS)
- \$(NXT_EXEC_LINK) -o $NXT_BUILD_DIR/$NXT_BIN \$(CFLAGS) \\
+ \$(NXT_EXEC_LINK) -o $NXT_BUILD_DIR/$NXT_DAEMON \$(CFLAGS) \\
\$(NXT_OBJS) $NXT_BUILD_DIR/$NXT_LIB_STATIC \\
$NXT_LIBM $NXT_LIBS $NXT_LIB_AUX_LIBS
@@ -210,6 +210,30 @@ END
done
+# install
+
+cat << END >> $NXT_MAKEFILE
+
+.PHONY: install ${NXT_DAEMON}-install
+
+install: ${NXT_DAEMON}-install
+
+${NXT_DAEMON}-install: $NXT_DAEMON
+ install -d \$(DESTDIR)$NXT_SBINDIR
+ install -p $NXT_BUILD_DIR/$NXT_DAEMON \$(DESTDIR)$NXT_SBINDIR/
+
+
+.PHONY: uninstall ${NXT_DAEMON}-uninstall
+
+uninstall: ${NXT_DAEMON}-uninstall
+
+${NXT_DAEMON}-uninstall:
+ rm -f \$(DESTDIR)$NXT_SBINDIR/$NXT_DAEMON
+ @rmdir -p \$(DESTDIR)$NXT_SBINDIR 2>/dev/null || true
+
+END
+
+
# Makefile.
# *.dSYM is MacOSX Clang debug information.
diff --git a/auto/modules/go b/auto/modules/go
index 2076a0bd..847938ea 100644
--- a/auto/modules/go
+++ b/auto/modules/go
@@ -85,7 +85,7 @@ fi
cat << END >> $NXT_MAKEFILE
-.PHONY: ${NXT_GO}
+.PHONY: ${NXT_GO} ${NXT_GO}-install ${NXT_GO}-uninstall
all: ${NXT_GO}
@@ -104,16 +104,22 @@ $NXT_BUILD_DIR/nxt_go_gen.h: src/go/unit/*.go
${NXT_GO} build -o $NXT_BUILD_DIR/nxt_go_gen.a \\
--buildmode=c-archive go/unit
+
+install: ${NXT_GO}-install
+
${NXT_GO}-install: ${NXT_GO}
- install -d \$(GOPATH)/src/unit
- install -p ./src/go/unit/* \$(GOPATH)/src/unit/
+ install -d \$(DESTDIR)\$(GOPATH)/src/unit
+ install -p ./src/go/unit/* \$(DESTDIR)\$(GOPATH)/src/unit/
CGO_CFLAGS="-I\$(NXT_ROOT)/$NXT_BUILD_DIR -I\$(NXT_ROOT)/src" \\
CGO_LDFLAGS="-L\$(NXT_ROOT)/$NXT_BUILD_DIR ${NXT_LIBRT}" \\
- GOPATH=$NXT_GO_PATH \\
+ GOPATH=\$(DESTDIR)\$(GOPATH) \\
${NXT_GO} install -v unit
+
+uninstall: ${NXT_GO}-uninstall
+
${NXT_GO}-uninstall:
- rm -rf \$(GOPATH)/src/unit
- rm -f \$(GOPATH)/pkg/\$(GOOS)_\$(GOARCH)/unit.a
+ rm -rf \$(DESTDIR)\$(GOPATH)/src/unit
+ rm -f \$(DESTDIR)\$(GOPATH)/pkg/\$(GOOS)_\$(GOARCH)/unit.a
END
diff --git a/auto/modules/php b/auto/modules/php
index c8da3fe9..00a1015e 100644
--- a/auto/modules/php
+++ b/auto/modules/php
@@ -148,7 +148,9 @@ done
cat << END >> $NXT_MAKEFILE
-.PHONY: ${NXT_PHP_MODULE}
+.PHONY: ${NXT_PHP_MODULE}
+.PHONY: ${NXT_PHP_MODULE}-install
+.PHONY: ${NXT_PHP_MODULE}-uninstall
all: ${NXT_PHP_MODULE}
@@ -158,4 +160,19 @@ $NXT_BUILD_DIR/${NXT_PHP_MODULE}.unit.so: $nxt_objs
$NXT_MODULE_LINK -o $NXT_BUILD_DIR/${NXT_PHP_MODULE}.unit.so \\
$nxt_objs ${NXT_PHP_LIB} ${NXT_PHP_LDFLAGS}
+
+install: ${NXT_PHP_MODULE}-install
+
+${NXT_PHP_MODULE}-install: ${NXT_PHP_MODULE}
+ install -d \$(DESTDIR)$NXT_MODULES
+ install -p $NXT_BUILD_DIR/${NXT_PHP_MODULE}.unit.so \\
+ \$(DESTDIR)$NXT_MODULES/
+
+
+uninstall: ${NXT_PHP_MODULE}-uninstall
+
+${NXT_PHP_MODULE}-uninstall:
+ rm -f \$(DESTDIR)$NXT_MODULES/${NXT_PHP_MODULE}.unit.so
+ @rmdir -p \$(DESTDIR)$NXT_MODULES 2>/dev/null || true
+
END
diff --git a/auto/modules/python b/auto/modules/python
index ba272999..9e3ced74 100644
--- a/auto/modules/python
+++ b/auto/modules/python
@@ -145,7 +145,9 @@ done
cat << END >> $NXT_MAKEFILE
-.PHONY: ${NXT_PYTHON_MODULE}
+.PHONY: ${NXT_PYTHON_MODULE}
+.PHONY: ${NXT_PYTHON_MODULE}-install
+.PHONY: ${NXT_PYTHON_MODULE}-uninstall
all: ${NXT_PYTHON_MODULE}
@@ -155,4 +157,19 @@ $NXT_BUILD_DIR/${NXT_PYTHON_MODULE}.unit.so: $nxt_objs
$NXT_MODULE_LINK -o $NXT_BUILD_DIR/${NXT_PYTHON_MODULE}.unit.so \\
$nxt_objs $NXT_PYTHON_LIBS
+
+install: ${NXT_PYTHON_MODULE}-install
+
+${NXT_PYTHON_MODULE}-install: ${NXT_PYTHON_MODULE}
+ install -d \$(DESTDIR)$NXT_MODULES
+ install -p $NXT_BUILD_DIR/${NXT_PYTHON_MODULE}.unit.so \\
+ \$(DESTDIR)$NXT_MODULES/
+
+
+uninstall: ${NXT_PYTHON_MODULE}-uninstall
+
+${NXT_PYTHON_MODULE}-uninstall:
+ rm -f \$(DESTDIR)$NXT_MODULES/${NXT_PYTHON_MODULE}.unit.so
+ @rmdir -p \$(DESTDIR)$NXT_MODULES 2>/dev/null || true
+
END
diff --git a/auto/options b/auto/options
index 19cd3dee..fe11f35f 100644
--- a/auto/options
+++ b/auto/options
@@ -55,9 +55,12 @@ do
--build-dir=*) NXT_BUILD_DIR="$value" ;;
--prefix=*) NXT_PREFIX="$value" ;;
+ --bindir=*) NXT_BINDIR="$value" ;;
+ --sbindir=*) NXT_SBINDIR="$value" ;;
+ --modules=*) NXT_MODULES="$value" ;;
+
--pid=*) NXT_PID="$value" ;;
--log=*) NXT_LOG="$value" ;;
- --modules=*) NXT_MODULES="$value" ;;
--control=*) NXT_CONTROL="$value" ;;
@@ -91,6 +94,11 @@ do
--tests) NXT_TESTS=YES ;;
+ --help)
+ . auto/help
+ exit 0
+ ;;
+
*)
$echo
$echo $0: error: invalid option \"$nxt_option\".
@@ -112,24 +120,29 @@ case "$NXT_PREFIX" in
*) NXT_PREFIX="$NXT_PREFIX/" ;;
esac
-case "$NXT_PID" in
+case "$NXT_BINDIR" in
/*) ;;
- *) NXT_PID="$NXT_PREFIX$NXT_PID" ;;
+ *) NXT_BINDIR="$NXT_PREFIX$NXT_BINDIR" ;;
esac
-case "$NXT_LOG" in
+case "$NXT_SBINDIR" in
/*) ;;
- *) NXT_LOG="$NXT_PREFIX$NXT_LOG" ;;
+ *) NXT_SBINDIR="$NXT_PREFIX$NXT_SBINDIR" ;;
esac
case "$NXT_MODULES" in
- ""|*/) ;;
- *) NXT_MODULES="$NXT_MODULES/" ;;
+ /*) ;;
+ *) NXT_MODULES="$NXT_PREFIX$NXT_MODULES" ;;
esac
-case "$NXT_MODULES" in
+case "$NXT_PID" in
/*) ;;
- *) NXT_MODULES="$NXT_PREFIX$NXT_MODULES" ;;
+ *) NXT_PID="$NXT_PREFIX$NXT_PID" ;;
+esac
+
+case "$NXT_LOG" in
+ /*) ;;
+ *) NXT_LOG="$NXT_PREFIX$NXT_LOG" ;;
esac
case "$NXT_CONTROL" in
diff --git a/auto/save b/auto/save
index dabe6e6f..3fad03e1 100644
--- a/auto/save
+++ b/auto/save
@@ -23,4 +23,6 @@ echo=$NXT_BUILD_DIR/echo
NXT_LIB_AUX_CFLAGS=
NXT_LIB_AUX_LIBS=
+NXT_MODULES='$NXT_MODULES'
+
END
diff --git a/configure b/configure
index 4a78e944..d085d786 100755
--- a/configure
+++ b/configure
@@ -27,14 +27,15 @@ NXT_AUTOCONF_ERR=$NXT_BUILD_DIR/autoconf.err
NXT_AUTOCONF_DATA=$NXT_BUILD_DIR/autoconf.data
NXT_AUTO_CONFIG_H=$NXT_BUILD_DIR/nxt_auto_config.h
NXT_MAKEFILE=$NXT_BUILD_DIR/Makefile
-NXT_BIN=unitd
-
CC=${CC:-cc}
+NXT_DAEMON=unitd
+NXT_BINDIR="bin"
+NXT_SBINDIR="sbin"
+NXT_MODULES="$NXT_BUILD_DIR"
NXT_PID="unit.pid"
NXT_LOG="unit.log"
-NXT_MODULES="modules/"
NXT_CONTROL="unix:control.unit.sock"
NXT_USER="nobody"
NXT_GROUP=