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