Skip to content
This repository was archived by the owner on Jan 1, 2024. It is now read-only.

Commit bb6862d

Browse files
committed
cpu counting for faster builds (hopefully)
1 parent df461f1 commit bb6862d

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

Dockerfile

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ RUN \
5656
ln -s /usr/lib/libftdi1.a /usr/lib/libftdi.a && \
5757
ln -s /usr/include/libftdi1/ftdi.h /usr/include/ftdi.h && \
5858

59+
5960
# build telldus-core
6061
mkdir -p \
6162
/tmp/telldus-core && \
@@ -104,8 +105,22 @@ RUN \
104105
-DUSE_STATIC_LIBSTDCXX=OFF \
105106
-DUSE_STATIC_OPENZWAVE=OFF \
106107
-Wno-dev && \
107-
make && \
108+
# attempt to set number of cores available for make to use
109+
set -ex && \
110+
CPU_CORES=$( < /proc/cpuinfo grep -c processor ) || echo "failed cpu look up" && \
111+
if echo $CPU_CORES | grep -E -q '^[0-9]+$'; then \
112+
: ;\
113+
if [ "$CPU_CORES" -gt 7 ]; then \
114+
CPU_CORES=$(( CPU_CORES - 3 )); \
115+
elif [ "$CPU_CORES" -gt 5 ]; then \
116+
CPU_CORES=$(( CPU_CORES - 2 )); \
117+
elif [ "$CPU_CORES" -gt 3 ]; then \
118+
CPU_CORES=$(( CPU_CORES - 1 )); fi \
119+
else CPU_CORES="1"; fi && \
120+
121+
make -j $CPU_CORES && \
108122
make install && \
123+
set +ex && \
109124

110125
# determine runtime packages
111126
RUNTIME_PACKAGES="$( \

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ The user manual is available at [www.domoticz.com][appurl]
106106

107107
## Versions
108108

109+
+ **26.11.2017:** Use cpu core counting routine to speed up build time.
109110
+ **28.05.2017:** Rebase to alpine 3.6.
110111
+ **26.02.2017:** Add curl and replace openssl with libressl.
111112
+ **11.02.2017:** Update README.

0 commit comments

Comments
 (0)