]> git.proxmox.com Git - mirror_frr.git/blame - debianpkg/rules
Merge pull request #1825 from chiragshah6/ospfv3_dev
[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)"
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) \
148 $(USE_TCP_ZEBRA) \
23b53dca 149 --enable-fpm \
7dc9a305
MW
150 $(USE_FRR_USER) $(USE_FRR_GROUP) \
151 $(USE_FRR_VTY_GROUP) \
f1db66bf
DS
152 --enable-configfile-mask=0640 \
153 --enable-logfile-mask=0640 \
d6db5772 154 --enable-werror \
6fb16c6b 155 --with-libpam \
f87adf0a 156 --enable-systemd=yes \
f879bbf4 157 --enable-poll=yes \
7dc9a305
MW
158 $(USE_CUMULUS) \
159 $(USE_PIM) \
9ad5ef40 160 --enable-dependency-tracking \
4c2db6ed 161 $(USE_BGP_VNC) \
100c355e 162 $(USE_RPKI) \
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
d8e4c438 189 # installing the Frr specific SNMP MIB
3d85ffa5 190ifeq ($(WANT_SNMP), 1)
4d916382 191 install -D -m 644 ./zebra/GNOME-PRODUCT-ZEBRA-MIB debian/tmp/usr/share/snmp/mibs/GNOME-PRODUCT-ZEBRA-MIB
3d85ffa5
DS
192else
193 mkdir -p debian/tmp/usr/share/snmp/mibs/
194endif
f1db66bf 195
4d916382
DS
196 # cleaning .la files
197 sed -i "/dependency_libs/ s/'.*'/''/" debian/tmp/usr/lib/*.la
27232291 198 sed -i "/dependency_libs/ s/'.*'/''/" debian/tmp/usr/lib/frr/modules/*.la
4d916382 199
858aa29c 200override_dh_systemd_start:
d8e4c438 201 dh_systemd_start frr.service
858aa29c
DS
202
203override_dh_systemd_enable:
d8e4c438 204 dh_systemd_enable frr.service
858aa29c 205
a8247b21
SM
206# backports
207SRCPKG = frr
2f29e6d7 208KNOWN_BACKPORTS = debian8 debian9 ubuntu12.04 ubuntu14.04 ubuntu16.04 ubuntu17.10
a8247b21 209DEBIAN_VERSION := $(shell dh_testdir && \
79c81c26
SM
210 dpkg-parsechangelog -c1 < debian/changelog | \
211 sed -rn 's/^Version: ?//p')
5eee7099 212ORIG_VERSION := $(DEBIAN_VERSION)
a8247b21
SM
213-include debian/backports/rules
214
215ifneq ($(TARBALLDIR),)
0f4ac621 216ifeq ($(wildcard frr-$(ORIG_VERSION).tar.gz),frr-$(ORIG_VERSION).tar.gz)
ee9d7744
SM
217
218$(TARBALLDIR)/$(SRCPKG)_$(ORIG_VERSION).orig.tar.gz: \
0f4ac621 219 frr-$(ORIG_VERSION).tar.gz
495feb8a 220 cp $< $@
ee9d7744 221
0f4ac621 222else # wildcard frr-$(ORIG_VERSION).tar.gz
ee9d7744 223
a8247b21
SM
224# better error message on missing .orig.tar.gz
225$(TARBALLDIR)/$(SRCPKG)_$(ORIG_VERSION).orig.tar.gz:
ee9d7744 226 @ echo "\`$(TARBALLDIR)/$(SRCPKG)-$(ORIG_VERSION).tar.gz'" not \
a8247b21
SM
227 found and not generated by debian/rules. Provided you have the \
228 necessary packages installed, you can generate it yourself via \
ee9d7744 229 "\"./bootstrap.sh && ./configure && make dist\"".
a8247b21 230 exit 1
ee9d7744 231
0f4ac621 232endif # wildcard frr-$(ORIG_VERSION).tar.gz
ee9d7744 233endif # TARBALLDIR nonempty