Skip to content

Commit

Permalink
chore: improve descriptions [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
joseluisq committed Oct 22, 2021
1 parent d2800c5 commit 8dcb0a6
Showing 1 changed file with 37 additions and 17 deletions.
54 changes: 37 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
# Rust Linux / Darwin Builder
<div>
<div align="center">
<img
src="https://camo.githubusercontent.com/a08032a2db94aea229991af8f73c45cc95174c8066dc7a6b1f88a79c94cf1093/68747470733a2f2f75706c6f61642e77696b696d656469612e6f72672f77696b6970656469612f636f6d6d6f6e732f7468756d622f642f64352f527573745f70726f6772616d6d696e675f6c616e67756167655f626c61636b5f6c6f676f2e7376672f3130323470782d527573745f70726f6772616d6d696e675f6c616e67756167655f626c61636b5f6c6f676f2e7376672e706e67"
height="100" width="100"
/>
</div>

[![CI](https://github.com/joseluisq/rust-linux-darwin-builder/workflows/CI/badge.svg)](https://github.com/joseluisq/rust-linux-darwin-builder/actions?query=workflow%3ACI) [![Docker Image Version (tag latest semver)](https://img.shields.io/docker/v/joseluisq/rust-linux-darwin-builder/1)](https://hub.docker.com/r/joseluisq/rust-linux-darwin-builder/) [![Docker Image Size (tag)](https://img.shields.io/docker/image-size/joseluisq/rust-linux-darwin-builder/1)](https://hub.docker.com/r/joseluisq/rust-linux-darwin-builder/tags) [![Docker Image](https://img.shields.io/docker/pulls/joseluisq/rust-linux-darwin-builder.svg)](https://hub.docker.com/r/joseluisq/rust-linux-darwin-builder/)
<h1 align="center">Rust Linux / Darwin Builder</h1>

> Use same Docker image for compiling [Rust](https://www.rust-lang.org/) programs for Linux ([musl libc](https://doc.rust-lang.org/edition-guide/rust-2018/platform-and-target-support/musl-support-for-fully-static-binaries.html)) & macOS ([osxcross](https://github.com/tpoechtrager/osxcross)).
<h4 align="center">
Use the same Docker image to cross-compile Rust programs for Linux (musl libc) and macOS (osxcross)
</h4>

#### OpenSSL Release Notes
<div align="center">

> _Until `v1.42.0` of this project, one old OpenSSL release `v1.0.2` was used._ <br>
> _Now, since `v1.43.x` or greater, OpenSSL `v1.1.1` (LTS) is used which is supported until `2023-09-11`. <br>
> View more at https://www.openssl.org/policies/releasestrat.html._
[![CI](https://github.com/joseluisq/rust-linux-darwin-builder/workflows/CI/badge.svg)](https://github.com/joseluisq/rust-linux-darwin-builder/actions?query=workflow%3ACI) [![Docker Image Version (tag latest semver)](https://img.shields.io/docker/v/joseluisq/rust-linux-darwin-builder/1)](https://hub.docker.com/r/joseluisq/rust-linux-darwin-builder/) [![Docker Image Size (tag)](https://img.shields.io/docker/image-size/joseluisq/rust-linux-darwin-builder/1)](https://hub.docker.com/r/joseluisq/rust-linux-darwin-builder/tags) [![Docker Image](https://img.shields.io/docker/pulls/joseluisq/rust-linux-darwin-builder.svg)](https://hub.docker.com/r/joseluisq/rust-linux-darwin-builder/)

</div>

</div>

## Overview

This is a __Linux Docker image__ based on [ekidd/rust-musl-builder](https://hub.docker.com/r/ekidd/rust-musl-builder) but using [debian:11-slim](https://hub.docker.com/_/debian?tab=tags&page=1&name=11-slim). It contains essential tools for compile [Rust](https://www.rust-lang.org/) projects such as __Linux__ static binaries via [musl-libc / musl-gcc](https://doc.rust-lang.org/edition-guide/rust-2018/platform-and-target-support/musl-support-for-fully-static-binaries.html) (`x86_64-unknown-linux-musl`) and __macOS__ binaries (`x86_64-apple-darwin`) via [osxcross](https://github.com/tpoechtrager/osxcross) just using the same Linux image.
This is a __Linux Docker image__ based on [ekidd/rust-musl-builder](https://hub.docker.com/r/ekidd/rust-musl-builder) but using latest __Debian [11-slim](https://hub.docker.com/_/debian?tab=tags&page=1&name=11-slim)__ ([Bullseye](https://www.debian.org/News/2021/20210814)).

It contains essential tools for cross-compile [Rust](https://www.rust-lang.org/) projects such as __Linux__ static binaries via [musl-libc / musl-gcc](https://doc.rust-lang.org/edition-guide/rust-2018/platform-and-target-support/musl-support-for-fully-static-binaries.html) (`x86_64-unknown-linux-musl`) and __macOS__ binaries (`x86_64-apple-darwin`) via [osxcross](https://github.com/tpoechtrager/osxcross) just using the same Linux image.

## Usage

Expand All @@ -30,6 +42,8 @@ docker run --rm \
sh -c "cargo build --release"
```

*Note that `x86_64-unknown-linux-gnu` is also available.*

#### x86_64-apple-darwin

```sh
Expand All @@ -42,7 +56,7 @@ docker run --rm \

### Cargo Home advice

It's known that the [`CARGO_HOME`](https://doc.rust-lang.org/cargo/guide/cargo-home.html#cargo-home) points to `$HOME/.cargo` by default (`/root/.cargo` in this case). However if you want to use a custom Cargo home directory make sure to copy the Cargo `config` file to the particular directory like `cp "$HOME/.cargo/config" "$CARGO_HOME/"` before to cross-compile your program. Otherwise you could face a linkage error when for example you want to cross-compile to an `x86_64-apple-darwin` target.
It's known that the [`CARGO_HOME`](https://doc.rust-lang.org/cargo/guide/cargo-home.html#cargo-home) points to `$HOME/.cargo` by default (`/root/.cargo` in this case). However if you want to use a custom Cargo home directory make sure to copy the Cargo `config` file to the particular directory like `cp "$HOME/.cargo/config" "$CARGO_HOME/"` before to cross-compile your program. Otherwise you could face a linkage error when for example if you want to cross-compile to an `x86_64-apple-darwin` target.

### Dockerfile

Expand Down Expand Up @@ -92,7 +106,7 @@ compile:
@docker run --rm -it \
-v $(PWD):/drone/src \
-w /drone/src \
joseluisq/rust-linux-darwin-builder:1.45.2 \
joseluisq/rust-linux-darwin-builder:1.56.0 \
make cross-compile
.PHONY: compile

Expand All @@ -117,13 +131,13 @@ Just run the makefile `compile` target, then you will see two release binaries `
make compile
# 1. Cross compiling example...

# rustc 1.45.2 (d3fb005a3 2020-07-31)
# rustc 1.56.0 (09c42c458 2021-10-18)
# binary: rustc
# commit-hash: d3fb005a39e62501b8b0b356166e515ae24e2e54
# commit-date: 2020-07-31
# host: x86_64-unknown-linux-gnu
# release: 1.45.2
# LLVM version: 10.0
# commit-hash: 09c42c45858d5f3aedfa670698275303a3d19afa
# commit-date: 2021-10-18
# host: x86_64-apple-darwin
# release: 1.56.0
# LLVM version: 13.0.0

# 2. Compiling application (linux-musl x86_64)...
# Finished release [optimized] target(s) in 0.01s
Expand All @@ -148,11 +162,17 @@ CXX=o64-clang++ \

For more details take a look at [Cross compiling Rust from Linux to macOS](https://wapl.es/rust/2019/02/17/rust-cross-compile-linux-to-macos.html) by James Waples.

### OpenSSL release advice

> _Until `v1.42.0` of this project, one old OpenSSL release `v1.0.2` was used._ <br>
> _Now, since `v1.43.x` or greater, OpenSSL `v1.1.1` (LTS) is used which is supported until `2023-09-11`. <br>
> View more at https://www.openssl.org/policies/releasestrat.html._
## Contributions

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in current work by you, as defined in the Apache-2.0 license, shall be dual licensed as described below, without any additional terms or conditions.

Feel free to send some [Pull request](https://github.com/joseluisq/rust-linux-darwin-builder/pulls) or [issue](https://github.com/joseluisq/rust-linux-darwin-builder/issues).
Feel free to send some [Pull request](https://github.com/joseluisq/rust-linux-darwin-builder/pulls) or file an [issue](https://github.com/joseluisq/rust-linux-darwin-builder/issues).

## License

Expand Down

0 comments on commit 8dcb0a6

Please sign in to comment.