make sure calibre's build process obeys MAKE_JOBS, instead of eating

all known CPUs.

OK sthen@
This commit is contained in:
phessler
2026-04-13 05:44:26 +00:00
parent 088b622be4
commit 6d882d9e98
3 changed files with 31 additions and 1 deletions
+2 -1
View File
@@ -1,7 +1,7 @@
COMMENT = ebook management application
V = 8.0.1
REVISION = 0
REVISION = 1
DISTNAME = calibre-$V
CATEGORIES = textproc
@@ -81,6 +81,7 @@ LDFLAGS += -L${LOCALBASE}/lib
MAKE_ENV += CALIBRE_PY3_PORT=1 \
FT_LIB_DIR="${X11BASE}/lib" \
LDFLAGS="${LDFLAGS}" \
MAKE_JOBS=${MAKE_JOBS} \
OVERRIDE_CFLAGS="${CFLAGS}" \
OVERRIDE_LDFLAGS="${LDFLAGS}" \
PODOFO_INC_DIR="${LOCALBASE}/include/podofo" \
@@ -21,3 +21,20 @@ Index: setup/build.py
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:
@@ -0,0 +1,12 @@
Index: setup/parallel_build.py
--- setup/parallel_build.py.orig
+++ setup/parallel_build.py
@@ -22,6 +22,8 @@ Job = namedtuple('Job', 'cmd human_text cwd')
cpu_count = min(16, max(1, os.cpu_count()))
+# let MAKE_JOBS override how many cpus are used
+cpu_count = min(cpu_count, int(os.environ.get('MAKE_JOBS', 1)))
def run_worker(job, decorate=True):
cmd, human_text = job.cmd, job.human_text