RESOLVED DUPLICATE of bug 241117 235981
Copy PDF.js in WebCore.framework bundle at build-time
https://bugs.webkit.org/show_bug.cgi?id=235981
Summary Copy PDF.js in WebCore.framework bundle at build-time
Tim Nguyen (:ntim)
Reported 2022-02-01 15:36:30 PST
We should: - get the downloaded version of PDF.js from https://mozilla.github.io/pdf.js/getting_started/#download (the Prebuilt one) - include it somewhere in Source/WebCore - create a script that copies it into the WebCore bundle - run that script during the build
Attachments
Patch (2.96 KB, patch)
2022-02-11 02:55 PST, Tim Nguyen (:ntim)
no flags
Patch (4.82 KB, patch)
2022-02-15 11:24 PST, Tim Nguyen (:ntim)
no flags
Radar WebKit Bug Importer
Comment 1 2022-02-01 15:36:43 PST
Tim Nguyen (:ntim)
Comment 2 2022-02-11 02:55:23 PST
EWS
Comment 3 2022-02-11 04:06:54 PST
Committed r289616 (247127@main): <https://commits.webkit.org/247127@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 451664 [details].
Tim Nguyen (:ntim)
Comment 4 2022-02-11 10:25:25 PST
Reverted this in r289637 since this broke production builds: ``` /bin/sh -c /System/Volumes/Data/otmp/od.xLjbWx/lw.JIlSYt/sandbox-0/OBJROOT/WebCore.build/WebCore.build/Script-49AA6B1727B6755F000B0F64.sh rsync: link_stat "/System/Volumes/Data/otmp/od.xLjbWx/lw.JIlSYt/sandbox-0/WebCore/Source/WebCore/../ThirdParty/pdfjs/." failed: No such file or directory (2) rsync error: some files could not be transferred (code 23) at /System/Volumes/Data/SWE/macOS/BuildRoots/6b362bc7f6/Library/Caches/com.apple.xbs/Sources/rsync/rsync-55/rsync/main.c(996) [sender=2.6.9] /System/Volumes/Data/otmp/od.xLjbWx/lw.JIlSYt/sandbox-0/OBJROOT/WebCore.build/WebCore.build/Script-49AA6B1727B6755F000B0F64.sh: line 9: cd: /System/Volumes/Data/otmp/od.xLjbWx/lw.JIlSYt/sandbox-0/WebCore/Source/WebCore/../ThirdParty/pdfjs: No such file or directory Command PhaseScriptExecution failed with a nonzero exit code ```
Elliott Williams
Comment 5 2022-02-11 10:51:44 PST
Comment on attachment 451664 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=451664&action=review > Source/WebCore/WebCore.xcodeproj/project.pbxproj:38406 > + 49AA6B1727B6755F000B0F64 /* Copy PDF.js Resources */ = { > + isa = PBXShellScriptBuildPhase; > + buildActionMask = 2147483647; > + files = ( > + ); > + inputFileListPaths = ( > + ); > + inputPaths = ( > + ); > + name = "Copy PDF.js Resources"; > + outputFileListPaths = ( > + ); > + outputPaths = ( > + ); > + runOnlyForDeploymentPostprocessing = 0; > + shellPath = /bin/sh; > + shellScript = "SRC_DIR=\"$SRCROOT/../ThirdParty/pdfjs\"\nDST_DIR=\"$BUILT_PRODUCTS_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/pdfjs\"\n\nmkdir -p \"$DST_DIR\"\n\nrsync -aq --exclude \".svn\" --exclude \".DS_Store\" \"$SRC_DIR/\" \"$DST_DIR/\"\n\ncd \"$SRC_DIR\"\n"; > + }; I think it would be preferable to add `pdfjs/` to the xcodeproj as a folder reference, and use a Copy Files phase to copy it over. This gives Xcode's build system more dependency information about what's being copied, is marginally faster, and might help with the production build problems you're seeing.
Tim Nguyen (:ntim)
Comment 6 2022-02-15 11:24:46 PST
Alexey Proskuryakov
Comment 7 2022-02-15 11:27:31 PST
Comment on attachment 452064 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=452064&action=review > Source/WebCore/Makefile:5 > + mkdir -p $@ Do we need to quote this, or anything else, in case of spaces in the path?
EWS
Comment 8 2022-02-15 13:52:30 PST
Committed r289850 (247292@main): <https://commits.webkit.org/247292@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 452064 [details].
Tim Nguyen (:ntim)
Comment 9 2022-03-14 11:33:27 PDT
We're reverting this in bug 237844, since this causes a significant size increase in the bundle. This patch can be re-landed once work on PDF.js resumes along with bundle size optimization.
Tim Nguyen (:ntim)
Comment 10 2022-03-14 11:35:42 PDT
(This needs a rebase fwiw)
Tim Nguyen (:ntim)
Comment 11 2022-03-14 11:36:43 PDT
To replicate the changes in Source/WebCore/WebCore.xcodeproj/project.pbxproj, add a folder reference to Source/ThirdParty/pdfjs in the WebCore/Resources folder in the file tree.
Tim Nguyen (:ntim)
Comment 12 2022-03-17 12:51:53 PDT
Worth noting that Igalia added a build option in bug 238023, probably worth using that for file size concerns.
Tim Nguyen (:ntim)
Comment 13 2022-07-01 15:07:27 PDT
*** This bug has been marked as a duplicate of bug 241117 ***
Note You need to log in before you can comment on or make changes to this bug.