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