summaryrefslogtreecommitdiffstats
path: root/debian/rules
blob: b831fafe460ddb73e23a7f9dd043ec0fe70ae092 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/usr/bin/make -f

# standard Debian options & profiles

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

ifneq (,$(filter terse,$(DEB_BUILD_OPTIONS)))
  MAKE_SILENT="V=0"
  export DH_VERBOSE=0
else
  MAKE_SILENT="V=1"
  export DH_VERBOSE=1
  export DH_OPTIONS=-v
endif

# package-specific build profiles

ifeq ($(filter pkg.frr.nortrlib,$(DEB_BUILD_PROFILES)),)
  CONF_RPKI=--enable-rpki
else
  CONF_RPKI=--disable-rpki
endif

ifeq ($(filter pkg.frr.nosystemd,$(DEB_BUILD_PROFILES)),)
  DH_WITH_SYSTEMD=systemd,
  CONF_SYSTEMD=--enable-systemd=yes
else
  DH_WITH_SYSTEMD=
  CONF_SYSTEMD=--enable-systemd=no
endif

export PYTHON=python3

%:
	dh $@ --with=$(DH_WITH_SYSTEMD)autoreconf --parallel

override_dh_auto_configure:
	$(shell dpkg-buildflags --export=sh); \
	dh_auto_configure -- \
		--enable-exampledir=/usr/share/doc/frr/examples/ \
		--localstatedir=/var/run/frr \
		--sbindir=/usr/lib/frr \
		--sysconfdir=/etc/frr \
		--with-vtysh-pager=/usr/bin/pager \
		--libdir=/usr/lib/$(DEB_HOST_MULTIARCH)/frr \
		--with-moduledir=/usr/lib/$(DEB_HOST_MULTIARCH)/frr/modules \
		LIBTOOLFLAGS="-rpath /usr/lib/$(DEB_HOST_MULTIARCH)/frr" \
		--disable-dependency-tracking \
		\
		$(CONF_SYSTEMD) \
		$(CONF_RPKI) \
		--with-libpam \
		--enable-doc \
		--enable-doc-html \
		--enable-snmp \
		--enable-fpm \
		--disable-protobuf \
		--disable-zeromq \
		--enable-ospfapi \
		--enable-bgp-vnc \
		--enable-multipath=256 \
		\
		--enable-user=frr \
		--enable-group=frr \
		--enable-vty-group=frrvty \
		--enable-configfile-mask=0640 \
		--enable-logfile-mask=0640 \
		# end

override_dh_auto_install:
	dh_auto_install

	sed -e '1c #!/usr/bin/python3' -i debian/tmp/usr/lib/frr/frr-reload.py

# let dh_systemd_* and dh_installinit do their thing automatically
ifeq ($(filter pkg.frr.nosystemd,$(DEB_BUILD_PROFILES)),)
	cp tools/frr.service debian/frr.service
endif
	cp tools/frrinit.sh debian/frr.init
	-rm -f debian/tmp/usr/lib/frr/frr

# install config files
	mkdir -p debian/tmp/etc/frr/
	sed -e 's#^!log file #!log file /var/log/frr/#' -i debian/tmp/usr/share/doc/frr/examples/*sample*
	-rm debian/tmp/etc/frr/daemons.conf

# drop dev-only files
	find debian/tmp -name '*.la' -o -name '*.a' -o -name 'lib*.so' | xargs rm -f
	rm -rf debian/tmp/usr/include
	-rm debian/tmp/usr/lib/frr/ssd

# use installed js libraries
	-rm -f debian/tmp/usr/share/doc/frr/html/_static/jquery.js
	ln -s /usr/share/javascript/jquery/jquery.js debian/tmp/usr/share/doc/frr/html/_static/jquery.js
	-rm -f debian/tmp/usr/share/doc/frr/html/_static/underscore.js
	ln -s /usr/share/javascript/underscore/underscore.js debian/tmp/usr/share/doc/frr/html/_static/underscore.js

override_dh_auto_build:
	dh_auto_build -- $(MAKE_SILENT)

override_dh_installinit:
	dh_installinit -r

override_dh_installsystemd:
	dh_installsystemd -r

override_dh_makeshlibs:
	dh_makeshlibs -n

override_dh_missing:
	dh_missing --fail-missing

override_dh_auto_clean:
# we generally do NOT want a full distclean since that wipes both
# debian/changelog and config.version
	if test -f Makefile; then make redistclean; fi
	-rm -f debian/frr.init
	-rm -f debian/frr.service