diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..21f55b8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,66 @@ +# SPDX-FileCopyrightText: 2026 Dipl.Phys. Peer Stritzinger GmbH +# SPDX-License-Identifier: Apache-2.0 +FROM ubuntu:22.04 + +#--- ENV ----------------------------------------------------------------------- + +ENV WORKDIR=/calzone +ENV LAUNCHER_SRC=$WORKDIR/launcher +ENV BAKER_SRC=$WORKDIR/baker + +#--- Install requirements ------------------------------------------------------ + +RUN BASIC="git cmake ca-certificates" && \ + BUILD="autoconf automake libtool build-essential" && \ + MUSL="musl-dev musl-tools" && \ + apt-get update && \ + apt-get install -y --no-install-recommends \ + $BASIC $BUILD $MUSL && \ + rm -rf /var/lib/apt/lists/* + +#--- Copy source --------------------------------------------------------------- +WORKDIR $WORKDIR + +COPY . $WORKDIR + +#--- Install libcbor ----------------------------------------------------------- +WORKDIR $WORKDIR/libcbor +RUN git clone https://github.com/PJK/libcbor.git . + +RUN CC=musl-gcc cmake -B _build \ + -DCMAKE_C_COMPILER_AR=/usr/bin/ar \ + -DCMAKE_C_COMPILER_RANLIB=/usr/bin/ranlib \ + -DBUILD_SHARED_LIBS=OFF \ + -DWITH_TESTS=OFF && \ + cmake --build _build -j$(nproc) + +#--- Install libarchive -------------------------------------------------------- +WORKDIR $WORKDIR/libarchive +RUN git clone https://github.com/libarchive/libarchive.git . + +RUN CC=musl-gcc cmake -B _build \ + -DCMAKE_C_COMPILER_AR=/usr/bin/ar \ + -DCMAKE_C_COMPILER_RANLIB=/usr/bin/ranlib \ + -DENABLE_TEST=OFF \ + -DENABLE_OPENSSL=OFF \ + -DENABLE_ZLIB=OFF \ + -DENABLE_BZip2=OFF \ + -DENABLE_LZMA=OFF \ + -DENABLE_ZSTD=OFF \ + -DENABLE_LZ4=OFF \ + -DENABLE_EXPAT=OFF \ + -DENABLE_ICONV=OFF \ + -DPOSIX_REGEX_LIB=NONE \ + -DENABLE_LIBB2=OFF \ + -DENABLE_LIBXML2=OFF && \ + cmake --build _build -j$(nproc) + +#--- Build ----------------------------------------------------------------- +WORKDIR $WORKDIR + +RUN ./autogen.sh && \ + ./configure && \ + make && \ + make check + +CMD ["/bin/bash"] diff --git a/README.md b/README.md index 0d006ca..905d81a 100644 --- a/README.md +++ b/README.md @@ -12,20 +12,26 @@ Both are built as part of the **calzone** project. ## Table of Contents - [calzone](#calzone) -- [Build Instructions](#build-instructions) - - [Prerequisites](#prerequisites) - - [Static vs Dynamic Builds](#static-vs-dynamic-builds) - - [Bootstrap, Configure, Build](#bootstrap-configure-build) - - [Build Troubleshooting](#build-troubleshooting) - - [Cleaning Up](#cleaning-up) +- [Getting Calzone](#getting-calzone) + - [Build From Source](#build-from-source) + - [Prerequisites](#prerequisites) + - [Static vs Dynamic Builds](#static-vs-dynamic-builds) + - [Bootstrap, Configure, Build](#bootstrap-configure-build) + - [Build Troubleshooting](#build-troubleshooting) + - [Cleaning Up](#cleaning-up) + - [Use the Dockerfile](#use-the-dockerfile) + - [Download Prebuilt Binaries](#download-prebuilt-binaries) - [Quickstart: build a sample self-extracting binary](#quickstart-build-a-sample-self-extracting-binary) - [Interpreter patching with PATCHELF_SET_INTERPRETER](#interpreter-patching-with-patchelf_set_interpreter) - -## Build Instructions + +## Getting Calzone + + +### Build From Source -### Prerequisites +##### Prerequisites - POSIX shell (`/bin/sh`) - GNU Autotools toolchain: @@ -55,7 +61,7 @@ sudo apt install musl-dev musl-tools ``` -### Static vs Dynamic Builds +##### Static vs Dynamic Builds By default, `configure` attempts to produce **fully static binaries** that are self-contained and do not depend on system shared libraries. This makes the @@ -203,7 +209,7 @@ make This produces binaries that depend on system shared libraries at runtime. -### Bootstrap, Configure, Build +##### Bootstrap, Configure, Build From the repository root: @@ -269,7 +275,7 @@ From the repository root: Use `DESTDIR` or `--prefix` to control the installation target. -### Build Troubleshooting +##### Build Troubleshooting #### "libcbor headers not found" @@ -340,13 +346,46 @@ sudo apt install musl-dev musl-tools ``` -### Cleaning Up +##### Cleaning Up - `make clean` removes build artifacts from the source tree. - `make distclean` additionally removes files generated by `configure`. - `git clean -xfd` resets the tree completely (use with care; this deletes untracked files). + +### Use the Dockerfile + +The repository includes a `Dockerfile` that installs the required build tools, +builds local copies of `libcbor` and `libarchive`, and then runs the project +build inside the container. + +Build the image from the repository root: + +```sh +docker build -t calzone:local . +``` + +Start an interactive shell in the built image: + +```sh +docker run --rm -it calzone:local /bin/bash +``` + +Inside the container you can find the binaries under `/calzone/baker/baker` and `/calzone/launcher/launcher` + + +### Download Prebuilt Binaries + +Prebuilt Linux binaries are attached to GitHub releases for: + +- `launcher-linux-amd64` +- `launcher-linux-arm64` +- `baker-linux-amd64` +- `baker-linux-arm64` + +Each release asset also includes a matching `.sha256` checksum file. + ## Quickstart: build a sample self-extracting binary