]> git.proxmox.com Git - mirror_frr.git/blame - debianpkg/rules
debianpkg: Add option to build with RPKI
[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
13WANT_TCP_ZEBRA ?= 0
f1aaa729 14WANT_BGP_VNC ?= 1
9782a8db 15WANT_CUMULUS_MODE ?= 0
16WANT_MULTIPATH ?= 1
17WANT_SNMP ?= 0
100c355e 18WANT_RPKI ?= 0
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
7dc9a305
MW
77ifeq ($(WANT_TCP_ZEBRA),1)
78 USE_TCP_ZEBRA=--enable-tcp-zebra
9782a8db 79else
80 USE_TCP_ZEBRA=--disable-tcp-zebra
7dc9a305
MW
81endif
82
9782a8db 83ifeq ($(WANT_BGP_VNC), 1)
7dc9a305
MW
84 USE_BGP_VNC=--enable-bgp-vnc=yes
85else
86 USE_BGP_VNC=--enable-bgp-vnc=no
87endif
88
9782a8db 89USE_FRR_USER=--enable-user=$(WANT_FRR_USER)
90USE_FRR_GROUP=--enable-group=$(WANT_FRR_USER)
91USE_FRR_VTY_GROUP=--enable-vty-group=$(WANT_FRR_VTY_GROUP)
7dc9a305 92
9782a8db 93ifeq ($(WANT_MULTIPATH), 1)
94 USE_MULTIPATH=--enable-multipath=$(MULTIPATH)
7dc9a305
MW
95else
96 USE_MULTIPATH=--disable-multipath
97endif
98
a2ec1de2 99ifeq ($(WANT_CUMULUS_MODE), 1)
7dc9a305
MW
100 USE_CUMULUS=--enable-cumulus=yes
101else
102 USE_CUMULUS=--enable-cumulus=no
103endif
104
100c355e
MW
105ifeq ($(WANT_RPKI), 1)
106 USE_RPKI=--enable-rpki
107else
108 USE_RPKI=--disable-rpki
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)"
125endif
126
4d916382 127override_dh_auto_configure:
d8e4c438 128 # Frr needs /proc to check some BSD vs Linux specific stuff.
4d916382
DS
129 # Else it fails with an obscure error message pointing out that
130 # IPCTL_FORWARDING is an undefined symbol which is not very helpful.
131 @if ! [ -d /proc/1 ]; then \
f1db66bf
DS
132 echo "./configure needs a mounted /proc"; \
133 exit 1; \
4d916382 134 fi
d0af8528
DS
135
136 if ! [ -e config.status ]; then \
4d916382 137 dh_auto_configure -- \
d8e4c438
DS
138 --enable-exampledir=/usr/share/doc/frr/examples/ \
139 --localstatedir=/var/run/frr \
140 --sbindir=/usr/lib/frr \
141 --sysconfdir=/etc/frr \
f1db66bf 142 $(USE_SNMP) \
7dc9a305
MW
143 $(USE_OSPFAPI) \
144 $(USE_MULTIPATH) \
145 $(USE_LDP) \
146 $(USE_TCP_ZEBRA) \
23b53dca 147 --enable-fpm \
7dc9a305
MW
148 $(USE_FRR_USER) $(USE_FRR_GROUP) \
149 $(USE_FRR_VTY_GROUP) \
f1db66bf
DS
150 --enable-configfile-mask=0640 \
151 --enable-logfile-mask=0640 \
d6db5772 152 --enable-werror \
6fb16c6b 153 --with-libpam \
f87adf0a 154 --enable-systemd=yes \
f879bbf4 155 --enable-poll=yes \
7dc9a305
MW
156 $(USE_CUMULUS) \
157 $(USE_PIM) \
9ad5ef40 158 --enable-dependency-tracking \
4c2db6ed 159 $(USE_BGP_VNC) \
100c355e 160 $(USE_RPKI) \
4c2db6ed 161 $(shell dpkg-buildflags --export=configure); \
d0af8528 162 fi
4d916382
DS
163
164override_dh_auto_build:
4d916382 165 # doc/ is a bit crazy
76ed358f 166ifeq ($(GENERATE_PDF), 1)
edc33b2f 167 dh_auto_build -- -C doc pdf
76ed358f 168endif
b59555c6 169 rm -vf doc/user/_build/texinfo/frr.info
edc33b2f 170 dh_auto_build -- -C doc info
d0af8528
DS
171
172override_dh_auto_test:
f1db66bf 173
4d916382
DS
174override_dh_auto_install:
175 dh_auto_install
f1db66bf 176
c650c681 177 # installed in frr-pythontools
178 rm debian/tmp/usr/lib/frr/frr-reload.py
179
4d916382
DS
180 # cleaning up the info dir
181 rm -f debian/tmp/usr/share/info/dir*
f1db66bf 182
4d916382 183 # install config files
d8e4c438
DS
184 mkdir -p debian/tmp/etc/frr/
185 perl -pi -e 's#^!log file #!log file /var/log/frr/#' debian/tmp/usr/share/doc/frr/examples/*sample*
f1db66bf 186
d8e4c438 187 # installing the Frr specific SNMP MIB
3d85ffa5 188ifeq ($(WANT_SNMP), 1)
4d916382 189 install -D -m 644 ./zebra/GNOME-PRODUCT-ZEBRA-MIB debian/tmp/usr/share/snmp/mibs/GNOME-PRODUCT-ZEBRA-MIB
3d85ffa5
DS
190else
191 mkdir -p debian/tmp/usr/share/snmp/mibs/
192endif
f1db66bf 193
4d916382
DS
194 # cleaning .la files
195 sed -i "/dependency_libs/ s/'.*'/''/" debian/tmp/usr/lib/*.la
27232291 196 sed -i "/dependency_libs/ s/'.*'/''/" debian/tmp/usr/lib/frr/modules/*.la
4d916382 197
858aa29c 198override_dh_systemd_start:
d8e4c438 199 dh_systemd_start frr.service
858aa29c
DS
200
201override_dh_systemd_enable:
d8e4c438 202 dh_systemd_enable frr.service
858aa29c 203
a8247b21
SM
204# backports
205SRCPKG = frr
2f29e6d7 206KNOWN_BACKPORTS = debian8 debian9 ubuntu12.04 ubuntu14.04 ubuntu16.04 ubuntu17.10
a8247b21 207DEBIAN_VERSION := $(shell dh_testdir && \
79c81c26
SM
208 dpkg-parsechangelog -c1 < debian/changelog | \
209 sed -rn 's/^Version: ?//p')
5eee7099 210ORIG_VERSION := $(DEBIAN_VERSION)
a8247b21
SM
211-include debian/backports/rules
212
213ifneq ($(TARBALLDIR),)
0f4ac621 214ifeq ($(wildcard frr-$(ORIG_VERSION).tar.gz),frr-$(ORIG_VERSION).tar.gz)
ee9d7744
SM
215
216$(TARBALLDIR)/$(SRCPKG)_$(ORIG_VERSION).orig.tar.gz: \
0f4ac621 217 frr-$(ORIG_VERSION).tar.gz
495feb8a 218 cp $< $@
ee9d7744 219
0f4ac621 220else # wildcard frr-$(ORIG_VERSION).tar.gz
ee9d7744 221
a8247b21
SM
222# better error message on missing .orig.tar.gz
223$(TARBALLDIR)/$(SRCPKG)_$(ORIG_VERSION).orig.tar.gz:
ee9d7744 224 @ echo "\`$(TARBALLDIR)/$(SRCPKG)-$(ORIG_VERSION).tar.gz'" not \
a8247b21
SM
225 found and not generated by debian/rules. Provided you have the \
226 necessary packages installed, you can generate it yourself via \
ee9d7744 227 "\"./bootstrap.sh && ./configure && make dist\"".
a8247b21 228 exit 1
ee9d7744 229
0f4ac621 230endif # wildcard frr-$(ORIG_VERSION).tar.gz
ee9d7744 231endif # TARBALLDIR nonempty