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