Skip to content

Commit 230b2ed

Browse files
committed
Add support for mips64el
Credit goes to @mara0004 See #93
1 parent d86dd12 commit 230b2ed

10 files changed

Lines changed: 65 additions & 3 deletions

File tree

.github/workflows/build-all.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,17 @@ jobs:
316316
target_cpu: arm64
317317
enable_v8: true
318318

319+
linux_mips64el:
320+
name: Linux mips64el
321+
uses: ./.github/workflows/build.yml
322+
with:
323+
branch: ${{ github.event.inputs.branch }}
324+
version: ${{ github.event.inputs.version }}
325+
is_debug: ${{ github.event.inputs.is_debug == 'true' }}
326+
target_os: linux
327+
target_cpu: mips64el
328+
enable_v8: false
329+
319330
linux_ppc64:
320331
name: Linux ppc64
321332
uses: ./.github/workflows/build.yml
@@ -749,6 +760,7 @@ jobs:
749760
- linux_musl_arm64
750761
- linux_musl_x64
751762
- linux_musl_x86
763+
- linux_mips64el
752764
- linux_ppc64
753765
- linux_x64
754766
- linux_x64_v8

.github/workflows/build-one.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ on:
2727
options:
2828
- arm
2929
- arm64
30+
- mips64el
3031
- ppc64
3132
- x64
3233
- x86

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ on:
2828
type: string
2929
required: true
3030
target_cpu:
31-
description: Target (CPU arm|arm64|ppc64|x64|x86|wasm)
31+
description: Target (CPU arm|arm64|mips64el|ppc64|x64|x86|wasm)
3232
type: string
3333
required: true
3434
target_environment:

.github/workflows/patch.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ jobs:
5959
environment: musl
6060
- os: linux
6161
cpu: ppc64
62+
- os: linux
63+
cpu: mips64el
6264
- os: emscripten
6365
cpu: wasm
6466
steps:

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ Here are the download links for latest release:
9797
<td><a href="https://github.com/bblanchon/pdfium-binaries/releases/latest/download/pdfium-linux-arm64.tgz">pdfium-linux-arm64.tgz</a></td>
9898
<td><a href="https://github.com/bblanchon/pdfium-binaries/releases/latest/download/pdfium-v8-linux-arm64.tgz">pdfium-v8-linux-arm64.tgz</a></td>
9999
</tr>
100+
<tr>
101+
<td>mips64el</td>
102+
<td><a href="https://github.com/bblanchon/pdfium-binaries/releases/latest/download/pdfium-linux-mips64el.tgz">pdfium-linux-mips64el.tgz</a></td>
103+
<td>not tested yet</td>
104+
</tr>
100105
<tr>
101106
<td>ppc64</td>
102107
<td><a href="https://github.com/bblanchon/pdfium-binaries/releases/latest/download/pdfium-linux-ppc64.tgz">pdfium-linux-ppc64.tgz</a></td>
@@ -311,7 +316,7 @@ The following projects use (or recommend using) our PDFium builds:
311316
<tr>
312317
<td><img src="https://github.com/mara004.png" width="48" height="48" alt="mara004"></td>
313318
<td><a href="https://github.com/mara004"><code>@mara004</code></a></td>
314-
<td>Conda packages. ppc64 build. Constant aid.</td>
319+
<td>Conda packages. ppc and mips builds. Constant aid.</td>
315320
</tr>
316321
<tr>
317322
<td><img src="https://github.com/mgiessing.png" width="48" height="48" alt="Marvin Gießing"></td>

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash -eu
22

33
OS_NAMES="android|emscripten|ios|linux|mac|win"
4-
CPU_NAMES="arm|arm64|ppc64|x64|x86|wasm"
4+
CPU_NAMES="arm|arm64|mips64el|ppc64|x64|x86|wasm"
55
ENV_NAMES="catalyst|device|musl|simulator"
66
OS_ENV_COMBINATIONS="linux musl|ios (catalyst|device|simulator)"
77
STEP_REGEX="[0-9]|10"

patches/mips64el/build.patch

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
diff --git a/config/compiler/BUILD.gn b/config/compiler/BUILD.gn
2+
index e1da114..70a4b9e 100644
3+
--- a/config/compiler/BUILD.gn
4+
+++ b/config/compiler/BUILD.gn
5+
@@ -655,14 +655,6 @@ config("compiler") {
6+
} else {
7+
cflags += [ "-ffp-contract=off" ]
8+
}
9+
-
10+
- # Enable ELF CREL (see crbug.com/357878242) for all platforms that use ELF.
11+
- # TODO(crbug.com/376278218): This causes segfault on Linux ARM builds.
12+
- # It also causes segfault on Linux s390x:
13+
- # https://github.com/llvm/llvm-project/issues/149511
14+
- if (is_linux && use_lld && current_cpu != "arm" && current_cpu != "s390x") {
15+
- cflags += [ "-Wa,--crel,--allow-experimental-crel" ]
16+
- }
17+
}
18+
19+
# C11/C++11 compiler flags setup.
20+
@@ -1085,7 +1077,7 @@ config("linker") {
21+
22+
if (is_linux || is_chromeos || is_android || is_fuchsia) {
23+
ldflags += [
24+
- "-Wl,-z,noexecstack",
25+
+ "-Wl,-z,execstack",
26+
"-Wl,-z,relro",
27+
]
28+

steps/01-install.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ case "$TARGET_OS" in
8181
sudo apt-get install -y libc6-i386 gcc-10-multilib g++-10-aarch64-linux-gnu gcc-10-aarch64-linux-gnu
8282
;;
8383

84+
mips64el)
85+
sudo apt-get install -y gcc-11-multilib g++-11-mips64el-linux-gnuabi64 gcc-11-mips64el-linux-gnuabi64
86+
sudo update-alternatives --install /usr/bin/mips64el-linux-gnuabi64-gcc mips64el-linux-gnuabi64-gcc /usr/bin/mips64el-linux-gnuabi64-gcc-11 100
87+
sudo update-alternatives --install /usr/bin/mips64el-linux-gnuabi64-g++ mips64el-linux-gnuabi64-g++ /usr/bin/mips64el-linux-gnuabi64-g++-11 100
88+
sudo update-alternatives --set mips64el-linux-gnuabi64-gcc /usr/bin/mips64el-linux-gnuabi64-gcc-11
89+
sudo update-alternatives --set mips64el-linux-gnuabi64-g++ /usr/bin/mips64el-linux-gnuabi64-g++-11
90+
;;
91+
8492
ppc64)
8593
sudo apt-get install -y gcc-11-multilib g++-11-powerpc64le-linux-gnu gcc-11-powerpc64le-linux-gnu
8694
sudo update-alternatives --install /usr/bin/powerpc64le-linux-gnu-gcc powerpc64le-linux-gnu-gcc /usr/bin/powerpc64le-linux-gnu-gcc-11 100

steps/03-patch.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ case "$TARGET_ENVIRONMENT" in
7979
esac
8080

8181
case "$TARGET_CPU" in
82+
mips64el)
83+
apply_patch "$PATCHES/mips64el/build.patch" build
84+
;;
8285
ppc64)
8386
apply_patch "$PATCHES/ppc64/pdfium.patch"
8487
apply_patch "$PATCHES/ppc64/build.patch" build

steps/09-test.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ case "$OS" in
8686
SUFFIX="-10"
8787
fi
8888
;;
89+
mips64el)
90+
PREFIX="mips64el-linux-gnuabi64-"
91+
;;
8992
ppc64)
9093
PREFIX="powerpc64le-linux-gnu-"
9194
;;

0 commit comments

Comments
 (0)