open5gs/debian/rules

44 lines
1.9 KiB
Makefile
Executable File

#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
DEBIAN := $(shell dpkg-parsechangelog | grep ^Version: | cut -d' ' -f2)
DEBVERS := $(shell echo '$(DEBIAN)' | cut -d- -f1)
VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g')
# This has to be exported to make some magic below work.
#export DH_OPTIONS
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
%:
dh $@ --with autoreconf --with systemd
override_dh_auto_test:
mongodb_exclude_list=; \
sctp_exclude_list=; \
mongodb_forked=no; \
remove_db_uri_conf=; \
if which mongod > /dev/null; then \
if ! ps -ef | grep mongod | grep -v grep > /dev/null; then \
mongodb_forked=yes; \
mongod --fork --logpath debian/test/var/log/mongodb.log --dbpath debian/test/db; \
fi; \
else \
remove_db_uri_conf="/DB_URI/d"; \
mongodb_exclude_list="-x s1setup_test attach_test volte_test handover_test"; \
fi; \
mkdir -p debian/test/db debian/test/etc/nextepc/freeDiameter debian/test/var/log/nextepc; \
sed -e 's?\([_a-z0-9]*\)\.conf?'`pwd`'/debian/test/etc/nextepc/freeDiameter/\1.conf?g;s?@LOCALSTATE_DIR@?'`pwd`'/debian/test/var?g;'$$remove_db_uri_conf'' support/config/nextepc.conf.in > debian/test/etc/nextepc/nextepc.conf; \
for i in `find support/freeDiameter -name '*.conf.in' -printf "%f\n" | sed 's/.in$$//g'`; do \
sed 's?@SYSCONF_DIR@/nextepc?'`pwd`'/support?g;s?\([_a-z0-9]*\)\.so?'`pwd`'/lib/freeDiameter-1.2.1/extensions/\1/.libs/\1.so?g' support/freeDiameter/$$i.in > debian/test/etc/nextepc/freeDiameter/$$i; \
done; \
if ! cat /proc/net/protocols | grep SCTP > /dev/null; then \
sctp_exclude_list="-x testsctp s1setup_test attach_test volte_test handover_test"; \
fi; \
lib/core/test/testcore $$sctp_exclude_list || exit; \
test/testepc -f debian/test/etc/nextepc/nextepc.conf -c $$sctp_exclude_list $$mongodb_exclude_list || exit; \
if test "x$$mongodb_forked" = xyes; then \
pkill mongod; \
fi;