diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..72e8ffc --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +* diff --git a/.gitignore b/.gitignore index eb5a316..830dd75 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,13 @@ -target +target/* +!target/.gitkeep +perf.data* +flamegraph*.svg +vgcore* +example.mid +cov +*/cov +*.profraw +build/* +!build/README.md +!build/*.sh +!build/Dockerfile.* diff --git a/Cargo.lock b/Cargo.lock index 9e791c8..8a72738 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -910,7 +910,7 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "perch" -version = "0.1.0" +version = "1.0.0" dependencies = [ "byte-unit", "clap", diff --git a/Cargo.toml b/Cargo.toml index c8744c0..923ed1d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "perch" -version = "0.1.0" +version = "1.0.0" edition = "2024" [dependencies.tengri] diff --git a/build/Dockerfile.glibc b/build/Dockerfile.glibc new file mode 100644 index 0000000..ec33045 --- /dev/null +++ b/build/Dockerfile.glibc @@ -0,0 +1,14 @@ +FROM docker.io/library/debian:bookworm +RUN apt update \ + && apt install -y build-essential bash tree git wget \ + pkg-config libjack-dev liblilv-dev libserd-dev libsord-dev +RUN adduser --quiet --uid 1000 --disabled-password build +RUN wget https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init \ + && chmod +x ./rustup-init \ + && mv rustup-init /usr/bin/rustup-init +USER build +WORKDIR /home/build +RUN rustup-init -yv --profile minimal --default-toolchain nightly \ + && rm -rvf "$HOME/.rustup/roolchains/*/share" +RUN ls -alh "$HOME" && bash -c '. "$HOME/.cargo/env" \ + && cargo version -vv' diff --git a/build/Dockerfile.musl b/build/Dockerfile.musl new file mode 100644 index 0000000..ed350cd --- /dev/null +++ b/build/Dockerfile.musl @@ -0,0 +1,13 @@ +FROM docker.io/library/alpine:edge + +RUN apk add --no-cache build-base bash tree rustup git just cloc clang20-dev pipewire-jack-dev + +RUN adduser -Du1000 build + +USER 1000 + +RUN rustup-init -y --profile minimal --default-toolchain nightly \ + && rm -rvf "$HOME/.rustup/roolchains/*/share" + +RUN source "$HOME/.cargo/env" \ + && cargo version -vv diff --git a/build/README.md b/build/README.md new file mode 100644 index 0000000..2f70fea --- /dev/null +++ b/build/README.md @@ -0,0 +1,11 @@ +This directory contains Dockerfiles and shell scripts +for building Tek in a container. For now, only the +GLIBC build works, as the Musl static build is unable +to `dlopen` the system's `libjack.so`. + +Invoke from repo root, like this: `build/release-glibc.sh`. +This will first build a Docker image, `tek:glibc`, which +will contain all build-time dependencies; then, it +will invoke a `cargo build --release` in a container +spawned from that image, ultimately placing the +release build in this directory, as `build/tek`. diff --git a/build/release-glibc-shell.sh b/build/release-glibc-shell.sh new file mode 100755 index 0000000..7051588 --- /dev/null +++ b/build/release-glibc-shell.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env sh +set -exo pipefail +docker inspect perch:glibc || time docker build --cache-from=internal \ + -f build/Dockerfile.glibc -t perch:glibc . +time docker run \ + --rm -itu0 \ + -v .:/build -w /build \ + -vperch-build-cargo:/home/build/.cargo \ + -vperch-build-target:/build/target \ + -eRUST_JACK_DLOPEN=true \ + perch:glibc $@ diff --git a/build/release-glibc.sh b/build/release-glibc.sh new file mode 100755 index 0000000..2692921 --- /dev/null +++ b/build/release-glibc.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env sh +set -exo pipefail +docker inspect perch:glibc || time docker build --cache-from=internal \ + -f build/Dockerfile.glibc -t perch:glibc . +time docker run \ + --rm -itu0 \ + -v .:/build -w /build \ + -vperch-build-cargo:/home/build/.cargo \ + -vperch-build-target:/build/target \ + -eRUST_JACK_DLOPEN=true \ + perch:glibc sh -c "chown -R 1000:1000 /build/target \ + && su build -c '. ~/.cargo/env \ + && time cargo build -j4 --release \ + && cp target/release/perch build/'" diff --git a/build/release-musl-shell.sh b/build/release-musl-shell.sh new file mode 100755 index 0000000..dae7d3c --- /dev/null +++ b/build/release-musl-shell.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env sh +set -exo pipefail +docker inspect perch:musl || time docker build --cache-from=internal \ + -f build/Dockerfile.musl -t perch:musl . +time docker run \ + --rm -itu0 \ + -v .:/build -w /build \ + -vperch-build-cargo:/home/build/.cargo \ + -vperch-build-target:/build/target \ + -eRUST_JACK_DLOPEN=true \ + perch:musl $@ diff --git a/build/release-musl.sh b/build/release-musl.sh new file mode 100755 index 0000000..8a21259 --- /dev/null +++ b/build/release-musl.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env sh +set -exo pipefail +docker inspect perch:musl || time docker build --cache-from=internal \ + -f build/Dockerfile.musl -t perch:musl . +time docker run \ + --rm -itu0 \ + -v .:/build -w /build \ + -vperch-build-cargo:/home/build/.cargo \ + -vperch-build-target:/build/target \ + -eRUST_JACK_DLOPEN=true \ + perch:musl sh -c "chown -R 1000:1000 /build/target \ + && su build -c 'source ~/.cargo/env \ + && just build-release \ + && cp target/release/perch build/'" diff --git a/target/.gitkeep b/target/.gitkeep new file mode 100644 index 0000000..e69de29