Consistent x86_64/armv7/aarch64 builds for synit-pid1
This commit is contained in:
parent
602969a7e7
commit
c55b9cf6e5
|
@ -0,0 +1,18 @@
|
|||
ARG ALPINE_ARCH
|
||||
ARG DOCKER_ARCH
|
||||
FROM --platform=linux/${DOCKER_ARCH} synit-build:${ALPINE_ARCH}
|
||||
|
||||
ARG http_proxy
|
||||
# Running without proxy for now, to ensure reasonable freshness and consistency:
|
||||
# RUN http_proxy=${http_proxy} https_proxy=${http_proxy} rustup-init -y --default-toolchain nightly
|
||||
#
|
||||
RUN rustup-init -y --default-toolchain nightly
|
||||
|
||||
ARG BUILD_USER
|
||||
ENV PATH=/home/${BUILD_USER}/.cargo/bin:$PATH
|
||||
|
||||
# Prime the crates.io index
|
||||
RUN cargo search --limit 0
|
||||
|
||||
# Hack to workaround https://github.com/rust-lang/rust/issues/89626
|
||||
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-Zgcc-ld=lld"
|
|
@ -32,6 +32,15 @@ DOCKER_CMD=\
|
|||
-v $(CURDIR)/distfiles:/var/cache/distfiles \
|
||||
synit-build:$(ARCH)
|
||||
|
||||
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)
|
||||
|
||||
build: build-image
|
||||
$(DOCKER_CMD) make -f Makefile.internal $@ KEYFILE=$(KEYFILE)
|
||||
sign: build-image
|
||||
|
@ -55,16 +64,21 @@ build-image: .build-image.$(ARCH)
|
|||
.build-image.$(ARCH): $(KEYFILE)
|
||||
docker buildx build \
|
||||
--progress plain \
|
||||
$(DOCKER_BUILD_ARGS) \
|
||||
--platform=linux/$(DOCKER_ARCH) \
|
||||
--build-arg http_proxy=$(HTTP_PROXY) \
|
||||
--build-arg http_proxy_hostname=$(DOCKER_SQUID_IP) \
|
||||
--build-arg DOCKER_ARCH=$(DOCKER_ARCH) \
|
||||
--build-arg KEYFILE=$(KEYFILE) \
|
||||
--build-arg UID=$(UID) \
|
||||
--build-arg BUILD_USER=$(BUILD_USER) \
|
||||
-t synit-build:$(ARCH) .
|
||||
touch $@
|
||||
|
||||
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 $@
|
||||
|
||||
keyfile: $(KEYFILE)
|
||||
|
||||
$(KEYFILE):
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
buildlog.*
|
|
@ -0,0 +1,30 @@
|
|||
# Contributor: Tony Garnock-Jones <tonyg@leastfixedpoint.com>
|
||||
# Maintainer: Tony Garnock-Jones <tonyg@leastfixedpoint.com>
|
||||
pkgname=synit-pid1
|
||||
pkgver=0.0.1
|
||||
pkgrel=0
|
||||
pkgdesc="synit pid 1 program"
|
||||
url="https://synit.org/"
|
||||
arch="all"
|
||||
license="GPLv3"
|
||||
depends=""
|
||||
makedepends=""
|
||||
source=""
|
||||
builddir="$srcdir/"
|
||||
options="!check"
|
||||
|
||||
# This allows us to stomple on /sbin/init, which is owned by the busybox package
|
||||
replaces="busybox"
|
||||
|
||||
build() {
|
||||
pwd
|
||||
ls -laR
|
||||
false
|
||||
}
|
||||
|
||||
package() {
|
||||
:
|
||||
}
|
||||
|
||||
sha512sums="
|
||||
"
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
set -e
|
||||
|
||||
build() {
|
||||
make -C ../../../synit-pid1 $1-binary-release 2>&1 | tee buildlog.$1
|
||||
cp -p ../../../synit-pid1/target/$1-*/release/synit-pid1 synit-pid1.$1
|
||||
}
|
||||
|
||||
build x86_64 &
|
||||
build armv7 &
|
||||
build aarch64 &
|
||||
wait
|
|
@ -1,9 +1,20 @@
|
|||
all:
|
||||
cargo build --all-targets
|
||||
|
||||
arm-binary: arm-binary-release
|
||||
x86_64-binary: x86_64-binary-release
|
||||
|
||||
arm-binary-release:
|
||||
x86_64-binary-release:
|
||||
$(MAKE) -C ../packaging build-image.rust ARCH=x86_64
|
||||
docker run -i --rm \
|
||||
-v $(HOME)/.cargo:/home/build/.cargo \
|
||||
-v `pwd`:/data \
|
||||
-e CARGO_TARGET_DIR=target/x86_64-unknown-linux-musl \
|
||||
synit-build-rust:x86_64 \
|
||||
cargo build --release --all-targets
|
||||
|
||||
armv7-binary: armv7-binary-release
|
||||
|
||||
armv7-binary-release:
|
||||
cross build --target=armv7-unknown-linux-musleabihf --release --all-targets
|
||||
|
||||
# Hack to workaround https://github.com/rust-embedded/cross/issues/598
|
||||
|
|
Loading…
Reference in New Issue