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