Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/actions/binary-compatible-builds/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ description: 'Set up a CentOS 6 container to build releases in'
runs:
using: node12
main: 'main.js'
inputs:
name:
required: true
description: "Name of the build"
43 changes: 12 additions & 31 deletions .github/actions/binary-compatible-builds/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ function set_env(name, val) {
// possible. For now 10.9 is the limit.
if (process.platform == 'darwin') {
set_env("MACOSX_DEPLOYMENT_TARGET", "10.9");
set_env("python", "python3");
return;
}

// On Windows we build against the static CRT to reduce dll dependencies
if (process.platform == 'win32') {
set_env("RUSTFLAGS", "-Ctarget-feature=+crt-static");
set_env("python", "python");
return;
}

Expand All @@ -28,48 +26,31 @@ if (process.platform == 'win32') {
// commands in there with the `$CENTOS` env var.

if (process.env.CENTOS !== undefined) {
const args = ['exec', '-w', process.cwd(), '-i', 'centos'];
const args = ['exec', '-w', process.cwd(), '-i', 'build-container'];
for (const arg of process.argv.slice(2)) {
args.push(arg);
}
child_process.execFileSync('docker', args, stdio);
return;
}

// Add our rust mount onto PATH, but also add some stuff to PATH from
// the packages that we install.
let path = process.env.PATH;
path = `${path}:/rust/bin`;
path = `/opt/rh/devtoolset-8/root/usr/bin:${path}`;
const name = process.env.INPUT_NAME;

child_process.execFileSync('docker', [
'build',
'--tag', 'build-image',
`${process.cwd()}/ci/docker/${name}`
], stdio);

// Spawn a container daemonized in the background which we'll connect to via
// `docker exec`. This'll have access to the current directory.
child_process.execFileSync('docker', [
'run',
'-di',
'--name', 'centos',
'--detach',
'--interactive',
'--name', 'build-container',
'-v', `${process.cwd()}:${process.cwd()}`,
'-v', `${child_process.execSync('rustc --print sysroot').toString().trim()}:/rust:ro`,
'--env', `PATH=${path}`,
// FIXME(rust-lang/rust#80703) this shouldn't be necessary
'--env', `LD_LIBRARY_PATH=/rust/lib`,
'centos:7',
'build-image',
], stdio);

// Use ourselves to run future commands
set_env("CENTOS", __filename);

// See https://edwards.sdsu.edu/research/c11-on-centos-6/ for where these
const exec = s => {
child_process.execSync(`docker exec centos ${s}`, stdio);
};
exec('yum install -y centos-release-scl cmake xz epel-release');
exec('yum install -y python3 patchelf unzip');
exec('yum install -y devtoolset-8-gcc devtoolset-8-binutils devtoolset-8-gcc-c++');
exec('yum install -y git');

// Delete `libstdc++.so` to force gcc to link against `libstdc++.a` instead.
// This is a hack and not the right way to do this, but it ends up doing the
// right thing for now.
exec('rm -f /opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8/libstdc++.so');
set_env("python", "python3");
16 changes: 2 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -376,29 +376,17 @@ jobs:
- build: aarch64-linux
os: ubuntu-latest
target: aarch64-unknown-linux-gnu
gcc_package: gcc-aarch64-linux-gnu
gcc: aarch64-linux-gnu-gcc
- build: s390x-linux
os: ubuntu-latest
target: s390x-unknown-linux-gnu
gcc_package: gcc-s390x-linux-gnu
gcc: s390x-linux-gnu-gcc
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: ./.github/actions/install-rust
- uses: ./.github/actions/binary-compatible-builds
if: matrix.target == ''

- name: Install cross-compilation tools
run: |
set -ex
sudo apt-get update
sudo apt-get install -y ${{ matrix.gcc_package }}
upcase=$(echo ${{ matrix.target }} | awk '{ print toupper($0) }' | sed 's/-/_/g')
echo CARGO_TARGET_${upcase}_LINKER=${{ matrix.gcc }} >> $GITHUB_ENV
if: matrix.target != '' && matrix.os == 'ubuntu-latest'
with:
name: ${{ matrix.build }}
- run: |
echo CARGO_BUILD_TARGET=${{ matrix.target }} >> $GITHUB_ENV
rustup target add ${{ matrix.target }}
Expand Down
7 changes: 7 additions & 0 deletions ci/docker/aarch64-linux/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM ubuntu:16.04

RUN apt-get update -y && apt-get install -y gcc gcc-aarch64-linux-gnu ca-certificates

ENV PATH=$PATH:/rust/bin
ENV CARGO_BUILD_TARGET=aarch64-unknown-linux-gnu
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc
7 changes: 7 additions & 0 deletions ci/docker/s390x-linux/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM ubuntu:16.04

RUN apt-get update -y && apt-get install -y gcc gcc-s390x-linux-gnu ca-certificates

ENV PATH=$PATH:/rust/bin
ENV CARGO_BUILD_TARGET=s390x-unknown-linux-gnu
ENV CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER=s390x-linux-gnu-gcc
5 changes: 5 additions & 0 deletions ci/docker/x86_64-linux/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM centos:7

RUN yum install -y git gcc

ENV PATH=$PATH:/rust/bin