build: Readjust where build instructions live

This commit is contained in:
June Tate-Gans 2024-03-29 10:06:18 -05:00
parent 59fbbd1ca4
commit 6f2cd546bb
3 changed files with 67 additions and 14 deletions

View File

@ -1,6 +1,6 @@
---
kind: pipeline
type: kubernetes
type: drone
name: manjaro
steps:
@ -20,10 +20,7 @@ steps:
mtu: 1000
commands:
- pacman -Sy --noconfirm
- pacman -S --noconfirm base-devel python meson lsb-release git
- chown -R nobody:nobody .
- sudo -u nobody make
- tools/dockerbuild.sh manjaro
- name: test
image: archlinux:latest
@ -38,7 +35,7 @@ steps:
---
kind: pipeline
type: kubernetes
type: drone
name: debian
steps:
@ -58,10 +55,7 @@ steps:
mtu: 1000
commands:
- touch /etc/pbuilderrc
- apt-get update
- apt-get install -y devscripts python3 build-essential git-buildpackage appstream dh-sequence-python3 meson
- make
- tools/dockerbuild.sh debian
- name: test
image: debian:unstable
@ -76,7 +70,7 @@ steps:
---
kind: pipeline
type: kubernetes
type: drone
name: fedora
steps:
@ -96,8 +90,7 @@ steps:
mtu: 1000
commands:
- dnf install -y rpmdevtools rpmlint make automake python meson lsb-release git
- make
- tools/dockerbuild.sh fedora
- name: test
image: fedora:latest

View File

@ -81,7 +81,14 @@ env:
test: env
PYTHONPATH=. tools/in-env python3 -m g13gui.tests
.PHONY: all clean install
dist: clean
mkdir -p build
tar --exclude=build --exclude=.drone.yml --exclude-vcs -zcf build/g13gui_$(VERSION).tar.gz .
docker run -ti -v ${PWD}:/srcs -w /srcs fedora:latest tools/dockerbuild.sh fedora
docker run -ti -v ${PWD}:/srcs -w /srcs debian:latest tools/dockerbuild.sh debian
docker run -ti -v ${PWD}:/srcs -w /srcs arch:latest tools/dockerbuild.sh arch
.PHONY: all clean install test
.PHONY: manjaro manjaro-clean manjaro-install
.PHONY: debian debian-build debian-clean debian-build-source debian-release

53
tools/dockerbuild.sh Executable file
View File

@ -0,0 +1,53 @@
#!/bin/bash
#
# Bare-minimum shell script to isolate distro-specific setup requirements
# without using make, which has been a standard part of POSIX for decades,
# but for some idiotic reason not installed on Linux images by default.
die() {
echo "$@" >/dev/stderr
exit 1
}
try() {
echo "$@"
"$@" || die "error: $1 exited with code $?"
}
DISTRO="$1"; shift
[[ -z "${DISTRO}" ]] && die "Usage: dockerbuild.sh <distro>"
case "${DISTRO}" in
manjaro)
try pacman -Sy --noconfirm
try pacman -S --noconfirm base-devel python meson lsb-release git
# Work around makepkg brain-damage and build as nobody
try mkdir -p /tmp/build
try cp -r /srcs /tmp/build
try chown -R nobody:nobody /tmp/build
cd /tmp/build
try sudo -u nobody make
try cp build/* /srcs/build
;;
debian)
# Work around pbuilder brain-damage in noninteractive contexts.
try touch /etc/pbuilderrc
try apt-get update
try apt-get install -y devscripts build-essential git-buildpackage appstream dh-sequence-python3 meson
cd /srcs
try make
;;
fedora)
try dnf install -y rpmdevtools rpmlint make python meson lsb-release git
cd /srcs
try make
;;
*)
die "Unknown distro '${DISTRO}'."
esac