packages/

protobuf

Details
Source
FROM scratch AS base
ENV VERSION=26.1
ENV SRC_HASH=4fc5ff1b2c339fb86cd3a25f0b5311478ab081e65ad258c6789359cd84d421f8
ENV SRC_FILE=v${VERSION}.tar.gz
ENV SRC_SITE=https://github.com/protocolbuffers/protobuf/archive/refs/tags/${SRC_FILE}

FROM base AS fetch
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} .

FROM fetch AS build
COPY --from=stagex/busybox . /
COPY --from=stagex/binutils . /
COPY --from=stagex/cmake . /
COPY --from=stagex/ninja . /
COPY --from=stagex/musl . /
COPY --from=stagex/gcc . /
COPY --from=stagex/openssl . /
COPY --from=stagex/gcc . /
COPY --from=stagex/zlib . /
COPY --from=stagex/abseil-cpp . /

RUN tar -xf ${SRC_FILE}
WORKDIR /protobuf-${VERSION}
RUN <<-EOF
	set -eux
	cmake \
		-B build \
		-G Ninja \
		-Wno-dev \
		-DCMAKE_INSTALL_PREFIX=/usr/ \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=ON \
		-Dprotobuf_BUILD_TESTS=OFF \
		-Dprotobuf_BUILD_LIBPROTOC=ON \
		-Dprotobuf_ABSL_PROVIDER="package" \
		-Dprotobuf_ALLOW_CCACHE=ON \
		-Dprotobuf_USE_EXTERNAL_GTEST=ON
	cmake --build build
EOF

FROM build AS install
RUN --network=none DESTDIR="/rootfs" cmake --install build

FROM stagex/filesystem AS package
COPY --from=install /rootfs/. /