From d9f79154faa310ebfa2c43d20a16ee2496555b6b Mon Sep 17 00:00:00 2001 From: Kyle Lacy Date: Sun, 31 Dec 2023 00:00:05 -0800 Subject: [PATCH] Split binaries from `brioche-pack` crate into separate crates --- .github/workflows/ci.yml | 24 +++++++++++---- Cargo.lock | 29 +++++++++++++++++++ Cargo.toml | 2 +- crates/brioche-ld/Cargo.toml | 10 +++++++ .../brioche-ld.rs => brioche-ld/src/main.rs} | 0 crates/brioche-packed-exec/Cargo.toml | 9 ++++++ .../src/main.rs} | 0 .../brioche-packed-userland-exec/Cargo.toml | 10 +++++++ .../src/main.rs} | 0 crates/brioche/Cargo.toml | 2 -- 10 files changed, 78 insertions(+), 8 deletions(-) create mode 100644 crates/brioche-ld/Cargo.toml rename crates/{brioche-pack/src/bin/brioche-ld.rs => brioche-ld/src/main.rs} (100%) create mode 100644 crates/brioche-packed-exec/Cargo.toml rename crates/{brioche-pack/src/bin/brioche-packed-exec.rs => brioche-packed-exec/src/main.rs} (100%) create mode 100644 crates/brioche-packed-userland-exec/Cargo.toml rename crates/{brioche-pack/src/bin/brioche-packed-userland-exec.rs => brioche-packed-userland-exec/src/main.rs} (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 34cfe02..9df1c45 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,11 +48,25 @@ jobs: --target x86_64-unknown-linux-musl \ --component rust-src - name: Build Brioche - run: cargo build --release --target=x86_64-unknown-linux-gnu - - name: Build brioche-pack run: | + cargo build \ + --all \ + --bin brioche \ + --release \ + --target=x86_64-unknown-linux-gnu + - name: Build brioche-pack tools + run: | + cargo build \ + --all \ + --bin brioche-packer \ + --bin brioche-ld \ + --release \ + --target=x86_64-unknown-linux-musl + cargo +"$NIGHTLY_TOOLCHAIN" build \ - -p brioche-pack \ + --all \ + --bin brioche-packed-exec \ + --bin brioche-packed-userland-exec \ --profile=release-tiny \ --target=x86_64-unknown-linux-musl \ -Z 'build-std=std,panic_abort' \ @@ -65,10 +79,10 @@ jobs: target/x86_64-unknown-linux-gnu/release/brioche \ artifacts/brioche/x86_64-linux/ cp \ - target/x86_64-unknown-linux-musl/release-tiny/brioche-ld \ + target/x86_64-unknown-linux-musl/release/brioche-packer \ + target/x86_64-unknown-linux-musl/release/brioche-ld \ target/x86_64-unknown-linux-musl/release-tiny/brioche-packed-exec \ target/x86_64-unknown-linux-musl/release-tiny/brioche-packed-userland-exec \ - target/x86_64-unknown-linux-musl/release-tiny/brioche-packer \ artifacts/brioche-pack/x86_64-linux/ (cd artifacts/brioche-pack/x86_64-linux/ && tar --zstd -cf ../../brioche/x86_64-linux/brioche-pack.tar.zstd .) tree --du -h artifacts/brioche-pack diff --git a/Cargo.lock b/Cargo.lock index 8178460..9615919 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -680,6 +680,16 @@ dependencies = [ "urlencoding", ] +[[package]] +name = "brioche-ld" +version = "0.1.0" +dependencies = [ + "brioche-pack", + "bstr 1.8.0", + "goblin", + "thiserror", +] + [[package]] name = "brioche-pack" version = "0.0.1" @@ -698,6 +708,25 @@ dependencies = [ "userland-execve", ] +[[package]] +name = "brioche-packed-exec" +version = "0.1.0" +dependencies = [ + "brioche-pack", + "bstr 1.8.0", + "thiserror", +] + +[[package]] +name = "brioche-packed-userland-exec" +version = "0.1.0" +dependencies = [ + "brioche-pack", + "bstr 1.8.0", + "thiserror", + "userland-execve", +] + [[package]] name = "bstr" version = "0.2.17" diff --git a/Cargo.toml b/Cargo.toml index a87fb76..137d527 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -members = ["crates/brioche", "crates/brioche-pack"] +members = ["crates/brioche", "crates/brioche-ld", "crates/brioche-pack", "crates/brioche-packed-exec", "crates/brioche-packed-userland-exec"] default-members = ["crates/brioche"] resolver = "2" diff --git a/crates/brioche-ld/Cargo.toml b/crates/brioche-ld/Cargo.toml new file mode 100644 index 0000000..558170d --- /dev/null +++ b/crates/brioche-ld/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "brioche-ld" +version = "0.1.0" +edition = "2021" + +[dependencies] +brioche-pack = { path = "../brioche-pack" } +bstr = "1.8.0" +goblin = "0.7.1" +thiserror = "1.0.51" diff --git a/crates/brioche-pack/src/bin/brioche-ld.rs b/crates/brioche-ld/src/main.rs similarity index 100% rename from crates/brioche-pack/src/bin/brioche-ld.rs rename to crates/brioche-ld/src/main.rs diff --git a/crates/brioche-packed-exec/Cargo.toml b/crates/brioche-packed-exec/Cargo.toml new file mode 100644 index 0000000..37aefd0 --- /dev/null +++ b/crates/brioche-packed-exec/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "brioche-packed-exec" +version = "0.1.0" +edition = "2021" + +[dependencies] +brioche-pack = { path = "../brioche-pack" } +bstr = "1.8.0" +thiserror = "1.0.51" diff --git a/crates/brioche-pack/src/bin/brioche-packed-exec.rs b/crates/brioche-packed-exec/src/main.rs similarity index 100% rename from crates/brioche-pack/src/bin/brioche-packed-exec.rs rename to crates/brioche-packed-exec/src/main.rs diff --git a/crates/brioche-packed-userland-exec/Cargo.toml b/crates/brioche-packed-userland-exec/Cargo.toml new file mode 100644 index 0000000..8e1a4a8 --- /dev/null +++ b/crates/brioche-packed-userland-exec/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "brioche-packed-userland-exec" +version = "0.1.0" +edition = "2021" + +[dependencies] +brioche-pack = { path = "../brioche-pack" } +bstr = "1.8.0" +thiserror = "1.0.51" +userland-execve = { git = "https://github.com/brioche-dev/userland-execve-rust.git" } diff --git a/crates/brioche-pack/src/bin/brioche-packed-userland-exec.rs b/crates/brioche-packed-userland-exec/src/main.rs similarity index 100% rename from crates/brioche-pack/src/bin/brioche-packed-userland-exec.rs rename to crates/brioche-packed-userland-exec/src/main.rs diff --git a/crates/brioche/Cargo.toml b/crates/brioche/Cargo.toml index 72ff608..05fd58e 100644 --- a/crates/brioche/Cargo.toml +++ b/crates/brioche/Cargo.toml @@ -3,8 +3,6 @@ name = "brioche" version = "0.0.1" edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] anyhow = { version = "1.0.75", features = ["backtrace"] } async-compression = { version = "0.4.5", features = ["tokio", "gzip", "xz", "zstd"] }