Commit fc192ca2c10bc9f52f93d6c8a9339404f8ad5c79

Thomas de Grivel 2023-02-14T13:49:08

parallel build

diff --git a/share/shpkg/shpkg.subr b/share/shpkg/shpkg.subr
index d56f97c..1a7fd34 100644
--- a/share/shpkg/shpkg.subr
+++ b/share/shpkg/shpkg.subr
@@ -163,6 +163,7 @@ shpkg_config () {
     else
         SHPKG_NCPU=1
     fi
+    verbose -n 2 "Detected ${SHPKG_NCPU} CPU cores."
     # SHA256
     if which sha256 >/dev/null 2>&1; then
         SHPKG_SHA256=sha256
@@ -378,9 +379,9 @@ shpkg_build () {
             SHPKG_REPO_VERSION="$(shpkg_version "${SHPKG_REPO}")"
             if [ -f "${SHPKG_REPO_SRC_DIR}/Makefile" ]; then
 		( verbose 1 cd "${SHPKG_REPO_SRC_DIR}" &&
-                      verbose 1 make; )
+                      verbose 1 make -j "{SHPKG_NCPU}"; )
             elif [ -f "${SHPKG_SRC_DIR}/${SHPKG_REPO_DIR}/CMakeLists.txt" ]; then
-		cmake --build "${SHPKG_REPO_OBJ_DIR}"
+		cmake -j "{SHPKG_NCPU}" --build "${SHPKG_REPO_OBJ_DIR}"
             fi
             shpkg__tag_write build-done
 	fi