Skip to content

Commit

Permalink
[+] Rust builder?
Browse files Browse the repository at this point in the history
  • Loading branch information
hykilpikonna committed Dec 22, 2024
1 parent a0db219 commit cafa3ff
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/build_pkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ function build_for_platform() {
build_for_platform "linux-amd64" "manylinux_2_31_x86_64"
build_for_platform "linux-aarch64" "manylinux_2_31_aarch64"
build_for_platform "linux-armv7l" "manylinux_2_31_armv7l"
# build_for_platform "linux-riscv64" "manylinux_2_31_riscv64"
# There doesn't seem to be tags for freebsd?
# build_for_platform "freebsd-amd64" "freebsd_x86_64"
# build_for_platform "freebsd-aarch64" "freebsd_aarch64"
Expand All @@ -119,7 +118,8 @@ build_for_platform "musl-amd64" "musllinux_1_1_x86_64"
# The official fastfetch build uses macOS 12.0
build_for_platform "macos-universal" "macosx_11_0_x86_64"
build_for_platform "macos-universal" "macosx_11_0_arm64"
# TODO: linux_riscv64
# TODO: linux_riscv64 (pypi's platform tag support is not there yet)
# build_for_platform "linux-riscv64" "manylinux_2_31_riscv64"

# Finally, remove temporary files
rm -rf wheel git
11 changes: 11 additions & 0 deletions tools/build_rust.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

set -e

# Step 1: Build the Docker image
echo "Building the Docker image..."
docker build -t rust-builder-general tools/rust-builder/general

# Step 2: Run the Docker container and execute the builder script
echo "Running the Docker container..."
docker run --rm -v "$(pwd)":/app rust-builder bash -c "cd /app && ./tools/rust-builder/general/builder.sh"
16 changes: 16 additions & 0 deletions tools/rust-builder/general/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM debian:10-slim

# Install Rust building environment
RUN apt update && apt install -y curl build-essential gcc libssl-dev bash musl-tools mingw-w64
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
RUN source $HOME/.cargo/env

# Add toolchains for building for gnu[x86_64, aarch64, armv7l], musl[x86_64], and windows[x86_64, aarch64]
RUN rustup target add \
x86_64-unknown-linux-gnu \
aarch64-unknown-linux-gnu \
armv7-unknown-linux-gnueabihf \
x86_64-unknown-linux-musl \
x86_64-pc-windows-gnu \

WORKDIR /app
8 changes: 8 additions & 0 deletions tools/rust-builder/general/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

# Build for platforms
cargo build --release --target x86_64-unknown-linux-gnu
cargo build --release --target aarch64-unknown-linux-gnu
cargo build --release --target armv7-unknown-linux-gnueabihf
cargo build --release --target x86_64-unknown-linux-musl
cargo build --release --target x86_64-pc-windows-gnu

0 comments on commit cafa3ff

Please sign in to comment.