@@ -384,7 +384,7 @@ def get_extensions(self):
384
384
])
385
385
add_numpy_flags (ext )
386
386
add_libagg_flags_and_sources (ext )
387
- FreeType () .add_flags (ext )
387
+ FreeType .add_flags (ext )
388
388
yield ext
389
389
# c_internal_utils
390
390
ext = Extension (
@@ -412,7 +412,7 @@ def get_extensions(self):
412
412
"src/mplutils.cpp" ,
413
413
"src/py_converters.cpp" ,
414
414
])
415
- FreeType () .add_flags (ext )
415
+ FreeType .add_flags (ext )
416
416
add_numpy_flags (ext )
417
417
add_libagg_flags (ext )
418
418
yield ext
@@ -441,7 +441,7 @@ def get_extensions(self):
441
441
"matplotlib._qhull" , ["src/qhull_wrap.c" ],
442
442
define_macros = [("MPL_DEVNULL" , os .devnull )])
443
443
add_numpy_flags (ext )
444
- add_qhull_flags (ext )
444
+ Qhull . add_flags (ext )
445
445
yield ext
446
446
# tkagg
447
447
ext = Extension (
@@ -550,17 +550,6 @@ def add_libagg_flags_and_sources(ext):
550
550
os .path .join ("extern" , "agg24-svn" , "src" , x ) for x in agg_sources )
551
551
552
552
553
- def add_qhull_flags (ext ):
554
- if options .get ("system_qhull" ):
555
- ext .libraries .append ("qhull" )
556
- else :
557
- qhull_path = Path (f'build/qhull-{ LOCAL_QHULL_VERSION } /src' )
558
- ext .include_dirs .insert (0 , str (qhull_path ))
559
- ext .sources .extend (map (str , sorted (qhull_path .glob ('libqhull_r/*.c' ))))
560
- if sysconfig .get_config_var ("LIBM" ) == "-lm" :
561
- ext .libraries .extend ("m" )
562
-
563
-
564
553
# First compile checkdep_freetype2.c, which aborts the compilation either
565
554
# with "foo.h: No such file or directory" if the header is not found, or an
566
555
# appropriate error message if the header indicates a too-old version.
@@ -569,7 +558,8 @@ def add_qhull_flags(ext):
569
558
class FreeType (SetupPackage ):
570
559
name = "freetype"
571
560
572
- def add_flags (self , ext ):
561
+ @classmethod
562
+ def add_flags (cls , ext ):
573
563
ext .sources .insert (0 , 'src/checkdep_freetype2.c' )
574
564
if options .get ('system_freetype' ):
575
565
pkg_config_setup_extension (
@@ -686,6 +676,36 @@ def do_custom_build(self, env):
686
676
shutil .copy2 (lib_path , src_path / "objs/.libs/libfreetype.lib" )
687
677
688
678
679
+ class Qhull (SetupPackage ):
680
+ name = "qhull"
681
+ _extensions_to_update = []
682
+
683
+ @classmethod
684
+ def add_flags (cls , ext ):
685
+ if options .get ("system_qhull" ):
686
+ ext .libraries .append ("qhull_r" )
687
+ else :
688
+ cls ._extensions_to_update .append (ext )
689
+
690
+ def do_custom_build (self , env ):
691
+ if options .get ('system_qhull' ):
692
+ return
693
+
694
+ toplevel = get_and_extract_tarball (
695
+ urls = ["http://www.qhull.org/download/qhull-2020-src-8.0.2.tgz" ],
696
+ sha = "b5c2d7eb833278881b952c8a52d20179eab87766b00b865000469a45c1838b7e" ,
697
+ dirname = f"qhull-{ LOCAL_QHULL_VERSION } " ,
698
+ )
699
+ shutil .copyfile (toplevel / "COPYING.txt" , "LICENSE/LICENSE_QHULL" )
700
+
701
+ for ext in self ._extensions_to_update :
702
+ qhull_path = Path (f'build/qhull-{ LOCAL_QHULL_VERSION } /src' )
703
+ ext .include_dirs .insert (0 , str (qhull_path ))
704
+ ext .sources .extend (map (str , sorted (qhull_path .glob ('libqhull_r/*.c' ))))
705
+ if sysconfig .get_config_var ("LIBM" ) == "-lm" :
706
+ ext .libraries .extend ("m" )
707
+
708
+
689
709
class BackendMacOSX (OptionalPackage ):
690
710
config_category = 'gui_support'
691
711
name = 'macosx'
0 commit comments