gwen: Bundle pdfium in macOS builds
Issue Triage Queue Board / Sync triage queue board (push) Has been cancelled
release_nightly / build_nix_linux_x86_64 (push) Has been cancelled
release_nightly / run_tests_linux (push) Has been cancelled
release_nightly / bundle_linux_aarch64 (push) Has been cancelled
release_nightly / bundle_linux_x86_64 (push) Has been cancelled
release_nightly / build_static_bwrap_linux_aarch64 (push) Has been cancelled
release_nightly / build_static_bwrap_linux_x86_64 (push) Has been cancelled
release_nightly / bundle_mac_aarch64 (push) Has been cancelled
release_nightly / bundle_mac_x86_64 (push) Has been cancelled
release_nightly / bundle_windows_aarch64 (push) Has been cancelled
release_nightly / bundle_windows_x86_64 (push) Has been cancelled
release_nightly / build_nix_mac_aarch64 (push) Has been cancelled
release_nightly / update_nightly_tag (push) Has been cancelled
release_nightly / notify_on_failure (push) Has been cancelled
Congratsbot / check-author (push) Has been cancelled
deploy_nightly_docs / deploy_docs (push) Has been cancelled
run_tests / orchestrate (push) Has been cancelled
run_tests / check_style (push) Has been cancelled
Update Duplicate Magnets Issue / update-duplicate-magnets (push) Has been cancelled
Congratsbot / congrats (push) Has been cancelled
run_tests / clippy_windows (push) Has been cancelled
run_tests / clippy_linux (push) Has been cancelled
run_tests / clippy_mac (push) Has been cancelled
run_tests / clippy_mac_x86_64 (push) Has been cancelled
run_tests / run_tests_windows (push) Has been cancelled
run_tests / run_tests_linux (push) Has been cancelled
run_tests / run_tests_mac (push) Has been cancelled
run_tests / miri_scheduler (push) Has been cancelled
run_tests / doctests (push) Has been cancelled
run_tests / check_workspace_binaries (push) Has been cancelled
run_tests / build_visual_tests_binary (push) Has been cancelled
run_tests / check_wasm (push) Has been cancelled
run_tests / check_dependencies (push) Has been cancelled
run_tests / check_docs (push) Has been cancelled
run_tests / check_licenses (push) Has been cancelled
run_tests / check_scripts (push) Has been cancelled
run_tests / check_remote_server_linux_x86_64 (push) Has been cancelled
run_tests / check_remote_server_mac_aarch64 (push) Has been cancelled
run_tests / check_remote_server_windows_x86_64 (push) Has been cancelled
run_tests / check_postgres_and_protobuf_migrations (push) Has been cancelled
run_tests / extension_tests (push) Has been cancelled
run_tests / tests_pass (push) Has been cancelled
Guild Stale Assignments / sweep (push) Has been cancelled
Community PR Cleanup / cleanup (push) Has been cancelled
PR Board Meta Fields Refresh / refresh (push) Has been cancelled
Hotfix Review Monitor / check-hotfix-reviews (push) Has been cancelled
Track duplicate bot effectiveness / classify-closed-issue (push) Has been cancelled
Track duplicate bot effectiveness / classify-open (push) Has been cancelled
Stale PR Review Reminder / check-stale-prs (push) Has been cancelled
Update Weekly Top Ranking Issues / update_top_ranking_issues (push) Has been cancelled
Bump collab-staging Tag / update-collab-staging-tag (push) Has been cancelled
Close Stale Issues / stale (push) Has been cancelled
compliance_check / scheduled_compliance_check (push) Has been cancelled
release_nightly / check_nightly_tag (push) Has been cancelled
Update All Top Ranking Issues / update_top_ranking_issues (push) Has been cancelled
Guild Weekly Shipped / digest (push) Has been cancelled
Issue Triage Queue Board / Sync triage queue board (push) Has been cancelled
release_nightly / build_nix_linux_x86_64 (push) Has been cancelled
release_nightly / run_tests_linux (push) Has been cancelled
release_nightly / bundle_linux_aarch64 (push) Has been cancelled
release_nightly / bundle_linux_x86_64 (push) Has been cancelled
release_nightly / build_static_bwrap_linux_aarch64 (push) Has been cancelled
release_nightly / build_static_bwrap_linux_x86_64 (push) Has been cancelled
release_nightly / bundle_mac_aarch64 (push) Has been cancelled
release_nightly / bundle_mac_x86_64 (push) Has been cancelled
release_nightly / bundle_windows_aarch64 (push) Has been cancelled
release_nightly / bundle_windows_x86_64 (push) Has been cancelled
release_nightly / build_nix_mac_aarch64 (push) Has been cancelled
release_nightly / update_nightly_tag (push) Has been cancelled
release_nightly / notify_on_failure (push) Has been cancelled
Congratsbot / check-author (push) Has been cancelled
deploy_nightly_docs / deploy_docs (push) Has been cancelled
run_tests / orchestrate (push) Has been cancelled
run_tests / check_style (push) Has been cancelled
Update Duplicate Magnets Issue / update-duplicate-magnets (push) Has been cancelled
Congratsbot / congrats (push) Has been cancelled
run_tests / clippy_windows (push) Has been cancelled
run_tests / clippy_linux (push) Has been cancelled
run_tests / clippy_mac (push) Has been cancelled
run_tests / clippy_mac_x86_64 (push) Has been cancelled
run_tests / run_tests_windows (push) Has been cancelled
run_tests / run_tests_linux (push) Has been cancelled
run_tests / run_tests_mac (push) Has been cancelled
run_tests / miri_scheduler (push) Has been cancelled
run_tests / doctests (push) Has been cancelled
run_tests / check_workspace_binaries (push) Has been cancelled
run_tests / build_visual_tests_binary (push) Has been cancelled
run_tests / check_wasm (push) Has been cancelled
run_tests / check_dependencies (push) Has been cancelled
run_tests / check_docs (push) Has been cancelled
run_tests / check_licenses (push) Has been cancelled
run_tests / check_scripts (push) Has been cancelled
run_tests / check_remote_server_linux_x86_64 (push) Has been cancelled
run_tests / check_remote_server_mac_aarch64 (push) Has been cancelled
run_tests / check_remote_server_windows_x86_64 (push) Has been cancelled
run_tests / check_postgres_and_protobuf_migrations (push) Has been cancelled
run_tests / extension_tests (push) Has been cancelled
run_tests / tests_pass (push) Has been cancelled
Guild Stale Assignments / sweep (push) Has been cancelled
Community PR Cleanup / cleanup (push) Has been cancelled
PR Board Meta Fields Refresh / refresh (push) Has been cancelled
Hotfix Review Monitor / check-hotfix-reviews (push) Has been cancelled
Track duplicate bot effectiveness / classify-closed-issue (push) Has been cancelled
Track duplicate bot effectiveness / classify-open (push) Has been cancelled
Stale PR Review Reminder / check-stale-prs (push) Has been cancelled
Update Weekly Top Ranking Issues / update_top_ranking_issues (push) Has been cancelled
Bump collab-staging Tag / update-collab-staging-tag (push) Has been cancelled
Close Stale Issues / stale (push) Has been cancelled
compliance_check / scheduled_compliance_check (push) Has been cancelled
release_nightly / check_nightly_tag (push) Has been cancelled
Update All Top Ranking Issues / update_top_ranking_issues (push) Has been cancelled
Guild Weekly Shipped / digest (push) Has been cancelled
script/bundle-mac now downloads the pinned pdfium-mac tarball from bblanchon/pdfium-binaries into Zed.app/Contents/Frameworks, matching what bundle-linux and bundle-windows.ps1 already do, so the bundled pdf_viewer no longer falls back to synthetic rendering on macOS. The runtime loader probes ../Frameworks next to the executable.
This commit is contained in:
1 parent
b61647f0bf
commit
312b37539c
2 files changed
+48
No files matched your search
@@ -174,6 +174,13 @@ impl PdfiumEngine {
|
||||
PathBuf::from("/usr/local/lib/libpdfium.dylib"),
|
||||
]);
|
||||
|
||||
// macOS app bundles ship libpdfium.dylib in Contents/Frameworks.
|
||||
if let Ok(executable_path) = std::env::current_exe() {
|
||||
if let Some(executable_dir) = executable_path.parent() {
|
||||
common_paths.push(executable_dir.join("../Frameworks/libpdfium.dylib"));
|
||||
}
|
||||
}
|
||||
|
||||
for path in &common_paths {
|
||||
if path.exists() {
|
||||
if let Ok(bindings) = Pdfium::bind_to_library(path) {
|
||||
|
||||
@@ -146,6 +146,7 @@ fi
|
||||
|
||||
GIT_VERSION="v2.43.3"
|
||||
GIT_VERSION_SHA="fa29823"
|
||||
PDFIUM_TAG="chromium/8066"
|
||||
|
||||
function download_and_unpack() {
|
||||
local url=$1
|
||||
@@ -192,6 +193,42 @@ function download_git() {
|
||||
rm -rf "$tmp_dir"
|
||||
}
|
||||
|
||||
function download_pdfium() {
|
||||
local architecture=$1
|
||||
local target_path=$2
|
||||
|
||||
case "$architecture" in
|
||||
aarch64-apple-darwin)
|
||||
pdfium_flavor="mac-arm64"
|
||||
pdfium_sha256="336219e80580b93c6523f44db7dc1de59cc497b13a7390ddac84223f68ca162b"
|
||||
;;
|
||||
x86_64-apple-darwin)
|
||||
pdfium_flavor="mac-x64"
|
||||
pdfium_sha256="841ecac278cdd46288dd065873522cf72f3996560d8978f473d336f01d59942c"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported architecture for pdfium: $architecture"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# sha256sum is not present on stock macOS, so checksums go through shasum.
|
||||
pdfium_tgz="${target_dir}/pdfium-${pdfium_flavor}.tgz"
|
||||
if ! echo "${pdfium_sha256} ${pdfium_tgz}" | shasum -a 256 -c >/dev/null 2>&1; then
|
||||
mkdir -p "${target_dir}"
|
||||
curl --silent --fail --location --output "${pdfium_tgz}" \
|
||||
"https://github.com/bblanchon/pdfium-binaries/releases/download/${PDFIUM_TAG}/pdfium-${pdfium_flavor}.tgz"
|
||||
echo "${pdfium_sha256} ${pdfium_tgz}" | shasum -a 256 -c
|
||||
fi
|
||||
|
||||
pdfium_tmp=$(mktemp -d)
|
||||
tar -xzf "${pdfium_tgz}" -C "${pdfium_tmp}" "lib/libpdfium.dylib" "LICENSE" "licenses"
|
||||
cp "${pdfium_tmp}/lib/libpdfium.dylib" "${target_path}"
|
||||
mkdir -p "${app_path}/Contents/Resources/pdfium-licenses"
|
||||
cp "${pdfium_tmp}/LICENSE" "${pdfium_tmp}/licenses/"* "${app_path}/Contents/Resources/pdfium-licenses/"
|
||||
rm -rf "${pdfium_tmp}"
|
||||
}
|
||||
|
||||
function sign_app_binaries() {
|
||||
rm -rf "${app_path}/Contents/Frameworks"
|
||||
mkdir -p "${app_path}/Contents/Frameworks"
|
||||
@@ -199,6 +236,10 @@ function sign_app_binaries() {
|
||||
echo "Downloading git binary"
|
||||
download_git "${target_triple}" "${app_path}/Contents/MacOS/git"
|
||||
|
||||
# PDFium is dlopen'd at runtime by the bundled pdf_viewer for native PDF viewing.
|
||||
echo "Downloading pdfium library"
|
||||
download_pdfium "${target_triple}" "${app_path}/Contents/Frameworks/libpdfium.dylib"
|
||||
|
||||
# Note: The app identifier for our development builds is the same as the app identifier for nightly.
|
||||
cp crates/zed/contents/$channel/embedded.provisionprofile "${app_path}/Contents/"
|
||||
|
||||
|
||||
Reference in new issue
Block a user