$NetBSD: patch-Makefile,v 1.1 2019/09/09 12:21:44 tm Exp $

Installation fixed to use all essential files, populate
PKG_SYSCONFDIR as expected by the Munin scripts. Gets
configured man3ext from Perl instead of assuming 3pm suffix.

--- Makefile.orig	Thu May  9 03:45:43 2019
+++ Makefile	Wed Aug 14 12:38:00 2019
@@ -33,8 +33,9 @@
 PODMAN8          := build/master/doc/munin-cron master/doc/munin master/doc/munin-check
 PODMAN5          := build/master/doc/munin.conf node/doc/munin-node.conf
 PYTHON_LINT_CALL ?= python3 -m flake8
+MAN3EXT          := $(shell $(PERL) -e 'use Config; print $$Config{man3ext};')
 CONFVAR_SUBSTITUTION_FILES = \
-	master/blib/libdoc/Munin\:\:Master\:\:HTMLOld.3pm \
+	master/blib/libdoc/Munin\:\:Master\:\:HTMLOld.$(MAN3EXT) \
	master/blib/lib/Munin/Master/HTMLOld.pm \
	node/blib/sbin/munin-node-configure \
	node/blib/sbin/munin-node \
@@ -94,50 +95,37 @@
 install: install-master-prime install-common-prime install-node-prime install-plugins-prime $(JAVA_INSTALL) install-man install-async-prime

 install-pre: $(MAKEFILES)
-	@$(CHECKUSER)
-	mkdir -p $(LOGDIR)
-	mkdir -p $(STATEDIR)
-	mkdir -p $(SPOOLDIR)
-	mkdir -p $(CONFDIR)
-	$(CHOWN) $(USER) $(LOGDIR) $(STATEDIR) $(SPOOLDIR)
+	mkdir -p $(EGDIR)

 install-master-prime: $(INFILES_MASTER) install-pre install-master
-	mkdir -p $(CONFDIR)/templates
-	mkdir -p $(CONFDIR)/static
-	mkdir -p $(CONFDIR)/templates/partial
-	mkdir -p $(CONFDIR)/munin-conf.d
+	mkdir -p $(EGDIR)/templates
+	mkdir -p $(EGDIR)/static
+	mkdir -p $(EGDIR)/templates/partial
+	mkdir -p $(EGDIR)/munin-conf.d
	mkdir -p $(LIBDIR)
	mkdir -p $(BINDIR)
	mkdir -p $(PERLLIB)
	mkdir -p $(PERLLIB)/Munin/Master
	mkdir -p $(HTMLDIR)
-	mkdir -p $(DBDIR)
-	mkdir -p $(DBDIR)/cgi-tmp
	mkdir -p $(CGIDIR)

-	$(CHOWN) $(USER) $(HTMLDIR) $(DBDIR)
-	$(CHMOD) 0755 $(DBDIR)
-
-	$(CHOWN) $(CGIUSER) $(DBDIR)/cgi-tmp
-	$(CHMOD) 0755 $(DBDIR)/cgi-tmp
-
	for p in master/www/*.tmpl ;  do \
-		$(INSTALL) -m 0644 "$$p" $(CONFDIR)/templates/ ; \
+		$(INSTALL) -m 0644 "$$p" $(EGDIR)/templates/ ; \
	done

	for p in master/static/* ; do \
-		$(INSTALL) -m 0644 "$$p" $(CONFDIR)/static/ ; \
+		$(INSTALL) -m 0644 "$$p" $(EGDIR)/static/ ; \
	done

	for p in master/www/partial/*.tmpl; do \
-		$(INSTALL) -m 0644 "$$p" $(CONFDIR)/templates/partial/ ; \
+		$(INSTALL) -m 0644 "$$p" $(EGDIR)/templates/partial/ ; \
	done

	$(INSTALL) -m 0644 master/DejaVuSansMono.ttf $(LIBDIR)/
	$(INSTALL) -m 0644 master/DejaVuSans.ttf $(LIBDIR)/

-	test -f $(HTMLDIR)/.htaccess || $(INSTALL) -m 0644 build/master/www/munin-htaccess $(HTMLDIR)/.htaccess
-	test -f "$(CONFDIR)/munin.conf"  || $(INSTALL) -m 0644 build/master/munin.conf $(CONFDIR)/
+	$(INSTALL) -m 0644 build/master/www/munin-htaccess $(HTMLDIR)/.htaccess
+	$(INSTALL) -m 0644 build/master/munin.conf $(EGDIR)/

	$(INSTALL) -m 0755 build/master/_bin/munin-cron $(BINDIR)/
	$(INSTALL) -m 0755 build/master/_bin/munin-check $(BINDIR)/
@@ -156,17 +144,8 @@
 install-node-plugins: install-plugins-prime

 install-plugins-prime: install-plugins build $(PLUGINS) $(MAKEFILES)
-	@$(CHECKGROUP)
-
-	mkdir -p $(CONFDIR)/plugins
-	mkdir -p $(CONFDIR)/plugin-conf.d
	mkdir -p $(LIBDIR)/plugins
-	mkdir -p $(PLUGSTATE)

-	$(CHOWN) root:root $(PLUGSTATE)
-	$(CHMOD) 0755 $(PLUGSTATE)
-	$(CHMOD) 0755 $(CONFDIR)/plugin-conf.d
-
	@# Process the OS specific plugins at the end. Otherwise they would be overridden by the
	@# generic ones.
	for p in build/plugins/node.d/* build/plugins/node.d.$(OSTYPE)/* ; do \
@@ -205,7 +184,7 @@
 install-node-prime: install-node-pre install-node

 install-node-pre: build/node/munin-node.conf install-pre
-	test -f "$(CONFDIR)/munin-node.conf" || $(INSTALL) -m 0644 build/node/munin-node.conf $(CONFDIR)/
+	$(INSTALL) -m 0644 build/node/munin-node.conf $(EGDIR)/


 install-common-prime: build-common install-common
