[Pdns-dev] [PATCH] Allow packagers to tweak more of the install
Roy Marples
roy at marples.name
Tue Apr 21 15:35:28 CEST 2009
Hi List!
I'm looking at merging pdns-recursor into pkgsrc as used by NetBSD and
other platforms. I have a set of patches to send upstream which this is
all about :)
This first patch improves the install system so that it's easier for
package managers to tweak various aspects, such as where things go and
what permissions they have.
Thanks
Roy
-------------- next part --------------
Index: pdns/Makefile-recursor
===================================================================
--- pdns/Makefile-recursor (revision 1354)
+++ pdns/Makefile-recursor (working copy)
@@ -1,6 +1,8 @@
# user editable stuff:
-SBINDIR=/usr/sbin/
-BINDIR=/usr/bin/
+PREFIX?=/usr
+SBINDIR=$(PREFIX)/sbin
+BINDIR=$(PREFIX)/bin
+MANDIR=$(PREFIX)/share/man
CONFIGDIR="/etc/powerdns/"
OPTFLAGS?=-O3
CXXFLAGS:= $(CXXFLAGS) -Wall -DBOOST_SP_DISABLE_THREADS $(OPTFLAGS) $(PROFILEFLAGS)
@@ -8,6 +10,13 @@
LINKCC=$(CXX)
CC?=gcc
+INSTALL?=install
+SHAREMODE?=644
+MANMODE?=444
+INSTALL_DIR?=$(INSTALL) -d
+INSTALL_DATA?=$(INSTALL) -m $(SHAREMODE)
+INSTALL_MAN?=$(INSTALL) -m $(MANMODE)
+
# Lua 5.1 settings
LUA_CPPFLAGS_CONFIG ?= -I/usr/include/lua5.1
LUA_LIBS_CONFIG ?= -llua5.1
@@ -28,7 +37,7 @@
REC_CONTROL_OBJECTS=rec_channel.o rec_control.o arguments.o
# what we need
-all: message pdns_recursor rec_control
+all: message pdns_recursor rec_control recursor.conf-dist
# OS specific instructions
-include sysdeps/$(shell uname).inc
@@ -72,21 +81,23 @@
rm -f dep ; \
fi
+recursor.conf-dist: pdns_recursor
+ @# Not cross-compile friendly :/
+ ./pdns_recursor --config > $@
+
install: all
- -mkdir -p $(DESTDIR)/$(SBINDIR)
- mv pdns_recursor $(DESTDIR)/$(SBINDIR)
- strip $(DESTDIR)/$(SBINDIR)/pdns_recursor
- mkdir -p $(DESTDIR)/$(BINDIR)
- mv rec_control $(DESTDIR)/$(BINDIR)
- strip $(DESTDIR)/$(BINDIR)/rec_control
- -mkdir -p $(DESTDIR)/$(CONFIGDIR)
- $(DESTDIR)/$(SBINDIR)/pdns_recursor --config > $(DESTDIR)/$(CONFIGDIR)/recursor.conf-dist
- -mkdir -p $(DESTDIR)/usr/share/man/man1
- cp pdns_recursor.1 rec_control.1 $(DESTDIR)/usr/share/man/man1
+ $(INSTALL_DIR) $(DESTDIR)/$(SBINDIR)
+ $(INSTALL) pdns_recursor $(DESTDIR)/$(SBINDIR)
+ $(INSTALL_DIR) $(DESTDIR)/$(BINDIR)
+ $(INSTALL) rec_control $(DESTDIR)/$(BINDIR)
+ $(INSTALL_DIR) $(DESTDIR)/$(CONFIGDIR)
+ $(INSTALL_DATA) recursor.conf-dist $(DESTDIR)/$(CONFIGDIR)
+ $(INSTALL_DIR) $(DESTDIR)/$(MANDIR)/man1
+ $(INSTALL_MAN) pdns_recursor.1 rec_control.1 $(DESTDIR)/$(MANDIR)/man1
$(OS_SPECIFIC_INSTALL)
clean:
- -rm -f dep *.o *~ pdns_recursor rec_control *.gcda *.gcno optional/*.gcda optional/*.gcno optional/*.o
+ -rm -f dep *.o *~ pdns_recursor recursor.conf-dist rec_control *.gcda *.gcno optional/*.gcda optional/*.gcno optional/*.o
dep:
$(CXX) $(CXXFLAGS) -MM -MG *.cc *.c *.hh > $@
@@ -94,7 +105,7 @@
-include dep
optional:
- mkdir optional
+ $(INSTALL_DIR) optional
pdns_recursor: optional $(OPTIONALS) $(PDNS_RECURSOR_OBJECTS) malloc.o
$(LINKCC) $(PDNS_RECURSOR_OBJECTS) $(wildcard optional/*.o) $(LDFLAGS) -o $@
More information about the Pdns-dev
mailing list