--- setupext.py.orig 2023-02-22 11:42:35 +++ setupext.py 2024-01-10 14:48:42 @@ -399,6 +399,7 @@ "src/_backend_agg_wrapper.cpp", ]) add_numpy_flags(ext) + add_macports_flags(ext) add_libagg_flags_and_sources(ext) FreeType.add_flags(ext) yield ext @@ -409,6 +410,7 @@ "linux": ["dl"], "win32": ["ole32", "shell32", "user32"], }.get(sys.platform, []))) + add_macports_flags(ext) yield ext # ft2font ext = Extension( @@ -419,6 +421,7 @@ ]) FreeType.add_flags(ext) add_numpy_flags(ext) + add_macports_flags(ext) add_libagg_flags(ext) yield ext # image @@ -428,6 +431,7 @@ "src/py_converters.cpp", ]) add_numpy_flags(ext) + add_macports_flags(ext) add_libagg_flags_and_sources(ext) yield ext # path @@ -437,6 +441,7 @@ "src/_path_wrapper.cpp", ]) add_numpy_flags(ext) + add_macports_flags(ext) add_libagg_flags_and_sources(ext) yield ext # qhull @@ -444,6 +449,7 @@ "matplotlib._qhull", ["src/_qhull_wrapper.cpp"], define_macros=[("MPL_DEVNULL", os.devnull)]) add_numpy_flags(ext) + add_macports_flags(ext) Qhull.add_flags(ext) yield ext # tkagg @@ -457,6 +463,7 @@ "cygwin": ["comctl32", "psapi"]}.get(sys.platform, []), extra_link_args={"win32": ["-mwindows"]}.get(sys.platform, [])) add_numpy_flags(ext) + add_macports_flags(ext) add_libagg_flags(ext) yield ext # tri @@ -466,6 +473,7 @@ "src/tri/_tri_wrapper.cpp", ], cxx_std=11) + add_macports_flags(ext) yield ext # ttconv ext = Extension( @@ -477,6 +485,7 @@ ], include_dirs=["extern"]) add_numpy_flags(ext) + add_macports_flags(ext) yield ext @@ -504,6 +513,11 @@ ] } + +def add_macports_flags(ext): + mp_cxxflags = os.getenv('CXXFLAGS').split() + print(f"MacPorts CXXFLAGS = {mp_cxxflags}") + ext.extra_compile_args.extend(mp_cxxflags) def add_numpy_flags(ext): import numpy as np @@ -796,8 +810,8 @@ 'matplotlib.backends._macosx', [ 'src/_macosx.m' ]) - ext.extra_compile_args.extend(['-Werror']) ext.extra_link_args.extend(['-framework', 'Cocoa']) if platform.python_implementation().lower() == 'pypy': ext.extra_compile_args.append('-DPYPY=1') + add_macports_flags(ext) yield ext