Use nproc and sysctl -n hw.cpu for default initializing CORES

This avoids having to pass --build-arg CORES=n when building the
docker images.
This commit is contained in:
Martin Storsjö committed 2018-11-09 22:20:34 +02:00
1 parent e0f186967a
commit 99e2fefc9d
9 files changed
+13 -7

No files matched your search

-2
View File
@@ -13,8 +13,6 @@ RUN git config --global user.name "LLVM MinGW" && \
WORKDIR /build
ARG CORES=4
ENV TOOLCHAIN_PREFIX=/opt/llvm-mingw
# Build and strip the LLVM installation
+1 -3
View File
@@ -22,8 +22,6 @@ ENV CROSS_TOOLCHAIN_PREFIX=/opt/llvm-mingw-$CROSS_ARCH
ENV EXEEXT=.exe
ENV HOST=$CROSS_ARCH-w64-mingw32
ARG CORES=4
COPY build-llvm.sh .
RUN ./build-llvm.sh $CROSS_TOOLCHAIN_PREFIX
COPY strip-llvm.sh .
@@ -47,7 +45,7 @@ RUN wget -q https://ftp.gnu.org/gnu/binutils/binutils-2.31.1.tar.xz && \
tar -Jxf binutils-2.31.1.tar.xz && \
cd binutils-2.31.1 && \
./configure --host=$HOST --target=x86_64-w64-mingw32 --prefix=/opt/binutils LDFLAGS="-Wl,-s" && \
make -j$CORES && \
make -j$(nproc) && \
make install && \
cp /opt/binutils/x86_64-w64-mingw32/bin/objcopy.exe $CROSS_TOOLCHAIN_PREFIX/bin/binutils-objcopy.exe && \
cp /opt/binutils/x86_64-w64-mingw32/bin/strip.exe $CROSS_TOOLCHAIN_PREFIX/bin/binutils-strip.exe
-2
View File
@@ -13,8 +13,6 @@ RUN git config --global user.name "LLVM MinGW" && \
WORKDIR /build
ARG CORES=4
ENV TOOLCHAIN_PREFIX=/opt/llvm-mingw
# Build LLVM
+2
View File
@@ -21,6 +21,8 @@ if [ -z "$PREFIX" ]; then
fi
export PATH=$PREFIX/bin:$PATH
: ${CORES:=$(nproc 2>/dev/null)}
: ${CORES:=$(sysctl -n hw.ncpu 2>/dev/null)}
: ${CORES:=4}
: ${ARCHS:=${TOOLCHAIN_ARCHS-i686 x86_64 armv7 aarch64}}
+2
View File
@@ -25,6 +25,8 @@ if [ -z "$PREFIX" ]; then
fi
export PATH=$PREFIX/bin:$PATH
: ${CORES:=$(nproc 2>/dev/null)}
: ${CORES:=$(sysctl -n hw.ncpu 2>/dev/null)}
: ${CORES:=4}
: ${ARCHS:=${TOOLCHAIN_ARCHS-i686 x86_64 armv7 aarch64}}
+2
View File
@@ -9,6 +9,8 @@ fi
PREFIX="$1"
export PATH=$PREFIX/bin:$PATH
: ${CORES:=$(nproc 2>/dev/null)}
: ${CORES:=$(sysctl -n hw.ncpu 2>/dev/null)}
: ${CORES:=4}
: ${ARCHS:=${TOOLCHAIN_ARCHS-i686 x86_64 armv7 aarch64}}
+2
View File
@@ -22,6 +22,8 @@ if [ -z "$PREFIX" ]; then
exit 1
fi
: ${CORES:=$(nproc 2>/dev/null)}
: ${CORES:=$(sysctl -n hw.ncpu 2>/dev/null)}
: ${CORES:=4}
if [ ! -d llvm ]; then
+2
View File
@@ -9,6 +9,8 @@ fi
PREFIX="$1"
export PATH=$PREFIX/bin:$PATH
: ${CORES:=$(nproc 2>/dev/null)}
: ${CORES:=$(sysctl -n hw.ncpu 2>/dev/null)}
: ${CORES:=4}
: ${ARCHS:=${TOOLCHAIN_ARCHS-i686 x86_64 armv7 aarch64}}
+2
View File
@@ -23,6 +23,8 @@ else
true
fi
: ${CORES:=$(nproc 2>/dev/null)}
: ${CORES:=$(sysctl -n hw.ncpu 2>/dev/null)}
: ${CORES:=4}
: ${ARCHS:=${TOOLCHAIN_ARCHS-i686 x86_64 armv7 aarch64}}