Files
MINGW-packages/mingw-w64-python-pymupdf/0001-pymupdf-add-mingw-setup.patch
مهدي شينون (Mehdi Chinoune) ad1ada3721 python-pymupdf: update to 1.26.7
2025-12-13 06:04:18 +01:00

99 lines
3.5 KiB
Diff

--- a/pipcl.py
+++ b/pipcl.py
@@ -1793,7 +1793,7 @@
#
rpath_flag = "-Wl,-rpath,'$ORIGIN'"
else:
- rpath_flag = "-Wl,-rpath,'$ORIGIN',-z,origin"
+ rpath_flag = ""
# Fun fact - on Linux, if the -L and -l options are before '{path_cpp}'
# they seem to be ignored...
@@ -1964,7 +1964,7 @@
#
-def base_compiler(vs=None, pythonflags=None, cpp=False, use_env=True):
+def base_compiler(vs=None, pythonflags=None, cpp=False, use_env=False):
'''
Returns basic compiler command and PythonFlags.
@@ -2331,7 +2331,7 @@
nl = '\n'
text += f' {nl.join(lines)}'
log1(text, caller=caller+1)
- sep = ' ' if windows() else ' \\\n'
+ sep = ' '
command2 = sep.join( lines)
cp = subprocess.run(
command2,
@@ -2081,7 +2081,7 @@
return sys.platform.startswith( 'darwin')
def windows():
- return platform.system() == 'Windows'
+ return platform.system() == 'Windows' and 'MSC' in sys.version
def wasm():
return os.environ.get( 'OS') in ('wasm', 'wasm-mt')
@@ -2547,11 +2547,11 @@
python_config = f'{python_exe}-config'
log2(f'Using {python_config=}.')
try:
- self.includes = run( f'{python_config} --includes', capture=1, verbose=0).strip()
+ self.includes = run( f'sh -c "{python_config} --includes"', capture=1, verbose=0).strip()
except Exception as e:
raise Exception('We require python development tools to be installed.') from e
- self.ldflags = run( f'{python_config} --ldflags', capture=1, verbose=0).strip()
+ self.ldflags = run( f'sh -c "{python_config} --ldflags"', capture=1, verbose=0).strip()
if linux():
# It seems that with python-3.10 on Linux, we can get an
# incorrect -lcrypt flag that on some systems (e.g. WSL)
--- a/setup.py
+++ b/setup.py
@@ -563,12 +563,12 @@
return get_mupdf_internal('dir', m)
-linux = sys.platform.startswith( 'linux') or 'gnu' in sys.platform
+linux = True
openbsd = sys.platform.startswith( 'openbsd')
freebsd = sys.platform.startswith( 'freebsd')
darwin = sys.platform.startswith( 'darwin')
-windows = platform.system() == 'Windows' or platform.system().startswith('CYGWIN')
-msys2 = platform.system().startswith('MSYS_NT-')
+windows = False
+msys2 = False
if os.environ.get('PYODIDE') == '1':
if os.environ.get('OS') != 'pyodide':
@@ -1169,7 +1169,7 @@
libraries = f'{mupdf_local}\\platform\\{infix}\\{wp.cpu.windows_subdir}{build_type_infix}\\{libs}'
compiler_extra = ''
else:
- libs = ['mupdf']
+ libs = ['mupdf', 'jbig2dec', 'openjp2', 'jpeg', 'png', 'z', 'freetype', 'gumbo', 'harfbuzz']
compiler_extra += (
' -Wall'
' -Wno-deprecated-declarations'
@@ -1183,8 +1183,6 @@
else:
libpaths = os.environ.get('PYMUPDF_MUPDF_LIB')
libraries = None
- if libpaths:
- libpaths = libpaths.split(':')
if mupdf_local:
includes = (
@@ -1196,6 +1194,9 @@
# Use system MuPDF.
includes = list()
pi = os.environ.get('PYMUPDF_INCLUDES')
+ mingw_prefix = os.getenv("MINGW_PREFIX", "/ucrt64")
+ includes.append(f'{mingw_prefix}/include')
+ includes.append(f'{mingw_prefix}/include/freetype2')
if pi:
includes += pi.split(':')
pmi = os.environ.get('PYMUPDF_MUPDF_INCLUDE')