build-win64-mxe
build-win64-mxe copied to clipboard
pdfium question
Description
Hello there and thanks for the hard work
I'm wondering why even in all, it's build with --without-pdfium argument.
The install seem well documented, so is there a problem with pdfium ?
Just trying to see if it could be possible to replace poppler (GPL) by pdfium (apache 2.0)
PDFium build is a bit of hassle to set-up as it uses a unusual build system (i.e. gclient and gn). Perhaps using the prebuilt binaries from https://github.com/bblanchon/pdfium-binaries here might help, but I'm not sure if this can be done without any problems since these are built with MSVC instead of MinGW-w64.
Let's tag this as an enhancement. Happy to accept a PR, if you're able.
I found a way to integrate pdfium, I write here a step-by-step procedure that can be easy (I guess) to integrate with the current build system. I'm not opening a merge request because I'm not familiar with it.
NOTE: I'm using the meson branch because it's way easier to use.
- Download the correct pdf binary
wget https://github.com/bblanchon/pdfium-binaries/releases/latest/download/pdfium-win-x64.tgz - Unpack it, and use
gendef(mingw64) andllvm-dlltool(llvm) to create a.deffrom the.dlland create a.amkdir pdfium mv pdfium-win-x64.tgz pdfium cd pdfium tar xvf pdfium-win-x64.tgz cd bin gendef pdfium.dll cd - llvm-dlltool -d bin/pdfium.def -D bin/pdfium.dll -l lib/pdfium.a - Move out of the
pdfiumfolder, clone the build-win64-mxe repo, checkout themesonbranch. - (extremely manual step). Create the path that mxe uses to look for the dependencies, and put the pdfium libraries inside. Here I suppose we are instested in building the
web+sharedconfiguration + pdfium. The same reasoning can be used for building other configurations (web + static, or all + shared, or all + static).git clone https://github.com/mxe/mxe build/mxe mkdir -p ./build/mxe/usr/x86_64-w64-mingw32.shared.posix.web/lib/ mkdir -p ./build/mxe/usr/x86_64-w64-mingw32.shared.posix.web/bin/ mkdir -p ./build/mxe/usr/x86_64-w64-mingw32.shared.posix.web/include/ # suppose that pdfium folder is in the parent folder cp ../pdfium/bin/pdfium.* build/mxe/usr/x86_64-w64-mingw32.shared.posix.web/bin/ cp ../pdfium/lib/pdfium.* build/mxe/usr/x86_64-w64-mingw32.shared.posix.web/lib/ cp -r ../pdfium/include/ build/mxe/usr/x86_64-w64-mingw32.shared.posix.web/include/pdfium - Create the
.pcfile for pdfium, in the standard directory used bypkg-config. The path are fixed because we are inside a container.mkdir -p ./build/mxe/usr/x86_64-w64-mingw32.shared.posix.web/lib/pkgconfig cat > ./build/mxe/usr/x86_64-w64-mingw32.shared.posix.web/lib/pkgconfig/pdfium.pc << EOF prefix=/data/mxe/usr/x86_64-w64-mingw32.shared.posix.web libdir=\${prefix}/lib includedir=\${prefix}/include bindir=\${prefix}/bin Name: pdfium Description: pdfium Version: 4997 Libs: -L\${libdir} -lpdfium Cflags: -I\${includedir}/pdfium EOF - Enable the
pdfiumsupport on meson:
diff --git a/build/vips-web.mk b/build/vips-web.mk
index 0331de0..24134ce 100644
--- a/build/vips-web.mk
+++ b/build/vips-web.mk
@@ -74,7 +74,7 @@ define $(PKG)_BUILD
-Dopenexr=disabled \
-Dopenjpeg=disabled \
-Dopenslide=disabled \
- -Dpdfium=disabled \
+ -Dpdfium=enabled \
-Dpoppler=disabled \
-Dquantizr=disabled \
-Dppm=false \
- Build!
./build.sh web x86_64 shared
At the end of the building process the zip archive build/vips-dev-w64-web-*.zip is created