diff --git a/.github/workflows/build-all.yml b/.github/workflows/build-all.yml index 660ac71d..1909ee51 100644 --- a/.github/workflows/build-all.yml +++ b/.github/workflows/build-all.yml @@ -134,8 +134,8 @@ jobs: target_cpu: x86 enable_v8: true - ios_arm64: - name: iOS ARM64 + ios_catalyst_arm64: + name: iOS catalyst ARM64 uses: ./.github/workflows/build.yml with: branch: ${{ github.event.inputs.branch }} @@ -143,12 +143,13 @@ jobs: is_debug: ${{ github.event.inputs.is_debug == 'true' }} target_os: ios target_cpu: arm64 + target_environment: catalyst enable_v8: false - ios_arm64_v8: - name: iOS ARM64 V8 + ios_catalyst_arm64_v8: + name: iOS catalyst ARM64 V8 if: github.event.inputs.enable_v8 == 'true' - needs: ios_arm64 + needs: ios_catalyst_arm64 uses: ./.github/workflows/build.yml with: branch: ${{ github.event.inputs.branch }} @@ -156,10 +157,11 @@ jobs: is_debug: ${{ github.event.inputs.is_debug == 'true' }} target_os: ios target_cpu: arm64 + target_environment: catalyst enable_v8: true - ios_x64: - name: iOS x64 + ios_catalyst_x64: + name: iOS catalyst x64 uses: ./.github/workflows/build.yml with: branch: ${{ github.event.inputs.branch }} @@ -167,12 +169,13 @@ jobs: is_debug: ${{ github.event.inputs.is_debug == 'true' }} target_os: ios target_cpu: x64 + target_environment: catalyst enable_v8: false - ios_x64_v8: - name: iOS x64 V8 + ios_catalyst_x64_v8: + name: iOS catalyst x64 V8 if: github.event.inputs.enable_v8 == 'true' - needs: ios_x64 + needs: ios_catalyst_x64 uses: ./.github/workflows/build.yml with: branch: ${{ github.event.inputs.branch }} @@ -180,6 +183,85 @@ jobs: is_debug: ${{ github.event.inputs.is_debug == 'true' }} target_os: ios target_cpu: x64 + target_environment: catalyst + enable_v8: true + + ios_device_arm64: + name: iOS device ARM64 + uses: ./.github/workflows/build.yml + with: + branch: ${{ github.event.inputs.branch }} + version: ${{ github.event.inputs.version }} + is_debug: ${{ github.event.inputs.is_debug == 'true' }} + target_os: ios + target_cpu: arm64 + target_environment: device + enable_v8: false + + ios_device_arm64_v8: + name: iOS device ARM64 V8 + if: github.event.inputs.enable_v8 == 'true' + needs: ios_device_arm64 + uses: ./.github/workflows/build.yml + with: + branch: ${{ github.event.inputs.branch }} + version: ${{ github.event.inputs.version }} + is_debug: ${{ github.event.inputs.is_debug == 'true' }} + target_os: ios + target_cpu: arm64 + target_environment: device + enable_v8: true + + ios_simulator_arm64: + name: iOS simulator ARM64 + uses: ./.github/workflows/build.yml + with: + branch: ${{ github.event.inputs.branch }} + version: ${{ github.event.inputs.version }} + is_debug: ${{ github.event.inputs.is_debug == 'true' }} + target_os: ios + target_cpu: arm64 + target_environment: simulator + enable_v8: false + + ios_simulator_arm64_v8: + name: iOS simulator ARM64 V8 + if: github.event.inputs.enable_v8 == 'true' + needs: ios_simulator_arm64 + uses: ./.github/workflows/build.yml + with: + branch: ${{ github.event.inputs.branch }} + version: ${{ github.event.inputs.version }} + is_debug: ${{ github.event.inputs.is_debug == 'true' }} + target_os: ios + target_cpu: arm64 + target_environment: simulator + enable_v8: true + + ios_simulator_x64: + name: iOS simulator x64 + uses: ./.github/workflows/build.yml + with: + branch: ${{ github.event.inputs.branch }} + version: ${{ github.event.inputs.version }} + is_debug: ${{ github.event.inputs.is_debug == 'true' }} + target_os: ios + target_cpu: x64 + target_environment: simulator + enable_v8: false + + ios_simulator_x64_v8: + name: iOS simulator x64 V8 + if: github.event.inputs.enable_v8 == 'true' + needs: ios_simulator_x64 + uses: ./.github/workflows/build.yml + with: + branch: ${{ github.event.inputs.branch }} + version: ${{ github.event.inputs.version }} + is_debug: ${{ github.event.inputs.is_debug == 'true' }} + target_os: ios + target_cpu: x64 + target_environment: simulator enable_v8: true linux_arm: @@ -287,12 +369,13 @@ jobs: is_debug: ${{ github.event.inputs.is_debug == 'true' }} target_os: linux target_cpu: arm64 - target_libc: musl + target_environment: musl enable_v8: false linux_musl_arm64_v8: name: Linux musl ARM64 V8 if: github.event.inputs.enable_v8 == 'true' + needs: linux_musl_arm64 uses: ./.github/workflows/build.yml with: branch: ${{ github.event.inputs.branch }} @@ -300,7 +383,7 @@ jobs: is_debug: ${{ github.event.inputs.is_debug == 'true' }} target_os: linux target_cpu: arm64 - target_libc: musl + target_environment: musl enable_v8: true linux_musl_x64: @@ -312,7 +395,7 @@ jobs: is_debug: ${{ github.event.inputs.is_debug == 'true' }} target_os: linux target_cpu: x64 - target_libc: musl + target_environment: musl enable_v8: false linux_musl_x64_v8: @@ -326,7 +409,7 @@ jobs: is_debug: ${{ github.event.inputs.is_debug == 'true' }} target_os: linux target_cpu: x64 - target_libc: musl + target_environment: musl enable_v8: true linux_musl_x86: @@ -338,7 +421,7 @@ jobs: is_debug: ${{ github.event.inputs.is_debug == 'true' }} target_os: linux target_cpu: x86 - target_libc: musl + target_environment: musl enable_v8: false linux_musl_x86_v8: @@ -352,7 +435,7 @@ jobs: is_debug: ${{ github.event.inputs.is_debug == 'true' }} target_os: linux target_cpu: x86 - target_libc: musl + target_environment: musl enable_v8: true mac_arm64: @@ -518,10 +601,12 @@ jobs: - android_x64_v8 - android_x86 - android_x86_v8 - - ios_arm64 - - ios_arm64_v8 - - ios_x64 - - ios_x64_v8 + - ios_device_arm64 + - ios_device_arm64_v8 + - ios_simulator_arm64 + - ios_simulator_arm64_v8 + - ios_simulator_x64 + - ios_simulator_x64_v8 - linux_arm - linux_arm_v8 - linux_arm64 @@ -660,10 +745,10 @@ jobs: - android_x64_v8 - android_x86 - android_x86_v8 - - ios_arm64 - - ios_arm64_v8 - - ios_x64 - - ios_x64_v8 + - ios_device_arm64 + - ios_device_arm64_v8 + - ios_simulator_x64 + - ios_simulator_x64_v8 - linux_arm - linux_arm_v8 - linux_arm64 @@ -714,6 +799,8 @@ jobs: Commits between \`$PREVIOUS_REV\` and \`$CURRENT_REV\`: END git -C "pdfium" log origin/${PREVIOUS_REV}.. --pretty=format:'* [%s](https://pdfium.googlesource.com/pdfium/+/%H)' >> RELEASE.md + - name: Generate artifacts checksums + run: sha256sum pdfium-*.tgz > pdfium-sha256sum.txt - name: Publish Release uses: ncipollo/release-action@v1 with: @@ -722,4 +809,4 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} name: PDFium ${{ github.event.inputs.version }} tag: ${{ github.event.inputs.branch }} - artifacts: "pdfium-*.tgz" + artifacts: "pdfium-*.tgz,pdfium-sha256sum.txt" diff --git a/.github/workflows/build-one.yml b/.github/workflows/build-one.yml index 83dad895..d714ef8e 100644 --- a/.github/workflows/build-one.yml +++ b/.github/workflows/build-one.yml @@ -30,12 +30,16 @@ on: - x64 - x86 - wasm - target_libc: - description: Target libc + target_environment: + description: Target environment type: choice + default: '' options: - - default + - '' + - device + - catalyst - musl + - simulator enable_v8: description: Enable V8 type: boolean @@ -45,7 +49,7 @@ on: description: Emscripten SDK type: string required: false - default: 3.1.34 + default: 3.1.72 is_debug: description: Is debug type: boolean @@ -62,6 +66,6 @@ jobs: is_debug: ${{ github.event.inputs.is_debug == 'true' }} target_os: ${{ github.event.inputs.target_os }} target_cpu: ${{ github.event.inputs.target_cpu }} - target_libc: ${{ github.event.inputs.target_libc }} + target_environment: ${{ github.event.inputs.target_environment }} enable_v8: ${{ github.event.inputs.enable_v8 == 'true' }} emsdk_version: ${{ github.event.inputs.emsdk_version }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d3e64ce7..d3795eed 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,8 +31,8 @@ on: description: Target (CPU arm|arm64|x64|x86|wasm) type: string required: true - target_libc: - description: Target libc (empty string or "musl") + target_environment: + description: Target environment (device|catalyst|musl|simulator) type: string required: false default: '' @@ -40,7 +40,7 @@ on: description: Emscripten SDK type: string required: false - default: 3.1.34 + default: 3.1.72 outputs: artifact: description: "The name of the artifact" @@ -50,7 +50,7 @@ jobs: build: outputs: artifact: ${{ steps.init.outputs.artifact }} - runs-on: ${{ (inputs.target_os == 'ios' || inputs.target_os == 'mac') && 'macos-latest' || inputs.target_os == 'win' && 'windows-2022' || 'ubuntu-20.04' }} + runs-on: ${{ (inputs.target_os == 'ios' || inputs.target_os == 'mac') && 'macos-latest' || inputs.target_os == 'win' && 'windows-2022' || 'ubuntu-24.04' }} steps: - name: Initialize id: init @@ -59,18 +59,12 @@ jobs: ARTIFACT="pdfium" [ "${{inputs.enable_v8}}" == "true" ] && ARTIFACT="$ARTIFACT-v8" ARTIFACT="$ARTIFACT-${{inputs.target_os}}" - [ "${{inputs.target_libc}}" != "" ] && ARTIFACT="$ARTIFACT-${{inputs.target_libc}}" + [ "${{inputs.target_environment}}" != "" ] && ARTIFACT="$ARTIFACT-${{inputs.target_environment}}" [ "${{inputs.target_os}}" != "${{inputs.target_cpu}}" ] && ARTIFACT="$ARTIFACT-${{inputs.target_cpu}}" [ "${{inputs.is_debug}}" == "true" ] && ARTIFACT="$ARTIFACT-debug" echo "artifact=$ARTIFACT" >> $GITHUB_OUTPUT - name: Checkout this repo uses: actions/checkout@v4 - - name: Workaround for libpcre2 i386 # https://github.com/actions/virtual-environments/issues/4589#issuecomment-1100899313 - if: inputs.target_os == 'android' - run: | - sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list - sudo apt-get update -qq - sudo apt-get install -yqq --allow-downgrades libpcre2-8-0/focal libpcre2-16-0/focal libpcre2-32-0/focal libpcre2-posix2/focal - name: Set environment variables run: | cat >>$GITHUB_ENV < OS + Env CPU PDFium PDFium V8 - Android + Android arm pdfium-android-arm.tgz pdfium-v8-android-arm.tgz @@ -53,19 +54,40 @@ Here are the download links for latest release: - iOS + iOS + catalyst arm64 - pdfium-ios-arm64.tgz - pdfium-v8-ios-arm64.tgz + pdfium-ios-catalyst-arm64.tgz + pdfium-v8-ios-catalyst-arm64.tgz x64 - pdfium-ios-x64.tgz - pdfium-v8-ios-x64.tgz + pdfium-ios-catalyst-x64.tgz + pdfium-v8-ios-catalyst-x64.tgz - Linux + device + arm64 + pdfium-ios-device-arm64.tgz + pdfium-v8-ios-device-arm64.tgz + + + + simulator + arm64 + pdfium-ios-simulator-arm64.tgz + pdfium-v8-ios-simulator-arm64.tgz + + + x64 + pdfium-ios-simulator-x64.tgz + pdfium-v8-ios-simulator-x64.tgz + + + + Linux + glibc arm pdfium-linux-arm.tgz pdfium-v8-linux-arm.tgz @@ -87,7 +109,7 @@ Here are the download links for latest release: - Linux
musl + musl arm64 pdfium-linux-musl-arm64.tgz pdfium-v8-linux-musl-arm64.tgz @@ -104,7 +126,7 @@ Here are the download links for latest release: - macOS + macOS arm64 pdfium-mac-arm64.tgz pdfium-v8-mac-arm64.tgz @@ -121,7 +143,7 @@ Here are the download links for latest release: - Windows + Windows arm64 pdfium-win-arm64.tgz pdfium-v8-win-arm64.tgz @@ -138,7 +160,7 @@ Here are the download links for latest release: - WebAssembly1 + WebAssembly1 pdfium-wasm.tgz not supported @@ -239,6 +261,7 @@ The following projects use (or recommend using) our PDFium builds: | [go-pdfium][go-pdfium] | Go | Go wrapper around PDFium with helper functions for various methods like image rendering and text extraction | | [libvips][libvips] | C | A performant image processing library | | [PDFium RS][pdfium_rs] | Rust | Rust wrapper around PDFium | +| [pdfium-vfp][pdfium-vfp] | VFP | PDF Viewer component for Visual FoxPro | | [PDFiumCore][pdfiumcore] | C# | .NET Standard P/Invoke bindings for PDFium | | [PdfiumLib][pdfiumlib] | Pascal | An interface to libpdfium for Delphi | | [PdfLibCore][pdflibcore] | C# | A fast PDF editing and reading library for modern .NET Core applications | @@ -305,6 +328,8 @@ The following projects use (or recommend using) our PDFium builds: https://github.com/bblanchon/pdfium-binaries This package contains pre-compiled binaries of the PDFium library, an open-source library for PDF manipulation and rendering. $releaseNotes$ - Copyright © Benoit Blanchon 2017-2023 + Copyright © Benoit Blanchon 2017-2024 PDFium PDF binaries library native Chromium icon.png @@ -54,4 +54,4 @@ - \ No newline at end of file + diff --git a/nuget/bblanchon.PDFium.Linux.nuspec b/nuget/bblanchon.PDFium.Linux.nuspec index d9944eb5..08a4fbd3 100644 --- a/nuget/bblanchon.PDFium.Linux.nuspec +++ b/nuget/bblanchon.PDFium.Linux.nuspec @@ -10,7 +10,7 @@ https://github.com/bblanchon/pdfium-binaries This package contains pre-compiled binaries of the PDFium library, an open-source library for PDF manipulation and rendering. $releaseNotes$ - Copyright © Benoit Blanchon 2017-2023 + Copyright © Benoit Blanchon 2017-2024 PDFium PDF binaries library native Chromium icon.png @@ -50,4 +50,4 @@ - \ No newline at end of file + diff --git a/nuget/bblanchon.PDFium.WebAssembly.nuspec b/nuget/bblanchon.PDFium.WebAssembly.nuspec index 0205ebc9..590ce0ff 100644 --- a/nuget/bblanchon.PDFium.WebAssembly.nuspec +++ b/nuget/bblanchon.PDFium.WebAssembly.nuspec @@ -10,7 +10,7 @@ https://github.com/bblanchon/pdfium-binaries This package contains pre-compiled binaries of the PDFium library, an open-source library for PDF manipulation and rendering. $releaseNotes$ - Copyright © Benoit Blanchon 2017-2023 + Copyright © Benoit Blanchon 2017-2024 PDFium PDF binaries library native Chromium wasm webassembly icon.png @@ -37,4 +37,4 @@ - \ No newline at end of file + diff --git a/nuget/bblanchon.PDFium.Win32.nuspec b/nuget/bblanchon.PDFium.Win32.nuspec index b11b4591..def697e3 100644 --- a/nuget/bblanchon.PDFium.Win32.nuspec +++ b/nuget/bblanchon.PDFium.Win32.nuspec @@ -10,7 +10,7 @@ https://github.com/bblanchon/pdfium-binaries This package contains pre-compiled binaries of the PDFium library, an open-source library for PDF manipulation and rendering. $releaseNotes$ - Copyright © Benoit Blanchon 2017-2023 + Copyright © Benoit Blanchon 2017-2024 PDFium PDF binaries library native Chromium icon.png @@ -53,4 +53,4 @@ - \ No newline at end of file + diff --git a/nuget/bblanchon.PDFium.iOS.nuspec b/nuget/bblanchon.PDFium.iOS.nuspec index bdd8f0a6..ff28d3d1 100644 --- a/nuget/bblanchon.PDFium.iOS.nuspec +++ b/nuget/bblanchon.PDFium.iOS.nuspec @@ -10,7 +10,7 @@ https://github.com/bblanchon/pdfium-binaries This package contains pre-compiled binaries of the PDFium library, an open-source library for PDF manipulation and rendering. $releaseNotes$ - Copyright © Benoit Blanchon 2017-2023 + Copyright © Benoit Blanchon 2017-2024 PDFium PDF binaries library native Chromium icon.png @@ -37,7 +37,8 @@ - - + + + - \ No newline at end of file + diff --git a/nuget/bblanchon.PDFium.macOS.nuspec b/nuget/bblanchon.PDFium.macOS.nuspec index 762fd30c..7f9eee2a 100644 --- a/nuget/bblanchon.PDFium.macOS.nuspec +++ b/nuget/bblanchon.PDFium.macOS.nuspec @@ -10,7 +10,7 @@ https://github.com/bblanchon/pdfium-binaries This package contains pre-compiled binaries of the PDFium library, an open-source library for PDF manipulation and rendering. $releaseNotes$ - Copyright © Benoit Blanchon 2017-2023 + Copyright © Benoit Blanchon 2017-2024 PDFium PDF binaries library native Chromium icon.png @@ -45,4 +45,4 @@ - \ No newline at end of file + diff --git a/nuget/bblanchon.PDFium.nuspec b/nuget/bblanchon.PDFium.nuspec index f2b30b4d..5bf6ed9c 100644 --- a/nuget/bblanchon.PDFium.nuspec +++ b/nuget/bblanchon.PDFium.nuspec @@ -10,7 +10,7 @@ https://github.com/bblanchon/pdfium-binaries This package contains pre-compiled binaries of the PDFium library, an open-source library for PDF manipulation and rendering. $releaseNotes$ - Copyright © Benoit Blanchon 2017-2023 + Copyright © Benoit Blanchon 2017-2024 PDFium PDF binaries library native Chromium icon.png @@ -33,4 +33,4 @@ - \ No newline at end of file + diff --git a/nuget/bblanchon.PDFiumV8.Android.nuspec b/nuget/bblanchon.PDFiumV8.Android.nuspec index 93dc0b4f..739ebb4a 100644 --- a/nuget/bblanchon.PDFiumV8.Android.nuspec +++ b/nuget/bblanchon.PDFiumV8.Android.nuspec @@ -10,7 +10,7 @@ https://github.com/bblanchon/pdfium-binaries This package contains pre-compiled binaries of the PDFium library, an open-source library for PDF manipulation and rendering. $releaseNotes$ - Copyright © Benoit Blanchon 2017-2023 + Copyright © Benoit Blanchon 2017-2024 PDFium PDF binaries library native Chromium icon.png @@ -54,4 +54,4 @@ - \ No newline at end of file + diff --git a/nuget/bblanchon.PDFiumV8.Linux.nuspec b/nuget/bblanchon.PDFiumV8.Linux.nuspec index c27ec769..d18f80aa 100644 --- a/nuget/bblanchon.PDFiumV8.Linux.nuspec +++ b/nuget/bblanchon.PDFiumV8.Linux.nuspec @@ -10,7 +10,7 @@ https://github.com/bblanchon/pdfium-binaries This package contains pre-compiled binaries of the PDFium library, an open-source library for PDF manipulation and rendering. $releaseNotes$ - Copyright © Benoit Blanchon 2017-2023 + Copyright © Benoit Blanchon 2017-2024 PDFium PDF binaries library native Chromium icon.png @@ -50,4 +50,4 @@ - \ No newline at end of file + diff --git a/nuget/bblanchon.PDFiumV8.Win32.nuspec b/nuget/bblanchon.PDFiumV8.Win32.nuspec index 71e230c9..2f806cb6 100644 --- a/nuget/bblanchon.PDFiumV8.Win32.nuspec +++ b/nuget/bblanchon.PDFiumV8.Win32.nuspec @@ -10,7 +10,7 @@ https://github.com/bblanchon/pdfium-binaries This package contains pre-compiled binaries of the PDFium library, an open-source library for PDF manipulation and rendering. $releaseNotes$ - Copyright © Benoit Blanchon 2017-2023 + Copyright © Benoit Blanchon 2017-2024 PDFium PDF binaries library native Chromium icon.png @@ -53,4 +53,4 @@ - \ No newline at end of file + diff --git a/nuget/bblanchon.PDFiumV8.iOS.nuspec b/nuget/bblanchon.PDFiumV8.iOS.nuspec index e6acd834..ae523f36 100644 --- a/nuget/bblanchon.PDFiumV8.iOS.nuspec +++ b/nuget/bblanchon.PDFiumV8.iOS.nuspec @@ -10,7 +10,7 @@ https://github.com/bblanchon/pdfium-binaries This package contains pre-compiled binaries of the PDFium library, an open-source library for PDF manipulation and rendering. $releaseNotes$ - Copyright © Benoit Blanchon 2017-2023 + Copyright © Benoit Blanchon 2017-2024 PDFium PDF binaries library native Chromium icon.png @@ -37,7 +37,8 @@ - - + + + - \ No newline at end of file + diff --git a/nuget/bblanchon.PDFiumV8.macOS.nuspec b/nuget/bblanchon.PDFiumV8.macOS.nuspec index 8268ec47..14a5846f 100644 --- a/nuget/bblanchon.PDFiumV8.macOS.nuspec +++ b/nuget/bblanchon.PDFiumV8.macOS.nuspec @@ -10,7 +10,7 @@ https://github.com/bblanchon/pdfium-binaries This package contains pre-compiled binaries of the PDFium library, an open-source library for PDF manipulation and rendering. $releaseNotes$ - Copyright © Benoit Blanchon 2017-2023 + Copyright © Benoit Blanchon 2017-2024 PDFium PDF binaries library native Chromium icon.png @@ -45,4 +45,4 @@ - \ No newline at end of file + diff --git a/nuget/bblanchon.PDFiumV8.nuspec b/nuget/bblanchon.PDFiumV8.nuspec index 4da69ab2..ccef0a74 100644 --- a/nuget/bblanchon.PDFiumV8.nuspec +++ b/nuget/bblanchon.PDFiumV8.nuspec @@ -10,7 +10,7 @@ https://github.com/bblanchon/pdfium-binaries This package contains pre-compiled binaries of the PDFium library, an open-source library for PDF manipulation and rendering. $releaseNotes$ - Copyright © Benoit Blanchon 2017-2023 + Copyright © Benoit Blanchon 2017-2024 PDFium PDF binaries library native Chromium icon.png @@ -32,4 +32,4 @@ - \ No newline at end of file + diff --git a/patches/ios/v8.patch b/patches/ios/v8.patch new file mode 100644 index 00000000..65f41ec3 --- /dev/null +++ b/patches/ios/v8.patch @@ -0,0 +1,14 @@ +diff --git a/BUILD.gn b/BUILD.gn +index d905b219a22..1610f1adae9 100644 +--- a/BUILD.gn ++++ b/BUILD.gn +@@ -4753,9 +4753,6 @@ v8_header_set("v8_internal_headers") { + } + + frameworks = [] +- if (is_ios) { +- frameworks += [ "BrowserEngineKit.framework" ] +- } + + public_deps = [ + ":torque_runtime_support", diff --git a/patches/linux/v8.patch b/patches/linux/v8.patch new file mode 100644 index 00000000..1c3cc9a9 --- /dev/null +++ b/patches/linux/v8.patch @@ -0,0 +1,12 @@ +diff --git a/BUILD.gn b/BUILD.gn +index 6a4efbb03ee..9c0a45df4a5 100644 +--- a/BUILD.gn ++++ b/BUILD.gn +@@ -1096,6 +1096,7 @@ config("features") { + + defines = + [ "V8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=${v8_typed_array_max_size_in_heap}" ] ++ defines += ["V8_TLS_USED_IN_LIBRARY"] + + configs = [ + ":v8_header_features", diff --git a/patches/musl/build.patch b/patches/musl/build.patch index b725dfd7..e149ce0f 100644 --- a/patches/musl/build.patch +++ b/patches/musl/build.patch @@ -1,5 +1,5 @@ diff --git a/config/BUILDCONFIG.gn b/config/BUILDCONFIG.gn -index 105e194..53dd476 100644 +index 8e0c3761f..0031b3c42 100644 --- a/config/BUILDCONFIG.gn +++ b/config/BUILDCONFIG.gn @@ -135,6 +135,9 @@ declare_args() { @@ -12,7 +12,7 @@ index 105e194..53dd476 100644 # Set to true when compiling with the Clang compiler. is_clang = current_os != "linux" || (current_cpu != "s390x" && current_cpu != "s390" && -@@ -237,7 +240,9 @@ if (target_os == "android") { +@@ -247,7 +250,9 @@ if (target_os == "android") { _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. @@ -24,15 +24,15 @@ index 105e194..53dd476 100644 } else { _default_toolchain = "//build/toolchain/linux:$target_cpu" diff --git a/config/compiler/BUILD.gn b/config/compiler/BUILD.gn -index 21683ac..fbf9764 100644 +index f58320b88..858fd54cc 100644 --- a/config/compiler/BUILD.gn +++ b/config/compiler/BUILD.gn -@@ -375,7 +375,7 @@ config("compiler") { - # TODO(phajdan.jr): Use -fstack-protector-strong when our gcc supports it. - # See also https://crbug.com/533294 - # The x86 toolchain currently has problems with stack-protector. -- if (is_android && current_cpu == "x86") { -+ if ((is_android || is_musl) && current_cpu == "x86") { - cflags += [ "-fno-stack-protector" ] - } else if (current_os != "aix") { +@@ -369,7 +369,7 @@ config("compiler") { + } + } else if (is_chromeos) { + cflags += [ "-fstack-protector-strong" ] +- } else if ((is_posix && !is_nacl) || is_fuchsia) { ++ } else if ((is_posix && !is_nacl && !is_musl) || is_fuchsia) { + if (current_os != "aix") { # Not available on aix. + cflags += [ "-fstack-protector" ] diff --git a/patches/v8/pdfium.patch b/patches/v8/pdfium.patch index 3a5bf917..952235f1 100644 --- a/patches/v8/pdfium.patch +++ b/patches/v8/pdfium.patch @@ -1,11 +1,11 @@ diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp -index fbe75d9b1..49222a43a 100644 +index 6b0a1c161..7a8788676 100644 --- a/fpdfsdk/fpdf_view.cpp +++ b/fpdfsdk/fpdf_view.cpp @@ -57,6 +57,9 @@ + #ifdef PDF_ENABLE_V8 #include "fxjs/cfx_v8_array_buffer_allocator.h" - #include "third_party/base/no_destructor.h" +#include "v8/include/libplatform/libplatform.h" +#include "v8/include/v8-array-buffer.h" +#include "v8/include/v8-initialization.h" @@ -47,7 +47,7 @@ index fbe75d9b1..49222a43a 100644 FX_InitializeMemoryAllocators(); CFX_Timer::InitializeGlobals(); CFX_GEModule::Create(config ? config->m_pUserFontPaths : nullptr); -@@ -238,14 +262,13 @@ FPDF_InitLibraryWithConfig(const FPDF_LIBRARY_CONFIG* config) { +@@ -242,14 +266,13 @@ FPDF_InitLibraryWithConfig(const FPDF_LIBRARY_CONFIG* config) { CPDFXFA_ModuleInit(); #endif // PDF_ENABLE_XFA @@ -68,9 +68,9 @@ index fbe75d9b1..49222a43a 100644 g_bLibraryInitialized = true; } -@@ -265,6 +288,19 @@ FPDF_EXPORT void FPDF_CALLCONV FPDF_DestroyLibrary() { - CFX_GEModule::Destroy(); +@@ -275,6 +298,19 @@ FPDF_EXPORT void FPDF_CALLCONV FPDF_DestroyLibrary() { CFX_Timer::DestroyGlobals(); + FX_DestroyMemoryAllocators(); +#ifdef PDF_ENABLE_XFA + cppgc::ShutdownProcess(); diff --git a/patches/wasm/build.patch b/patches/wasm/build.patch index 4f417960..581da016 100644 --- a/patches/wasm/build.patch +++ b/patches/wasm/build.patch @@ -1,8 +1,8 @@ diff --git a/config/BUILDCONFIG.gn b/config/BUILDCONFIG.gn -index 105e194..beea137 100644 +index 8e0c3761f..ab6a9afb1 100644 --- a/config/BUILDCONFIG.gn +++ b/config/BUILDCONFIG.gn -@@ -268,6 +268,8 @@ if (target_os == "android") { +@@ -278,6 +278,8 @@ if (target_os == "android") { _default_toolchain = "//build/toolchain/aix:$target_cpu" } else if (target_os == "zos") { _default_toolchain = "//build/toolchain/zos:$target_cpu" @@ -11,19 +11,19 @@ index 105e194..beea137 100644 } else { assert(false, "Unsupported target_os: $target_os") } -@@ -306,6 +308,7 @@ is_linux = current_os == "linux" - is_mac = current_os == "mac" +@@ -317,6 +319,7 @@ is_mac = current_os == "mac" is_nacl = current_os == "nacl" + is_watchos = current_os == "watchos" is_win = current_os == "win" || current_os == "winuwp" +is_wasm = current_os == "wasm" - is_apple = is_ios || is_mac + is_apple = is_ios || is_mac || is_watchos is_posix = !is_win && !is_fuchsia diff --git a/config/compiler/BUILD.gn b/config/compiler/BUILD.gn -index 21683ac..54810f0 100644 +index f58320b88..b3ca0efb0 100644 --- a/config/compiler/BUILD.gn +++ b/config/compiler/BUILD.gn -@@ -310,6 +310,8 @@ config("compiler") { +@@ -305,6 +305,8 @@ config("compiler") { configs += [ "//build/config/aix:compiler" ] } else if (current_os == "zos") { configs += [ "//build/config/zos:compiler" ] @@ -32,17 +32,17 @@ index 21683ac..54810f0 100644 } configs += [ -@@ -377,7 +379,7 @@ config("compiler") { - # The x86 toolchain currently has problems with stack-protector. - if (is_android && current_cpu == "x86") { - cflags += [ "-fno-stack-protector" ] -- } else if (current_os != "aix") { -+ } else if (current_os != "aix" && current_os != "wasm") { +@@ -370,7 +372,7 @@ config("compiler") { + } else if (is_chromeos) { + cflags += [ "-fstack-protector-strong" ] + } else if ((is_posix && !is_nacl) || is_fuchsia) { +- if (current_os != "aix") { ++ if (current_os != "aix" && current_os != "wasm") { # Not available on aix. cflags += [ "-fstack-protector" ] } diff --git a/toolchain/toolchain.gni b/toolchain/toolchain.gni -index 9170959..3e529fe 100644 +index 4e18accf1..34951eede 100644 --- a/toolchain/toolchain.gni +++ b/toolchain/toolchain.gni @@ -62,6 +62,8 @@ if (is_apple) { diff --git a/patches/wasm/pdfium.patch b/patches/wasm/pdfium.patch index 951ed1b3..6fe9052c 100644 --- a/patches/wasm/pdfium.patch +++ b/patches/wasm/pdfium.patch @@ -1,26 +1,26 @@ diff --git a/core/fxcrt/BUILD.gn b/core/fxcrt/BUILD.gn -index 1b3f6e4..ac8c65f 100644 +index 90b9ec7..1e9be68 100644 --- a/core/fxcrt/BUILD.gn +++ b/core/fxcrt/BUILD.gn -@@ -140,7 +140,7 @@ source_set("fxcrt") { +@@ -150,7 +150,7 @@ source_set("fxcrt") { } else { sources += [ "fx_memory_malloc.cpp" ] } -- if (is_posix || is_fuchsia) { -+ if (is_posix || is_fuchsia || is_wasm) { +- if (is_posix) { ++ if (is_posix || is_wasm) { sources += [ "cfx_fileaccess_posix.cpp", "cfx_fileaccess_posix.h", diff --git a/core/fxge/BUILD.gn b/core/fxge/BUILD.gn -index a3d2b0e..bcfd1be 100644 +index 215a63b..e52e9b6 100644 --- a/core/fxge/BUILD.gn +++ b/core/fxge/BUILD.gn -@@ -157,7 +157,7 @@ source_set("fxge") { +@@ -160,7 +160,7 @@ source_set("fxge") { ] } -- if (is_linux || is_chromeos || is_fuchsia) { -+ if (is_linux || is_chromeos || is_fuchsia || is_wasm) { +- if (is_linux || is_chromeos) { ++ if (is_linux || is_chromeos || is_wasm) { sources += [ "linux/fx_linux_impl.cpp" ] } diff --git a/patches/win/pdfium.patch b/patches/win/pdfium.patch deleted file mode 100644 index 9c244fa6..00000000 --- a/patches/win/pdfium.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/core/fxge/win32/cgdi_printer_driver.cpp b/core/fxge/win32/cgdi_printer_driver.cpp -index 28bc516bc..aa4cb0452 100644 ---- a/core/fxge/win32/cgdi_printer_driver.cpp -+++ b/core/fxge/win32/cgdi_printer_driver.cpp -@@ -15,6 +15,7 @@ - #include "core/fxcrt/fx_memory.h" - #include "core/fxcrt/fx_system.h" - #include "core/fxcrt/retain_ptr.h" -+#include "core/fxcrt/widestring.h" - #include "core/fxge/cfx_font.h" - #include "core/fxge/cfx_windowsrenderdevice.h" - #include "core/fxge/dib/cfx_dibbase.h" diff --git a/steps/01-install.sh b/steps/01-install.sh index a92ed90b..48837855 100755 --- a/steps/01-install.sh +++ b/steps/01-install.sh @@ -2,7 +2,7 @@ PATH_FILE=${GITHUB_PATH:-$PWD/.path} TARGET_OS=${PDFium_TARGET_OS:?} -TARGET_LIBC=${PDFium_TARGET_LIBC:-default} +TARGET_ENVIRONMENT=${PDFium_TARGET_ENVIRONMENT:-} TARGET_CPU=${PDFium_TARGET_CPU:?} CURRENT_CPU=${PDFium_CURRENT_CPU:-x64} MUSL_URL=${MUSL_URL:-https://musl.cc} @@ -20,6 +20,9 @@ echo "$DepotTools_DIR" >> "$PATH_FILE" case "$TARGET_OS" in android) + sudo apt-get update + sudo apt-get install -y unzip + # pdfium installs its version of the NDK, but we need one for compiling the example ANDROID_NDK_VERSION="r25c" ANDROID_NDK_FOLDER="android-ndk-$ANDROID_NDK_VERSION" @@ -37,27 +40,27 @@ case "$TARGET_OS" in sudo apt-get update sudo apt-get install -y cmake pkg-config - if [ "$TARGET_LIBC" == "musl" ]; then + if [ "$TARGET_ENVIRONMENT" == "musl" ]; then case "$TARGET_CPU" in x86) MUSL_VERSION="i686-linux-musl-cross" - PACKAGES="g++-10 g++-10-multilib" + PACKAGES="g++ g++-multilib" ;; x64) MUSL_VERSION="x86_64-linux-musl-cross" - PACKAGES="g++-10" + PACKAGES="g++" ;; arm) MUSL_VERSION="arm-linux-musleabihf-cross" - PACKAGES="g++-10" + PACKAGES="g++" ;; arm64) MUSL_VERSION="aarch64-linux-musl-cross" - PACKAGES="g++-10" + PACKAGES="g++" ;; esac @@ -65,8 +68,6 @@ case "$TARGET_OS" in echo "$PWD/$MUSL_VERSION/bin" >> "$PATH_FILE" sudo apt-get install -y $PACKAGES - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10 - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10 else @@ -98,8 +99,8 @@ case "$TARGET_OS" in git clone https://github.com/emscripten-core/emsdk.git fi pushd emsdk - ./emsdk install ${EMSDK_VERSION:-3.1.34} - ./emsdk activate ${EMSDK_VERSION:-3.1.34} + ./emsdk install ${EMSDK_VERSION:-3.1.72} + ./emsdk activate ${EMSDK_VERSION:-3.1.72} echo "$PWD/upstream/emscripten" >> "$PATH_FILE" echo "$PWD/upstream/bin" >> "$PATH_FILE" popd @@ -108,4 +109,10 @@ case "$TARGET_OS" in win) echo "$WindowsSDK_DIR/$CURRENT_CPU" >> "$PATH_FILE" ;; + + ios) + # Xcode 15.4 produces the following error when targeting ARM64 with V8: + # undefined symbol: be_memory_inline_jit_restrict_rwx_to_rx_with_witness_impl + sudo xcode-select -s "/Applications/Xcode_15.0.1.app" + ;; esac diff --git a/steps/02-checkout.sh b/steps/02-checkout.sh index f976705c..03fceadd 100755 --- a/steps/02-checkout.sh +++ b/steps/02-checkout.sh @@ -17,11 +17,11 @@ echo "target_os = [ '$OS' ]" >> .gclient # Reset -for FOLDER in pdfium pdfium/build pdfium/third_party/libjpeg_turbo pdfium/base/allocator/partition_allocator; do +for FOLDER in pdfium pdfium/build pdfium/v8 pdfium/third_party/libjpeg_turbo pdfium/base/allocator/partition_allocator; do if [ -e "$FOLDER" ]; then git -C $FOLDER reset --hard git -C $FOLDER clean -df fi done -gclient sync -r "origin/${PDFium_BRANCH:-main}" --no-history --shallow \ No newline at end of file +gclient sync -r "origin/${PDFium_BRANCH:-main}" --no-history --shallow diff --git a/steps/03-patch.sh b/steps/03-patch.sh index 1d66a422..be22daa7 100755 --- a/steps/03-patch.sh +++ b/steps/03-patch.sh @@ -3,7 +3,7 @@ PATCHES="$PWD/patches" SOURCE="${PDFium_SOURCE_DIR:-pdfium}" OS="${PDFium_TARGET_OS:?}" -TARGET_LIBC="${PDFium_TARGET_LIBC:-default}" +TARGET_ENVIRONMENT="${PDFium_TARGET_ENVIRONMENT:-}" pushd "${SOURCE}" @@ -19,6 +19,11 @@ case "$OS" in ios) git apply -v "$PATCHES/ios/pdfium.patch" + [ "${PDFium_ENABLE_V8:-}" == "true" ] && git -C v8 apply -v "$PATCHES/ios/v8.patch" + ;; + + linux) + [ "${PDFium_ENABLE_V8:-}" == "true" ] && git -C v8 apply -v "$PATCHES/linux/v8.patch" ;; wasm) @@ -31,7 +36,6 @@ case "$OS" in ;; win) - git apply -v "$PATCHES/win/pdfium.patch" git -C build apply -v "$PATCHES/win/build.patch" VERSION=${PDFium_VERSION:-0.0.0.0} @@ -42,7 +46,7 @@ case "$OS" in ;; esac -case "$TARGET_LIBC" in +case "$TARGET_ENVIRONMENT" in musl) git -C build apply -v "$PATCHES/musl/build.patch" mkdir -p "build/toolchain/linux/musl" diff --git a/steps/04-install-extras.sh b/steps/04-install-extras.sh index 43479b1c..cc577e57 100755 --- a/steps/04-install-extras.sh +++ b/steps/04-install-extras.sh @@ -8,12 +8,12 @@ pushd "$SOURCE" case "$OS" in linux) + build/install-build-deps.sh + gclient runhooks build/linux/sysroot_scripts/install-sysroot.py "--arch=$CPU" ;; android) - sudo apt-get update - sudo apt-get remove -y php7.4-common build/install-build-deps.sh --android gclient runhooks ;; diff --git a/steps/05-configure.sh b/steps/05-configure.sh index 74158538..1fad3b77 100755 --- a/steps/05-configure.sh +++ b/steps/05-configure.sh @@ -4,7 +4,7 @@ OS=${PDFium_TARGET_OS:?} SOURCE=${PDFium_SOURCE_DIR:-pdfium} BUILD=${PDFium_BUILD_DIR:-$SOURCE/out} TARGET_CPU=${PDFium_TARGET_CPU:?} -TARGET_LIBC=${PDFium_TARGET_LIBC:-default} +TARGET_ENVIRONMENT=${PDFium_TARGET_ENVIRONMENT:-} ENABLE_V8=${PDFium_ENABLE_V8:-false} IS_DEBUG=${PDFium_IS_DEBUG:-false} @@ -29,33 +29,35 @@ mkdir -p "$BUILD" case "$OS" in android) echo "clang_use_chrome_plugins = false" + echo "default_min_sdk_version = 21" ;; ios) + [ -n "$TARGET_ENVIRONMENT" ] && echo "target_environment = \"$TARGET_ENVIRONMENT\"" echo "ios_enable_code_signing = false" echo "use_blink = true" [ "$ENABLE_V8" == "true" ] && [ "$TARGET_CPU" == "arm64" ] && echo 'arm_control_flow_integrity = "none"' echo "clang_use_chrome_plugins = false" ;; linux) - echo 'use_allocator_shim = false' echo "clang_use_chrome_plugins = false" ;; mac) - echo 'use_allocator_shim = false' echo 'mac_deployment_target = "10.13.0"' echo "clang_use_chrome_plugins = false" ;; wasm) echo 'pdf_is_complete_lib = true' echo 'is_clang = false' + echo 'use_custom_libcxx = false' ;; esac - case "$TARGET_LIBC" in + case "$TARGET_ENVIRONMENT" in musl) echo 'is_musl = true' echo 'is_clang = false' echo 'use_custom_libcxx = false' + echo 'use_custom_libcxx_for_host = false' [ "$ENABLE_V8" == "true" ] && case "$TARGET_CPU" in arm) echo "v8_snapshot_toolchain = \"//build/toolchain/linux:clang_x86_v8_arm\"" diff --git a/steps/08-test.sh b/steps/08-test.sh index 700b8ec7..e4b25087 100755 --- a/steps/08-test.sh +++ b/steps/08-test.sh @@ -2,10 +2,11 @@ OS=${PDFium_TARGET_OS:?} CPU="${PDFium_TARGET_CPU:?}" -TARGET_LIBC="${PDFium_TARGET_LIBC:-default}" +TARGET_ENVIRONMENT="${PDFium_TARGET_ENVIRONMENT:-}" SOURCE_DIR="$PWD/example" CMAKE_ARGS=() CAN_RUN_ON_HOST=false +EXAMPLE="./example" export PDFium_DIR="$PWD/staging" @@ -35,17 +36,30 @@ case "$OS" in case "$CPU" in arm64) ARCH="arm64" - SDK="iphoneos" ;; x64) ARCH="x86_64" + ;; + esac + case "$TARGET_ENVIRONMENT" in + catalyst) + SDK="macosx" + EXAMPLE="example.app/Contents/MacOS/example" + ;; + device) + SDK="iphoneos" + EXAMPLE="example.app/example" + ;; + simulator) SDK="iphonesimulator" + EXAMPLE="example.app/example" ;; esac CMAKE_ARGS+=( -D CMAKE_SYSTEM_NAME="iOS" -D CMAKE_OSX_SYSROOT="$SDK" -D CMAKE_OSX_ARCHITECTURES="$ARCH" + -D CMAKE_OSX_DEPLOYMENT_TARGET="14.0" # https://discourse.cmake.org/t/find-package-stops-working-when-cmake-system-name-ios/4609/7 -D CMAKE_FIND_ROOT_PATH_MODE_PACKAGE="BOTH" -D CMAKE_FIND_ROOT_PATH_MODE_INCLUDE="BOTH" @@ -56,7 +70,7 @@ case "$OS" in linux) case "$CPU" in arm) - if [ "$TARGET_LIBC" == "musl" ]; then + if [ "$TARGET_ENVIRONMENT" == "musl" ]; then PREFIX="arm-linux-musleabihf-" else PREFIX="arm-linux-gnueabihf-" @@ -64,7 +78,7 @@ case "$OS" in fi ;; arm64) - if [ "$TARGET_LIBC" == "musl" ]; then + if [ "$TARGET_ENVIRONMENT" == "musl" ]; then PREFIX="aarch64-linux-musl-" else PREFIX="aarch64-linux-gnu-" @@ -72,7 +86,7 @@ case "$OS" in fi ;; x86) - if [ "$TARGET_LIBC" == "musl" ]; then + if [ "$TARGET_ENVIRONMENT" == "musl" ]; then PREFIX="i686-linux-musl-" else CAN_RUN_ON_HOST=true @@ -83,7 +97,7 @@ case "$OS" in ) ;; x64) - if [ "$TARGET_LIBC" == "musl" ]; then + if [ "$TARGET_ENVIRONMENT" == "musl" ]; then PREFIX="x86_64-linux-musl-" else CAN_RUN_ON_HOST=true @@ -129,6 +143,7 @@ case "$OS" in -G "Visual Studio 17 2022" -A "$ARCH" ) + EXAMPLE="Debug/example.exe" ;; wasm) @@ -145,12 +160,6 @@ pushd build cmake "${CMAKE_ARGS[@]}" cmake --build . -if [ "$OS" == "win" ]; then - EXAMPLE="Debug/example.exe" -else - EXAMPLE="./example" -fi - file $EXAMPLE if [ $CAN_RUN_ON_HOST == "true" ]; then diff --git a/steps/09-pack.sh b/steps/09-pack.sh index 0d6ce0b5..88802193 100755 --- a/steps/09-pack.sh +++ b/steps/09-pack.sh @@ -3,18 +3,18 @@ IS_DEBUG=${PDFium_IS_DEBUG:-false} ENABLE_V8=${PDFium_ENABLE_V8:-false} OS=${PDFium_TARGET_OS:?} -TARGET_LIBC=${PDFium_TARGET_LIBC:-default} +TARGET_ENVIRONMENT=${PDFium_TARGET_ENVIRONMENT:-} CPU=${PDFium_TARGET_CPU:?} STAGING="$PWD/staging" ARTIFACT_BASE="$PWD/pdfium" [ "$ENABLE_V8" == "true" ] && ARTIFACT_BASE="$ARTIFACT_BASE-v8" ARTIFACT_BASE="$ARTIFACT_BASE-$OS" -[ "$TARGET_LIBC" != "default" ] && ARTIFACT_BASE="$ARTIFACT_BASE-$TARGET_LIBC" +[ -n "$TARGET_ENVIRONMENT" ] && ARTIFACT_BASE="$ARTIFACT_BASE-$TARGET_ENVIRONMENT" [ "$OS" != "$CPU" ] && ARTIFACT_BASE="$ARTIFACT_BASE-$CPU" [ "$IS_DEBUG" == "true" ] && ARTIFACT_BASE="$ARTIFACT_BASE-debug" ARTIFACT="$ARTIFACT_BASE.tgz" pushd "$STAGING" tar cvzf "$ARTIFACT" -- * -popd \ No newline at end of file +popd