Skip to content

Commit

Permalink
Remove cross from build tools (#540)
Browse files Browse the repository at this point in the history
By including a linker for windows and the corresponding toolchain, we
can cross compile to Windows quite easily, and then we no longer
need cross or Docker in Docker.

(Hopefully) closes #530
  • Loading branch information
markmandel authored Jun 6, 2022
1 parent 786d0d3 commit 7c80a2e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
17 changes: 8 additions & 9 deletions build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ package_version := $(shell grep version -m 1 $(project_path)/Cargo.toml | awk '{

common_rust_args := -v $(project_path):/workspace -w /workspace \
-v $(CARGO_HOME)/registry:/usr/local/cargo/registry
docker_in_docker := -v /var/run/docker.sock:/var/run/docker.sock

# _____ _
# |_ _|_ _ _ __ __ _ ___| |_ ___
Expand Down Expand Up @@ -91,17 +90,17 @@ binary-archive: ensure-build-image build-all-binaries

# Build release and debug binaries for x86_64-unknown-linux-gnu
build-linux-binary: ensure-build-image
docker run --rm $(common_rust_args) $(docker_in_docker) \
--entrypoint=cross $(BUILD_IMAGE_TAG) build --target x86_64-unknown-linux-gnu
docker run --rm $(common_rust_args) $(docker_in_docker) \
--entrypoint=cross $(BUILD_IMAGE_TAG) build --target x86_64-unknown-linux-gnu --release
docker run --rm $(common_rust_args) \
--entrypoint=cargo $(BUILD_IMAGE_TAG) build --target x86_64-unknown-linux-gnu
docker run --rm $(common_rust_args) \
--entrypoint=cargo $(BUILD_IMAGE_TAG) build --target x86_64-unknown-linux-gnu --release

# Build release and debug binaries for x86_64-pc-windows-gnu
build-windows-binary: ensure-build-image
docker run --rm $(common_rust_args) $(docker_in_docker) \
--entrypoint=cross $(BUILD_IMAGE_TAG) build --target x86_64-pc-windows-gnu
docker run --rm $(common_rust_args) $(docker_in_docker) \
--entrypoint=cross $(BUILD_IMAGE_TAG) build --target x86_64-pc-windows-gnu --release
docker run --rm $(common_rust_args) \
--entrypoint=cargo $(BUILD_IMAGE_TAG) build --target x86_64-pc-windows-gnu
docker run --rm $(common_rust_args) \
--entrypoint=cargo $(BUILD_IMAGE_TAG) build --target x86_64-pc-windows-gnu --release

# Build release and debug binaries for x86_64-apple-darwin
build-macos-binary:
Expand Down
8 changes: 4 additions & 4 deletions build/build-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ENV RUSTUP_HOME=/usr/local/rustup \
# Install packages
RUN set -eux && \
apt-get update && \
apt-get install -y jq wget zip build-essential libssl-dev pkg-config python3-pip && \
apt-get install -y jq wget zip build-essential libssl-dev pkg-config python3-pip g++-mingw-w64-x86-64 && \
pip3 install live-server

# Install htmltest
Expand All @@ -41,10 +41,10 @@ RUN wget https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustu
rm rustup-init && \
chmod -R a+w $RUSTUP_HOME $CARGO_HOME && \
rustup component add rustfmt clippy && \
cargo install cross cargo-watch mdbook && \
rustup target add x86_64-pc-windows-gnu && \
cargo install cargo-watch mdbook && \
cargo install cargo-about && \
cargo install --locked cargo-deny && \
rustup --version && \
cargo --version && \
rustc --version && \
cross --version
rustc --version

0 comments on commit 7c80a2e

Please sign in to comment.