Skip to content

Commit 50e541e

Browse files
committed
Makefile: various changes to make CI easier
- made more things externally settable - added a target for checksumming - platformfs targets require the respective rootfs - if the env var $CI is set (automatic in github CI), prints github ci magic strings for grouping output - added targets for building live isos
1 parent e73b635 commit 50e541e

1 file changed

Lines changed: 42 additions & 13 deletions

File tree

Makefile

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
SCRIPTS += $(shell find -type f -name '*.sh')
2-
DATECODE=$(shell date "+%Y%m%d")
1+
DATECODE:=$(shell date -u "+%Y%m%d")
32
SHELL=/bin/bash
43

4+
T_LIVE_ARCHS=i686 x86_64{,-musl}
5+
56
T_PLATFORMS=rpi-{armv{6,7}l,aarch64}{,-musl} beaglebone{,-musl} cubieboard2{,-musl} odroid-c2{,-musl} GCP{,-musl} pinebookpro{,-musl}
67
T_ARCHS=i686 x86_64{,-musl} armv{6,7}l{,-musl} aarch64{,-musl}
78

@@ -10,12 +11,15 @@ T_CLOUD_IMGS=GCP{,-musl}
1011

1112
T_PXE_ARCHS=x86_64{,-musl}
1213

13-
ARCHS=$(shell echo $(T_ARCHS))
14-
PLATFORMS=$(shell echo $(T_PLATFORMS))
15-
SBC_IMGS=$(shell echo $(T_SBC_IMGS))
16-
CLOUD_IMGS=$(shell echo $(T_CLOUD_IMGS))
17-
PXE_ARCHS=$(shell echo $(T_PXE_ARCHS))
14+
LIVE_ARCHS:=$(shell echo $(T_LIVE_ARCHS))
15+
LIVE_FLAVORS:=base enlightenment xfce mate cinnamon gnome kde lxde lxqt
16+
ARCHS:=$(shell echo $(T_ARCHS))
17+
PLATFORMS:=$(shell echo $(T_PLATFORMS))
18+
SBC_IMGS:=$(shell echo $(T_SBC_IMGS))
19+
CLOUD_IMGS:=$(shell echo $(T_CLOUD_IMGS))
20+
PXE_ARCHS:=$(shell echo $(T_PXE_ARCHS))
1821

22+
ALL_LIVE_ISO=$(foreach arch,$(LIVE_ARCHS), $(foreach flavor,$(LIVE_FLAVORS),void-live-$(arch)-$(DATECODE)-$(flavor).iso))
1923
ALL_ROOTFS=$(foreach arch,$(ARCHS),void-$(arch)-ROOTFS-$(DATECODE).tar.xz)
2024
ALL_PLATFORMFS=$(foreach platform,$(PLATFORMS),void-$(platform)-PLATFORMFS-$(DATECODE).tar.xz)
2125
ALL_SBC_IMAGES=$(foreach platform,$(SBC_IMGS),void-$(platform)-$(DATECODE).img.xz)
@@ -24,32 +28,51 @@ ALL_PXE_ARCHS=$(foreach arch,$(PXE_ARCHS),void-$(arch)-NETBOOT-$(DATECODE).tar.g
2428

2529
SUDO := sudo
2630

27-
XBPS_REPOSITORY := -r https://repo-default.voidlinux.org/current -r https://repo-default.voidlinux.org/current/musl -r https://repo-default.voidlinux.org/current/aarch64
28-
COMPRESSOR_THREADS=2
31+
REPOSITORY := https://repo-default.voidlinux.org/current
32+
XBPS_REPOSITORY := -r $(REPOSITORY) -r $(REPOSITORY)/musl -r $(REPOSITORY)/aarch64
33+
COMPRESSOR_THREADS:=2
2934

3035
all:
3136

37+
checksum: dist
38+
cd distdir-$(DATECODE)/ && sha256 * > sha256sum.txt
39+
3240
distdir-$(DATECODE):
3341
mkdir -p distdir-$(DATECODE)
3442

3543
dist: distdir-$(DATECODE)
3644
mv void*$(DATECODE)* distdir-$(DATECODE)/
3745

46+
live-iso-all: $(ALL_LIVE_ISO)
47+
48+
live-iso-all-print:
49+
@echo $(ALL_LIVE_ISO) | sed "s: :\n:g"
50+
51+
void-live-%.iso:
52+
@[ -n "${CI}" ] && printf "::group::\x1b[32mBuilding $@...\x1b[0m\n" || true
53+
$(SUDO) ./build-x86-images.sh -r $(REPOSITORY) -t $*
54+
@[ -n "${CI}" ] && printf '::endgroup::\n' || true
55+
3856
rootfs-all: $(ALL_ROOTFS)
3957

4058
rootfs-all-print:
4159
@echo $(ALL_ROOTFS) | sed "s: :\n:g"
4260

43-
void-%-ROOTFS-$(DATECODE).tar.xz: $(SCRIPTS)
61+
void-%-ROOTFS-$(DATECODE).tar.xz:
62+
@[ -n "${CI}" ] && printf "::group::\x1b[32mBuilding $@...\x1b[0m\n" || true
4463
$(SUDO) ./mkrootfs.sh $(XBPS_REPOSITORY) -x $(COMPRESSOR_THREADS) $*
64+
@[ -n "${CI}" ] && printf '::endgroup::\n' || true
4565

4666
platformfs-all: $(ALL_PLATFORMFS)
4767

4868
platformfs-all-print:
4969
@echo $(ALL_PLATFORMFS) | sed "s: :\n:g"
5070

51-
void-%-PLATFORMFS-$(DATECODE).tar.xz: $(SCRIPTS)
71+
.SECONDEXPANSION:
72+
void-%-PLATFORMFS-$(DATECODE).tar.xz: void-$$(shell ./lib.sh platform2arch %)-ROOTFS-$(DATECODE).tar.xz
73+
@[ -n "${CI}" ] && printf "::group::\x1b[32mBuilding $@...\x1b[0m\n" || true
5274
$(SUDO) ./mkplatformfs.sh $(XBPS_REPOSITORY) -x $(COMPRESSOR_THREADS) $* void-$(shell ./lib.sh platform2arch $*)-ROOTFS-$(DATECODE).tar.xz
75+
@[ -n "${CI}" ] && printf '::endgroup::\n' || true
5376

5477
images-all: platformfs-all images-all-sbc images-all-cloud
5578

@@ -64,19 +87,25 @@ images-all-print:
6487
@echo $(ALL_SBC_IMAGES) $(ALL_CLOUD_IMAGES) | sed "s: :\n:g"
6588

6689
void-%-$(DATECODE).img.xz: void-%-PLATFORMFS-$(DATECODE).tar.xz
90+
@[ -n "${CI}" ] && printf "::group::\x1b[32mBuilding $@...\x1b[0m\n" || true
6791
$(SUDO) ./mkimage.sh -x $(COMPRESSOR_THREADS) void-$*-PLATFORMFS-$(DATECODE).tar.xz
92+
@[ -n "${CI}" ] && printf '::endgroup::\n' || true
6893

6994
# Some of the images MUST be compressed with gzip rather than xz, this
7095
# rule services those images.
7196
void-%-$(DATECODE).tar.gz: void-%-PLATFORMFS-$(DATECODE).tar.xz
97+
@[ -n "${CI}" ] && printf "::group::\x1b[32mBuilding $@...\x1b[0m\n" || true
7298
$(SUDO) ./mkimage.sh -x $(COMPRESSOR_THREADS) void-$*-PLATFORMFS-$(DATECODE).tar.xz
99+
@[ -n "${CI}" ] && printf '::endgroup::\n' || true
73100

74101
pxe-all: $(ALL_PXE_ARCHS)
75102

76103
pxe-all-print:
77104
@echo $(ALL_PXE_ARCHS) | sed "s: :\n:g"
78105

79-
void-%-NETBOOT-$(DATECODE).tar.gz: $(SCRIPTS) void-%-ROOTFS-$(DATECODE).tar.xz
106+
void-%-NETBOOT-$(DATECODE).tar.gz: void-%-ROOTFS-$(DATECODE).tar.xz
107+
@[ -n "${CI}" ] && printf "::group::\x1b[32mBuilding $@...\x1b[0m\n" || true
80108
$(SUDO) ./mknet.sh void-$*-ROOTFS-$(DATECODE).tar.xz
109+
@[ -n "${CI}" ] && printf '::endgroup::\n' || true
81110

82-
.PHONY: all dist rootfs-all-print rootfs-all platformfs-all-print platformfs-all pxe-all-print pxe-all
111+
.PHONY: all checksum dist live-iso-all live-iso-all-print rootfs-all-print rootfs-all platformfs-all-print platformfs-all pxe-all-print pxe-all

0 commit comments

Comments
 (0)