Skip to content

Instantly share code, notes, and snippets.

@zembutsu
Created June 7, 2014 08:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zembutsu/3a72b7a489b9030f1547 to your computer and use it in GitHub Desktop.
Save zembutsu/3a72b7a489b9030f1547 to your computer and use it in GitHub Desktop.
Makefile.config for Munin 2.1.x; This is similer to setup like package's directory hierarcy.
# -*- makefile -*-
#
# This is the Makefile.config file to use for a "clean" distribution.
#
# This file specifies where Munin will look for things after you've
# run 'make' in the source directory. Modify it to suit your needs.
# DESTDIR is meant only for use when making Munin packages. Unless
# you're doing packaging do NOT set it.
# DESTDIR is empty during building, and optionally set to point to
# a shadow tree during make install.
# Note: There is a need for a VARDIR, with DBDIR, PLUGSTATE, HTMLDIR
# and LOGDIR as subdirectories. Today, DBDIR contains configured
# domains, as well as PLUGSTATE, and we risk collisions.
#### for RHEL/CentOS 6.x @zembutsu
DESTDIR = /
#
# the base of the Munin installation.
#
PREFIX = $(DESTDIR)/usr
# Where Munin keeps its configurations (server.conf, client.conf, ++)
CONFDIR = $(DESTDIR)/etc/munin
# Server only - where to put munin-cron
BINDIR = $(DESTDIR)/bin
# Client only - where to put munin-node, munin-node-configure, and munin-run
SBINDIR = $(DESTDIR)/sbin
# Where to put text and html documentation
DOCDIR = $(DESTDIR)/usr/share/doc/munin-$(VERSION)
# Where to put man pages
MANDIR = $(DESTDIR)/usr/share/man
# Where to put internal binaries and plugin repository
LIBDIR = $(DESTDIR)/usr/share/munin
# Server only - Output directory
HTMLDIR = $(DESTDIR)/var/www/html/munin
CGIDIR = $(DESTDIR)/var/www/cgi-bin
# Where to put internal data for master (RRD, internal files, ...)
DBDIR = $(DESTDIR)/var/lib/munin
# Where to put CGI cached files (for master only)
CGITMPDIR = /var/tmp
# Where to put internal data for node (plugin state, ...)
DBDIRNODE = $(DESTDIR)/var/lib/munin-node
# Client only - Where the spool files are written. Must be writable by
# group "munin", and should be preserved between reboots
SPOOLDIR = $(DBDIR)/spool
# Client only - Where plugins should put their states. Must be writable by
# group "munin", and should be preserved between reboots
PLUGSTATE = $(DBDIRNODE)/plugin-state
# Where Munin should place its logs.
LOGDIR = $(DESTDIR)/var/log/munin
# Location of PID files and other statefiles. On the server, must be
# writable by the user "munin".
STATEDIR = $(DESTDIR)/var/run/munin
# The perl interpreter to use
PERL := /usr/bin/perl
# The python interpreter to use (used by some plugins)
PYTHON := /usr/bin/python
# The ruby interpreter to use (used by some plugins)
RUBY := /usr/bin/ruby
# The java runtime to use (used by some plugins)
JAVARUN := /usr/bin/java
# The java library dir to use (used by some plugins)
# this is needed in order to be able to install
# java libraries in a custom location. Many distrubutions
# enforce a spesific location for java libraries.
JAVALIBDIR = $(DESTDIR)/usr/share/java
# A modern (posix) shell. We're not looking for arrays, but $() and
# other modern stuff is expected. On a posix-system the expression
# below will find the right shell. Most Unixes released the last 10
# years are POSIX compliant enough for this to work (he said bravely).
#
# On Linux /bin/sh, SunOS/Solaris /usr/xpg4/bin/sh or /bin/ksh
# In general: bash or ksh will work
#
GOODSH := $(shell PATH=`getconf PATH 2>/dev/null || echo $(PATH)` LANG=C sh -c 'type sh | sed "s/.* //"')
# Path of bash for bash specific plugins
BASH := /bin/bash
# Server only - Where to install the perl libraries
PERLSITELIB := $(shell $(PERL) -V:sitelib | cut -d"'" -f2)
PERLLIB = $(DESTDIR)$(PERLSITELIB)
# Client only - Install plugins for this architecture
# the LANG=C makes tr work as expected, not regarding any locale it
# isn't done globally to enable users to have as much localized
# errors as possible
OSTYPE := $(shell uname | LANG=C tr '[A-Z]' '[a-z]' | cut -f 1 -d _)
# How to figure out the hostname. (Only used in default configuration
# files)
HOSTNAME = localhost.localdomain
# What is the safest way to create a tempfile.
# Default is to figure it out by testing various methods.
# Replace this with a known platform-specific method
MKTEMP := $(shell ./test-mktemp)
# Munin version number.
VERSION := $(shell ./getversion)
# User to run munin as
USER := munin
GROUP := munin
# Default user to run the plugins as
PLUGINUSER := nobody
# Default user to run the cgi as
CGIUSER := apache
# Which command to use to check if the USER and GROUP to run Munin as, exists.
# These will work on most modern OSes:
#
GETENT := $(shell which getent || which true 2>/dev/null)
CHECKUSER := $(shell $(GETENT) passwd $(USER) >/dev/null 2>/dev/null || (echo "echo User $(USER) nonexistent. Create the user and retry; exit 2"))
CHECKGROUP := $(shell $(GETENT) group $(GROUP) >/dev/null 2>/dev/null || (echo "echo Group $(GROUP) nonexistent. Create the group and retry; exit 2"))
# For OSX, comment out the previous two lines and comment in these
#
#CHECKUSER := $(shell nicl . -read /users/$(USER) >/dev/null 2>/dev/null || (echo "echo User $(USER) nonexistent. Create the user and retry; exit 2"))
#CHECKGROUP := $(shell nicl . -read /groups/$(GROUP) >/dev/null 2>/dev/null || (echo "echo Group $(GROUP) nonexistent. Create the group and retry; exit 2"))
# For OSX 10.5 (Leopard), use the following two lines instead of what's above
#
#CHECKUSER := $(shell dscl . -read /Users/$(USER) >/dev/null 2>/dev/null || (echo "echo User $(USER) nonexistent. Create the user and retry; exit 2"))
#CHECKGROUP := $(shell dscl . -read /Groups/$(GROUP) >/dev/null 2>/dev/null || (echo "echo Group $(GROUP) nonexistent. Create the group and retry; exit 2"))
# For HP-UX, use these instead:
#
#CHECKUSER := $(shell pwget -n $(USER) >/dev/null 2>/dev/null || (echo "echo User $(USER) nonexistent. Create the user and retry; exit 2"))
#CHECKGROUP := $(shell grget -n $(GROUP) >/dev/null 2>/dev/null || (echo "echo Group $(GROUP) nonexistent. Create the group and retry; exit 2"))
# For Cygwin, use these instead:
#CHECKUSER := $(shell id $(USER) >/dev/null 2>/dev/null || (echo "echo User $(USER) nonexistent. Create the user and retry; exit 2"))
#CHECKGROUP := $(shell grep ^$(GROUP): /etc/group >/dev/null 2>/dev/null || (echo "echo Group $(GROUP) nonexistent. Create the group and retry; exit 2"))
CHOWN := chown
CHMOD := chmod
CHGRP := chgrp
# Java compiler stuff - only needed on the buildhost
JC := javac
JFLAGS := -g -source 1.5 -target 1.5 -Xlint
JAR := jar
# Check if the java compiler works
# Note that we defer JCVALID evaluation to runtime,
# since $(JC) can be redefined later in a specific Makefile.config
# The core Makefile.config is then used as a Makefile.default
JCVALID = $(shell $(JC) -version >/dev/null 2>/dev/null && echo "yes")
# Check whether setruid functionality can be used
HASSETR := $(shell perl -e 'use Config; my @vars=("d_setruid", "d_setreuid", "d_setresuid"); foreach my $$var (@vars) { if ($$Config{$$var} eq "define") { print "1\n"; exit 0; } } print "0\n"; exit 0;' )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment