- Enhanced Package Information: Expanded PackageInfo struct with 23 fields including section, priority, maintainer, homepage, size, dependencies, and more - Real Package Data Extraction: Integrated dpkg and apt-cache for actual package information instead of mock data - Professional Debian Packaging: Added man pages, shell completions, postinst/prerm scripts, triggers, and lintian overrides - Enhanced Build System: Improved debian/rules with cross-compilation support, enhanced build.sh with options and validation - CI Workflow Updates: Added missing build dependencies, enhanced package validation, lintian quality checks, and comprehensive reporting - Quality Assurance: Added lintian validation, enhanced file checking, and professional packaging standards - Documentation: Comprehensive README.Debian with build instructions and troubleshooting guide Resolves mock package issues and provides production-ready Debian packaging infrastructure.
80 lines
No EOL
2.6 KiB
Makefile
Executable file
80 lines
No EOL
2.6 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
|
|
RUST_TARGET := $(shell dpkg-architecture -qDEB_HOST_ARCH_GNU_TYPE)
|
|
|
|
# Build flags
|
|
CARGO_FLAGS := --release
|
|
ifneq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
|
|
CARGO_FLAGS += --target $(RUST_TARGET)
|
|
endif
|
|
|
|
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/$(if $(filter $(DEB_HOST_ARCH),$(DEB_BUILD_ARCH)),release,$(RUST_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 --dbg-package=apt-ostree-dbg
|
|
# Keep debug package for development
|
|
|
|
override_dh_shlibdeps:
|
|
# Handle shared library dependencies
|
|
dh_shlibdeps
|
|
|
|
override_dh_fixperms:
|
|
# Fix file permissions
|
|
dh_fixperms
|
|
|
|
%:
|
|
dh $@
|