mostly automate make target generation

This commit is contained in:
Lance Vick 2024-02-08 09:09:58 -08:00
parent b823d29aef
commit fc2f84c1eb
Signed by: lrvick
GPG Key ID: 8E47A1EC35A1551D
11 changed files with 673 additions and 485 deletions

View File

@ -1,26 +1,21 @@
export PLATFORM := linux/amd64
export BUILDER := $(shell which docker)
export REGISTRY := stagex
export REGISTRY_LOCAL := stagex-local
export REGISTRY_REMOTE := stagex
export NOCACHE ?= 0
export MIRRORS := \
git.distrust.co \
hub.docker.com
ifeq ($(NOCACHE), 1)
NOCACHE_FLAG=--no-cache
else
NOCACHE_FLAG=
endif
export NOCACHE_FLAG
clean_logs := $(shell rm *.log 2>&1 >/dev/null || :)
include src/macros.mk
include src/bootstrap/build.mk
include src/core/build.mk
include src/kernel/build.mk
include src/libs/build.mk
include src/tools/build.mk
include src/packages.mk
include src/packages_manual.mk
compat:
./src/compat.sh

View File

@ -1,18 +0,0 @@
.PHONY: bootstrap
bootstrap: \
out/stage0.tar \
out/stage1.tar \
out/stage2.tar \
out/stage3.tar
out/stage0.tar:
$(call build,bootstrap,stage0)
out/stage1.tar: out/stage0.tar
$(call build,bootstrap,stage1)
out/stage2.tar: out/stage1.tar
$(call build,bootstrap,stage2)
out/stage3.tar: out/stage2.tar
$(call build,bootstrap,stage3)

10
src/context.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
for each in $(find src/*/*/Containerfile); do
package=$(basename $(dirname ${each}))
digest_file=out/${package}/index.json
digest_line=""
if [ -e ${digest_file} ]; then
printf -- ' --build-context %s=oci-layout://./out/%s' "${package}" "${package}"
fi
done

View File

@ -1,377 +0,0 @@
.PHONY: core
core: \
out/rust.tar \
out/go.tar \
out/python.tar \
out/perl.tar \
out/gcc.tar \
out/llvm.tar
out/musl.tar: out/stage3.tar
$(call build,core,musl)
out/busybox.tar: out/stage3.tar
$(call build,core,busybox)
out/binutils.tar: out/stage3.tar out/musl.tar
$(call build,core,binutils)
out/make.tar: out/stage3.tar
$(call build,core,make)
out/gcc.tar: out/stage3.tar out/binutils.tar out/musl.tar
$(call build,core,gcc)
out/bash.tar: \
out/busybox.tar \
out/gcc.tar \
out/binutils.tar \
out/musl.tar \
out/make.tar
$(call build,core,bash)
out/m4.tar: \
out/busybox.tar \
out/gcc.tar \
out/binutils.tar \
out/musl.tar \
out/make.tar
$(call build,core,m4)
out/perl.tar: \
out/gcc.tar \
out/binutils.tar \
out/busybox.tar \
out/make.tar \
out/musl.tar
$(call build,core,perl)
out/autoconf.tar: \
out/busybox.tar \
out/gcc.tar \
out/binutils.tar \
out/musl.tar \
out/make.tar \
out/perl.tar \
out/m4.tar
$(call build,core,autoconf,,fetch)
$(call build,core,autoconf)
out/automake.tar: \
out/busybox.tar \
out/gcc.tar \
out/binutils.tar \
out/musl.tar \
out/make.tar \
out/perl.tar \
out/autoconf.tar \
out/m4.tar
$(call build,core,automake)
out/sed.tar: \
out/busybox.tar \
out/gcc.tar \
out/binutils.tar \
out/musl.tar \
out/make.tar
$(call build,core,sed)
out/libtool.tar: \
out/busybox.tar \
out/gcc.tar \
out/binutils.tar \
out/musl.tar \
out/make.tar \
out/bash.tar \
out/sed.tar \
out/m4.tar
$(call build,core,libtool)
out/pkgconf.tar: \
out/busybox.tar \
out/gcc.tar \
out/binutils.tar \
out/musl.tar \
out/make.tar \
out/libtool.tar
$(call build,core,pkgconf)
out/libunwind.tar: \
out/busybox.tar \
out/gcc.tar \
out/binutils.tar \
out/musl.tar \
out/make.tar \
out/bash.tar \
out/autoconf.tar \
out/automake.tar \
out/libtool.tar
$(call build,core,libunwind)
out/linux-headers.tar:
$(call build,core,linux-headers)
out/openssl.tar: \
out/gcc.tar \
out/binutils.tar \
out/busybox.tar \
out/linux-headers.tar \
out/musl.tar
$(call build,core,openssl)
out/go.tar: \
out/gcc.tar \
out/binutils.tar \
out/busybox.tar \
out/bash.tar \
out/musl.tar
$(call build,core,go)
out/python.tar: \
out/gcc.tar \
out/perl.tar \
out/binutils.tar \
out/busybox.tar \
out/openssl.tar \
out/zlib.tar \
out/make.tar \
out/musl.tar
$(call build,core,python)
out/ninja.tar: \
out/busybox.tar \
out/gcc.tar \
out/binutils.tar \
out/musl.tar \
out/make.tar \
out/openssl.tar \
out/python.tar
$(call build,core,ninja)
out/cmake.tar: \
out/busybox.tar \
out/gcc.tar \
out/binutils.tar \
out/ninja.tar \
out/musl.tar \
out/make.tar \
out/linux-headers.tar
$(call build,core,cmake)
out/py-setuptools.tar: \
out/busybox.tar \
out/python.tar \
out/zlib.tar
$(call build,core,py-setuptools)
out/zlib.tar: \
out/busybox.tar \
out/gcc.tar \
out/binutils.tar \
out/musl.tar \
out/make.tar
$(call build,core,zlib)
out/llvm13.tar: \
out/gcc.tar \
out/python.tar \
out/py-setuptools.tar \
out/perl.tar \
out/binutils.tar \
out/cmake.tar \
out/ninja.tar \
out/busybox.tar \
out/zlib.tar \
out/musl.tar
$(call build,core,llvm,13.0.1)
out/llvm.tar: \
out/gcc.tar \
out/python.tar \
out/py-setuptools.tar \
out/perl.tar \
out/binutils.tar \
out/cmake.tar \
out/ninja.tar \
out/busybox.tar \
out/zlib.tar \
out/musl.tar
$(call build,core,llvm)
$(BUILDER) tag $(REGISTRY)/llvm $(REGISTRY)/llvm:16
$(BUILDER) tag $(REGISTRY)/llvm $(REGISTRY)/llvm:16.0.6
out/rust1.54.tar: \
out/gcc.tar \
out/bash.tar \
out/zlib.tar \
out/python.tar \
out/py-setuptools.tar \
out/perl.tar \
out/libunwind.tar \
out/pkgconf.tar \
out/llvm13.tar \
out/binutils.tar \
out/cmake.tar \
out/make.tar \
out/busybox.tar \
out/musl.tar
$(call build,core,rust,1.54.0,bootstrap-package)
out/rust1.55.tar: out/rust1.54.tar
$(call build,core,rust,1.55.0,package,--build-arg BUILD_VERSION=1.54.0)
out/rust1.56.tar: out/rust1.55.tar
$(call build,core,rust,1.56.0,package,--build-arg BUILD_VERSION=1.55.0)
out/rust1.57.tar: out/rust1.56.tar
$(call build,core,rust,1.57.0,package,--build-arg BUILD_VERSION=1.56.0)
out/rust1.58.tar: out/rust1.57.tar
$(call build,core,rust,1.58.0,package,--build-arg BUILD_VERSION=1.57.0)
out/rust1.59.tar: out/rust1.58.tar
$(call build,core,rust,1.59.0,package,--build-arg BUILD_VERSION=1.58.0)
out/rust1.60.tar: out/rust1.59.tar
$(call build,core,rust,1.60.0,package,--build-arg BUILD_VERSION=1.59.0)
out/rust1.61.tar: out/rust1.60.tar
$(call build,core,rust,1.61.0,package,--build-arg BUILD_VERSION=1.60.0)
out/rust1.62.tar: out/rust1.61.tar
$(call build,core,rust,1.62.0,package,--build-arg BUILD_VERSION=1.61.0)
out/rust1.63.tar: out/rust1.62.tar
$(call build,core,rust,1.63.0,package,--build-arg BUILD_VERSION=1.62.0)
out/rust1.64.tar: out/rust1.63.tar
$(call build,core,rust,1.64.0,package,--build-arg BUILD_VERSION=1.63.0)
out/rust1.65.tar: out/rust1.64.tar
$(call build,core,rust,1.65.0,package,--build-arg BUILD_VERSION=1.64.0)
out/rust1.66.tar: out/rust1.65.tar
$(call build,core,rust,1.66.0,package,--build-arg BUILD_VERSION=1.65.0)
out/rust1.67.tar: out/rust1.66.tar
$(call build,core,rust,1.67.0,package,--build-arg BUILD_VERSION=1.66.0)
out/rust1.68.tar: out/rust1.67.tar
$(call build,core,rust,1.68.0,package,--build-arg BUILD_VERSION=1.67.0)
out/rust1.69.tar: out/rust1.68.tar out/llvm.tar
$(call build,core,rust,1.69.0,package,--build-arg BUILD_VERSION=1.68.0 --build-arg LLVM_VERSION=16)
out/rust1.70.tar: out/rust1.69.tar
$(call build,core,rust,1.70.0,package,--build-arg BUILD_VERSION=1.69.0 --build-arg LLVM_VERSION=16)
out/rust1.71.tar: out/rust1.70.tar
$(call build,core,rust,1.71.0,package,--build-arg BUILD_VERSION=1.70.0 --build-arg LLVM_VERSION=16)
out/rust1.72.tar: out/rust1.71.tar
$(call build,core,rust,1.72.0,package,--build-arg BUILD_VERSION=1.71.0 --build-arg LLVM_VERSION=16)
out/rust1.73.tar: out/rust1.72.tar
$(call build,core,rust,1.73.0,package,--build-arg BUILD_VERSION=1.72.0 --build-arg LLVM_VERSION=16)
out/rust.tar: out/rust1.73.tar
$(call build,core,rust,1.74.0,package,--build-arg BUILD_VERSION=1.73.0 --build-arg LLVM_VERSION=16)
out/bison.tar: \
out/busybox.tar \
out/gcc.tar \
out/binutils.tar \
out/musl.tar \
out/make.tar
$(call build,core,bison)
out/gettext.tar: \
out/busybox.tar \
out/gcc.tar \
out/binutils.tar \
out/musl.tar \
out/make.tar
$(call build,core,gettext)
out/flex.tar: \
out/busybox.tar \
out/gcc.tar \
out/autoconf.tar \
out/libtool.tar \
out/binutils.tar \
out/gettext.tar \
out/bison.tar \
out/musl.tar \
out/make.tar
$(call build,core,flex)
out/argp-standalone.tar: \
out/libtool.tar \
out/automake.tar \
out/autoconf.tar \
out/make.tar \
out/musl.tar \
out/m4.tar \
out/gcc.tar
$(call build,core,argp-standalone)
out/musl-fts.tar: \
out/libtool.tar \
out/automake.tar \
out/autoconf.tar \
out/make.tar \
out/musl.tar \
out/m4.tar \
out/pkgconf.tar \
out/gcc.tar
$(call build,core,musl-fts)
out/musl-obstack.tar: \
out/libtool.tar \
out/automake.tar \
out/autoconf.tar \
out/make.tar \
out/musl.tar \
out/m4.tar \
out/pkgconf.tar \
out/gcc.tar
$(call build,core,musl-obstack)
out/meson.tar: \
out/busybox.tar \
out/cmake.tar \
out/llvm.tar \
out/python.tar \
out/py-setuptools.tar \
out/linux-headers.tar \
out/zlib.tar
$(call build,core,meson)
out/libzstd.tar: \
out/busybox.tar \
out/meson.tar \
out/python.tar \
out/zlib.tar
$(call build,core,libzstd)
out/elfutils.tar: \
out/busybox.tar \
out/argp-standalone.tar \
out/musl.tar \
out/musl-fts.tar \
out/musl-obstack.tar \
out/binutils.tar \
out/bison.tar \
out/flex.tar \
out/linux-headers.tar \
out/libtool.tar \
out/gettext.tar \
out/libzstd.tar \
out/pkgconf.tar \
out/autoconf.tar \
out/automake.tar \
out/m4.tar \
out/make.tar \
out/gcc.tar \
out/zlib.tar
$(call build,core,elfutils)

View File

@ -1,18 +0,0 @@
.PHONY: linux
linux: \
out/linux-generic.tar
out/linux-generic.tar: \
out/gcc.tar \
out/binutils.tar \
out/make.tar \
out/musl.tar \
out/bison.tar \
out/pkgconf.tar \
out/libzstd.tar \
out/openssl.tar \
out/perl.tar \
out/zlib.tar \
out/flex.tar \
out/elfutils.tar
$(call build,kernel,linux-generic)

View File

@ -1,18 +0,0 @@
out/libxml2.tar: \
out/busybox.tar \
out/gcc.tar \
out/binutils.tar \
out/musl.tar \
out/make.tar \
out/bash.tar \
out/python.tar \
out/sed.tar \
out/m4.tar \
out/autoconf.tar \
out/automake.tar \
out/pkgconf.tar \
out/libtool.tar
$(call build,libs,libxml2)
out/ca-certificates.tar:
$(call build,libs,ca-certificates)

View File

@ -35,30 +35,23 @@ define build
$(BUILDER) \
build \
--ulimit nofile=2048:16384 \
--tag $(REGISTRY)/$(NAME):$(VERSION) \
--tag $(REGISTRY_LOCAL)/$(NAME):$(VERSION) \
--build-arg SOURCE_DATE_EPOCH=1 \
--build-arg REGISTRY=$(REGISTRY) \
--build-arg CORES=$(shell nproc --all) \
--platform $(PLATFORM) \
--progress=plain \
$(if $(filter latest,$(VERSION)),,--build-arg VERSION=$(VERSION)) \
--output type=oci,rewrite-timestamp=true,force-compression=true,name=$(NAME),annotation.org.opencontainers.image.revision=$(REVISION),annotation.org.opencontainers.image.version=$(VERSION),dest=$(TEMPFILE) \
--output type=oci,rewrite-timestamp=true,force-compression=true,name=$(NAME),annotation.org.opencontainers.image.revision=$(REVISION),annotation.org.opencontainers.image.version=$(VERSION),tar=false,dest=out/$(NAME) \
--target $(TARGET) \
$(shell ./src/context.sh) \
$(EXTRA_ARGS) \
$(NOCACHE_FLAG) \
-f src/$(CATEGORY)/$(NAME)/Containerfile \
src/$(CATEGORY)/$(NAME) \
)
$(eval TIMESTAMP := $(shell TZ=GMT date +"%Y-%m-%dT%H:%M:%SZ"))
set -eux; \
mkdir -p out/; \
echo $(TIMESTAMP) $(BUILD_CMD) start >> out/build.log; \
$(BUILD_CMD); \
tar -tf $(TEMPFILE); \
docker load < $(TEMPFILE); \
mv $(TEMPFILE) $@; \
tar -xf $@ index.json -O \
| jq -r '.manifests[].digest | sub("sha256:";"")' \
> $(basename $@).digest; \
echo $(TIMESTAMP) $(BUILD_CMD) end >> out/build.log;
mkdir -p out/ \
&& echo $(TIMESTAMP) $(BUILD_CMD) start >> out/build.log \
&& $(BUILD_CMD) \
&& echo $(TIMESTAMP) $(BUILD_CMD) end >> out/build.log;
endef

500
src/packages.mk Normal file
View File

@ -0,0 +1,500 @@
src/packages.mk: src/packages.sh
src/packages.sh > src/packages.mk
PHONY: stage0
stage0: out/stage0/index.json
out/stage0/index.json: \
src/bootstrap/stage0/Containerfile
$(call build,bootstrap,stage0)
PHONY: stage1
stage1: out/stage1/index.json
out/stage1/index.json: \
src/bootstrap/stage1/Containerfile \
stage0
$(call build,bootstrap,stage1)
PHONY: stage2
stage2: out/stage2/index.json
out/stage2/index.json: \
src/bootstrap/stage2/Containerfile \
stage1 \
stage2
$(call build,bootstrap,stage2)
PHONY: stage3
stage3: out/stage3/index.json
out/stage3/index.json: \
src/bootstrap/stage3/Containerfile \
stage2
$(call build,bootstrap,stage3)
PHONY: argp-standalone
argp-standalone: out/argp-standalone/index.json
out/argp-standalone/index.json: \
src/core/argp-standalone/Containerfile \
autoconf \
automake \
binutils \
busybox \
gcc \
m4 \
make \
musl
$(call build,core,argp-standalone)
PHONY: autoconf
autoconf: out/autoconf/index.json
out/autoconf/index.json: \
src/core/autoconf/Containerfile \
binutils \
busybox \
gcc \
m4 \
make \
musl \
perl
$(call build,core,autoconf)
PHONY: automake
automake: out/automake/index.json
out/automake/index.json: \
src/core/automake/Containerfile \
autoconf \
binutils \
busybox \
gcc \
m4 \
make \
musl \
perl
$(call build,core,automake)
PHONY: bash
bash: out/bash/index.json
out/bash/index.json: \
src/core/bash/Containerfile \
binutils \
busybox \
gcc \
make \
musl
$(call build,core,bash)
PHONY: binutils
binutils: out/binutils/index.json
out/binutils/index.json: \
src/core/binutils/Containerfile \
stage3
$(call build,core,binutils)
PHONY: bison
bison: out/bison/index.json
out/bison/index.json: \
src/core/bison/Containerfile \
binutils \
busybox \
gcc \
make \
musl
$(call build,core,bison)
PHONY: busybox
busybox: out/busybox/index.json
out/busybox/index.json: \
src/core/busybox/Containerfile \
stage3
$(call build,core,busybox)
PHONY: cmake
cmake: out/cmake/index.json
out/cmake/index.json: \
src/core/cmake/Containerfile \
binutils \
busybox \
gcc \
linux-headers \
make \
musl \
ninja \
openssl
$(call build,core,cmake)
PHONY: elfutils
elfutils: out/elfutils/index.json
out/elfutils/index.json: \
src/core/elfutils/Containerfile \
argp-standalone \
autoconf \
automake \
binutils \
bison \
busybox \
flex \
gcc \
gettext \
libtool \
libzstd \
linux-headers \
m4 \
make \
musl \
musl-fts \
musl-obstack \
pkgconf \
zlib
$(call build,core,elfutils)
PHONY: flex
flex: out/flex/index.json
out/flex/index.json: \
src/core/flex/Containerfile \
autoconf \
automake \
binutils \
bison \
busybox \
gcc \
gettext \
libtool \
m4 \
make \
musl
$(call build,core,flex)
PHONY: gcc
gcc: out/gcc/index.json
out/gcc/index.json: \
src/core/gcc/Containerfile \
stage3 \
binutils \
busybox \
musl
$(call build,core,gcc)
PHONY: gettext
gettext: out/gettext/index.json
out/gettext/index.json: \
src/core/gettext/Containerfile \
binutils \
busybox \
gcc \
make \
musl
$(call build,core,gettext)
PHONY: go
go: out/go/index.json
out/go/index.json: \
src/core/go/Containerfile \
bash \
binutils \
busybox \
gcc \
musl
$(call build,core,go)
PHONY: libtool
libtool: out/libtool/index.json
out/libtool/index.json: \
src/core/libtool/Containerfile \
binutils \
busybox \
gcc \
m4 \
make \
musl
$(call build,core,libtool)
PHONY: libunwind
libunwind: out/libunwind/index.json
out/libunwind/index.json: \
src/core/libunwind/Containerfile \
autoconf \
automake \
binutils \
busybox \
gcc \
libtool \
make \
musl
$(call build,core,libunwind)
PHONY: libzstd
libzstd: out/libzstd/index.json
out/libzstd/index.json: \
src/core/libzstd/Containerfile \
binutils \
busybox \
gcc \
meson \
musl \
ninja \
pkgconf \
python \
zlib
$(call build,core,libzstd)
PHONY: linux-headers
linux-headers: out/linux-headers/index.json
out/linux-headers/index.json: \
src/core/linux-headers/Containerfile \
stage3
$(call build,core,linux-headers)
PHONY: m4
m4: out/m4/index.json
out/m4/index.json: \
src/core/m4/Containerfile \
binutils \
busybox \
gcc \
make \
musl
$(call build,core,m4)
PHONY: make
make: out/make/index.json
out/make/index.json: \
src/core/make/Containerfile \
stage3
$(call build,core,make)
PHONY: meson
meson: out/meson/index.json
out/meson/index.json: \
src/core/meson/Containerfile \
busybox \
py-setuptools \
python \
zlib
$(call build,core,meson)
PHONY: musl
musl: out/musl/index.json
out/musl/index.json: \
src/core/musl/Containerfile \
stage3
$(call build,core,musl)
PHONY: musl-fts
musl-fts: out/musl-fts/index.json
out/musl-fts/index.json: \
src/core/musl-fts/Containerfile \
autoconf \
automake \
binutils \
busybox \
gcc \
libtool \
m4 \
make \
musl \
pkgconf
$(call build,core,musl-fts)
PHONY: musl-obstack
musl-obstack: out/musl-obstack/index.json
out/musl-obstack/index.json: \
src/core/musl-obstack/Containerfile \
autoconf \
automake \
binutils \
busybox \
gcc \
libtool \
m4 \
make \
musl \
pkgconf
$(call build,core,musl-obstack)
PHONY: ninja
ninja: out/ninja/index.json
out/ninja/index.json: \
src/core/ninja/Containerfile \
binutils \
busybox \
gcc \
make \
musl \
openssl \
python
$(call build,core,ninja)
PHONY: openssl
openssl: out/openssl/index.json
out/openssl/index.json: \
src/core/openssl/Containerfile \
binutils \
busybox \
gcc \
linux-headers \
make \
musl \
perl
$(call build,core,openssl)
PHONY: perl
perl: out/perl/index.json
out/perl/index.json: \
src/core/perl/Containerfile \
binutils \
busybox \
gcc \
make \
musl
$(call build,core,perl)
PHONY: pkgconf
pkgconf: out/pkgconf/index.json
out/pkgconf/index.json: \
src/core/pkgconf/Containerfile \
binutils \
busybox \
gcc \
make \
musl
$(call build,core,pkgconf)
PHONY: py-setuptools
py-setuptools: out/py-setuptools/index.json
out/py-setuptools/index.json: \
src/core/py-setuptools/Containerfile \
busybox \
python \
zlib
$(call build,core,py-setuptools)
PHONY: python
python: out/python/index.json
out/python/index.json: \
src/core/python/Containerfile \
binutils \
busybox \
gcc \
make \
musl \
openssl \
zlib
$(call build,core,python)
PHONY: sed
sed: out/sed/index.json
out/sed/index.json: \
src/core/sed/Containerfile \
binutils \
busybox \
gcc \
make \
musl
$(call build,core,sed)
PHONY: zlib
zlib: out/zlib/index.json
out/zlib/index.json: \
src/core/zlib/Containerfile \
binutils \
busybox \
gcc \
make \
musl
$(call build,core,zlib)
PHONY: linux-generic
linux-generic: out/linux-generic/index.json
out/linux-generic/index.json: \
src/kernel/linux-generic/Containerfile \
binutils \
bison \
busybox \
elfutils \
flex \
gcc \
libzstd \
linux-headers \
m4 \
make \
musl \
openssl \
perl \
pkgconf \
zlib
$(call build,kernel,linux-generic)
PHONY: ca-certificates
ca-certificates: out/ca-certificates/index.json
out/ca-certificates/index.json: \
src/libs/ca-certificates/Containerfile \
busybox
$(call build,libs,ca-certificates)
PHONY: libxml2
libxml2: out/libxml2/index.json
out/libxml2/index.json: \
src/libs/libxml2/Containerfile \
autoconf \
automake \
binutils \
busybox \
gcc \
libtool \
m4 \
make \
musl \
pkgconf \
python
$(call build,libs,libxml2)
PHONY: cpio
cpio: out/cpio/index.json
out/cpio/index.json: \
src/tools/cpio/Containerfile \
binutils \
busybox \
gcc \
make \
musl
$(call build,tools,cpio)
PHONY: curl
curl: out/curl/index.json
out/curl/index.json: \
src/tools/curl/Containerfile \
binutils \
busybox \
gcc \
make \
musl \
openssl \
ca-certificates
$(call build,tools,curl)
PHONY: gen_initramfs
gen_initramfs: out/gen_initramfs/index.json
out/gen_initramfs/index.json: \
src/tools/gen_initramfs/Containerfile \
binutils \
busybox \
gcc \
musl
$(call build,tools,gen_initramfs)
PHONY: sops
sops: out/sops/index.json
out/sops/index.json: \
src/tools/sops/Containerfile \
busybox \
go \
ca-certificates
$(call build,tools,sops)
PHONY: tofu
tofu: out/tofu/index.json
out/tofu/index.json: \
src/tools/tofu/Containerfile \
busybox \
go \
ca-certificates
$(call build,tools,tofu)

47
src/packages.sh Executable file
View File

@ -0,0 +1,47 @@
#!/bin/bash
# Warning: This is slow/brittle garbage and will probably kill your dog
# Please replace it with a script in a near universally pre-installed
# language like python
manual_targets="rust llvm"
gen_deps() {
local container_file=${1?}
local dependencies=$( \
cat ${container_file} \
| egrep -- "(--from=|FROM)" \
| sed \
-e "s/^FROM \([^ ]\+\) .*/\1/" \
-e "s/^COPY --from=\([^ ]\+\).*/\1/g" \
| grep -v scratch \
| grep -v base \
| grep -v fetch \
| grep -v build \
| grep -v install \
| uniq \
| tr '\n' ' '
)
printf "$dependencies"
}
printf "src/packages.mk: src/packages.sh\n"
printf "\tsrc/packages.sh > src/packages.mk\n\n"
bs='\'
for container_file in $(find src/*/*/Containerfile); do
package=$(basename $(dirname ${container_file}))
[[ "$manual_targets" =~ "$package" ]] && continue
group=$(basename $(dirname $(dirname ${container_file})))
deps=$(gen_deps "${container_file}")
printf "PHONY: ${package}\n${package}: out/${package}/index.json\n"
printf "out/${package}/index.json: %s" "$bs"
printf "\n\t${container_file}"
for each in $(find src/*/*/Containerfile); do
dep_package=$(basename $(dirname ${each}))
if [[ "$deps" =~ "$dep_package" ]]; then
printf " %s\n\t${dep_package}" "$bs"
fi
done
printf '\n\t$(call build,%s,%s)' "$group" "$package"
printf "\n\n"
done

105
src/packages_manual.mk Normal file
View File

@ -0,0 +1,105 @@
out/llvm13/index.json: \
out/gcc/index.json \
out/python/index.json \
out/py-setuptools/index.json \
out/perl/index.json \
out/binutils/index.json \
out/cmake/index.json \
out/ninja/index.json \
out/busybox/index.json \
out/musl/index.json
$(call build,core,llvm,13.0.1)
out/llvm/index.json: \
out/gcc/index.json \
out/python/index.json \
out/py-setuptools/index.json \
out/perl/index.json \
out/binutils/index.json \
out/cmake/index.json \
out/ninja/index.json \
out/busybox/index.json \
out/musl/index.json
$(call build,core,llvm)
$(BUILDER) tag $(REGISTRY)/llvm $(REGISTRY)/llvm:16
$(BUILDER) tag $(REGISTRY)/llvm $(REGISTRY)/llvm:16.0.6
out/rust1.54/index.json: \
out/gcc/index.json \
out/bash/index.json \
out/zlib/index.json \
out/python/index.json \
out/py-setuptools/index.json \
out/perl/index.json \
out/libunwind/index.json \
out/pkgconf/index.json \
out/llvm13/index.json \
out/binutils/index.json \
out/cmake/index.json \
out/make/index.json \
out/busybox/index.json \
out/musl/index.json
$(call build,core,rust,1.54.0,bootstrap-package)
out/rust1.55/index.json: out/rust1.54/index.json
$(call build,core,rust,1.55.0,package,--build-arg BUILD_VERSION=1.54.0)
out/rust1.56/index.json: out/rust1.55/index.json
$(call build,core,rust,1.56.0,package,--build-arg BUILD_VERSION=1.55.0)
out/rust1.57/index.json: out/rust1.56/index.json
$(call build,core,rust,1.57.0,package,--build-arg BUILD_VERSION=1.56.0)
out/rust1.58/index.json: out/rust1.57/index.json
$(call build,core,rust,1.58.0,package,--build-arg BUILD_VERSION=1.57.0)
out/rust1.59/index.json: out/rust1.58/index.json
$(call build,core,rust,1.59.0,package,--build-arg BUILD_VERSION=1.58.0)
out/rust1.60/index.json: out/rust1.59/index.json
$(call build,core,rust,1.60.0,package,--build-arg BUILD_VERSION=1.59.0)
out/rust1.61/index.json: out/rust1.60/index.json
$(call build,core,rust,1.61.0,package,--build-arg BUILD_VERSION=1.60.0)
out/rust1.62/index.json: out/rust1.61/index.json
$(call build,core,rust,1.62.0,package,--build-arg BUILD_VERSION=1.61.0)
out/rust1.63/index.json: out/rust1.62/index.json
$(call build,core,rust,1.63.0,package,--build-arg BUILD_VERSION=1.62.0)
out/rust1.64/index.json: out/rust1.63/index.json
$(call build,core,rust,1.64.0,package,--build-arg BUILD_VERSION=1.63.0)
out/rust1.65/index.json: out/rust1.64/index.json
$(call build,core,rust,1.65.0,package,--build-arg BUILD_VERSION=1.64.0)
out/rust1.66/index.json: out/rust1.65/index.json
$(call build,core,rust,1.66.0,package,--build-arg BUILD_VERSION=1.65.0)
out/rust1.67/index.json: out/rust1.66/index.json
$(call build,core,rust,1.67.0,package,--build-arg BUILD_VERSION=1.66.0)
out/rust1.68/index.json: out/rust1.67/index.json
$(call build,core,rust,1.68.0,package,--build-arg BUILD_VERSION=1.67.0)
out/rust1.69/index.json: out/rust1.68/index.json out/llvm/index.json
$(call build,core,rust,1.69.0,package,--build-arg BUILD_VERSION=1.68.0 --build-arg LLVM_VERSION=16)
out/rust1.70/index.json: out/rust1.69/index.json
$(call build,core,rust,1.70.0,package,--build-arg BUILD_VERSION=1.69.0 --build-arg LLVM_VERSION=16)
out/rust1.71/index.json: out/rust1.70/index.json
$(call build,core,rust,1.71.0,package,--build-arg BUILD_VERSION=1.70.0 --build-arg LLVM_VERSION=16)
out/rust1.72/index.json: out/rust1.71/index.json
$(call build,core,rust,1.72.0,package,--build-arg BUILD_VERSION=1.71.0 --build-arg LLVM_VERSION=16)
out/rust1.73/index.json: out/rust1.72/index.json
$(call build,core,rust,1.73.0,package,--build-arg BUILD_VERSION=1.72.0 --build-arg LLVM_VERSION=16)
out/rust/index.json: out/rust1.73/index.json src/core/rust/Containerfile
$(call build,core,rust,1.74.0,package,--build-arg BUILD_VERSION=1.73.0 --build-arg LLVM_VERSION=16)
.PHONY: rust
rust: out/rust/index.json

View File

@ -1,31 +0,0 @@
out/curl.tar: \
out/gcc.tar \
out/musl.tar \
out/busybox.tar \
out/make.tar \
out/binutils.tar \
out/openssl.tar \
out/ca-certificates.tar
$(call build,tools,curl)
out/gen_initramfs.tar: \
out/gcc.tar \
out/binutils.tar \
out/musl.tar
$(call build,tools,gen_initramfs)
out/cpio.tar: \
out/gcc.tar \
out/binutils.tar \
out/musl.tar
$(call build,tools,cpio)
out/tofu.tar: \
out/busybox.tar \
out/go.tar
$(call build,tools,tofu)
out/sops.tar: \
out/busybox.tar \
out/go.tar
$(call build,tools,sops)