rpmbuilder/rpms/incus/resources/build.sh
Ben Vincent 182641132a
All checks were successful
Build / build-8 (pull_request) Successful in 8s
Build / build-9 (pull_request) Successful in 9s
refactor: modernise RPM builder with Python tooling v2
- Migrate from legacy shell-based build system to modern Python tooling
- Update all metadata.yaml files to new schema with per-distro builds
- Standardise build scripts with curl -L, envsubst, and error handling
- Convert nfpm.yaml templates to use environment variable substitution
- Update Dockerfile to accept all package metadata as build arguments
- Modernise Makefile to use new Python build tool commands
- Update CI workflow to use tools/build instead of make
2025-11-30 20:27:05 +11:00

55 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/bash
set -e
# Install build dependencies
dnf install -y \
unzip \
libtool \
autoconf \
automake \
gcc \
make \
git \
go \
cowsql-devel \
libacl-devel \
libcap-devel \
libseccomp-devel \
libuv-devel \
raft-devel \
libudev-devel \
lxc-devel \
libsqlite3x-devel \
sqlite-devel \
systemd-rpm-macros \
bash-completion \
gettext \
help2man \
curl-minimal
# Download and extract incus source
curl -L -o /app/incus.tar.gz https://github.com/lxc/incus/archive/refs/tags/v${PACKAGE_VERSION}.tar.gz
tar -C /app -xf incus.tar.gz
# Install specific Go version
curl -L -O https://go.dev/dl/go1.24.1.linux-amd64.tar.gz
rm -rf /usr/local/go
tar -C /usr/local -xzf go1.24.1.linux-amd64.tar.gz
# Set up Go environment and build incus
export PATH=/usr/local/go/bin:$PATH
pushd /app/incus-${PACKAGE_VERSION}
make deps
export CGO_CFLAGS="-I/root/go/deps/raft/include/ -I/root/go/deps/cowsql/include/"
export CGO_LDFLAGS="-L/root/go/deps/raft/.libs -L/root/go/deps/cowsql/.libs/"
export LD_LIBRARY_PATH="/root/go/deps/raft/.libs/:/root/go/deps/cowsql/.libs/"
export CGO_LDFLAGS_ALLOW="(-Wl,-wrap,pthread_create)|(-Wl,-z,now)"
make build
popd
# Build the RPMs
nfpm pkg --config /app/resources/nfpm_incus.yaml --target /app/dist --packager rpm
nfpm pkg --config /app/resources/nfpm_incus-client.yaml --target /app/dist --packager rpm
nfpm pkg --config /app/resources/nfpm_incus-tools.yaml --target /app/dist --packager rpm