--- setup.py.orig	2021-02-10 08:43:57.000000000 -0600
+++ setup.py	2021-02-10 08:46:06.000000000 -0600
@@ -62,9 +62,9 @@
     extra_link_args += ["-lfftw3_threads"]
 
 # Only compile with OpenCV if exists (nice for the 'camera' G'MIC command :-D )
-if pkgconfig.exists("opencv"):
+if pkgconfig.exists("opencv4"):
     define_macros += [("cimg_use_opencv", None)]
-    pkgconfig_list += ["opencv"]
+    pkgconfig_list += ["opencv4"]
 
 packages = pkgconfig.parse(" ".join(pkgconfig_list))
 libraries = packages["libraries"] + [
@@ -73,10 +73,10 @@
 
 library_dirs = packages["library_dirs"] + [here, gmic_src_path]
 if sys.platform == "darwin":
-    library_dirs += ["/usr/local/opt/llvm@6/lib"]
+    library_dirs += ["%PREFIX%/libexec/llvm-9.0/lib"]
 include_dirs = packages["include_dirs"] + [here, gmic_src_path]
 if sys.platform == "darwin":
-    include_dirs += ["/usr/local/opt/llvm@6/include"]
+    include_dirs += ["%PREFIX%/libexec/llvm-9.0/include"]
 # Debugging is now set through --global-option --debug and more.
 # debugging_args = [
 #     "-O0",
@@ -94,12 +94,14 @@
     extra_link_args += ["-flto"]
 
 if sys.platform == "darwin":
-    extra_compile_args += ["-fopenmp", "-stdlib=libc++"]
+    extra_compile_args += ["-Xpreprocessor", "-fopenmp", "-stdlib=libc++"]
     extra_link_args += [
         "-lomp",
         "-nodefaultlibs",
         "-lc++",
     ]  # options inspired by https://github.com/explosion/spaCy/blob/master/setup.py
+    library_dirs += ["%PREFIX%/lib/libomp"]
+    include_dirs += ["%PREFIX%/include/libomp"]
 elif sys.platform == "linux":  # Enable openmp for 32bit & 64bit linuxes
     extra_compile_args += ["-fopenmp"]
     extra_link_args += ["-lgomp"]
