From 17e1171464e35647b6b81a1cca9af6037178970b Mon Sep 17 00:00:00 2001 From: Kai Krakow Date: Sun, 21 Jan 2018 01:40:19 +0100 Subject: [PATCH] Installation: Remove USR_PREFIX from Makefile This commit removes USR_PREFIX and introduces ETC_PREFIX instead. The purpose of PREFIX is the installation prefix in the system, not the installation destination. The latter one is what DESTDIR is used for. This should clear up the confusion. PREFIX was already mis-used as installation destination. But that doesn't mix well with how the make targets are designed. CC: Timofey Titovets Signed-off-by: Kai Krakow --- Makefile | 25 ++++++++++++-------- contrib/gentoo/files/v0.5-gentoo_build.patch | 3 +-- scripts/beesd.in | 2 +- scripts/beesd@.service.in | 2 +- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 11116ed..165a0b3 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,10 @@ -PREFIX ?= / +PREFIX ?= /usr +ETC_PREFIX ?= /etc LIBDIR ?= lib -USR_PREFIX ?= $(PREFIX)/usr -USRLIB_PREFIX ?= $(USR_PREFIX)/$(LIBDIR) -LIBEXEC_PREFIX ?= $(USRLIB_PREFIX)/bees + +LIB_PREFIX ?= $(PREFIX)/$(LIBDIR) +LIBEXEC_PREFIX ?= $(LIB_PREFIX)/bees + SYSTEMD_SYSTEM_UNIT_DIR ?= $(shell pkg-config systemd --variable=systemdsystemunitdir) MARKDOWN := $(firstword $(shell which markdown markdown2 markdown_py 2>/dev/null || echo markdown)) @@ -38,7 +40,10 @@ test: lib src $(MAKE) -C test scripts/%: scripts/%.in - sed -e's#@LIBEXEC_PREFIX@#$(LIBEXEC_PREFIX)#' -e's#@PREFIX@#$(PREFIX)#' $< >$@ + sed $< >$@ \ + -e's#@PREFIX@#$(PREFIX)#' \ + -e's#@ETC_PREFIX@#$(ETC_PREFIX)#' \ + -e's#@LIBEXEC_PREFIX@#$(LIBEXEC_PREFIX)#' scripts: scripts/beesd scripts/beesd@.service @@ -47,12 +52,12 @@ README.html: README.md mv -f README.html.new README.html install_libs: lib - install -Dm644 lib/libcrucible.so $(DESTDIR)$(USRLIB_PREFIX)/libcrucible.so + install -Dm644 lib/libcrucible.so $(DESTDIR)$(LIB_PREFIX)/libcrucible.so install_tools: ## Install support tools + libs install_tools: install_libs src - install -Dm755 bin/fiemap $(DESTDIR)$(USR_PREFIX)/bin/fiemap - install -Dm755 bin/fiewalk $(DESTDIR)$(USR_PREFIX)/sbin/fiewalk + install -Dm755 bin/fiemap $(DESTDIR)$(PREFIX)/bin/fiemap + install -Dm755 bin/fiewalk $(DESTDIR)$(PREFIX)/sbin/fiewalk install_bees: ## Install bees + libs install_bees: install_libs src $(RUN_INSTALL_TESTS) @@ -60,8 +65,8 @@ install_bees: install_libs src $(RUN_INSTALL_TESTS) install_scripts: ## Install scipts install_scripts: scripts - install -Dm755 scripts/beesd $(DESTDIR)$(USR_PREFIX)/sbin/beesd - install -Dm644 scripts/beesd.conf.sample $(DESTDIR)$(PREFIX)/etc/bees/beesd.conf.sample + install -Dm755 scripts/beesd $(DESTDIR)$(PREFIX)/sbin/beesd + install -Dm644 scripts/beesd.conf.sample $(DESTDIR)/$(ETC_PREFIX)/bees/beesd.conf.sample ifneq (SYSTEMD_SYSTEM_UNIT_DIR,) install -Dm644 scripts/beesd@.service $(DESTDIR)$(SYSTEMD_SYSTEM_UNIT_DIR)/beesd@.service endif diff --git a/contrib/gentoo/files/v0.5-gentoo_build.patch b/contrib/gentoo/files/v0.5-gentoo_build.patch index 9f22cbc..74e48a9 100644 --- a/contrib/gentoo/files/v0.5-gentoo_build.patch +++ b/contrib/gentoo/files/v0.5-gentoo_build.patch @@ -3,8 +3,7 @@ new file mode 100644 index 0000000..7705cbb --- /dev/null +++ b/localconf -@@ -0,0 +1,2 @@ -+PREFIX=/ +@@ -0,0 +1,1 @@ +LIBEXEC_PREFIX=/usr/libexec diff --git a/makeflags b/makeflags index f5983cb..0348623 100644 diff --git a/scripts/beesd.in b/scripts/beesd.in index 269f77f..df7c895 100755 --- a/scripts/beesd.in +++ b/scripts/beesd.in @@ -12,7 +12,7 @@ export CONFIG_FILE export UUID AL16M readonly AL16M="$((16*1024*1024))" -readonly CONFIG_DIR=@PREFIX@/etc/bees/ +readonly CONFIG_DIR=@ETC_PREFIX@/bees/ ## Pre checks { diff --git a/scripts/beesd@.service.in b/scripts/beesd@.service.in index c720eb2..1585c5c 100644 --- a/scripts/beesd@.service.in +++ b/scripts/beesd@.service.in @@ -5,7 +5,7 @@ After=sysinit.target [Service] Type=simple -ExecStart=@PREFIX@/usr/sbin/beesd %i +ExecStart=@PREFIX@/sbin/beesd %i Nice=19 KillMode=control-group KillSignal=SIGTERM