This repository has been archived on 2024-08-04. You can view files and clone it, but cannot push or open issues or pull requests.
stagex/Makefile

366 lines
7.4 KiB
Makefile
Raw Normal View History

2023-12-10 18:05:50 +00:00
export REGISTRY := local
2023-12-12 17:45:39 +00:00
export PLATFORM := linux/amd64
2023-12-10 18:05:50 +00:00
export BUILDER := $(shell which docker)
2023-12-15 20:32:54 +00:00
export SOURCE_DATE_EPOCH = 1
2023-12-12 17:45:39 +00:00
clean_logs := $(shell rm *.log 2>&1 >/dev/null || :)
DEFAULT_GOAL := default
.PHONY: default
default: all
.PHONY: all
all: \
python.tgz \
2023-12-15 20:32:54 +00:00
rust.tgz \
go.tgz
graph.svg: Makefile
$(MAKE) -Bnd | make2graph | dot -Tsvg -o graph.svg
2023-12-12 17:45:39 +00:00
bootstrap.tgz:
2023-12-10 18:05:50 +00:00
$(call build,bootstrap)
2023-12-12 17:45:39 +00:00
musl.tgz: bootstrap.tgz
2023-12-10 18:05:50 +00:00
$(call build,musl)
2023-11-13 22:48:49 +00:00
2023-12-12 17:45:39 +00:00
busybox.tgz: bootstrap.tgz
2023-12-10 18:05:50 +00:00
$(call build,busybox)
2023-11-13 22:48:49 +00:00
2023-12-12 17:45:39 +00:00
binutils.tgz: bootstrap.tgz
2023-12-10 18:05:50 +00:00
$(call build,binutils)
2023-12-12 17:45:39 +00:00
gcc.tgz: \
bootstrap.tgz \
musl.tgz
2023-12-10 18:05:50 +00:00
$(call build,gcc)
2023-11-09 10:13:20 +00:00
2023-12-12 17:45:39 +00:00
make.tgz: bootstrap.tgz
2023-12-10 18:05:50 +00:00
$(call build,make)
2023-11-16 10:01:19 +00:00
2023-12-12 17:45:39 +00:00
ca-certificates.tgz:
2023-12-10 18:05:50 +00:00
$(call build,ca-certificates)
2023-11-19 07:38:16 +00:00
2023-12-12 17:45:39 +00:00
bash.tgz: \
busybox.tgz \
gcc.tgz \
binutils.tgz \
musl.tgz \
make.tgz
2023-12-10 18:05:50 +00:00
$(call build,bash)
2023-12-12 17:45:39 +00:00
m4.tgz: \
busybox.tgz \
gcc.tgz \
binutils.tgz \
musl.tgz \
make.tgz
2023-12-10 18:05:50 +00:00
$(call build,m4)
2023-12-05 04:34:07 +00:00
2023-12-12 17:45:39 +00:00
perl.tgz: \
gcc.tgz \
binutils.tgz \
busybox.tgz \
make.tgz \
musl.tgz
$(call build,perl)
autoconf.tgz: \
busybox.tgz \
gcc.tgz \
binutils.tgz \
musl.tgz \
make.tgz \
perl.tgz \
m4.tgz
$(call build,autoconf,,fetch)
2023-12-10 18:05:50 +00:00
$(call build,autoconf)
2023-12-05 04:34:07 +00:00
2023-12-12 17:45:39 +00:00
automake.tgz: \
busybox.tgz \
gcc.tgz \
binutils.tgz \
musl.tgz \
make.tgz \
perl.tgz \
autoconf.tgz \
m4.tgz
2023-12-10 18:05:50 +00:00
$(call build,automake)
2023-12-05 04:34:07 +00:00
2023-12-12 17:45:39 +00:00
sed.tgz: \
busybox.tgz \
gcc.tgz \
binutils.tgz \
musl.tgz \
make.tgz
2023-12-10 18:05:50 +00:00
$(call build,sed)
2023-12-05 04:36:18 +00:00
2023-12-12 17:45:39 +00:00
libtool.tgz: \
busybox.tgz \
gcc.tgz \
binutils.tgz \
musl.tgz \
make.tgz \
bash.tgz \
sed.tgz \
m4.tgz
2023-12-10 18:05:50 +00:00
$(call build,libtool)
2023-12-05 04:36:18 +00:00
2023-12-12 17:45:39 +00:00
pkgconf.tgz: \
busybox.tgz \
gcc.tgz \
binutils.tgz \
musl.tgz \
make.tgz \
libtool.tgz
2023-12-10 18:05:50 +00:00
$(call build,pkgconf)
2023-12-05 04:36:18 +00:00
2023-12-12 17:45:39 +00:00
libxml2.tgz: \
busybox.tgz \
gcc.tgz \
binutils.tgz \
musl.tgz \
make.tgz \
bash.tgz \
python.tgz \
sed.tgz \
m4.tgz \
autoconf.tgz \
automake.tgz \
pkgconf.tgz \
libtool.tgz
2023-12-10 18:05:50 +00:00
$(call build,libxml2)
2023-12-05 04:36:18 +00:00
2023-12-12 17:45:39 +00:00
libunwind.tgz: \
busybox.tgz \
gcc.tgz \
binutils.tgz \
musl.tgz \
make.tgz \
bash.tgz \
autoconf.tgz \
automake.tgz \
libtool.tgz
2023-12-10 18:05:50 +00:00
$(call build,libunwind)
2023-12-06 12:56:43 +00:00
2023-12-12 17:45:39 +00:00
linux-headers.tgz:
$(call build,linux-headers)
openssl.tgz: \
gcc.tgz \
binutils.tgz \
busybox.tgz \
linux-headers.tgz \
musl.tgz
2023-12-10 18:05:50 +00:00
$(call build,openssl)
2023-11-16 10:01:19 +00:00
2023-12-12 17:45:39 +00:00
go.tgz: \
gcc.tgz \
binutils.tgz \
busybox.tgz \
bash.tgz \
musl.tgz
2023-12-10 18:05:50 +00:00
$(call build,go)
2023-11-15 00:30:48 +00:00
2023-12-12 17:45:39 +00:00
curl.tgz: \
gcc.tgz \
musl.tgz \
busybox.tgz \
make.tgz \
binutils.tgz \
openssl.tgz \
ca-certificates.tgz
2023-12-10 18:05:50 +00:00
$(call build,curl)
2023-11-19 07:38:16 +00:00
2023-12-12 17:45:39 +00:00
python.tgz: \
gcc.tgz \
perl.tgz \
binutils.tgz \
busybox.tgz \
openssl.tgz \
make.tgz \
musl.tgz
2023-12-10 18:05:50 +00:00
$(call build,python)
2023-11-16 10:01:19 +00:00
2023-12-12 17:45:39 +00:00
ninja.tgz: \
busybox.tgz \
gcc.tgz \
binutils.tgz \
musl.tgz \
make.tgz \
openssl.tgz \
python.tgz
2023-12-10 18:05:50 +00:00
$(call build,ninja)
2023-11-21 23:57:26 +00:00
2023-12-12 17:45:39 +00:00
cmake.tgz: \
busybox.tgz \
gcc.tgz \
binutils.tgz \
ninja.tgz \
musl.tgz \
make.tgz \
linux-headers.tgz
2023-12-10 18:05:50 +00:00
$(call build,cmake)
2023-11-21 23:57:26 +00:00
2023-12-12 17:45:39 +00:00
py-setuptools.tgz: \
busybox.tgz \
python.tgz
2023-12-10 18:05:50 +00:00
$(call build,py-setuptools)
2023-11-21 23:57:26 +00:00
2023-12-12 17:45:39 +00:00
zlib.tgz: \
busybox.tgz \
gcc.tgz \
binutils.tgz \
musl.tgz \
make.tgz
2023-12-10 18:05:50 +00:00
$(call build,zlib)
2023-12-12 17:45:39 +00:00
llvm13.tgz: \
gcc.tgz \
python.tgz \
py-setuptools.tgz \
perl.tgz \
binutils.tgz \
cmake.tgz \
ninja.tgz \
curl.tgz \
2023-12-12 17:45:39 +00:00
busybox.tgz \
musl.tgz
$(call build,llvm,13.0.1)
llvm.tgz: \
gcc.tgz \
python.tgz \
py-setuptools.tgz \
perl.tgz \
binutils.tgz \
cmake.tgz \
ninja.tgz \
curl.tgz \
2023-12-12 17:45:39 +00:00
busybox.tgz \
musl.tgz
2023-12-10 18:05:50 +00:00
$(call build,llvm)
$(BUILDER) tag $(REGISTRY)/llvm $(REGISTRY)/llvm:16
$(BUILDER) tag $(REGISTRY)/llvm $(REGISTRY)/llvm:16.0.6
2023-11-21 23:57:26 +00:00
2023-12-12 17:45:39 +00:00
rust1.54.tgz: \
gcc.tgz \
bash.tgz \
zlib.tgz \
python.tgz \
py-setuptools.tgz \
curl.tgz \
perl.tgz \
libunwind.tgz \
2023-12-13 18:26:03 +00:00
pkgconf.tgz \
2023-12-12 17:45:39 +00:00
llvm13.tgz \
binutils.tgz \
cmake.tgz \
make.tgz \
busybox.tgz \
musl.tgz
$(call build,rust,1.54.0,bootstrap-package)
rust1.55.tgz: rust1.54.tgz
$(call build,rust,1.55.0,package,--build-arg BUILD_VERSION=1.54.0)
2023-12-13 18:26:03 +00:00
rust1.56.tgz: rust1.55.tgz
$(call build,rust,1.56.0,package,--build-arg BUILD_VERSION=1.55.0)
rust1.57.tgz: rust1.56.tgz
$(call build,rust,1.57.0,package,--build-arg BUILD_VERSION=1.56.0)
rust1.58.tgz: rust1.57.tgz
$(call build,rust,1.58.0,package,--build-arg BUILD_VERSION=1.57.0)
rust1.59.tgz: rust1.58.tgz
$(call build,rust,1.59.0,package,--build-arg BUILD_VERSION=1.58.0)
rust1.60.tgz: rust1.59.tgz
$(call build,rust,1.60.0,package,--build-arg BUILD_VERSION=1.59.0)
rust1.61.tgz: rust1.60.tgz
$(call build,rust,1.61.0,package,--build-arg BUILD_VERSION=1.60.0)
rust1.62.tgz: rust1.61.tgz
$(call build,rust,1.62.0,package,--build-arg BUILD_VERSION=1.61.0)
rust1.63.tgz: rust1.62.tgz
$(call build,rust,1.63.0,package,--build-arg BUILD_VERSION=1.62.0)
rust1.64.tgz: rust1.63.tgz
$(call build,rust,1.64.0,package,--build-arg BUILD_VERSION=1.63.0)
rust1.65.tgz: rust1.64.tgz
$(call build,rust,1.65.0,package,--build-arg BUILD_VERSION=1.64.0)
rust1.66.tgz: rust1.65.tgz
$(call build,rust,1.66.0,package,--build-arg BUILD_VERSION=1.65.0)
rust1.67.tgz: rust1.66.tgz
$(call build,rust,1.67.0,package,--build-arg BUILD_VERSION=1.66.0)
rust1.68.tgz: rust1.67.tgz
$(call build,rust,1.68.0,package,--build-arg BUILD_VERSION=1.67.0)
rust1.69.tgz: rust1.68.tgz llvm.tgz
$(call build,rust,1.69.0,package,--build-arg BUILD_VERSION=1.68.0 --build-arg LLVM_VERSION=16)
2023-12-13 18:26:03 +00:00
rust1.70.tgz: rust1.69.tgz
$(call build,rust,1.70.0,package,--build-arg BUILD_VERSION=1.69.0 --build-arg LLVM_VERSION=16)
2023-12-13 18:26:03 +00:00
rust1.71.tgz: rust1.70.tgz
$(call build,rust,1.71.0,package,--build-arg BUILD_VERSION=1.70.0 --build-arg LLVM_VERSION=16)
2023-12-13 18:26:03 +00:00
rust1.72.tgz: rust1.71.tgz
$(call build,rust,1.72.0,package,--build-arg BUILD_VERSION=1.71.0 --build-arg LLVM_VERSION=16)
2023-12-13 18:26:03 +00:00
rust1.73.tgz: rust1.72.tgz
$(call build,rust,1.73.0,package,--build-arg BUILD_VERSION=1.72.0 --build-arg LLVM_VERSION=16)
2023-12-13 18:26:03 +00:00
2023-12-15 20:32:54 +00:00
rust.tgz: rust1.73.tgz
$(call build,rust,1.74.0,package,--build-arg BUILD_VERSION=1.73.0 --build-arg LLVM_VERSION=16)
2023-12-13 18:26:03 +00:00
2023-12-12 17:45:39 +00:00
# Build package with chosen $(BUILDER)
# Supported BUILDERs: docker
# Usage: $(call build,$(NAME),$(VERSION),$(TARGET),$(EXTRA_ARGS))
# Notes:
# - Packages are expected to use the following layer names in order:
# - "fetch": [optional] obtain any artifacts from the internet.
# - "build": [optional] do any required build work
# - "package": [required] scratch layer exporting artifacts for distribution
# - "test": [optional] define any tests
# - Packages may prefix layer names with "text-" if more than one is desired
# - VERSION will be set as a build-arg if defined, otherwise it is "latest"
# - TARGET defaults to "package"
# - EXTRA_ARGS will be blindly injected
# - packages may also define a "test" layer
# TODO:
# - try to disable networking on fetch layers with something like:
# $(if $(filter fetch,$(lastword $(subst -, ,$(TARGET)))),,--network=none)
# - actually output OCI files for each build (vs plain tar)
# - output manifest.txt of all tar/digest hashes for an easy git diff
# - support buildah and podman
define build
$(eval NAME := $(1))
$(eval VERSION := $(if $(2),$(2),latest))
$(eval TARGET := $(if $(3),$(3),package))
$(eval EXTRA_ARGS := $(if $(4),$(4),))
$(eval BUILD_CMD := \
DOCKER_BUILDKIT=1 \
2023-12-12 17:45:39 +00:00
SOURCE_DATE_EPOCH=1 \
$(BUILDER) \
build \
-t $(REGISTRY)/$(NAME):$(VERSION) \
--build-arg REGISTRY=$(REGISTRY) \
--platform $(PLATFORM) \
--progress=plain \
$(if $(filter latest,$(VERSION)),,--build-arg VERSION=$(VERSION)) \
--target $(TARGET) \
$(EXTRA_ARGS) \
$(NAME) \
)
$(eval TIMESTAMP := $(shell TZ=GMT date +"%Y-%m-%dT%H:%M:%SZ"))
echo $(TIMESTAMP) $(BUILD_CMD) >> build.log
$(BUILD_CMD)
$(if $(filter package,$(TARGET)),$(BUILDER) save $(REGISTRY)/$(NAME):$(VERSION) -o $@,)
2023-12-12 17:45:39 +00:00
endef