forked from munin-monitoring/munin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.config
178 lines (141 loc) · 6.29 KB
/
Makefile.config
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#
# 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.
#
# the base of the Munin installation.
#
PREFIX = $(DESTDIR)/opt/munin
# Where Munin keeps its configurations (server.conf, client.conf, ++)
CONFDIR = $(DESTDIR)/etc/opt/munin
# Server only - where to put munin-cron
BINDIR = $(PREFIX)/bin
# Client only - where to put munin-node, munin-node-configure, and munin-run
SBINDIR = $(PREFIX)/sbin
# Where to put text and html documentation
DOCDIR = $(PREFIX)/doc
# Where to put man pages
MANDIR = $(PREFIX)/man
# Where to put internal binaries and plugin repository
LIBDIR = $(PREFIX)/lib
# Server only - Output directory
HTMLDIR = $(PREFIX)/www/docs
CGIDIR = $(PREFIX)/www/cgi
# Where to put internal data for master (RRD, internal files, ...)
DBDIR = $(DESTDIR)/var/opt/munin
# Where to put CGI cached files (for master only)
CGITMPDIR = $(DBDIR)/cgi-tmp
# Where to put internal data for node (plugin state, ...)
DBDIRNODE = $(DESTDIR)/var/opt/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 = $(PREFIX)/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 := $(shell which perl)
# The Python interpreter to use (used by some plugins)
PYTHON := /usr/bin/env python3
# The ruby interpreter to use (used by some plugins)
RUBY := /usr/bin/env 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 distributions
# enforce a spesific location for java libraries.
JAVALIBDIR = $(LIBDIR)
# Determines the set of default destinations for the perl libraries and scripts installed with
# Munin. Useful values are "site" for a standalone install of munin, and "vendor" for packaging.
#
# See Module::Build for documentation.
#
# Hint: "perl -MConfig -e 'print Config::config_sh()' | egrep '^install(site|vendor)'" will show the
# install locations for each.
INSTALLDIRS = site
# 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
PERLLIB = $(DESTDIR)$(shell $(PERL) -V:sitelib | cut -d"'" -f2)
# 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 := $(shell hostname)
# 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 := nobody
# Which command to use to check if the USER and GROUP to run Munin as, exists.
ifneq ($(shell which getent),)
# "getent" works on most modern OS
CHECKUSER_COMMAND := getent passwd $(USER)
CHECKGROUP_COMMAND := getent group $(GROUP)
else
ifeq ($(OSTYPE),darwin)
# This should work for OSX 10.5 (Leopard) or later
CHECKUSER_COMMAND := dscl . -read /Users/$(USER)
CHECKGROUP_COMMAND := dscl . -read /Groups/$(GROUP)
else
ifeq ($(OSTYPE),cygwin)
CHECKUSER_COMMAND := id $(USER)
CHECKGROUP_COMMAND := grep ^$(GROUP): /etc/group
else
ifeq ($(OSTYPE),hp-ux)
CHECKUSER_COMMAND := pwget -n $(USER)
CHECKGROUP_COMMAND := grget -n $(GROUP)
else
$(warning Missing test for user existence on this platform. Skipping this check and hoping for the best ...)
CHECKUSER_COMMAND := true
CHECKGROUP_COMMAND := true
endif
endif
endif
endif
CHECKUSER := $(shell $(CHECKUSER_COMMAND) >/dev/null 2>/dev/null || (echo "echo User $(USER) nonexistent. Create the user and retry; exit 2"))
CHECKGROUP := $(shell $(CHECKGROUP_COMMAND) >/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.7 -target 1.7 -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;' )