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