From fc2f84c1ebe3ea9e3a5b11d88382d01359e09f44 Mon Sep 17 00:00:00 2001 From: "Lance R. Vick" Date: Thu, 8 Feb 2024 09:09:58 -0800 Subject: [PATCH] mostly automate make target generation --- Makefile | 13 +- src/bootstrap/build.mk | 18 -- src/context.sh | 10 + src/core/build.mk | 377 ------------------------------- src/kernel/build.mk | 18 -- src/libs/build.mk | 18 -- src/macros.mk | 21 +- src/packages.mk | 500 +++++++++++++++++++++++++++++++++++++++++ src/packages.sh | 47 ++++ src/packages_manual.mk | 105 +++++++++ src/tools/build.mk | 31 --- 11 files changed, 673 insertions(+), 485 deletions(-) delete mode 100644 src/bootstrap/build.mk create mode 100755 src/context.sh delete mode 100644 src/core/build.mk delete mode 100644 src/kernel/build.mk delete mode 100644 src/libs/build.mk create mode 100644 src/packages.mk create mode 100755 src/packages.sh create mode 100644 src/packages_manual.mk delete mode 100644 src/tools/build.mk diff --git a/Makefile b/Makefile index 62ad61f..5609e3d 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/src/bootstrap/build.mk b/src/bootstrap/build.mk deleted file mode 100644 index bcff135..0000000 --- a/src/bootstrap/build.mk +++ /dev/null @@ -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) diff --git a/src/context.sh b/src/context.sh new file mode 100755 index 0000000..163bdc8 --- /dev/null +++ b/src/context.sh @@ -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 diff --git a/src/core/build.mk b/src/core/build.mk deleted file mode 100644 index 47b35fa..0000000 --- a/src/core/build.mk +++ /dev/null @@ -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) diff --git a/src/kernel/build.mk b/src/kernel/build.mk deleted file mode 100644 index e8be938..0000000 --- a/src/kernel/build.mk +++ /dev/null @@ -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) diff --git a/src/libs/build.mk b/src/libs/build.mk deleted file mode 100644 index aa7d700..0000000 --- a/src/libs/build.mk +++ /dev/null @@ -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) diff --git a/src/macros.mk b/src/macros.mk index 67258e1..9a2aafa 100644 --- a/src/macros.mk +++ b/src/macros.mk @@ -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 diff --git a/src/packages.mk b/src/packages.mk new file mode 100644 index 0000000..3cf68f4 --- /dev/null +++ b/src/packages.mk @@ -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) + diff --git a/src/packages.sh b/src/packages.sh new file mode 100755 index 0000000..ffa36d8 --- /dev/null +++ b/src/packages.sh @@ -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 diff --git a/src/packages_manual.mk b/src/packages_manual.mk new file mode 100644 index 0000000..3e22390 --- /dev/null +++ b/src/packages_manual.mk @@ -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 diff --git a/src/tools/build.mk b/src/tools/build.mk deleted file mode 100644 index f278224..0000000 --- a/src/tools/build.mk +++ /dev/null @@ -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)