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