Skip to content

Commit

Permalink
use pdfium-binaries to get an up-to-date DLL
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@28023 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Nov 28, 2020
1 parent 9b33943 commit 1e75d8b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
17 changes: 11 additions & 6 deletions src/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,7 @@ def add_DLLs(*dll_names):
print(" %s" % e)
sys.exit(1)

def do_add_DLLs(*dll_names):
def do_add_DLLs(prefix="lib", *dll_names):
dll_names = list(dll_names)
dll_files = []
import re
Expand All @@ -1116,11 +1116,16 @@ def do_add_DLLs(*dll_names):
continue
for x in os.listdir(d):
dll_path = os.path.join(d, x)
if os.path.isdir(dll_path):
continue
x = x.lower()
if os.path.isdir(dll_path) or not x.startswith("lib") or not x.endswith(".dll"):
if prefix and not x.startswith(prefix):
continue
if not x.endswith(".dll"):
continue
#strip "lib" and ".dll": "libatk-1.0-0.dll" -> "atk-1.0-0"
nameversion = x[3:-4]
#strip prefix (ie: "lib") and ".dll":
#ie: "libatk-1.0-0.dll" -> "atk-1.0-0"
nameversion = x[len(prefix):-4]
if verbose_ENABLED:
print("checking %s: %s" % (x, nameversion))
m = version_re.search(nameversion) #look for version part of filename
Expand All @@ -1139,7 +1144,7 @@ def do_add_DLLs(*dll_names):
if dll_names:
print("some DLLs could not be found:")
for x in dll_names:
print(" - lib%s*.dll" % x)
print(" - %s%s*.dll" % (prefix, x))
add_data_files("", dll_files)

#list of DLLs we want to include, without the "lib" prefix, or the version and extension
Expand Down Expand Up @@ -1360,7 +1365,7 @@ def add_service_exe(script, icon, base_name):
if printing_ENABLED:
add_console_exe("xpra/platform/printing.py", "printer.ico", "Print")
add_console_exe("xpra/platform/win32/pdfium.py", "printer.ico", "PDFIUM_Print")
add_DLLs("pdfium") #libpdfium.dll
do_add_DLLs("", "pdfium")
if nvenc_ENABLED:
add_console_exe("xpra/codecs/nv_util.py", "nvidia.ico", "NVidia_info")
if nvfbc_ENABLED:
Expand Down
2 changes: 2 additions & 0 deletions src/win32/MINGW_BUILD.sh
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,8 @@ mv ./lib/gstreamer-1.0/libgst*-1.0-*.dll ./lib/
mv *dll lib/
#but keep the core DLLs (python, gcc, etc):
cp lib/msvcrt*dll lib/libpython*dll lib/libgcc*dll lib/libwinpthread*dll ./
#and keep pdfium:
mv lib/*pdfium*.dll ./
pushd lib > /dev/null
#remove all the pointless duplication:
for x in `ls *dll`; do
Expand Down
3 changes: 3 additions & 0 deletions src/win32/MINGW_SETUP.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ pip3 install yuicompressor browser-cookie3 qrencode
#$PACMAN --noconfirm -S ${XPKG}opencv ${XPKG}hdf5 ${XPKG}tesseract-ocr

echo "for printing support, install libpdfium"
echo "by downloading the plain x64 pdfium binary from"
echo "https://github.com/bblanchon/pdfium-binaries"
echo "and place the `pdfium.dll` in '$MINGW_PREFIX/bin'"

echo "for a more seamless theme, install https://b00merang.weebly.com/windows-10.html"
echo " (see ticket #2762)"
2 changes: 1 addition & 1 deletion src/xpra/platform/win32/pdfium.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from xpra.platform.win32 import win32con
from xpra.platform.win32.win32_printing import GDIPrinterContext, DOCINFO, StartDocA, EndDoc, LPCSTR

LIBPDFIUMDLL = os.environ.get("XPRA_LIBPDFIUMDLL", "libpdfium.dll")
LIBPDFIUMDLL = os.environ.get("XPRA_LIBPDFIUMDLL", "pdfium.dll")
try:
pdfium = WinDLL(LIBPDFIUMDLL, use_last_error=True)
except WindowsError as e: #@UndefinedVariable
Expand Down

0 comments on commit 1e75d8b

Please sign in to comment.