-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add builds for rust compatible musl toolchains (#17)
Adds builds of several musl cross toolchains that are compatible with rustc. The rust musl libc is based on version 1.1.24, which is incompatible with prebuilt versions of these toolchains that are available online. This build is based off of the following two projects: - https://github.com/richfelker/musl-cross-make - https://github.com/rust-cross/rust-musl-cross
- Loading branch information
1 parent
e797fdd
commit 10fe5d8
Showing
5 changed files
with
140 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
name: musl | ||
on: | ||
pull_request: | ||
paths: | ||
- "musl/**" | ||
- .github/workflows/musl.yaml | ||
push: | ||
tags: | ||
- "musl-cross-*" | ||
|
||
jobs: | ||
toolchains: | ||
strategy: | ||
matrix: | ||
target: [aarch64-linux-musl, arm-linux-musleabihf, x86_64-linux-musl] | ||
runs-on: ubuntu-22.04 | ||
name: ${{ matrix.target }} | ||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build ${{ matrix.target }} | ||
run: make ${{ matrix.target }} | ||
|
||
- name: Upload release | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | ||
uses: svenstaro/upload-release-action@v1-release | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: "${{ matrix.target }}-cross.tar.gz*" | ||
tag: ${{ github.ref }} | ||
overwrite: true | ||
file_glob: true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM debian:buster-slim | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y \ | ||
build-essential \ | ||
curl \ | ||
file \ | ||
git \ | ||
sudo \ | ||
unzip | ||
|
||
CMD ["bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
|
||
if [ $# -ne 1 ]; then | ||
echo "usage: $0 target" 2>&1 | ||
exit 1 | ||
fi | ||
|
||
target=$1 | ||
|
||
git clone --depth 1 https://github.com/richfelker/musl-cross-make.git /tmp/musl | ||
cp musl/config.mak /tmp/musl | ||
export CFLAGS="-fPIC -g1 $CFLAGS" | ||
export TARGET=$target | ||
make -C /tmp/musl -j4 | ||
make -C /tmp/musl install | ||
tar -C /tmp/musl -czf ${target}-cross.tar.gz output/ | ||
sha256sum ${target}-cross.tar.gz > ${target}-cross.tar.gz.sha256 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# By default, cross compilers are installed to ./output under the top-level | ||
# musl-cross-make directory and can later be moved wherever you want them. | ||
# To install directly to a specific location, set it here. Multiple targets | ||
# can safely be installed in the same location. Some examples: | ||
|
||
#OUTPUT = /opt/musl/armhf | ||
|
||
# By default, latest supported release versions of musl and the toolchain | ||
# components are used. You can override those here, but the version selected | ||
# must be supported (under hashes/ and patches/) to work. For musl, you | ||
# can use "git-refname" (e.g. git-master) instead of a release. Setting a | ||
# blank version for gmp, mpc, mpfr and isl will suppress download and | ||
# in-tree build of these libraries and instead depend on pre-installed | ||
# libraries when available (isl is optional and not set by default). | ||
# Setting a blank version for linux will suppress installation of kernel | ||
# headers, which are not needed unless compiling programs that use them. | ||
|
||
# BINUTILS_VER = | ||
GCC_VER = 11.2.0 | ||
|
||
# https://github.com/rust-embedded/cross/issues/478 | ||
# https://github.com/rust-lang/libc/issues/1848 | ||
|
||
MUSL_VER = 1.1.24 | ||
|
||
# GMP_VER = | ||
# MPC_VER = | ||
# MPFR_VER = | ||
# ISL_VER = | ||
# LINUX_VER = | ||
|
||
# By default source archives are downloaded with wget. curl is also an option. | ||
|
||
# DL_CMD = wget -c -O | ||
DL_CMD = curl -C - -L -o | ||
|
||
# Something like the following can be used to produce a static-linked | ||
# toolchain that's deployable to any system with matching arch, using | ||
# an existing musl-targeted cross compiler. This only # works if the | ||
# system you build on can natively (or via binfmt_misc and # qemu) run | ||
# binaries produced by the existing toolchain (in this example, i486). | ||
|
||
# COMMON_CONFIG += CC="i486-linux-musl-gcc -static --static" CXX="i486-linux-musl-g++ -static --static" | ||
|
||
# Recommended options for smaller build for deploying binaries: | ||
|
||
COMMON_CONFIG += CFLAGS="-g0 -Os -w" CXXFLAGS="-g0 -Os -w" LDFLAGS="-s" | ||
|
||
# Recommended options for faster/simpler build: | ||
|
||
COMMON_CONFIG += --disable-nls | ||
GCC_CONFIG += --enable-languages=c,c++ | ||
GCC_CONFIG += --disable-libquadmath --disable-decimal-float | ||
GCC_CONFIG += --disable-multilib | ||
|
||
# You can keep the local build path out of your toolchain binaries and | ||
# target libraries with the following, but then gdb needs to be told | ||
# where to look for source files. | ||
|
||
COMMON_CONFIG += --with-debug-prefix-map=$(CURDIR)= |