Skip to content

Commit a372c14

Browse files
committed
Update runtime build
1 parent 27cd0dc commit a372c14

4 files changed

Lines changed: 67 additions & 7 deletions

File tree

.github/workflows/release-libpdfium.yml

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,61 @@ jobs:
3030
- group: linux-x64-wasm
3131
runner: ubuntu-24.04
3232
targets: linux-x64 linuxmusl-x64 wasm32
33+
target_os: linux emscripten
3334
- group: linux-arm64
34-
runner: ubuntu-24.04-arm
35+
runner: ubuntu-24.04
3536
targets: linux-arm64 linuxmusl-arm64
37+
target_os: linux
3638
- group: darwin
3739
runner: macos-14
3840
targets: darwin-arm64 darwin-x64
41+
target_os: mac
3942
- group: win32
4043
runner: windows-2022
4144
targets: win32-x64 win32-arm64
45+
target_os: win
46+
env:
47+
DEPOT_TOOLS_WIN_TOOLCHAIN: 0
48+
EMSDK_VERSION: 3.1.72
49+
MUSL_URL: https://musl.cc
50+
PDF_RUNTIME_TARGET_OS_LIST: ${{ matrix.target_os }}
4251
steps:
4352
- uses: actions/checkout@v6
4453
with:
45-
ref: ${{ inputs.ref }}
54+
ref: ${{ inputs.ref || github.ref_name }}
4655
- name: Install depot_tools
4756
shell: bash
4857
run: |
4958
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git "$RUNNER_TEMP/depot_tools"
5059
echo "$RUNNER_TEMP/depot_tools" >> "$GITHUB_PATH"
5160
- name: Install Linux deps
5261
if: runner.os == 'Linux'
53-
run: sudo apt-get update && sudo apt-get install -y cmake g++ pkg-config
62+
shell: bash
63+
run: |
64+
sudo apt-get update
65+
sudo apt-get install -y cmake curl g++ pkg-config tar
66+
67+
if [[ " ${{ matrix.targets }} " == *" linux-arm64 "* ]]; then
68+
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
69+
fi
70+
71+
if [[ " ${{ matrix.targets }} " == *" linuxmusl-x64 "* ]]; then
72+
curl -L "$MUSL_URL/x86_64-linux-musl-cross.tgz" | tar xz
73+
echo "$PWD/x86_64-linux-musl-cross/bin" >> "$GITHUB_PATH"
74+
fi
75+
76+
if [[ " ${{ matrix.targets }} " == *" linuxmusl-arm64 "* ]]; then
77+
curl -L "$MUSL_URL/aarch64-linux-musl-cross.tgz" | tar xz
78+
echo "$PWD/aarch64-linux-musl-cross/bin" >> "$GITHUB_PATH"
79+
fi
80+
81+
if [[ " ${{ matrix.targets }} " == *" wasm32 "* ]]; then
82+
git clone https://github.com/emscripten-core/emsdk.git "$RUNNER_TEMP/emsdk"
83+
"$RUNNER_TEMP/emsdk/emsdk" install "$EMSDK_VERSION"
84+
"$RUNNER_TEMP/emsdk/emsdk" activate "$EMSDK_VERSION"
85+
echo "$RUNNER_TEMP/emsdk/upstream/emscripten" >> "$GITHUB_PATH"
86+
echo "$RUNNER_TEMP/emsdk/upstream/bin" >> "$GITHUB_PATH"
87+
fi
5488
- name: Build and package targets
5589
shell: bash
5690
run: |
@@ -71,7 +105,7 @@ jobs:
71105
steps:
72106
- uses: actions/checkout@v6
73107
with:
74-
ref: ${{ inputs.ref }}
108+
ref: ${{ inputs.ref || github.ref_name }}
75109
- uses: actions/download-artifact@v7
76110
with:
77111
path: artifacts

scripts/embedpdf-runtime/build-target.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ case "$TARGET" in
5454
;;
5555
esac
5656

57-
"$SOURCE_DIR/scripts/embedpdf-runtime/ensure-deps.sh"
57+
PDF_RUNTIME_TARGET_OS_LIST="${PDF_RUNTIME_TARGET_OS_LIST:-$GN_TARGET_OS}" \
58+
"$SOURCE_DIR/scripts/embedpdf-runtime/ensure-deps.sh"
5859

5960
"$SOURCE_DIR/scripts/embedpdf-runtime/apply-patches.sh" "$TARGET"
6061

scripts/embedpdf-runtime/ensure-deps.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ SOURCE_DIR="${PDF_RUNTIME_SOURCE_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../..
55
FORK_URL="${PDF_RUNTIME_FORK_URL:-https://github.com/embedpdf/pdfium.git}"
66
REF="${PDF_RUNTIME_REF:-HEAD}"
77
SYNC_MODE="${PDF_RUNTIME_SYNC:-auto}"
8+
TARGET_OS_LIST="${PDF_RUNTIME_TARGET_OS_LIST:-}"
89
STAMP_DIR="$SOURCE_DIR/.embedpdf-runtime"
910
STAMP_FILE="$STAMP_DIR/deps-sync.stamp"
1011

@@ -32,6 +33,7 @@ write_stamp() {
3233
cat > "$STAMP_FILE" <<EOF
3334
fork_url=$FORK_URL
3435
ref=$REF
36+
target_os_list=$TARGET_OS_LIST
3537
deps_sha=$(deps_sha)
3638
EOF
3739
}
@@ -40,6 +42,7 @@ stamp_matches() {
4042
[[ -f "$STAMP_FILE" ]] || return 1
4143
grep -Fxq "fork_url=$FORK_URL" "$STAMP_FILE" &&
4244
grep -Fxq "ref=$REF" "$STAMP_FILE" &&
45+
grep -Fxq "target_os_list=$TARGET_OS_LIST" "$STAMP_FILE" &&
4346
grep -Fxq "deps_sha=$(deps_sha)" "$STAMP_FILE"
4447
}
4548

scripts/embedpdf-runtime/sync-deps.sh

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,41 @@ WORKSPACE_DIR="$(cd "$SOURCE_DIR/.." && pwd)"
66
SOLUTION_NAME="$(basename "$SOURCE_DIR")"
77
FORK_URL="${PDF_RUNTIME_FORK_URL:-https://github.com/embedpdf/pdfium.git}"
88
REF="${PDF_RUNTIME_REF:-HEAD}"
9+
TARGET_OS_LIST="${PDF_RUNTIME_TARGET_OS_LIST:-}"
10+
11+
write_target_os() {
12+
local first=true
13+
14+
printf 'target_os = ['
15+
for target_os in $TARGET_OS_LIST; do
16+
if [[ "$first" == true ]]; then
17+
first=false
18+
else
19+
printf ','
20+
fi
21+
printf ' "%s"' "$target_os"
22+
done
23+
printf ' ]\n'
24+
}
925

1026
cat > "$WORKSPACE_DIR/.gclient" <<EOF
1127
solutions = [
1228
{ "name": "$SOLUTION_NAME",
1329
"url": "$FORK_URL",
1430
"deps_file": "DEPS",
1531
"managed": False,
16-
"custom_deps": {},
32+
"custom_vars": {
33+
"checkout_configuration": "small",
34+
},
1735
},
1836
]
1937
EOF
2038

39+
if [[ -n "$TARGET_OS_LIST" ]]; then
40+
write_target_os >> "$WORKSPACE_DIR/.gclient"
41+
fi
42+
2143
(
2244
cd "$SOURCE_DIR"
23-
gclient sync -r "$REF" --no-history --shallow --nohooks --deps=builder
45+
gclient sync -r "$REF" --no-history --shallow
2446
)

0 commit comments

Comments
 (0)