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