| 1 |
#!/usr/bin/make -f |
| 2 |
export DEB_BUILD_MAINT_OPTIONS = hardening=+all |
| 3 |
DPKG_EXPORT_BUILDFLAGS = 1 |
| 4 |
include /usr/share/dpkg/buildflags.mk |
| 5 |
include /usr/share/dpkg/architecture.mk |
| 6 |
|
| 7 |
LDFLAGS += -Wl,--as-needed |
| 8 |
DH_ADDONS = |
| 9 |
CONFIGURE_FLAGS = |
| 10 |
|
| 11 |
ifeq ($(filter nopython,$(DEB_BUILD_PROFILES)),) |
| 12 |
# For building bindings/swig/ and bindings/python/ for all Python version, these directories are cloned and build in addition to the main library |
| 13 |
PY3DEFAULTVER := $(shell py3versions --default --version) |
| 14 |
PY3VERS := $(shell py3versions --requested --version debian/control) |
| 15 |
PY3VERS := $(filter-out $(PY3DEFAULTVER), $(PY3VERS)) |
| 16 |
CONFIGURE_FLAGS += --without-python --with-python3 |
| 17 |
DH_ADDONS += --with python3 |
| 18 |
else |
| 19 |
CONFIGURE_FLAGS += --without-python --without-python3 |
| 20 |
endif |
| 21 |
|
| 22 |
ifneq ($(filter pkg.audit.noldap,$(DEB_BUILD_PROFILES)),) |
| 23 |
CONFIGURE_FLAGS += --disable-zos-remote |
| 24 |
endif |
| 25 |
|
| 26 |
# Merge the last remaining Ubuntu specific change in Debian: |
| 27 |
# Disable auditd network listener to reduce the risk of a remote attack on |
| 28 |
# auditd, which runs as root |
| 29 |
ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes), yes) |
| 30 |
CONFIGURE_FLAGS += --disable-listener |
| 31 |
endif |
| 32 |
|
| 33 |
%: |
| 34 |
dh $@ --builddirectory=debian/build --buildsystem=autoconf $(DH_ADDONS) |
| 35 |
|
| 36 |
override_dh_auto_configure: debian/config-python-stamp $(PY3VERS:%=debian/config-python3-%-stamp) |
| 37 |
debian/config-python-stamp: |
| 38 |
dh_testdir |
| 39 |
# We should also have "--with-golang" but it's not available in all arch and |
| 40 |
# the golang binding package is arch:all anyway. |
| 41 |
dh_auto_configure -- \ |
| 42 |
--libdir=/usr/lib/${DEB_HOST_MULTIARCH} \ |
| 43 |
--enable-shared=audit \ |
| 44 |
--enable-gssapi-krb5 \ |
| 45 |
--with-apparmor \ |
| 46 |
--with-libwrap \ |
| 47 |
--with-libcap-ng \ |
| 48 |
--with-io_uring \ |
| 49 |
$(CONFIGURE_FLAGS) \ |
| 50 |
--with-arm --with-aarch64 --with-riscv ${EXTRA_ARCH_TABLE} |
| 51 |
touch $@ |
| 52 |
debian/config-python3-%-stamp: debian/config-python-stamp |
| 53 |
cp -lpr debian/build/bindings/swig debian/build/bindings/swig3.$* |
| 54 |
cp -lpr debian/build/bindings/python debian/build/bindings/python3.$* |
| 55 |
touch $@ |
| 56 |
|
| 57 |
override_dh_auto_clean: |
| 58 |
$(RM) debian/*-stamp |
| 59 |
dh_auto_clean |
| 60 |
|
| 61 |
override_dh_auto_build: debian/build-python-stamp $(PY3VERS:%=debian/build-python3-%-stamp) |
| 62 |
debian/build-python-stamp: debian/config-python-stamp |
| 63 |
dh_testdir |
| 64 |
dh_auto_build |
| 65 |
touch $@ |
| 66 |
debian/build-python3-%-stamp: debian/config-python3-%-stamp debian/build-python-stamp |
| 67 |
PYTHON=/usr/bin/python$* $(MAKE) -C debian/build/bindings/swig3.$*/python3 pyexecdir=/usr/lib/python$*/dist-packages \ |
| 68 |
PYTHON3_CFLAGS="$(shell python$*-config --cflags 2> /dev/null)" PYTHON3_LIBS="$(shell python$*-config --libs 2> /dev/null)" PYTHON3_INCLUDES="$(shell python$*-config --includes 2> /dev/null)" |
| 69 |
PYTHON=/usr/bin/python$* $(MAKE) -C debian/build/bindings/python3.$*/python3 pyexecdir=/usr/lib/python$*/dist-packages \ |
| 70 |
PYTHON3_CFLAGS="$(shell python$*-config --cflags 2> /dev/null)" PYTHON3_LIBS="$(shell python$*-config --libs 2> /dev/null)" PYTHON3_INCLUDES="$(shell python$*-config --includes 2> /dev/null)" |
| 71 |
touch $@ |
| 72 |
|
| 73 |
debian/install-python-stamp: debian/build-python-stamp |
| 74 |
dh_testdir |
| 75 |
dh_auto_install --sourcedir=debian/build --destdir=debian/tmp |
| 76 |
touch $@ |
| 77 |
debian/install-python3-%-stamp: debian/build-python3-%-stamp debian/install-python-stamp |
| 78 |
PYTHON=/usr/bin/python$* $(MAKE) -C debian/build/bindings/swig3.$*/python3 pyexecdir=/usr/lib/python$*/dist-packages DESTDIR=$(CURDIR)/debian/tmp install \ |
| 79 |
PYTHON3_CFLAGS="$(shell python$*-config --cflags 2> /dev/null)" PYTHON3_LIBS="$(shell python$*-config --libs 2> /dev/null)" PYTHON3_INCLUDES="$(shell python$*-config --includes 2> /dev/null)" |
| 80 |
PYTHON=/usr/bin/python$* $(MAKE) -C debian/build/bindings/python3.$*/python3 pyexecdir=/usr/lib/python$*/dist-packages DESTDIR=$(CURDIR)/debian/tmp install \ |
| 81 |
PYTHON3_CFLAGS="$(shell python$*-config --cflags 2> /dev/null)" PYTHON3_LIBS="$(shell python$*-config --libs 2> /dev/null)" PYTHON3_INCLUDES="$(shell python$*-config --includes 2> /dev/null)" |
| 82 |
touch $@ |
| 83 |
override_dh_auto_install: debian/install-python-stamp $(PY3VERS:%=debian/install-python3-%-stamp) |
| 84 |
# Remove some RedHat specific files |
| 85 |
$(RM) debian/tmp/etc/rc.d/init.d/auditd |
| 86 |
$(RM) debian/tmp/etc/sysconfig/auditd |
| 87 |
|
| 88 |
# Install the default configuration |
| 89 |
install -o root -g root -m 0750 -d debian/tmp/etc/audit/rules.d/ |
| 90 |
install -o root -g root -m 0640 rules/10-base-config.rules debian/tmp/etc/audit/rules.d/audit.rules |
| 91 |
|
| 92 |
override_dh_installexamples: |
| 93 |
dh_installexamples -XMakefile |
| 94 |
|
| 95 |
override_dh_installlogrotate: |
| 96 |
# auditd has a equivalent built-in feature |
| 97 |
|
| 98 |
override_dh_installinit: |
| 99 |
dh_installinit --restart-after-upgrade |
| 100 |
|
| 101 |
override_dh_fixperms-arch: |
| 102 |
dh_fixperms -a |
| 103 |
#chmod o-wx debian/auditd/usr/bin/aulastlog |
| 104 |
#chmod o-wx debian/auditd/usr/sbin/auditctl |
| 105 |
#chmod o-wx debian/auditd/usr/sbin/auditd |
| 106 |
#chmod o-wx debian/auditd/usr/sbin/autrace |
| 107 |
#chmod 750 debian/auditd/usr/sbin/audispd |
| 108 |
chmod -R o-rwx debian/auditd/var/log/audit |
| 109 |
chgrp adm debian/auditd/var/log/audit |
| 110 |
chmod -R o-rwx debian/auditd/etc/audit debian/audispd-plugins/etc/audit |
| 111 |
|
| 112 |
get-orig-source: |
| 113 |
-uscan --upstream-version 0 |
| 114 |
|
| 115 |
my-check: |
| 116 |
find debian/*aud*/ -mindepth 0 -name DEBIAN -prune -o -not -type d -print|sed -e 's,debian/[^/]*/,,' -e 's/\.gz$$//' |