]> git.proxmox.com Git - mirror_frr.git/blame - debianpkg/rules
debianpkg: Fix lintian warning "command-with-path-in-maintainer-script"
[mirror_frr.git] / debianpkg / rules
CommitLineData
4d916382
DS
1#!/usr/bin/make -f
2
7dc9a305
MW
3# FRRouting Configuration options
4######################################
5#
6# WANT_xxxx --> Set to 1 for enable, 0 for disable
7# The following are the defaults. They can be overridden by setting a
8# env variable to a different value
9#
10# export WANT_LDP=1
11# export WANT_PIM=1
12# export WANT_OSPFAPI=1
13# export WANT_TCP_ZEBRA=0
7dc9a305
MW
14# export WANT_BGP_VNC=0
15# export WANT_CUMULUS_MODE=0
16# export WANT_MULTIPATH=1
17#
18# If multipath is enabled (WANT_MULTIPATH=1), then set number of multipaths here
19# Please be aware that 0 is NOT disabled, but treated as unlimited
20# export MULTIPATH=256
21#
22# Set the following to the value required (or leave undefined for the default below)
23# WANT_FRR_USER is used for the username and groupname of the FRR user account
24# export WANT_FRR_USER=frr
25# export WANT_FRR_VTY_GROUP=frrvty
26#
27####################################
28
4d916382 29export DH_VERBOSE=1
4c2db6ed 30export DEB_BUILD_MAINT_OPTIONS = hardening=+all
d0af8528 31export DH_OPTIONS=-v
4d916382
DS
32
33ifeq ($(WANT_SNMP), 1)
34 USE_SNMP=--enable-snmp
35 $(warning "DEBIAN: SNMP enabled, sorry for your inconvenience")
36else
37 $(warning "DEBIAN: SNMP disabled, see README.Debian")
38endif
39
7dc9a305
MW
40ifneq ($(WANT_LDP), 0)
41 USE_LDP=--enable-ldpd
42else
43 USE_LDP=--disable-ldpd
44endif
45
46ifneq ($(WANT_PIM), 0)
47 USE_PIM=--enable-pimd
48else
49 USE_PIM=--disable-pimd
50endif
51
52ifneq ($(WANT_OSPFAPI), 0)
53 USE_OSPFAPI=--enable-ospfapi=yes
54else
55 USE_OSPFAPI=--enable-ospfapi=no
56endif
57
7dc9a305
MW
58ifeq ($(WANT_TCP_ZEBRA),1)
59 USE_TCP_ZEBRA=--enable-tcp-zebra
60endif
61
62ifneq ($(WANT_BGP_VNC), 0)
63 USE_BGP_VNC=--enable-bgp-vnc=yes
64else
65 USE_BGP_VNC=--enable-bgp-vnc=no
66endif
67
68ifndef WANT_FRR_USER
69 USE_FRR_USER=--enable-user=frr
70 USE_FRR_GROUP=--enable-group=frr
71else
72 USE_FRR_USER=$(WANT_FRR_USER)
73 USE_FRR_GROUP=$(WANT_FRR_USER)
74endif
75
76ifndef WANT_FRR_VTY_GROUP
77 USE_FRR_VTY_GROUP=--enable-vty-group=frrvty
78else
79 USE_FRR_VTY_GROUP=--enable-vty-group=$(WANT_FRR_VTY_GROUP)
80endif
81
82ifneq ($(WANT_MULTIPATH), 0)
83 ifdef MULTIPATH
84 USE_MULTIPATH=--enable-multipath=$(MULTIPATH)
85 else
86 USE_MULTIPATH=--enable-multipath=256
87 endif
88else
89 USE_MULTIPATH=--disable-multipath
90endif
91
92ifeq ($(WANT_CUMULUS_NODE), 1)
93 USE_CUMULUS=--enable-cumulus=yes
94else
95 USE_CUMULUS=--enable-cumulus=no
96endif
97
35dab95b
DS
98ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
99 DEBIAN_JOBS := $(subst parallel=,,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
100endif
101
102ifdef DEBIAN_JOBS
103MAKEFLAGS += -j$(DEBIAN_JOBS)
104endif
105
4d916382 106%:
d8e4c438 107 dh $@ --with=systemd,autoreconf --parallel --dbg-package=frr-dbg --list-missing
4d916382
DS
108
109override_dh_auto_configure:
d8e4c438 110 # Frr needs /proc to check some BSD vs Linux specific stuff.
4d916382
DS
111 # Else it fails with an obscure error message pointing out that
112 # IPCTL_FORWARDING is an undefined symbol which is not very helpful.
113 @if ! [ -d /proc/1 ]; then \
f1db66bf
DS
114 echo "./configure needs a mounted /proc"; \
115 exit 1; \
4d916382 116 fi
d0af8528
DS
117
118 if ! [ -e config.status ]; then \
4d916382 119 dh_auto_configure -- \
d8e4c438
DS
120 --enable-exampledir=/usr/share/doc/frr/examples/ \
121 --localstatedir=/var/run/frr \
122 --sbindir=/usr/lib/frr \
123 --sysconfdir=/etc/frr \
f1db66bf 124 $(USE_SNMP) \
7dc9a305
MW
125 $(USE_OSPFAPI) \
126 $(USE_MULTIPATH) \
127 $(USE_LDP) \
128 $(USE_TCP_ZEBRA) \
23b53dca 129 --enable-fpm \
7dc9a305
MW
130 $(USE_FRR_USER) $(USE_FRR_GROUP) \
131 $(USE_FRR_VTY_GROUP) \
f1db66bf
DS
132 --enable-configfile-mask=0640 \
133 --enable-logfile-mask=0640 \
d6db5772 134 --enable-werror \
6fb16c6b 135 --with-libpam \
f87adf0a 136 --enable-systemd=yes \
f879bbf4 137 --enable-poll=yes \
7dc9a305
MW
138 $(USE_CUMULUS) \
139 $(USE_PIM) \
9ad5ef40 140 --enable-dependency-tracking \
4c2db6ed
MW
141 $(USE_BGP_VNC) \
142 $(shell dpkg-buildflags --export=configure); \
d0af8528 143 fi
4d916382
DS
144
145override_dh_auto_build:
d0af8528
DS
146 #dh_auto_build
147 $(MAKE)
85ca2dfd 148 dh_auto_build -- -C doc draft-zebra-00.txt
d0af8528 149
f1db66bf 150
4d916382 151 # doc/ is a bit crazy
76ed358f 152ifeq ($(GENERATE_PDF), 1)
d8e4c438 153 dh_auto_build -- -C doc frr.pdf || true # pdfetex fails with exit code 1 but still produces a good looking .pdf
76ed358f 154endif
d8e4c438
DS
155 rm -vf doc/frr.info
156 dh_auto_build -- -C doc frr.info
157 rm -vf doc/frr.info.html*
d0af8528
DS
158
159override_dh_auto_test:
f1db66bf 160
4d916382
DS
161override_dh_auto_install:
162 dh_auto_install
f1db66bf 163
c650c681 164 # installed in frr-pythontools
165 rm debian/tmp/usr/lib/frr/frr-reload.py
166
4d916382
DS
167 # cleaning up the info dir
168 rm -f debian/tmp/usr/share/info/dir*
f1db66bf 169
4d916382 170 # install config files
d8e4c438
DS
171 mkdir -p debian/tmp/etc/frr/
172 perl -pi -e 's#^!log file #!log file /var/log/frr/#' debian/tmp/usr/share/doc/frr/examples/*sample*
f1db66bf 173
d8e4c438 174 # installing the Frr specific SNMP MIB
3d85ffa5 175ifeq ($(WANT_SNMP), 1)
4d916382 176 install -D -m 644 ./zebra/GNOME-PRODUCT-ZEBRA-MIB debian/tmp/usr/share/snmp/mibs/GNOME-PRODUCT-ZEBRA-MIB
3d85ffa5
DS
177else
178 mkdir -p debian/tmp/usr/share/snmp/mibs/
179endif
f1db66bf 180
4d916382
DS
181 # cleaning .la files
182 sed -i "/dependency_libs/ s/'.*'/''/" debian/tmp/usr/lib/*.la
27232291 183 sed -i "/dependency_libs/ s/'.*'/''/" debian/tmp/usr/lib/frr/modules/*.la
4d916382 184
858aa29c 185override_dh_systemd_start:
d8e4c438 186 dh_systemd_start frr.service
858aa29c
DS
187
188override_dh_systemd_enable:
d8e4c438 189 dh_systemd_enable frr.service
858aa29c 190
a8247b21
SM
191# backports
192SRCPKG = frr
0d14a9ef 193KNOWN_BACKPORTS = debian8 debian9 ubuntu12.04 ubuntu14.04 ubuntu16.04
a8247b21 194DEBIAN_VERSION := $(shell dh_testdir && \
79c81c26
SM
195 dpkg-parsechangelog -c1 < debian/changelog | \
196 sed -rn 's/^Version: ?//p')
5eee7099 197ORIG_VERSION := $(DEBIAN_VERSION)
a8247b21
SM
198-include debian/backports/rules
199
200ifneq ($(TARBALLDIR),)
0f4ac621 201ifeq ($(wildcard frr-$(ORIG_VERSION).tar.gz),frr-$(ORIG_VERSION).tar.gz)
ee9d7744
SM
202
203$(TARBALLDIR)/$(SRCPKG)_$(ORIG_VERSION).orig.tar.gz: \
0f4ac621 204 frr-$(ORIG_VERSION).tar.gz
495feb8a 205 cp $< $@
ee9d7744 206
0f4ac621 207else # wildcard frr-$(ORIG_VERSION).tar.gz
ee9d7744 208
a8247b21
SM
209# better error message on missing .orig.tar.gz
210$(TARBALLDIR)/$(SRCPKG)_$(ORIG_VERSION).orig.tar.gz:
ee9d7744 211 @ echo "\`$(TARBALLDIR)/$(SRCPKG)-$(ORIG_VERSION).tar.gz'" not \
a8247b21
SM
212 found and not generated by debian/rules. Provided you have the \
213 necessary packages installed, you can generate it yourself via \
ee9d7744 214 "\"./bootstrap.sh && ./configure && make dist\"".
a8247b21 215 exit 1
ee9d7744 216
0f4ac621 217endif # wildcard frr-$(ORIG_VERSION).tar.gz
ee9d7744 218endif # TARBALLDIR nonempty