| 1 |
#! /usr/bin/make -f |
| 2 |
# debian/rules for collectd |
| 3 |
# |
| 4 |
# Written by Sebastian Harl <[email protected]>. |
| 5 |
|
| 6 |
# Uncomment this to turn on verbose mode. |
| 7 |
#export DH_VERBOSE=1 |
| 8 |
|
| 9 |
# These are used for cross-compiling and for saving the configure script |
| 10 |
# from having to guess our platform (since we know it already) |
| 11 |
include /usr/share/dpkg/architecture.mk |
| 12 |
include /usr/share/javahelper/java-vars.mk |
| 13 |
|
| 14 |
export DEB_BUILD_MAINT_OPTIONS=hardening=+all |
| 15 |
|
| 16 |
CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS) |
| 17 |
CPPFLAGS += -I$(CURDIR)/debian/include |
| 18 |
CFLAGS = $(shell dpkg-buildflags --get CFLAGS) |
| 19 |
CFLAGS += -Wall -Wno-error=deprecated-declarations |
| 20 |
CXXFLAGS = $(shell dpkg-buildflags --get CXXFLAGS) |
| 21 |
CXXFLAGS += -Wall -Wno-error=deprecated-declarations |
| 22 |
|
| 23 |
TEST_GCC_VER_9 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 9) |
| 24 |
ifeq ($(TEST_GCC_VER_9),1) |
| 25 |
CFLAGS += -Wno-error=address-of-packed-member -Wno-stringop-truncation -Wno-cpp -Wno-error=format-truncation |
| 26 |
endif |
| 27 |
|
| 28 |
# Upstream defaults to ${sysconfdir}/collectd.conf. Setting ${sysconfdir} to |
| 29 |
# /etc/collectd would be wrong though. |
| 30 |
CPPFLAGS += -UCONFIGFILE |
| 31 |
CPPFLAGS += -DCONFIGFILE='\"/etc/collectd/collectd.conf\"' |
| 32 |
|
| 33 |
# A PostgreSQL header redefines CACHE_LINE_SIZE on FreeBSD. |
| 34 |
# Cf. https://bugs.debian.org/760719 and https://bugs.debian.org/763098 |
| 35 |
ifeq ($(DEB_HOST_ARCH_OS),kfreebsd) |
| 36 |
CPPFLAGS += -Wp,-w |
| 37 |
endif |
| 38 |
|
| 39 |
LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS) |
| 40 |
|
| 41 |
# grpc workaround |
| 42 |
ifneq (,$(filter $(DEB_HOST_ARCH), armel mips mipsel powerpc)) |
| 43 |
LDFLAGS += -Wl,--no-as-needed -latomic -Wl,--as-needed |
| 44 |
endif |
| 45 |
|
| 46 |
|
| 47 |
JAVAC = $(JAVA_HOME)/bin/javac |
| 48 |
JAR = $(JAVA_HOME)/bin/jar |
| 49 |
#JAVA_CPPFLAGS = -I$(JAVA_HOME)/include |
| 50 |
#JAVA_LDFLAGS = -L$(JVM_SERVER_DIR) -Wl,-rpath -Wl,$(JVM_SERVER_DIR) |
| 51 |
|
| 52 |
confflags = --host=$(DEB_HOST_GNU_TYPE) \ |
| 53 |
--build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr \ |
| 54 |
--mandir=\$${prefix}/share/man \ |
| 55 |
--localstatedir=/var --sysconfdir=/etc \ |
| 56 |
--with-perl-bindings="INSTALLDIRS=vendor INSTALL_BASE=" \ |
| 57 |
--without-libstatgrab \ |
| 58 |
--disable-static \ |
| 59 |
--disable-silent-rules \ |
| 60 |
--enable-all-plugins \ |
| 61 |
--with-libgcrypt=/usr \ |
| 62 |
GCRYPT_LIBS=-lgcrypt |
| 63 |
|
| 64 |
# java doesn't link on i386. (see blocking bug for #1057712) |
| 65 |
ifeq ($(DEB_HOST_ARCH),i386) |
| 66 |
confflags += \ |
| 67 |
--disable-java |
| 68 |
endif |
| 69 |
|
| 70 |
# no mongodb on loong64 |
| 71 |
ifeq ($(DEB_HOST_ARCH),loong64) |
| 72 |
confflags += \ |
| 73 |
--disable-write_mongodb |
| 74 |
endif |
| 75 |
|
| 76 |
# disable tokyotyrant (#980331) |
| 77 |
confflags += --disable-tokyotyrant |
| 78 |
|
| 79 |
# varnish is broken again. |
| 80 |
confflags += --disable-varnish |
| 81 |
|
| 82 |
# These plugins do not provide any functionality under Linux. |
| 83 |
# MacOS only (requires IO Kit): |
| 84 |
confflags += --disable-apple_sensors |
| 85 |
# AIX only (requires perfstat): |
| 86 |
confflags += --disable-lpar |
| 87 |
# Solaris only (requires devinfo and kstat) |
| 88 |
confflags += --disable-tape |
| 89 |
|
| 90 |
# redfish.h is missing |
| 91 |
confflags += --disable-redfish |
| 92 |
|
| 93 |
# pmw_api.h is missing |
| 94 |
confflags += --disable-dcpmm |
| 95 |
|
| 96 |
# libaquaero5 is required for the aquaero plugin |
| 97 |
confflags += --disable-aquaero |
| 98 |
|
| 99 |
# libjevents is required for the intel_pmu plugin |
| 100 |
confflags += --disable-intel_pmu |
| 101 |
|
| 102 |
# libmic is required for the mic plugin |
| 103 |
confflags += --disable-mic |
| 104 |
|
| 105 |
# libnetapp is required for the netapp plugin. |
| 106 |
confflags += --disable-netapp |
| 107 |
|
| 108 |
# libclntsh is required for the oracle plugin. |
| 109 |
confflags += --disable-oracle |
| 110 |
|
| 111 |
# librouteros is required for the routeros plugin. |
| 112 |
confflags += --disable-routeros |
| 113 |
|
| 114 |
# xmms1 is required for the xmms plugin. |
| 115 |
confflags += --disable-xmms |
| 116 |
|
| 117 |
# libslurm doesn't have a pkg-config file in Debian |
| 118 |
confflags += --disable-slurm |
| 119 |
|
| 120 |
# libsigrok4 incompatible with the plugin. |
| 121 |
# Cf. https://github.com/collectd/collectd/issues/1574 |
| 122 |
confflags += --disable-sigrok |
| 123 |
|
| 124 |
# libnvidia-ml is non-free |
| 125 |
confflags += --disable-gpu_nvidia |
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
# ganglia FTBS, disable it for now |
| 130 |
# see #1000041 |
| 131 |
confflags += --disable-gmond |
| 132 |
|
| 133 |
# hddtemp will be remove from debian |
| 134 |
# #1001954 |
| 135 |
confflags += --disable-hddtemp |
| 136 |
|
| 137 |
# These plugins are Linux-specific. |
| 138 |
ifeq ($(DEB_HOST_ARCH_OS),kfreebsd) |
| 139 |
confflags += \ |
| 140 |
--disable-barometer \ |
| 141 |
--disable-cgroups \ |
| 142 |
--disable-cpusleep \ |
| 143 |
--disable-drbd \ |
| 144 |
--disable-ethstat \ |
| 145 |
--disable-fhcount \ |
| 146 |
--disable-hugepages \ |
| 147 |
--disable-ipc \ |
| 148 |
--disable-iptables \ |
| 149 |
--disable-ipvs \ |
| 150 |
--disable-madwifi \ |
| 151 |
--disable-md \ |
| 152 |
--disable-netlink \ |
| 153 |
--disable-numa \ |
| 154 |
--disable-sensors \ |
| 155 |
--disable-vserver |
| 156 |
endif |
| 157 |
|
| 158 |
# These plugins are FreeBSD-specific. |
| 159 |
ifneq ($(DEB_HOST_ARCH_OS),kfreebsd) |
| 160 |
confflags += \ |
| 161 |
--disable-pf \ |
| 162 |
--disable-ipstats \ |
| 163 |
--disable-netstat_udp |
| 164 |
endif |
| 165 |
|
| 166 |
|
| 167 |
# intel only stuff |
| 168 |
ifeq (,$(filter $(DEB_HOST_ARCH),amd64 i386)) |
| 169 |
confflags += --disable-capabilities |
| 170 |
endif |
| 171 |
ifeq (,$(filter $(DEB_HOST_ARCH),amd64)) |
| 172 |
confflags += --disable-dpdk_telemetry |
| 173 |
endif |
| 174 |
|
| 175 |
# This plugin is Solaris-specific. |
| 176 |
confflags += \ |
| 177 |
--disable-zone |
| 178 |
|
| 179 |
# These plugins have not been ported to FreeBSD yet. |
| 180 |
ifeq ($(DEB_HOST_ARCH_OS),kfreebsd) |
| 181 |
# Work-around an incomplete check for kvm functionality |
| 182 |
CPPFLAGS += -DHAVE_STRUCT_KINFO_PROC_FREEBSD |
| 183 |
confflags += --enable-processes=force |
| 184 |
|
| 185 |
confflags += \ |
| 186 |
--disable-battery \ |
| 187 |
--disable-conntrack \ |
| 188 |
--disable-contextswitch \ |
| 189 |
--disable-cpufreq \ |
| 190 |
--disable-entropy \ |
| 191 |
--disable-fscache \ |
| 192 |
--disable-irq \ |
| 193 |
--disable-nfs \ |
| 194 |
--disable-protocols \ |
| 195 |
--disable-serial \ |
| 196 |
--disable-synproxy \ |
| 197 |
--disable-thermal \ |
| 198 |
--disable-vmem \ |
| 199 |
--disable-wireless |
| 200 |
endif |
| 201 |
|
| 202 |
# Build-dependencies of these plugins are (not yet) available for kfreebsd. |
| 203 |
ifeq ($(DEB_HOST_ARCH_OS),kfreebsd) |
| 204 |
confflags += \ |
| 205 |
--disable-gmond \ |
| 206 |
--disable-virt \ |
| 207 |
--disable-java \ |
| 208 |
--disable-mysql |
| 209 |
endif |
| 210 |
|
| 211 |
# Missing build-deps on sh4 |
| 212 |
ifeq ($(DEB_HOST_ARCH),sh4) |
| 213 |
confflags += \ |
| 214 |
--disable-virt |
| 215 |
endif |
| 216 |
|
| 217 |
# Missing build-deps on ia64 |
| 218 |
ifeq ($(DEB_HOST_ARCH),ia64) |
| 219 |
confflags += \ |
| 220 |
--disable-virt |
| 221 |
endif |
| 222 |
|
| 223 |
# Missing build-deps on alpha |
| 224 |
ifeq ($(DEB_HOST_ARCH),alpha) |
| 225 |
confflags += \ |
| 226 |
--disable-virt |
| 227 |
endif |
| 228 |
|
| 229 |
# Missing build-deps on hurd |
| 230 |
ifeq ($(DEB_HOST_ARCH_OS),hurd) |
| 231 |
confflags += \ |
| 232 |
--disable-barometer |
| 233 |
endif |
| 234 |
|
| 235 |
# These plugins are Intel-hardware specific. |
| 236 |
ifeq (,$(filter amd64 i386, $(DEB_HOST_ARCH))) |
| 237 |
confflags += \ |
| 238 |
--disable-intel_pmu \ |
| 239 |
--disable-intel_rdt \ |
| 240 |
--disable-mcelog \ |
| 241 |
--disable-mic \ |
| 242 |
--disable-turbostat |
| 243 |
endif |
| 244 |
ifeq (,$(filter amd64, $(DEB_HOST_ARCH))) |
| 245 |
confflags += \ |
| 246 |
--disable-dpdkevents \ |
| 247 |
--disable-dpdkstat |
| 248 |
endif |
| 249 |
|
| 250 |
# the pcie_errors plugin does not work on all kinds of hardware |
| 251 |
ifeq (,$(filter amd64 arm64 armel armhf i386 mips64el mipsel ppc64el, $(DEB_HOST_ARCH))) |
| 252 |
confflags += \ |
| 253 |
--disable-pcie_errors |
| 254 |
endif |
| 255 |
|
| 256 |
# This plugin is x86 and arm specific. |
| 257 |
ifeq (,$(filter amd64 arm64, $(DEB_HOST_ARCH))) |
| 258 |
confflags += \ |
| 259 |
--disable-xencpu |
| 260 |
endif |
| 261 |
|
| 262 |
# libatasmart isn't available on these platforms. |
| 263 |
ifneq (,$(filter hurd kfreebsd,$(DEB_HOST_ARCH_OS))) |
| 264 |
confflags += --disable-smart |
| 265 |
endif |
| 266 |
|
| 267 |
# The hppa buildds currently do not keep up with Java related stuff, thus |
| 268 |
# prevending testing transitions. sparc is also having trouble building the |
| 269 |
# java plugin. |
| 270 |
ifneq (,$(filter hppa sparc, $(DEB_HOST_ARCH))) |
| 271 |
confflags += --disable-java |
| 272 |
endif |
| 273 |
|
| 274 |
# gRPC is not available everywhere. |
| 275 |
ifeq (,$(filter amd64 arm64 armel armhf i386 mips64el mipsel ppc64el s390x loong64 powerpc ppc64, $(DEB_HOST_ARCH))) |
| 276 |
confflags += --disable-grpc |
| 277 |
endif |
| 278 |
|
| 279 |
|
| 280 |
%: |
| 281 |
dh $@ |
| 282 |
|
| 283 |
override_dh_auto_configure: |
| 284 |
CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \ |
| 285 |
JAVAC="$(JAVAC)" JAR="$(JAR)" JAVA_CPPFLAGS="$(JAVA_CPPFLAGS)" \ |
| 286 |
JAVA_LDFLAGS="$(JAVA_LDFLAGS)" \ |
| 287 |
./configure $(confflags) \ |
| 288 |
|| ( status=$$?; \ |
| 289 |
echo -e '\n\n\n\n\n\n'; \ |
| 290 |
printf '%.0s-' {1..100}; \ |
| 291 |
echo; \ |
| 292 |
dpkg-architecture -l; \ |
| 293 |
echo -e '\n\n\n\n\n\n'; \ |
| 294 |
printf '%.0s-' {1..100}; \ |
| 295 |
echo; \ |
| 296 |
cat config.log; \ |
| 297 |
exit $$status ) |
| 298 |
|
| 299 |
override_dh_auto_test: |
| 300 |
dh_auto_test |
| 301 |
perl ./debian/bin/check_plugins.pl |
| 302 |
|
| 303 |
|
| 304 |
override_dh_clean: |
| 305 |
dh_clean |
| 306 |
debconf-updatepo |
| 307 |
rm -f src/liboconfig/parser.c src/liboconfig/parser.h src/liboconfig/scanner.c |
| 308 |
|
| 309 |
override_dh_install: |
| 310 |
rm -f debian/tmp/usr/lib/collectd/*.la |
| 311 |
rm -f debian/tmp/usr/lib/libcollectdclient.la |
| 312 |
rm -f debian/tmp/etc/collectd.conf |
| 313 |
|
| 314 |
|
| 315 |
set -e ;\ |
| 316 |
find src -path src/libcollectdclient -prune -o -path src/liboconfig -prune -o -name '*.h' -print | while read i; do \ |
| 317 |
d=$$(echo "$${i}" | sed 's,^src,debian/tmp/usr/include/collectd/core,') ;\ |
| 318 |
mkdir -p $$(echo "$${i}" | sed -e 's,^src,debian/tmp/usr/include/collectd/core,' -e 's,/[^/]*$$,,') ;\ |
| 319 |
cp "$${i}" "$${d}" ;\ |
| 320 |
done |
| 321 |
|
| 322 |
# update include path for collectd header files |
| 323 |
( set -e; \ |
| 324 |
cd $(CURDIR)/debian/tmp/usr/include/collectd/; \ |
| 325 |
headers=$$(find . -type f -name '*.h'); \ |
| 326 |
for lib in $$headers; do \ |
| 327 |
libname=$$(basename $$lib); \ |
| 328 |
fullpath=$$(echo $$lib | sed -r -e 's,^\./,collectd/,'); \ |
| 329 |
sed -r -i -e "s,(include\s+)\".*\<$$libname\",\1\"$$fullpath\"," $$headers; \ |
| 330 |
done ) |
| 331 |
perl ./debian/bin/gen_plugin_deps.pl |
| 332 |
dh_install |
| 333 |
|
| 334 |
|
| 335 |
override_dh_installexamples: |
| 336 |
dh_installexamples -i contrib/examples/myplugin.c \ |
| 337 |
contrib/examples/MyPlugin.pm |
| 338 |
dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \ |
| 339 |
contrib/collection3/ contrib/php-collection/ \ |
| 340 |
contrib/exec-munin.conf contrib/exec-munin.px contrib/exec-smartctl \ |
| 341 |
contrib/exec-nagios.conf contrib/exec-nagios.px contrib/exec-ksm.sh \ |
| 342 |
contrib/SpamAssassin/ contrib/iptables/ contrib/cussh.pl \ |
| 343 |
contrib/snmp-data.conf contrib/add_rra.sh contrib/network-proxy.py \ |
| 344 |
contrib/collectd_network.py contrib/collectd_unixsock.py \ |
| 345 |
contrib/snmp-probe-host.px contrib/GenericJMX.conf \ |
| 346 |
contrib/postgresql \ |
| 347 |
debian/collectd.conf debian/filters.conf debian/thresholds.conf |
| 348 |
|
| 349 |
|
| 350 |
override_dh_strip: |
| 351 |
dh_strip --dbgsym-migration='collectd-dbg (<< 5.9.2.g-2~)' |
| 352 |
dh_strip_nondeterminism -pcollectd-core |
| 353 |
|
| 354 |
override_dh_shlibdeps: |
| 355 |
dh_shlibdeps -a -Ncollectd-core -Ncollectd |
| 356 |
dpkg-shlibdeps -Tdebian/collectd.substvars \ |
| 357 |
-dDepends debian/collectd-core/usr/lib/collectd/rrdtool.so |
| 358 |
dpkg-shlibdeps -Tdebian/collectd-core.substvars \ |
| 359 |
-dDepends debian/collectd-core/usr/sbin/* \ |
| 360 |
-dSuggests debian/collectd-core/usr/lib/collectd/*.so |
| 361 |
grep shlibs:Suggests debian/collectd-core.substvars \ |
| 362 |
| sed -e 's/shlibs:Suggests/shlibs:Recommends/' \ |
| 363 |
>> debian/collectd.substvars |
| 364 |
|
| 365 |
override_dh_installsystemd: |
| 366 |
dh_installsystemd -pcollectd-core --name=collectd |
| 367 |
|
| 368 |
override_dh_installinit: |
| 369 |
dh_installinit -pcollectd-core --name=collectd |