From c86be9931b41eb71367e7b04b23021ea0e56ba53 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Thu, 5 Feb 2009 15:21:33 +0100 Subject: [PATCH] Install by default xbps.conf into $(PREFIX)/etc and use it. --HG-- extra : convert_revision : d6550a3d9e6093cb1ec789715e2b1107b9bb59bd --- Makefile | 2 +- bin/xbps-src/Makefile | 10 +++++----- bin/xbps-src/main.sh | 4 ++-- doc/README | 4 ++-- etc/Makefile | 18 ++++++++++++++++++ vars.mk | 1 + 6 files changed, 29 insertions(+), 10 deletions(-) create mode 100644 etc/Makefile diff --git a/Makefile b/Makefile index c1ace38176..e6d1dd50f7 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ include vars.mk -SUBDIRS = lib bin +SUBDIRS = lib bin etc .PHONY: all all: diff --git a/bin/xbps-src/Makefile b/bin/xbps-src/Makefile index 6a2b9baba7..5efa064c93 100644 --- a/bin/xbps-src/Makefile +++ b/bin/xbps-src/Makefile @@ -5,14 +5,14 @@ BIN = xbps-src .PHONY: all all: - sed -e "s|@@XBPS_INSTALL_PREFIX@@|$(PREFIX)|g" main.sh > xbps-src + sed -e "s|@@XBPS_INSTALL_PREFIX@@|$(PREFIX)|g" \ + -e "s|@@XBPS_INSTALL_ETCDIR@@|$(ETCDIR)|g" \ + main.sh > xbps-src .PHONY: clean -clean: clean-bins - -clean-bins: +clean: -rm -f $(BIN) -install: $(BIN) +install: all install -d $(SBINDIR) install -m 755 $(BIN) $(SBINDIR) diff --git a/bin/xbps-src/main.sh b/bin/xbps-src/main.sh index c4f0ab2c72..20f21446a3 100755 --- a/bin/xbps-src/main.sh +++ b/bin/xbps-src/main.sh @@ -27,7 +27,7 @@ #- trap "echo && exit 1" INT QUIT -: ${XBPS_CONFIG_FILE:=/etc/xbps.conf} +: ${XBPS_CONFIG_FILE:=@@XBPS_INSTALL_ETCDIR@@/xbps.conf} : ${progname:=$(basename $0)} : ${fakeroot_cmd:=fakeroot} @@ -67,7 +67,7 @@ Targets: Options: -C Do not remove build directory after successful installation. -c Path to global configuration file: - if not specified /etc/xbps.conf is used. + if not specified @@XBPS_INSTALL_ETCDIR@@/xbps.conf is used. _EOF exit 1 } diff --git a/doc/README b/doc/README index f70cae11d0..a46d87f5a0 100644 --- a/doc/README +++ b/doc/README @@ -63,8 +63,8 @@ your $HOME. If configuration file is not specified from the command line with the -c flag, it will first try to use the default location at -/etc/xbps.conf, and as last resort in the etc directory of the current -directory. +/usr/local/etc/xbps.conf, and as last resort in the etc directory of the +current directory. To avoid problems with libtool and configure scripts finding stuff that is available in the host system, almost all packages must be built inside of a diff --git a/etc/Makefile b/etc/Makefile new file mode 100644 index 0000000000..c19e8fabfe --- /dev/null +++ b/etc/Makefile @@ -0,0 +1,18 @@ +include ../vars.mk + +CONF_FILE = xbps.conf + +.PHONY: all +all: + +.PHONY: clean +clean: + +install: + if [ ! -d $(ETCDIR) ]; then \ + install -d $(ETCDIR); \ + fi + + if [ ! -f $(ETCDIR)/$(CONF_FILE) ]; then \ + install -m 644 $(CONF_FILE) $(ETCDIR); \ + fi diff --git a/vars.mk b/vars.mk index 8e84b7445e..9eb5ff598b 100644 --- a/vars.mk +++ b/vars.mk @@ -3,6 +3,7 @@ PREFIX ?= /usr/local SBINDIR ?= $(PREFIX)/sbin LIBDIR ?= $(PREFIX)/lib +ETCDIR ?= $(PREFIX)/etc TOPDIR ?= .. LDFLAGS += -L$(TOPDIR)/lib -L$(PREFIX)/lib -lxbps