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