Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 70 additions & 4 deletions .github/workflows/release-libpdfium.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
default: false

permissions:
contents: read
contents: write

jobs:
source-tests:
Expand Down Expand Up @@ -57,15 +57,27 @@ jobs:
fail-fast: false
matrix:
include:
# Linux & Wasm
- { target: linux-x64, runner: ubuntu-24.04 }
- { target: linux-arm64, runner: ubuntu-24.04 }
- { target: linuxmusl-x64, runner: ubuntu-24.04 }
- { target: linuxmusl-arm64, runner: ubuntu-24.04 }
- { target: wasm32, runner: ubuntu-24.04 }
# Darwin (macOS)
- { target: darwin-arm64, runner: macos-15 }
- { target: darwin-x64, runner: macos-15 }
# Windows
- { target: win32-x64, runner: windows-2022 }
- { target: win32-arm64, runner: windows-2022 }
# Android
- { target: arm64-v8a, runner: ubuntu-24.04 }
- { target: armeabi-v7a, runner: ubuntu-24.04 }
- { target: x86, runner: ubuntu-24.04 }
- { target: x86_64, runner: ubuntu-24.04 }
# iOS
- { target: ios-arm64, runner: macos-15 }
- { target: ios-simulator-arm64, runner: macos-15 }
- { target: ios-simulator-x64, runner: macos-15 }
env:
DEPOT_TOOLS_WIN_TOOLCHAIN: 0
EMSDK_VERSION: 3.1.72
Expand Down Expand Up @@ -132,7 +144,7 @@ jobs:
- name: Select Xcode
if: runner.os == 'macOS'
shell: bash
run: sudo xcode-select -s "/Applications/Xcode_26.0.app"
run: sudo xcode-select -s "/Applications/Xcode_16.1.app"
- name: Install Windows deps
if: runner.os == 'Windows'
shell: pwsh
Expand Down Expand Up @@ -161,18 +173,72 @@ jobs:
name: libembedpdf-pdf-runtime-${{ matrix.target }}
path: out/embedpdf-runtime-artifacts/*.tar.gz

ios-universal:
name: Build ios-arm64_x86_64-simulator
needs: build
runs-on: macos-15
steps:
- uses: actions/checkout@v6
with:
ref: ${{ inputs.ref || github.ref_name }}
- uses: actions/download-artifact@v6
with:
name: libembedpdf-pdf-runtime-ios-simulator-arm64
path: artifacts/ios-simulator-arm64
- uses: actions/download-artifact@v6
with:
name: libembedpdf-pdf-runtime-ios-simulator-x64
path: artifacts/ios-simulator-x64
- name: Combine iOS simulator libraries
shell: bash
run: |
mkdir -p out/ios-universal/lib

# Unpack
mkdir -p staging/arm64 staging/x64
tar -xzf artifacts/ios-simulator-arm64/*.tar.gz -C staging/arm64
tar -xzf artifacts/ios-simulator-x64/*.tar.gz -C staging/x64

# Combine with lipo
lipo -create staging/arm64/lib/libpdfium.a staging/x64/lib/libpdfium.a -output out/ios-universal/lib/libpdfium.a

# Copy headers and other files from one of them
mkdir -p out/ios-universal/include out/ios-universal/LICENSES
cp -R staging/arm64/include/. out/ios-universal/include/
cp -R staging/arm64/LICENSES/. out/ios-universal/LICENSES/
cp staging/arm64/args.gn out/ios-universal/args.gn

# Write metadata
cat > out/ios-universal/BUILD-METADATA.json <<EOF
{
"name": "embedpdf-pdf-runtime",
"target": "ios-arm64_x86_64-simulator",
"sha": "$(git rev-parse HEAD)",
"createdAt": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
}
EOF

# Package
mkdir -p out/embedpdf-runtime-artifacts
short_sha=$(git rev-parse --short HEAD)
tar -czf "out/embedpdf-runtime-artifacts/libembedpdf-pdf-runtime-ios-arm64_x86_64-simulator-$short_sha.tar.gz" -C out/ios-universal .
- uses: actions/upload-artifact@v6
with:
name: libembedpdf-pdf-runtime-ios-arm64_x86_64-simulator
path: out/embedpdf-runtime-artifacts/*.tar.gz

release:
name: Publish release
runs-on: ubuntu-24.04
needs: build
needs: [build, ios-universal]
if: github.event_name == 'workflow_dispatch' && inputs.release == true
permissions:
contents: write
steps:
- uses: actions/checkout@v6
with:
ref: ${{ inputs.ref || github.ref_name }}
- uses: actions/download-artifact@v7
- uses: actions/download-artifact@v6
with:
path: artifacts
- name: Flatten artifacts
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,5 @@
*.vcxproj
*.xcodeproj
*~
.idea

175 changes: 92 additions & 83 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -300,53 +300,55 @@ group("pdfium_unittest_deps") {
]
}

test("pdfium_unittests") {
testonly = true
sources = [ "testing/unit_test_main.cpp" ]
deps = [
"core/fdrm:unittests",
"core/fpdfapi/edit:unittests",
"core/fpdfapi/font:unittests",
"core/fpdfapi/page:unittests",
"core/fpdfapi/parser:unittests",
"core/fpdfapi/render:unittests",
"core/fpdfdoc:unittests",
"core/fpdftext:unittests",
"core/fxcodec:unittests",
"core/fxcrt",
"core/fxcrt:unittests",
"core/fxge:unittests",
"fpdfsdk:unittests",
"testing:unit_test_support",
"testing/image_diff:unittests",
"//testing/gmock",
"//testing/gtest",
]
configs += [ ":pdfium_core_config" ]
if (is_android) {
use_raw_android_executable = true
}
if (pdf_enable_v8) {
configs += [ "//v8:external_startup_data" ]
deps += [
"fxjs:unittests",
"//v8",
if (!is_ios) {
test("pdfium_unittests") {
testonly = true
sources = [ "testing/unit_test_main.cpp" ]
deps = [
"core/fdrm:unittests",
"core/fpdfapi/edit:unittests",
"core/fpdfapi/font:unittests",
"core/fpdfapi/page:unittests",
"core/fpdfapi/parser:unittests",
"core/fpdfapi/render:unittests",
"core/fpdfdoc:unittests",
"core/fpdftext:unittests",
"core/fxcodec:unittests",
"core/fxcrt",
"core/fxcrt:unittests",
"core/fxge:unittests",
"fpdfsdk:unittests",
"testing:unit_test_support",
"testing/image_diff:unittests",
"//testing/gmock",
"//testing/gtest",
]
if (pdf_enable_xfa) {
configs += [ ":pdfium_core_config" ]
if (is_android) {
use_raw_android_executable = true
}
if (pdf_enable_v8) {
configs += [ "//v8:external_startup_data" ]
deps += [
"core/fxcrt/css:unittests",
"fxbarcode:unittests",
"xfa/fde:unittests",
"xfa/fgas/crt:unittests",
"xfa/fgas/font:unittests",
"xfa/fgas/layout:unittests",
"xfa/fxfa:unittests",
"xfa/fxfa/formcalc:unittests",
"xfa/fxfa/parser:unittests",
"fxjs:unittests",
"//v8",
]
if (pdf_enable_xfa) {
deps += [
"core/fxcrt/css:unittests",
"fxbarcode:unittests",
"xfa/fde:unittests",
"xfa/fgas/crt:unittests",
"xfa/fgas/font:unittests",
"xfa/fgas/layout:unittests",
"xfa/fxfa:unittests",
"xfa/fxfa/formcalc:unittests",
"xfa/fxfa/parser:unittests",
]
}
}
}
}
} # !is_ios

group("pdfium_embeddertest_deps") {
testonly = true
Expand All @@ -365,49 +367,51 @@ group("pdfium_embeddertest_deps") {
]
}

test("pdfium_embeddertests") {
testonly = true
sources = [ "testing/embedder_test_main.cpp" ]
deps = [
":pdfium_embeddertest_deps",
"core/fpdfapi/edit:embeddertests",
"core/fpdfapi/parser:embeddertests",
"core/fpdfapi/render:embeddertests",
"core/fxcodec:embeddertests",
"core/fxcrt",
"core/fxge:embeddertests",
"fpdfsdk:embeddertests",
"fpdfsdk/formfiller:embeddertests",
"fpdfsdk/pwl:embeddertests",
"testing/image_diff",
"//testing/gmock",
"//testing/gtest",
]
include_dirs = [ "testing/gmock/include" ]
configs += [ ":pdfium_core_config" ]
if (!is_ios) {
test("pdfium_embeddertests") {
testonly = true
sources = [ "testing/embedder_test_main.cpp" ]
deps = [
":pdfium_embeddertest_deps",
"core/fpdfapi/edit:embeddertests",
"core/fpdfapi/parser:embeddertests",
"core/fpdfapi/render:embeddertests",
"core/fxcodec:embeddertests",
"core/fxcrt",
"core/fxge:embeddertests",
"fpdfsdk:embeddertests",
"fpdfsdk/formfiller:embeddertests",
"fpdfsdk/pwl:embeddertests",
"testing/image_diff",
"//testing/gmock",
"//testing/gtest",
]
include_dirs = [ "testing/gmock/include" ]
configs += [ ":pdfium_core_config" ]

if (is_android) {
ignore_all_data_deps = true
use_raw_android_executable = true
}
if (is_android) {
ignore_all_data_deps = true
use_raw_android_executable = true
}

if (pdf_enable_v8) {
deps += [
"fxjs:embeddertests",
"//v8",
]
configs += [ "//v8:external_startup_data" ]
}
if (pdf_enable_v8) {
deps += [
"fxjs:embeddertests",
"//v8",
]
configs += [ "//v8:external_startup_data" ]
}

if (pdf_enable_xfa) {
deps += [
"fpdfsdk/fpdfxfa:embeddertests",
"xfa/fwl:embeddertests",
"xfa/fxfa/layout:embeddertests",
"xfa/fxfa/parser:embeddertests",
]
if (pdf_enable_xfa) {
deps += [
"fpdfsdk/fpdfxfa:embeddertests",
"xfa/fwl:embeddertests",
"xfa/fxfa/layout:embeddertests",
"xfa/fxfa/parser:embeddertests",
]
}
}
}
} # !is_ios

executable("pdfium_diff") {
visibility += [ "testing/tools:test_runner_py" ]
Expand All @@ -427,12 +431,17 @@ group("pdfium_all") {
testonly = true
deps = [
":pdfium_diff",
":pdfium_embeddertests",
":pdfium_unittests",
"testing:pdfium_test",
"testing/fuzzers",
]

if (!is_ios) {
deps += [
":pdfium_embeddertests",
":pdfium_unittests",
]
}

if (pdf_is_standalone) {
deps += [ "testing/tools:test_runner_py" ]
}
Expand Down
5 changes: 3 additions & 2 deletions build_overrides/build.gni
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ if (use_system_xcode == "") {
[ target_os ],
"value")
use_system_xcode = _result == 0
}
if (target_os == "ios") {
} else if (target_os == "ios") {
use_system_xcode = true
} else {
use_system_xcode = true
}
}
2 changes: 1 addition & 1 deletion core/fxge/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ source_set("fxge") {
sources += [ "linux/fx_linux_impl.cpp" ]
}

if (is_mac) {
if (is_mac || is_ios) {
sources += [
"apple/fx_apple_impl.cpp",
"apple/fx_apple_platform.cpp",
Expand Down
35 changes: 35 additions & 0 deletions patches/embedpdf-runtime/android/build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
diff --git a/config/BUILDCONFIG.gn b/config/BUILDCONFIG.gn
index b5dca4a..279e0ab 100644
--- a/config/BUILDCONFIG.gn
+++ b/config/BUILDCONFIG.gn
@@ -241,7 +241,7 @@ _default_toolchain = ""

if (target_os == "android") {
# Targeting android on Mac is best-effort and not guaranteed to work.
- assert(host_os == "linux", "Android builds are only supported on Linux.")
+ assert(host_os == "linux" || host_os == "mac", "Android builds are only supported on Linux or Mac.")
_default_toolchain = "//build/toolchain/android:android_clang_$target_cpu"
} else if (target_os == "chromeos" || target_os == "linux") {
# See comments in build/toolchain/cros/BUILD.gn about board compiles.
diff --git a/config/android/config.gni b/config/android/config.gni
index cc12ce7..392e125 100644
--- a/config/android/config.gni
+++ b/config/android/config.gni
@@ -69,7 +69,7 @@ if (is_android) {

# The default to use for android:minSdkVersion for targets that do
# not explicitly set it.
- default_min_sdk_version = 29
+ default_min_sdk_version = 21
if (is_cronet_build) {
# Cronet's min sdk version support policy is different from the rest of
# Chromium; Cronet explicitly supports older devices.
@@ -131,7 +131,7 @@ if (is_android) {
}

# Our build system no longer supports legacy multidex.
- min_supported_sdk_version = 23
+ min_supported_sdk_version = 21

# ASAN requires O MR1.
# https://github.com/google/sanitizers/wiki/AddressSanitizerOnAndroid/01f8df1ac1a447a8475cdfcb03e8b13140042dbd#running-with-wrapsh-recommended
Loading