Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d4b2d5201c | ||
|
|
e1ea800ed7 | ||
|
|
fc51bd6dfd | ||
|
|
d02a87e838 |
12
.github/workflows/test.yml
vendored
12
.github/workflows/test.yml
vendored
@@ -57,8 +57,16 @@ jobs:
|
|||||||
os: ubuntu-20.04
|
os: ubuntu-20.04
|
||||||
target: i586-unknown-linux-musl
|
target: i586-unknown-linux-musl
|
||||||
expect_file_re: "ELF.+80386"
|
expect_file_re: "ELF.+80386"
|
||||||
expect_cross: "--no-expect-cross"
|
expect_cross: "--expect-cross"
|
||||||
expect_stripped: "--expect-stripped"
|
expect_stripped: "--no-expect-stripped"
|
||||||
|
can_test: true
|
||||||
|
|
||||||
|
- platform_name: Linux-i686
|
||||||
|
os: ubuntu-20.04
|
||||||
|
target: i686-unknown-linux-musl
|
||||||
|
expect_file_re: "ELF.+80386"
|
||||||
|
expect_cross: "--expect-cross"
|
||||||
|
expect_stripped: "--no-expect-stripped"
|
||||||
can_test: true
|
can_test: true
|
||||||
|
|
||||||
- platform_name: Linux-mips
|
- platform_name: Linux-mips
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
## 0.0.11 - 2023-12-17
|
||||||
|
|
||||||
|
- Use `cross` when compiling for 32-bit Linux targets. While in theory this should work without
|
||||||
|
`cross`, compiling `openssl` with the `vendored` feature fails when we run
|
||||||
|
`cargo build --target i686-unknown-linux-musl`.
|
||||||
|
|
||||||
## 0.0.10 - 2023-12-10
|
## 0.0.10 - 2023-12-10
|
||||||
|
|
||||||
- Fixed handling of crates with multiple binaries. Attempting to strip binaries for such a crate
|
- Fixed handling of crates with multiple binaries. Attempting to strip binaries for such a crate
|
||||||
|
|||||||
@@ -58,17 +58,17 @@ This action takes the following parameters:
|
|||||||
| Key | Type | Required? | Description |
|
| Key | Type | Required? | Description |
|
||||||
| ------------------- | ---------------------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| ------------------- | ---------------------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `command` | string (one of `build`, `test`, or `both`) | no | The command(s) to run. The default is `build`. Running the `test` command will fail with \*BSD targets, non-x86 Windows, and macOS ARM. |
|
| `command` | string (one of `build`, `test`, or `both`) | no | The command(s) to run. The default is `build`. Running the `test` command will fail with \*BSD targets, non-x86 Windows, and macOS ARM. |
|
||||||
| `target` | string | yes | The target triple to compile for. This should be one of the targets listed by running `rustup target list`. |
|
| `target` | string | yes | The target triple to compile for. This should be one of the targets found by running `rustup target list`. |
|
||||||
| `working-directory` | string | no | The working directory in which to run the `cargo` or `cross` commands. Defaults to the current directory (`.`). |
|
| `working-directory` | string | no | The working directory in which to run the `cargo` or `cross` commands. Defaults to the current directory (`.`). |
|
||||||
| `toolchain` | string (one of `stable`, `beta`, or `nightly`) | no | The Rust toolchain version to install. The default is `stable`. |
|
| `toolchain` | string (one of `stable`, `beta`, or `nightly`) | no | The Rust toolchain version to install. The default is `stable`. |
|
||||||
| `GITHUB_TOKEN` | string | no | Defaults to the value of `${{ github.token }}`. |
|
| `GITHUB_TOKEN` | string | no | Defaults to the value of `${{ github.token }}`. |
|
||||||
| `args` | string | no | A string-separated list of arguments to be passed to `cross build`, like `--release --locked`. |
|
| `args` | string | no | A string-separated list of arguments to be passed to `cross build`, like `--release --locked`. |
|
||||||
| `strip` | boolean (`true` or `false`) | no | If this is true, then the resulting binary will be stripped if possible. This is only possible for binaries which weren't cross-compiled. |
|
| `strip` | boolean (`true` or `false`) | no | If this is true, then the resulting binaries will be stripped if possible. This is only possible for binaries which weren't cross-compiled. |
|
||||||
| `cross-version` | string | no | This can be used to set the version of `cross` to use. If specified, it should be a specific `cross` release tag. If this is not set then the latest version will always be used. |
|
| `cross-version` | string | no | This can be used to set the version of `cross` to use. If specified, it should be a specific `cross` release tag. If this is not set then the latest version will always be used. |
|
||||||
|
|
||||||
## How it Works
|
## How it Works
|
||||||
|
|
||||||
Under the hood, this action will compile your binary with either `cargo` or `cross`, depending on
|
Under the hood, this action will compile your binaries with either `cargo` or `cross`, depending on
|
||||||
the host machine and target. For Linux builds, it will always use `cross` except for builds
|
the host machine and target. For Linux builds, it will always use `cross` except for builds
|
||||||
targeting an x86 architecture like `x86_64` or `i686`.
|
targeting an x86 architecture like `x86_64` or `i686`.
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ build `cross`.
|
|||||||
When compiling on Windows, it will do so in a Powershell environment, which can matter in some
|
When compiling on Windows, it will do so in a Powershell environment, which can matter in some
|
||||||
corner cases, like compiling the `openssl` crate with the `vendored` feature.
|
corner cases, like compiling the `openssl` crate with the `vendored` feature.
|
||||||
|
|
||||||
Finally, it will run `strip` to strip the binary if the `strip` parameter is true. This is only
|
Finally, it will run `strip` to strip the binaries if the `strip` parameter is true. This is only
|
||||||
possible for builds that are not done via `cross`. In addition, Windows builds for `aarch64` cannot
|
possible for builds that are not done via `cross`. In addition, Windows builds for `aarch64` cannot
|
||||||
be stripped either.
|
be stripped either.
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,11 @@ if uname -a | grep --quiet --extended-regexp -i "darwin|msys|windows"; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if echo "$TARGET" | grep --quiet --extended-regexp -i '(x86_64|586|686).+linux-(gnu|musl)'; then
|
# On Linux, we should be able to cross-compile to i586 and i686, but in
|
||||||
|
# practice this fails with some crates, notably openssl with the "vendored"
|
||||||
|
# feature. This feature makes it compile openssl itself, which fails without
|
||||||
|
# cross.
|
||||||
|
if echo "$TARGET" | grep --quiet --extended-regexp -i 'x86_64.+linux-(gnu|musl)'; then
|
||||||
echo "needs-cross=false" >> $GITHUB_OUTPUT
|
echo "needs-cross=false" >> $GITHUB_OUTPUT
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user