Index | Thread | Search

From:
Peter Hessler <phessler@theapt.org>
Subject:
fix textproc/calibre to respect MAKE_JOBS
To:
ports@openbsd.org
Date:
Sun, 12 Apr 2026 00:21:54 +0200

Download raw body.

Thread
  • Peter Hessler:

    fix textproc/calibre to respect MAKE_JOBS

This tells calibre to objec MAKE_JOBS when building, instead of eating
all known CPUs.

OK?


Index: Makefile
===================================================================
RCS file: /cvs/openbsd/ports/textproc/calibre/Makefile,v
diff -u -p -u -p -r1.111 Makefile
--- Makefile	20 Dec 2025 15:03:35 -0000	1.111
+++ Makefile	10 Apr 2026 18:25:40 -0000
@@ -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" \
Index: patches/patch-setup_build_py
===================================================================
RCS file: /cvs/openbsd/ports/textproc/calibre/patches/patch-setup_build_py,v
diff -u -p -u -p -r1.11 patch-setup_build_py
--- patches/patch-setup_build_py	12 Sep 2025 16:44:09 -0000	1.11
+++ patches/patch-setup_build_py	11 Apr 2026 22:14:04 -0000
@@ -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:
Index: patches/patch-setup_parallel_build_py
===================================================================
RCS file: patches/patch-setup_parallel_build_py
diff -N patches/patch-setup_parallel_build_py
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-setup_parallel_build_py	11 Apr 2026 22:04:45 -0000
@@ -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



-- 
The best book on programming for the layman is "Alice in Wonderland";
but that's because it's the best book on anything for the layman.