mirror of
https://github.com/ruby/ruby.git
synced 2026-08-21 02:04:38 +08:00
Use setup/ubuntu action for cross-compiling
This commit is contained in:
parent
a14260294f
commit
0cebfe9474
28
.github/actions/setup/ubuntu/action.yml
vendored
28
.github/actions/setup/ubuntu/action.yml
vendored
@ -24,18 +24,35 @@ runs:
|
||||
using: composite
|
||||
|
||||
steps:
|
||||
- id: uname
|
||||
name: uname
|
||||
shell: bash
|
||||
env:
|
||||
arch: ${{ inputs.arch }}
|
||||
run: |
|
||||
setarch="${arch:+setarch $arch --}"
|
||||
# normalize `uname`
|
||||
if uname=$(${setarch} uname -m 2> /dev/null); then
|
||||
echo "setarch=${setarch}" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
# if `setarch` failed, take the given `arch` as-is.
|
||||
uname="${arch}"
|
||||
setarch=""
|
||||
fi
|
||||
echo "uname=$uname" >> "$GITHUB_OUTPUT"
|
||||
echo "dpkg=${uname/686/386}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: set SETARCH
|
||||
shell: bash
|
||||
run: echo "SETARCH=${setarch}" >> "$GITHUB_ENV" # zizmor: ignore[github-env]
|
||||
env:
|
||||
setarch: ${{ inputs.arch && format('setarch {0} --', inputs.arch) }}
|
||||
setarch: ${{ steps.uname.outputs.setarch }}
|
||||
|
||||
- id: uname
|
||||
name: uname
|
||||
- name: dpkg setup
|
||||
shell: bash
|
||||
run: |
|
||||
echo uname=`${SETARCH} uname -m` >> "$GITHUB_OUTPUT"
|
||||
echo dpkg=`${SETARCH} uname -m | sed s/686/386/` >> "$GITHUB_OUTPUT"
|
||||
sudo dpkg --add-architecture ${{ steps.uname.outputs.dpkg }}
|
||||
if: ${{ inputs.arch }}
|
||||
|
||||
- name: apt-get
|
||||
shell: bash
|
||||
@ -43,7 +60,6 @@ runs:
|
||||
arch: ${{ inputs.arch && format(':{0}', steps.uname.outputs.dpkg) || '' }}
|
||||
run: |
|
||||
set -x
|
||||
${arch:+sudo dpkg --add-architecture ${arch#:}}
|
||||
sudo apt-get update -qq || :
|
||||
sudo apt-get install --no-install-recommends -qq -y -o=Dpkg::Use-Pty=0 \
|
||||
${arch:+cross}build-essential${arch/:/-} \
|
||||
|
||||
17
.github/workflows/crosscompile.yml
vendored
17
.github/workflows/crosscompile.yml
vendored
@ -64,9 +64,8 @@ jobs:
|
||||
builddir: build
|
||||
makeup: true
|
||||
|
||||
- name: Install cross-compilation toolchain
|
||||
- name: Setup cross-compilation toolchain sources
|
||||
run: |
|
||||
sudo dpkg --add-architecture ${{ matrix.arch }}
|
||||
native_arch=$(dpkg --print-architecture)
|
||||
# Restrict existing sources to native arch
|
||||
sudo sed -i '/^Architectures:/d' /etc/apt/sources.list.d/ubuntu.sources
|
||||
@ -84,16 +83,10 @@ jobs:
|
||||
"Components: main universe" \
|
||||
"Architectures: ${{ matrix.arch }}" \
|
||||
| sudo tee /etc/apt/sources.list.d/cross-${{ matrix.arch }}.sources
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install --no-install-recommends -qq -y \
|
||||
crossbuild-essential-${{ matrix.arch }} \
|
||||
libssl-dev:${{ matrix.arch }} \
|
||||
libyaml-dev:${{ matrix.arch }} \
|
||||
zlib1g-dev:${{ matrix.arch }} \
|
||||
libffi-dev:${{ matrix.arch }} \
|
||||
libreadline-dev:${{ matrix.arch }} \
|
||||
libncurses-dev:${{ matrix.arch }} \
|
||||
autoconf ruby
|
||||
|
||||
- uses: ./.github/actions/setup/ubuntu
|
||||
with:
|
||||
arch: ${{ matrix.arch }}
|
||||
|
||||
- uses: ./.github/actions/setup/baseruby
|
||||
id: baseruby
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user