Skip to content

Commit 16c7db8

Browse files
committed
feat: electron build v32.2.5 complete
1 parent c0cea46 commit 16c7db8

File tree

4 files changed

+80
-9
lines changed

4 files changed

+80
-9
lines changed

.github/workflows/builder.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ on:
2323
required: true
2424
default: "14.2.0"
2525
description: Gcc version to compile
26+
libffiVersion:
27+
type: string
28+
required: true
29+
default: "3.4.6"
30+
description: Libffi version to compile
2631
imageTag:
2732
type: string
2833
required: true
@@ -56,6 +61,32 @@ jobs:
5661
name: libgcc
5762
path: dist/libgcc.tar.gz
5863

64+
libffi:
65+
runs-on: self-hosted
66+
container:
67+
image: ghcr.io/darkyzhou/electron-build-runner:latest
68+
steps:
69+
- uses: actions/checkout@v4
70+
- name: Build libffi
71+
uses: docker/build-push-action@v5
72+
with:
73+
load: true
74+
tags: libffi:latest
75+
file: Dockerfile.libffi
76+
build-args: |
77+
GCC_VERSION=${{ inputs.gccVersion }}
78+
- name: Extract libffi Artifact
79+
uses: shrink/actions-docker-extract@v3
80+
with:
81+
image: libffi:latest
82+
path: /root/build/libffi.tar.gz
83+
destination: dist
84+
- name: Upload Artifact
85+
uses: actions/upload-artifact@v4
86+
with:
87+
name: libffi
88+
path: dist/libffi.tar.gz
89+
5990
rustc:
6091
runs-on: self-hosted
6192
container:
@@ -88,6 +119,7 @@ jobs:
88119
builder:
89120
needs:
90121
- libgcc
122+
- libffi
91123
- rustc
92124
runs-on: self-hosted
93125
container:

.github/workflows/electron.yaml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
name: Build Electron
22

3+
env:
4+
ROOT_PATH: /home/builduser/buildroot
5+
SRC_PATH: /home/builduser/buildroot/src
6+
OUT_PATH: /home/builduser/buildroot/src/out/Release
7+
38
on:
49
workflow_dispatch:
510
inputs:
@@ -27,9 +32,9 @@ jobs:
2732
run: |
2833
set -ex
2934
export REPO_PATH=`pwd`
30-
cd /home/builduser/buildroot
35+
cd "$ROOT_PATH"
3136
if [ ! -d "src/electron" ]; then
32-
npx e init -i release -r /home/builduser/buildroot electron-loong64
37+
npx e init -i release -r "$ROOT_PATH" electron-loong64
3338
git clone https://github.com/electron/electron.git src/electron
3439
fi
3540
git -C src clean -fd || true
@@ -65,9 +70,10 @@ jobs:
6570
- name: Build Electron
6671
run: |
6772
set -ex
68-
cd /home/builduser/buildroot/src
69-
gn gen out/Release --args="import(\"//electron/build/args/release.gn\")" --script-executable=/usr/bin/python3
70-
ninja -C out/Release/ electron
73+
cd "$SRC_PATH"
74+
rm -f "$OUT_PATH"/electron
75+
gn gen "$OUT_PATH" --args="import(\"//electron/build/args/release.gn\")" --script-executable=/usr/bin/python3
76+
ninja -C "$OUT_PATH" electron
7177
env:
7278
CC: clang
7379
CXX: clang++
@@ -77,12 +83,13 @@ jobs:
7783
- name: Package Electron
7884
run: |
7985
set -ex
80-
cd /home/builduser/buildroot/src
81-
ninja -C out/Release/ electron:electron_dist_zip
86+
cd "$SRC_PATH"
87+
electron/script/strip-binaries.py -d "$OUT_PATH"
88+
ninja -C "$OUT_PATH" electron:electron_dist_zip
8289
- name: Upload Artifact
8390
uses: svenstaro/upload-release-action@v2
8491
with:
85-
file: /home/builduser/buildroot/src/out/Release/dist.zip
92+
file: ${{ env.OUT_PATH }}/dist.zip
8693
asset_name: electron-v${{ inputs.electronVersion }}-linux-loong64.zip
8794
release_name: Electron v${{ inputs.electronVersion }} port for LoongArch64
8895
overwrite: true

Dockerfile.builder

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,15 @@ RUN curl -L -O https://unofficial-builds.nodejs.org/download/release/v${NODE_VER
185185
rm -rf node-v${NODE_VERSION}-linux-loong64* && \
186186
npm i -g yarn @esbuild/linux-loong64@0.14.54
187187

188-
COPY libgcc.tar.gz rustc.tar.gz .
188+
COPY libgcc.tar.gz libffi.tar.gz rustc.tar.gz .
189189
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
190190
RUN mkdir libgcc && \
191191
tar -xzvf libgcc.tar.gz -C libgcc && \
192192
# Replacing the crtbeginS.o is hacky, we might need to build the whole gcc instead
193193
cp libgcc/gcc/loongarch64-unknown-linux-gnu/*/crtbeginS.o /usr/lib/gcc/loongarch64-linux-gnu/*/ && \
194+
tar -xzvf libffi.tar.gz -C libffi && \
195+
# Also hacky here
196+
cp libffi/libffi_convenience.a /usr/lib/loongarch64-linux-gnu/libffi_pic.a && \
194197
tar -xzvf rustc.tar.gz -C /usr && \
195198
# Chromium seems to require that bindgen binary lives together with llvm
196199
cargo install bindgen-cli@0.69.1 --root /usr/lib/llvm-19

Dockerfile.libffi

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM ghcr.io/darkyzhou/loong64-debian:latest
2+
3+
ARG LIBFFI_VERSION="3.4.6"
4+
5+
ENV DEBIAN_FRONTEND=noninteractive
6+
RUN apt-get update && \
7+
apt-get install -y --no-install-recommends \
8+
ca-certificates \
9+
curl \
10+
build-essential \
11+
binutils \
12+
autoconf \
13+
automake \
14+
libtool \
15+
pkg-config
16+
17+
WORKDIR /root
18+
RUN curl -LO https://github.com/libffi/libffi/releases/download/v${LIBFFI_VERSION}/libffi-${LIBFFI_VERSION}.tar.gz && \
19+
tar xf libffi-${LIBFFI_VERSION}.tar.gz
20+
21+
WORKDIR /root/build
22+
RUN /root/libffi-${LIBFFI_VERSION}/configure \
23+
CFLAGS="-mcmodel=medium" \
24+
--prefix=/root/build/out \
25+
--enable-pax_emutramp \
26+
--enable-static \
27+
--disable-docs && \
28+
make libffi_convenience.la && \
29+
tar czf libffi.tar.gz --directory=.libs .

0 commit comments

Comments
 (0)