Ian Wienand b08d522be7 Build jammy packages
This is an import of the infrastructure to make Jammy packages

Depends-On: https://review.opendev.org/c/openstack/openstack-zuul-jobs/+/840788
Change-Id: Ie66d3b1e39ef9fa714b1dabdb7eb61cc43538587
2022-05-06 12:53:24 +10:00

112 lines
3.5 KiB
Makefile
Executable File

#!/usr/bin/make -f
# Determine whether we're building with optimization. This doesn't really
# work at the moment due to upstream problems.
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
DEBIAN_OPT_FLAGS = --disable-optimize --disable-optimize-lwp
DEBIAN_KERN_FLAGS = --disable-optimize-kernel
else
DEBIAN_OPT_FLAGS =
DEBIAN_KERN_FLAGS =
endif
# Find kernel build information.
ifndef KSRC
KSRC := /lib/modules/$(shell uname -r)/build
endif
ifndef KPKG_DEST_DIR
KPKG_DEST_DIR = ..
endif
KVERS := $(shell perl debian/kernel-version $(KSRC))
export KSRC
export KVERS
export KPKG_DEST_DIR
SYS_NAME := $(shell KSRC="$(KSRC)" KVERS="$(KVERS)" ARCH="$(ARCH)" \
sh debian/sysname)
package = openafs
modulepkg := openafs-modules-$(KVERS)${INT_SUBARCH}
moduledir := debian/$(modulepkg)/lib/modules/$(KVERS)/fs
# After building the package, m-a calls debian/rules with the target
# echo-debfile. Without this dummy rule, this would trigger the setup
# target (by way of the wildcard rule for dh), which re-creates the setup
# flag file that we removed during make clean.
#
# Then, if module-assistant unpacks a new version of the source, the setup
# file already exists so the setup rule isn't run again. But the
# debian/control file is the template from the new source, which doesn't
# contain any buildable packages.
#
# Add a dummy target for echo-debfile to ensure that setup isn't run again
# after clean. If there are further changes to module-assistant, causing it
# to run other targets after clean, more similar dummy rules may need to be
# added.
echo-debfile:
@true
# make-kpkg tries to rebuild debian/rules first, so add a dummy target to
# avoid our dh wildcard rule and a fatal error.
debian/rules ./debian/rules:
@true
# This setup must be done before running any other target if it hasn't
# already been done.
setup:
@if test x"$(SYS_NAME)" = x"UNKNOWN" ; then exit 1 ; fi
@if test x"$(KVERS)" = x ; then \
echo 'No version in $(KSRC)/include/linux/version.h' >&2 ; \
exit 1 ; \
fi
sh debian/prep-modules $(KSRC)
touch $@
%: setup
dh $@
override_dh_auto_configure:
sh configure --prefix=$(CURDIR)/debian/tmp \
--with-afs-sysname=$(SYS_NAME) \
--disable-linux-syscall-probing \
--with-linux-kernel-headers=$(KSRC) \
--with-linux-kernel-packaging \
--enable-debug --enable-debug-lwp --enable-debug-kernel \
$(DEBIAN_OPT_FLAGS) $(DEBIAN_KERN_FLAGS)
override_dh_auto_install:
cd src/libafs && make install DESTDIR=$(CURDIR)/debian/tmp
install -d -g root -o root -m 755 $(moduledir)
install -g root -o root -m 644 \
debian/tmp/lib/modules/*/extra/openafs/*o $(moduledir)/
override_dh_clean:
rm -rf src/libafs/MODLOAD-* *-stamp
dh_clean Makefile config.log config.status setup src/libafs/Makefile \
src/libafs/Makefile.common src/libafs/asm src/libafs/asm-generic \
src/libafs/h src/libafs/linux src/libafs/net src/libafs/netinet \
src/libafs/rpc src/libafs/sys
override_dh_gencontrol:
dh_gencontrol -- -v`cat debian/VERSION`
override_dh_builddeb:
dh_builddeb --destdir="$(KPKG_DEST_DIR)"
kdist_configure: override_dh_auto_configure
kdist_image:
$(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules binary-arch
$(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules clean
kdist:
$(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules binary-arch
KSRC="$(KSRC)" KMAINT="$(KMAINT)" KEMAIL="$(KEMAIL)" \
sh -v debian/genchanges
$(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules clean
kdist_clean:
$(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules clean
.PHONY: kdist kdist_clean kdist_configure kdist_image