Commit 40507036 authored by Michael Tremer's avatar Michael Tremer

debian: Add script to build package for various arches

Signed-off-by: default avatarMichael Tremer <michael.tremer@ipfire.org>
parent 8cac548e
......@@ -9,11 +9,6 @@ BINDINGS =
OS = $(shell uname -s)
DEBIAN_TARBALL_NAME = $(PACKAGE_NAME)_$(PACKAGE_VERSION).orig.tar.xz
CLEANFILES += \
$(DEBIAN_TARBALL_NAME)
if ENABLE_PERL
BINDINGS += perl
endif
......@@ -444,9 +439,22 @@ man/%.html: man/%.txt man/asciidoc.conf
upload-man: $(MANPAGES_HTML)
rsync -avHz --delete --progress $(MANPAGES_HTML) ms@fs01.haj.ipfire.org:/pub/man-pages/$(PACKAGE_NAME)/
$(DEBIAN_TARBALL_NAME): dist
cp -v $(distdir).tar.xz $@
EXTRA_DIST += \
debian/autoreconf.after \
debian/autoreconf.before \
debian/build.sh \
debian/changelog \
debian/compat \
debian/control \
debian/copyright \
debian/libloc-dev.install \
debian/libloc.install \
debian/libloc.lintian-overrides \
debian/libloc.manpages \
debian/libloc-perl.install \
debian/rules \
debian/source/format
.PHONY: debian
debian: $(DEBIAN_TARBALL_NAME)
debuild -i -us -uc -b
debian: dist
$(SHELL) debian/build.sh $(PACKAGE_NAME)-$(PACKAGE_VERSION) $(distdir).tar.xz
#!/bin/bash
set -x
ARCHITECTURES=( amd64 arm64 i386 armhf riscv64 )
RELEASES=( buster )
CHROOT_PATH="/var/tmp"
main() {
if [ $# -lt 2 ]; then
echo "Not enough arguments" >&2
return 2
fi
local package="${1}"
local sources="${2}"
# Create some temporary directory
local tmp="$(mktemp -d)"
# Extract the sources into it
tar xvfa "${sources}" -C "${tmp}"
# Copy the tarball under the correct Debian name
cp -vf "${sources}" "${tmp}/${package//-/_}.orig.tar.xz"
# Change into source directory
pushd "${tmp}/${package}"
# Prepare the build environment
#if ! debuild -us -uc; then
# echo "Could not prepare build environment" >&2
# return 1
#fi
# Build the package for each release
local release
for release in ${RELEASES[@]}; do
# And for each architecture we want to support
local arch
for arch in ${ARCHITECTURES[@]}; do
local chroot="${release}-${arch}-sbuild"
# Create a chroot environment
if [ ! -d "/etc/sbuild/chroot/${chroot}" ]; then
if ! sbuild-createchroot --arch="${arch}" "${release}" \
"${CHROOT_PATH}/${chroot}"; then
echo "Could not create chroot for ${release} on ${arch}" >&2
return 1
fi
fi
# Run the build process
if ! sbuild --dist="${release}" --host="${arch}"; then
echo "Could not build package for ${release} on ${arch}" >&2
return 1
fi
done
done
popd
# Cleanup
rm -rf "${tmp}"
}
main "$@" || exit $?
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment