Files
MINGW-packages/mingw-w64-python-pymupdf/0001-setup-add-mingw.patch
2023-05-18 12:57:43 +05:30

41 lines
1.3 KiB
Diff

--- a/setup.py
+++ b/setup.py
@@ -365,7 +365,7 @@
def load_libraries():
- if os.getenv("NIX_STORE"):
+ if os.getenv("NIX_STORE") or os.getenv("MINGW_PREFIX"):
return LIBRARIES["nix"]
try:
@@ -573,7 +573,8 @@
openbsd = platform.system() == 'OpenBSD'
freebsd = platform.system() == 'FreeBSD'
darwin = platform.system() == 'Darwin'
-windows = platform.system() == 'Windows' or platform.system().startswith('CYGWIN')
+windows = (platform.system() == 'Windows' and "MSC" in sys.version) or platform.system().startswith('CYGWIN')
+mingw = platform.system() == 'Windows' and "MSC" not in sys.version
if 'sdist' in sys.argv:
@@ -786,6 +787,18 @@
'harfbuzz',
]
+ elif mingw:
+ mingw_prefix = os.getenv("MINGW_PREFIX", "/mingw64")
+ include_dirs.append( f'{mingw_prefix}/include')
+ include_dirs.append( f'{mingw_prefix}/include/mupdf')
+ include_dirs.append( f'{mingw_prefix}/include/freetype2')
+ extra_swig_args.append(f'-I{mingw_prefix}/include')
+ extra_compile_args.append( '-Wno-incompatible-pointer-types')
+ extra_compile_args.append( '-Wno-pointer-sign')
+ extra_compile_args.append( '-Wno-sign-compare')
+ libraries = load_libraries()
+ libraries += ['z']
+
elif windows:
# Windows.
assert mupdf_local