Skip to content

Commit dda08fc

Browse files
committed
armv7l-linux-gnueabihf precompile
Signed-off-by: Cocoa <[email protected]>
1 parent 06401ab commit dda08fc

File tree

3 files changed

+100
-1
lines changed

3 files changed

+100
-1
lines changed

.github/build.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
3+
set -x
4+
5+
DOCKER_PLATFORM=$1
6+
DOCKER_IMAGE=$2
7+
OTP_VERSION=$3
8+
ELIXIR_VERSION=$4
9+
TARGET_TRIPLET=$5
10+
11+
sudo docker run --privileged --network=host --rm --platform="${DOCKER_PLATFORM}" -v $(pwd):/work "${DOCKER_IMAGE}" \
12+
sh -c "chmod a+x /work/do-build.sh && /work/do-build.sh ${OTP_VERSION} ${ELIXIR_VERSION} ${TARGET_TRIPLET}"
13+
14+
sudo chmod -R a+r ./cache

.github/do-build.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/sh
2+
3+
set -x
4+
5+
OTP_VERSION=$1
6+
ELIXIR_VERSION=$2
7+
TARGET_TRIPLET=$3
8+
9+
OTP_MAIN_VER="${OTP_VERSION%%.*}"
10+
export DEBIAN_FRONTEND=noninteractive
11+
export LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8
12+
13+
case $TARGET_TRIPLET in
14+
armv7l-linux-gnueabihf )
15+
apt-get update && \
16+
apt-get install -y libncurses-dev libssl-dev make cmake build-essential gcc g++ curl unzip locales locales-all && \
17+
sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \
18+
locale-gen
19+
;;
20+
*)
21+
echo "Unknown TRIPLET: ${TARGET_TRIPLET}"
22+
exit 1
23+
;;
24+
esac
25+
26+
ROOTDIR="/work"
27+
OTP_ROOTDIR="${ROOTDIR}/.tools/otp"
28+
ELIXIR_DIR="${ROOTDIR}/.tools/elixir"
29+
export PATH="${OTP_ROOTDIR}/usr/local/bin:${ELIXIR_DIR}/${ELIXIR_VERSION}/bin:${PATH}"
30+
export ERL_ROOTDIR="${OTP_ROOTDIR}/usr/local/lib/erlang"
31+
export ELIXIR_MAKE_CACHE_DIR="${ROOTDIR}/cache"
32+
export CC_PRECOMPILER_PRECOMPILE_ONLY_LOCAL="true"
33+
34+
mkdir -p "${OTP_ROOTDIR}" && \
35+
mkdir -p "${ELIXIR_DIR}" && \
36+
mkdir -p "${ELIXIR_MAKE_CACHE_DIR}" && \
37+
cd "${OTP_ROOTDIR}" && \
38+
curl -fSL "https://github.com/cocoa-xu/otp-build/releases/download/v${OTP_VERSION}/otp-${TARGET_TRIPLET}.tar.gz" -o "otp-${TARGET_TRIPLET}.tar.gz" && \
39+
tar -xzf "otp-${TARGET_TRIPLET}.tar.gz" && \
40+
cd "${ELIXIR_DIR}" && \
41+
curl -fSL "https://github.com/elixir-lang/elixir/releases/download/v${ELIXIR_VERSION}/elixir-otp-${OTP_MAIN_VER}.zip" -o "elixir-otp-${OTP_MAIN_VER}.zip" && \
42+
unzip -o -q "elixir-otp-${OTP_MAIN_VER}.zip" -d "${ELIXIR_VERSION}" && \
43+
mix local.hex --force && \
44+
mix local.rebar --force && \
45+
cd "${ROOTDIR}" && \
46+
mix deps.get && \
47+
mix elixir_make.precompile

.github/workflows/linux-precompile.yml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,45 @@ permissions:
99
contents: write
1010

1111
jobs:
12+
armv7l-linux-gnueabihf:
13+
runs-on: ubuntu-latest
14+
env:
15+
TARGET: armv7l-linux-gnueabihf
16+
DOCKER_PLATFORM: linux/arm/v7
17+
DOCKER_IMAGE: ubuntu:20.04
18+
strategy:
19+
matrix:
20+
job:
21+
- {otp: "27.1.1", elixir: "1.17.3"}
22+
- {otp: "25.3.2.14", elixir: "1.16.0"}
23+
24+
name: Linux armv7l - OTP ${{ matrix.job.otp }} - Elixir ${{ matrix.job.elixir }}
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Install binfmt
30+
run: |
31+
sudo apt update
32+
sudo apt install -y binfmt-support qemu-user-static
33+
34+
- name: Pull docker image
35+
run: |
36+
sudo docker pull --platform=${{ env.DOCKER_PLATFORM }} ${{ env.DOCKER_IMAGE }}
37+
38+
- name: Run docker container
39+
run: |
40+
cp .github/build.sh ./
41+
cp .github/do-build.sh ./
42+
43+
bash ./build.sh ${{ env.DOCKER_PLATFORM }} ${{ env.DOCKER_IMAGE }} "${{ matrix.job.otp }}" "${{ matrix.job.elixir }}" "${{ env.TARGET }}"
44+
45+
- uses: softprops/action-gh-release@v1
46+
if: startsWith(github.ref, 'refs/tags/')
47+
with:
48+
files: |
49+
cache/*.tar.gz
50+
1251
precompile:
1352
runs-on: ubuntu-20.04
1453
env:
@@ -44,7 +83,6 @@ jobs:
4483
if: matrix.arch == 'x86_64'
4584
run: |
4685
sudo apt-get install -y gcc-i686-linux-gnu g++-i686-linux-gnu \
47-
gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf \
4886
gcc-powerpc64le-linux-gnu g++-powerpc64le-linux-gnu \
4987
gcc-s390x-linux-gnu g++-s390x-linux-gnu
5088

0 commit comments

Comments
 (0)