2021-11-11 18:38:35 +00:00
|
|
|
.PHONY: build-image build sign clean veryclean keyfile
|
|
|
|
|
|
|
|
# If you run:
|
|
|
|
# docker run --rm --name squid adricu/alpine-squid
|
|
|
|
# and set DOCKER_SQUID_CONTAINER=squid
|
|
|
|
# then you can avoid repeated downloads of a lot of alpine packages.
|
|
|
|
#
|
|
|
|
DOCKER_SQUID_CONTAINER?=squid
|
|
|
|
ifeq ($(DOCKER_SQUID_CONTAINER),)
|
|
|
|
DOCKER_SQUID_OPTS=
|
|
|
|
else
|
2021-11-12 12:15:20 +00:00
|
|
|
DOCKER_SQUID_OPTS=--link $(DOCKER_SQUID_CONTAINER):squid \
|
|
|
|
-e http_proxy=http://squid:3128/ \
|
|
|
|
-e https_proxy=http://squid:3128/
|
|
|
|
DOCKER_SQUID_IP=$(shell docker inspect squid | preserves-tool convert -o unquoted --select '/ . "NetworkSettings" . "IPAddress"')
|
|
|
|
HTTP_PROXY=http://$(DOCKER_SQUID_IP):3128/
|
2021-11-11 18:38:35 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ARCH?=aarch64
|
|
|
|
DOCKER_ARCH=$(shell ./map_docker_arch.sh $(ARCH))
|
2021-11-11 21:42:08 +00:00
|
|
|
KEYFILE?=synit-apk-key
|
2021-11-11 18:38:35 +00:00
|
|
|
UID:=$(shell id -u)
|
|
|
|
GID:=$(shell id -g)
|
|
|
|
BUILD_USER?=build
|
|
|
|
|
|
|
|
DOCKER_CMD=\
|
|
|
|
mkdir -p $(CURDIR)/distfiles && \
|
|
|
|
docker run --platform linux/$(DOCKER_ARCH) -it --rm \
|
|
|
|
$(DOCKER_SQUID_OPTS) \
|
|
|
|
-v `pwd`:/data \
|
2021-11-11 21:42:08 +00:00
|
|
|
-v `pwd`/$(KEYFILE):/home/$(BUILD_USER)/.abuild/$(KEYFILE) \
|
2021-11-11 18:38:35 +00:00
|
|
|
-v $(CURDIR)/distfiles:/var/cache/distfiles \
|
|
|
|
synit-build:$(ARCH)
|
|
|
|
|
2021-11-13 11:37:03 +00:00
|
|
|
DOCKER_BUILD_ARGS=\
|
|
|
|
--build-arg http_proxy=$(HTTP_PROXY) \
|
|
|
|
--build-arg http_proxy_hostname=$(DOCKER_SQUID_IP) \
|
|
|
|
--build-arg ALPINE_ARCH=$(ARCH) \
|
|
|
|
--build-arg DOCKER_ARCH=$(DOCKER_ARCH) \
|
|
|
|
--build-arg KEYFILE=$(KEYFILE) \
|
|
|
|
--build-arg UID=$(UID) \
|
|
|
|
--build-arg BUILD_USER=$(BUILD_USER)
|
|
|
|
|
2021-11-11 18:38:35 +00:00
|
|
|
build: build-image
|
2021-11-11 21:42:08 +00:00
|
|
|
$(DOCKER_CMD) make -f Makefile.internal $@ KEYFILE=$(KEYFILE)
|
2021-11-11 18:38:35 +00:00
|
|
|
sign: build-image
|
2021-11-11 21:42:08 +00:00
|
|
|
$(DOCKER_CMD) make -f Makefile.internal $@ KEYFILE=$(KEYFILE)
|
|
|
|
%.apk: build-image
|
|
|
|
$(DOCKER_CMD) make -f Makefile.internal $@ KEYFILE=$(KEYFILE)
|
|
|
|
%.checksum: build-image
|
|
|
|
$(DOCKER_CMD) make -f Makefile.internal $@ KEYFILE=$(KEYFILE)
|
2021-11-11 18:38:35 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f .build-image.*
|
|
|
|
-docker rmi synit-build:aarch64
|
|
|
|
-docker rmi synit-build:x86_64
|
|
|
|
-docker rmi synit-build:armv7
|
|
|
|
|
|
|
|
veryclean: clean
|
|
|
|
rm -rf target
|
|
|
|
|
|
|
|
build-image: .build-image.$(ARCH)
|
|
|
|
|
|
|
|
.build-image.$(ARCH): $(KEYFILE)
|
|
|
|
docker buildx build \
|
2021-11-12 12:15:20 +00:00
|
|
|
--progress plain \
|
2021-11-13 11:37:03 +00:00
|
|
|
$(DOCKER_BUILD_ARGS) \
|
2021-11-11 18:38:35 +00:00
|
|
|
--platform=linux/$(DOCKER_ARCH) \
|
|
|
|
-t synit-build:$(ARCH) .
|
|
|
|
touch $@
|
|
|
|
|
2021-11-13 11:37:03 +00:00
|
|
|
build-image.rust: .build-image.rust.$(ARCH)
|
|
|
|
|
|
|
|
.build-image.rust.$(ARCH): .build-image.$(ARCH)
|
|
|
|
docker buildx build \
|
|
|
|
--progress plain \
|
|
|
|
$(DOCKER_BUILD_ARGS) \
|
|
|
|
--platform=linux/$(DOCKER_ARCH) \
|
|
|
|
-t synit-build-rust:$(ARCH) -f Dockerfile.rust .
|
|
|
|
touch $@
|
|
|
|
|
2021-11-11 18:38:35 +00:00
|
|
|
keyfile: $(KEYFILE)
|
|
|
|
|
|
|
|
$(KEYFILE):
|
|
|
|
docker run -it --rm \
|
2021-11-11 21:42:08 +00:00
|
|
|
-v `pwd`:/data \
|
2021-11-11 18:38:35 +00:00
|
|
|
alpine \
|
2021-11-11 21:42:08 +00:00
|
|
|
sh -c "apk add abuild && echo /data/$(KEYFILE) | abuild-keygen && chown $(UID):$(GID) /data/$(KEYFILE)*"
|