--- setupext.py.orig 2022-08-10 22:00:22.000000000 -0400 +++ setupext.py 2022-08-17 21:46:17.000000000 -0400 @@ -391,6 +391,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 @@ -401,6 +402,7 @@ "linux": ["dl"], "win32": ["ole32", "shell32", "user32"], }.get(sys.platform, []))) + add_macports_flags(ext) yield ext # contour ext = Extension( @@ -410,6 +412,7 @@ "src/py_converters.cpp", ]) add_numpy_flags(ext) + add_macports_flags(ext) add_libagg_flags(ext) yield ext # ft2font @@ -421,6 +424,7 @@ ]) FreeType.add_flags(ext) add_numpy_flags(ext) + add_macports_flags(ext) add_libagg_flags(ext) yield ext # image @@ -430,6 +434,7 @@ "src/py_converters.cpp", ]) add_numpy_flags(ext) + add_macports_flags(ext) add_libagg_flags_and_sources(ext) yield ext # path @@ -439,6 +444,7 @@ "src/_path_wrapper.cpp", ]) add_numpy_flags(ext) + add_macports_flags(ext) add_libagg_flags_and_sources(ext) yield ext # qhull @@ -446,6 +452,7 @@ "matplotlib._qhull", ["src/qhull_wrap.cpp"], define_macros=[("MPL_DEVNULL", os.devnull)]) add_numpy_flags(ext) + add_macports_flags(ext) Qhull.add_flags(ext) yield ext # tkagg @@ -459,6 +466,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 @@ -468,6 +476,7 @@ "src/tri/_tri_wrapper.cpp", ]) add_numpy_flags(ext) + add_macports_flags(ext) yield ext # ttconv ext = Extension( @@ -479,9 +488,11 @@ ], include_dirs=["extern"]) add_numpy_flags(ext) + add_macports_flags(ext) yield ext + class Tests(OptionalPackage): name = "tests" default_config = False @@ -501,6 +512,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 ext.include_dirs.append(np.get_include()) @@ -771,4 +787,5 @@ 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