--- pipcl.py 2024-04-18 02:21:23.000000000 +0800 +++ pipcl.py 2024-05-25 07:40:42.000000000 +0800 @@ -1533,12 +1533,13 @@ if optimise: general_flags += ' -O2 -DNDEBUG' + loadable_module_flag = '-shared' if darwin(): - # MacOS's linker does not like `-z origin`. - rpath_flag = "-Wl,-rpath,@loader_path/" + rpath_flag = '' # Avoid `Undefined symbols for ... "_PyArg_UnpackTuple" ...'. general_flags += ' -undefined dynamic_lookup' + loadable_module_flag = '-bundle' elif pyodide(): # Setting `-Wl,-rpath,'$ORIGIN',-z,origin` gives: # emcc: warning: ignoring unsupported linker flag: `-rpath` [-Wlinkflags] @@ -1595,7 +1596,7 @@ command = f''' {command} -fPIC - -shared + {loadable_module_flag} {general_flags.strip()} {pythonflags.includes} {includes_text} @@ -1962,6 +1963,7 @@ List of paths of shared libraries; these have typically been specified with `-l` when `library` was created. ''' + return log2( f'macos_patch(): library={library} sublibraries={sublibraries}') if not darwin(): return diff --git setup.py setup.py index 4563dc197d7f..d5f1c4ccb1d7 100755 --- setup.py +++ setup.py @@ -1005,7 +1005,7 @@ libraries = f'{mupdf_local}\\platform\\{infix}\\{wp.cpu.windows_subdir}{build_type_infix}\\{libs}' compiler_extra = '' else: - libs = ['mupdf'] + libs = ['mupdf', 'freetype'] defines = None compiler_extra += ( ' -Wall' @@ -1169,23 +1169,6 @@ ''' ret = list() ret.append('setuptools') - libclang = os.environ.get('PYMUPDF_SETUP_LIBCLANG') - if libclang: - print(f'Overriding to use {libclang=}.') - ret.append(libclang) - elif openbsd: - print(f'OpenBSD: libclang not available via pip; assuming `pkg_add py3-llvm`.') - elif darwin and platform.machine() == 'arm64': - print(f'MacOS/arm64: forcing use of libclang 16.0.6 because 18.1.1 known to fail with `clang.cindex.TranslationUnitLoadError: Error parsing translation unit.`') - ret.append('libclang==16.0.6') - else: - ret.append('libclang') - if msys2: - print(f'msys2: pip install of swig does not build; assuming `pacman -S swig`.') - elif openbsd: - print(f'OpenBSD: pip install of swig does not build; assuming `pkg_add swig`.') - else: - ret.append( 'swig') return ret