Index: setup/build.py
--- setup/build.py.orig
+++ setup/build.py
@@ -256,8 +256,8 @@ def init_env(debug=False, sanitize=False, compiling_fo
     platform_name = 'linux'
     dest_ext = '.so'
     if isunix:
-        cc = os.environ.get('CC', 'gcc')
-        cxx = os.environ.get('CXX', 'g++')
+        cc = os.environ.get('CC', '${CC}')
+        cxx = os.environ.get('CXX', '${CXX}')
         debug = '-ggdb' if debug else ''
         cflags = os.environ.get('OVERRIDE_CFLAGS',
             f'-Wall -DNDEBUG {debug} -fno-strict-aliasing -pipe -O3')
@@ -283,6 +283,8 @@ def init_env(debug=False, sanitize=False, compiling_fo
     if isbsd:
         cflags.append('-pthread')
         ldflags.append('-shared')
+        cflags.append('-I${PREFIX}/include')
+        ldflags.append('-L${PREFIX}/lib')
 
     if ishaiku:
         cflags.append('-lpthread')
@@ -726,6 +729,7 @@ sip-file = {os.path.basename(sipf)!r}
 
     def build_pyqt_extension(self, ext, sbf):
         self.info(f'\n####### Building {ext.name} extension', '#'*7)
+        cpu_count = os.environ.get('MAKE_JOBS', '1')
         src_dir = os.path.dirname(sbf)
         cwd = os.getcwd()
         try:
@@ -733,7 +737,7 @@ sip-file = {os.path.basename(sipf)!r}
             env = os.environ.copy()
             if is_macos_universal_build:
                 env['ARCHS'] = 'x86_64 arm64'
-            self.check_call([self.env.make] + ([] if iswindows else [f'-j{os.cpu_count() or 1}']), env=env)
+            self.check_call([self.env.make] + ([] if iswindows else [f'-j{cpu_count or 1}']), env=env)
             e = 'pyd' if iswindows else 'so'
             m = glob.glob(f'{ext.name}/{ext.name}.*{e}')
             if not m:
