Add musl/Alpine native support (linux-musl-x64 / linux-musl-arm64)#16
Open
Frooodle wants to merge 3 commits into
Open
Add musl/Alpine native support (linux-musl-x64 / linux-musl-arm64)#16Frooodle wants to merge 3 commits into
Frooodle wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
linux-musl-x64andlinux-musl-arm64native targets so JPDFium can run on Alpine/musl (e.g. Stirling-PDF's ultra-lite Docker image). The bundled PDFium natives are glibc-linked today, so a musl JVM can't load them; this wires up musl-specific native artifacts and runtime selection.What's in here
Validated locally (gradle wiring resolves,
:jpdfium:compileJavais green):NativeLoader.detectPlatform()now detects musl (probes/lib/ld-musl-*, falls back toldd --version) and returnslinux-musl-<arch>, cached.jpdfium-natives-linux-musl-x64/-arm64(use the existing platform-genericnatives-conventionsplugin), wired intosettings.gradle.ktsand the BOM.jpdfium.versionbumped to1.1.0-SNAPSHOT.fetch-prebuilt-pdfium.shdoc/usage updated for the new platforms (no whitelist to change).Best-effort, must be proven by CI (I cannot build Chromium-under-musl locally):
prebuild-pdfium.yml: newlinux-musl-*matrix legs that build natively inside matching-arch Alpine containers (x64 onubuntu-latest, arm64 onubuntu-24.04-arm), with a bash/toolchain bootstrap (apk add ... gcompat). The release job is nowalways()+ warn-only for musl so an unproven musl leg can't block the glibc/darwin/windows prebuild.setup-pdfium.sh: aJPDFIUM_LIBC=muslbranch (use_custom_libcxx=true).Honest caveat / how to test
PDFium/Chromium has no official musl support and its bundled clang is a glibc binary, so the Alpine PDFium build is the open part - it will likely need EmbedPDF fork patches and GN/toolchain tuning. Note
prebuild-pdfium.ymlruns onworkflow_dispatch/cron, not on PRs, so to actually exercise the musl legs trigger the Prebuild PDFium workflow manually on this branch. The publish workflows (release/snapshot/publish-github-packages) are intentionally not wired for musl yet - that's a follow-up once the musl prebuild is green (no point publishing natives that don't build).Opening as a draft to see how the musl prebuild fares in CI.