apt-ostree/debian/rules
joe b4fa6fe1c2 fix: Simplify debian/rules to resolve build errors
- Remove unsupported DEB_HOST_ARCH_GNU_TYPE variable
- Remove invalid --dbg-package=apt-ostree-dbg reference
- Simplify cross-compilation logic to avoid complex conditionals
- Fix binary install path to use standard release target
- Resolves dpkg-architecture and dh_strip errors in CI build

Fixes Debian package build failures in CI workflow.
2025-08-15 15:08:55 -07:00

76 lines
No EOL
2.3 KiB
Makefile
Executable file

#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE = 1
# This has to be exported to make some magic below work.
export DH_OPTIONS
# Build system configuration
export CARGO_HOME = $(CURDIR)/debian/cargo
export CARGO_TARGET_DIR = $(CURDIR)/debian/cargo/target
# Detect architecture for cross-compilation
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
# Rust target for cross-compilation (simplified)
RUST_TARGET := $(DEB_HOST_ARCH)
# Build flags
CARGO_FLAGS := --release
override_dh_auto_build:
@echo "Building apt-ostree for $(DEB_HOST_ARCH)..."
# Ensure cargo is available
@which cargo > /dev/null || (echo "Error: cargo not found. Please install Rust toolchain." && exit 1)
# Build apt-ostree with cargo
cargo build $(CARGO_FLAGS)
dh_auto_build
override_dh_auto_install:
@echo "Installing apt-ostree binary..."
# Install the apt-ostree binary to the correct location
install -D -m 755 debian/cargo/target/release/apt-ostree \
debian/apt-ostree/usr/bin/apt-ostree
# Create additional directories
mkdir -p debian/apt-ostree/usr/share/doc/apt-ostree
mkdir -p debian/apt-ostree/usr/share/man/man1
mkdir -p debian/apt-ostree/usr/share/bash-completion/completions
mkdir -p debian/apt-ostree/usr/share/zsh/vendor-completions
# Install man page if it exists
@if [ -f "debian/apt-ostree.1" ]; then \
install -D -m 644 debian/apt-ostree.1 debian/apt-ostree/usr/share/man/man1/apt-ostree.1; \
fi
# Install bash completion if it exists
@if [ -f "debian/apt-ostree.bash-completion" ]; then \
install -D -m 644 debian/apt-ostree.bash-completion \
debian/apt-ostree/usr/share/bash-completion/completions/apt-ostree; \
fi
# Install zsh completion if it exists
@if [ -f "debian/apt-ostree.zsh-completion" ]; then \
install -D -m 644 debian/apt-ostree.zsh-completion \
debian/apt-ostree/usr/share/zsh/vendor-completions/_apt-ostree; \
fi
# Skip dh_auto_install since we've handled installation manually
override_dh_auto_clean:
@echo "Cleaning cargo build artifacts..."
# Clean cargo build artifacts
rm -rf debian/cargo
dh_auto_clean
override_dh_strip:
# Strip debug symbols from binary
dh_strip
override_dh_shlibdeps:
# Handle shared library dependencies
dh_shlibdeps
override_dh_fixperms:
# Fix file permissions
dh_fixperms
%:
dh $@