]> git.proxmox.com Git - mirror_frr.git/blobdiff - debianpkg/rules
debian: move changelog out of the way
[mirror_frr.git] / debianpkg / rules
index 894cd7f198a26ab8d230b5dcc34a24899b6668f7..bc7d4de269351d36eda90cda3c939f23f01ef256 100755 (executable)
 #!/usr/bin/make -f
 
-# FRRouting Configuration options
-######################################
-#
-#    WANT_xxxx   --> Set to 1 for enable, 0 for disable
-# The following are the defaults. They can be overridden by setting a 
-# env variable to a different value
-
-# -Werror - don't enable this unless you're doing a dev package build
-WANT_WERROR ?= 0
-
-WANT_OSPFAPI ?= 1
-WANT_BGP_VNC ?= 1
-WANT_CUMULUS_MODE ?= 0
-WANT_MULTIPATH ?= 1
-WANT_SNMP ?= 0
-WANT_RPKI ?= 0
-
-# NOTES:
-#
-# If you use WANT_RPKI, then there is a new dependency for librtr0 package
-#    and a build dependency of the librtr-dev package.
-#    While the librtr0 is added to the depenencies automatically, the build
-#    dependency can't be changed dynamically and building will fail if the
-#    librtr-dev isn't installed during package build
-#    Tested versions of both packages can be found at
-#    https://ci1.netdef.org/browse/RPKI-RTRLIB/latestSuccessful/artifact
-#
-# If multipath is enabled (WANT_MULTIPATH=1), then set number of multipaths here
-#    Please be aware that 0 is NOT disabled, but treated as unlimited
-
-MULTIPATH ?= 256
-
-# Set the following to the value required (or leave alone for the default below)
-# WANT_FRR_USER is used for the username and groupname of the FRR user account
-
-WANT_FRR_USER ?= frr
-WANT_FRR_VTY_GROUP ?= frrvty
-
-# Don't build PDF docs by default
-# add build deps: texlive-latex-base, texlive-generic-recommended
-GENERATE_PDF ?= 0
-
-#
-####################################
-
-export DH_VERBOSE=1
-export DEB_BUILD_MAINT_OPTIONS = hardening=+all
-export DH_OPTIONS=-v
+# standard Debian options & profiles
 
-ifeq ($(WANT_SNMP), 1)
-  USE_SNMP=--enable-snmp
-  $(warning "DEBIAN: SNMP enabled, sorry for your inconvenience")
-else
-  USE_SNMP=--disable-snmp
-  $(warning "DEBIAN: SNMP disabled, see README.Debian")
-endif
-
-ifeq ($(WANT_OSPFAPI), 1)
-  USE_OSPFAPI=--enable-ospfapi=yes
-else
-  USE_OSPFAPI=--enable-ospfapi=no
-endif
-
-ifeq ($(WANT_BGP_VNC), 1)
-  USE_BGP_VNC=--enable-bgp-vnc=yes
-else
-  USE_BGP_VNC=--enable-bgp-vnc=no
-endif
-
-USE_FRR_USER=--enable-user=$(WANT_FRR_USER)
-USE_FRR_GROUP=--enable-group=$(WANT_FRR_USER)
-USE_FRR_VTY_GROUP=--enable-vty-group=$(WANT_FRR_VTY_GROUP)
+export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 
-ifeq ($(WANT_MULTIPATH), 1)
-  USE_MULTIPATH=--enable-multipath=$(MULTIPATH)
+ifneq (,$(filter terse,$(DEB_BUILD_OPTIONS)))
+  MAKE_SILENT="V=0"
+  export DH_VERBOSE=0
 else
-  USE_MULTIPATH=--disable-multipath
+  MAKE_SILENT="V=1"
+  export DH_VERBOSE=1
+  export DH_OPTIONS=-v
 endif
 
-ifeq ($(WANT_CUMULUS_MODE), 1)
-  USE_CUMULUS=--enable-cumulus=yes
-else
-  USE_CUMULUS=--enable-cumulus=no
-endif
+# package-specific build profiles
 
-ifeq ($(WANT_RPKI), 1)
-  USE_RPKI=--enable-rpki
+ifeq ($(filter pkg.frr.nortrlib,$(DEB_BUILD_PROFILES)),)
+  CONF_RPKI=--enable-rpki
 else
-  USE_RPKI=--disable-rpki
+  CONF_RPKI=--disable-rpki
 endif
 
-ifeq ($(WANT_WERROR), 1)
-  USE_WERROR=--enable-werror
+ifeq ($(filter pkg.frr.nosystemd,$(DEB_BUILD_PROFILES)),)
+  DH_WITH_SYSTEMD=systemd,
+  CONF_SYSTEMD=--enable-systemd=yes
 else
-  USE_WERROR=--disable-werror
+  DH_WITH_SYSTEMD=
+  CONF_SYSTEMD=--enable-systemd=no
 endif
 
-ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
-  DEBIAN_JOBS := $(subst parallel=,,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
-endif
-
-ifdef DEBIAN_JOBS
-MAKEFLAGS += -j$(DEBIAN_JOBS)
-endif
+export PYTHON=python3
 
 %:
-       dh $@ --with=systemd,autoreconf --parallel --dbg-package=frr-dbg --list-missing
-
-override_dh_gencontrol:
-ifeq ($(WANT_RPKI), 1)
-       dh_gencontrol -- -Vdist:Depends="librtr0 (>= 0.5)"
-else
-       dh_gencontrol
-endif
+       dh $@ --with=$(DH_WITH_SYSTEMD)autoreconf --parallel
 
 override_dh_auto_configure:
-       if ! [ -e config.status ]; then \
+       $(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 \
-               $(USE_SNMP) \
-               $(USE_OSPFAPI) \
-               $(USE_MULTIPATH) \
+               --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 \
-               $(USE_FRR_USER) $(USE_FRR_GROUP) \
-               $(USE_FRR_VTY_GROUP) \
+               --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 \
-               $(USE_WERROR) \
-               --with-libpam \
-               --enable-systemd=yes \
-               $(USE_CUMULUS) \
-               --disable-dependency-tracking \
-               $(USE_BGP_VNC) \
-               $(USE_RPKI) \
-               $(shell dpkg-buildflags --export=configure); \
-       fi
-
-override_dh_auto_build:
-       dh_auto_build
-
-override_dh_auto_test:
+               # end
 
 override_dh_auto_install:
        dh_auto_install
 
-       # installed in frr-pythontools
-       rm debian/tmp/usr/lib/frr/frr-reload.py
+       sed -e '1c #!/usr/bin/python3' -i debian/tmp/usr/lib/frr/frr-reload.py
 
-       # cleaning up the info dir
-       rm -f debian/tmp/usr/share/info/dir*
+# 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/frr debian/frr.init
 
-       # install config files
+# install config files
        mkdir -p debian/tmp/etc/frr/
-       perl -pi -e 's#^!log file #!log file /var/log/frr/#' debian/tmp/usr/share/doc/frr/examples/*sample*
-
-       # we don't need .la files
-       rm debian/tmp/usr/lib/*.la
-       rm debian/tmp/usr/lib/frr/modules/*.la
-
-override_dh_systemd_start:
-       dh_systemd_start frr.service
-
-override_dh_systemd_enable:
-       dh_systemd_enable frr.service
-
-# backports
-SRCPKG = frr
-KNOWN_BACKPORTS = debian8 debian9 ubuntu12.04 ubuntu14.04 ubuntu16.04 ubuntu17.10 ubuntu18.04
-DEBIAN_VERSION := $(shell dh_testdir && \
-               dpkg-parsechangelog -c1 < debian/changelog | \
-               sed -rn 's/^Version: ?//p')
-ORIG_VERSION := $(DEBIAN_VERSION)
--include debian/backports/rules
-
-ifneq ($(TARBALLDIR),)
-ifeq ($(wildcard frr-$(ORIG_VERSION).tar.gz),frr-$(ORIG_VERSION).tar.gz)
-
-$(TARBALLDIR)/$(SRCPKG)_$(ORIG_VERSION).orig.tar.gz: \
-               frr-$(ORIG_VERSION).tar.gz
-       cp $< $@
-
-else # wildcard frr-$(ORIG_VERSION).tar.gz
-
-# better error message on missing .orig.tar.gz
-$(TARBALLDIR)/$(SRCPKG)_$(ORIG_VERSION).orig.tar.gz:
-       @ echo "\`$(TARBALLDIR)/$(SRCPKG)-$(ORIG_VERSION).tar.gz'" not \
-               found and not generated by debian/rules. Provided you have the \
-               necessary packages installed, you can generate it yourself via \
-               "\"./bootstrap.sh && ./configure && make dist\"".
-       exit 1
-
-endif # wildcard frr-$(ORIG_VERSION).tar.gz
-endif # TARBALLDIR nonempty
+       sed -e 's#^!log file #!log file /var/log/frr/#' -i debian/tmp/usr/share/doc/frr/examples/*sample*
+
+# 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
+
+# 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_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
+# debianpkg/changelog and config.version
+       if test -f Makefile; then make redistclean; fi