view more/buildall.sh @ 1786:0787ceb820bf draft 1.4.2

When x86-64 switched on NPTL in uClibc, distcc broke, and it turns out fully native compiles under qemu never worked due to qemu not quite emulating floating point right and confusing the perl build with zero not comparing equal to zero. As long as it's broken anyway, switch it over to musl and fix it up on that side. It's no longer worth trying to fix anything broken in uClibc, the project is dead. (I'm aware of uClibc-ng, and am treating it exactly the same way I treated the ecommstation reboot of OS/2.)
author Rob Landley <rob@landley.net>
date Fri, 11 Sep 2015 13:25:14 -0500
parents f0315ac24c40
children
line wrap: on
line source

#!/bin/bash

# Build every target architecture, saving log files to build/log.
# If $FORK is set, build them in parallel.

. sources/utility_functions.sh || exit 1

[ -z "$CROSS_COMPILER_HOST" ] && export CROSS_COMPILER_HOST=i686

trap "killtree $$" EXIT

# Build the host architecture.  This has to be built first so the other
# architectures can canadian cross static compilers to run on the host using
# this toolchain to link against a host version of uClibc.

# This also performs the download.sh and host-tools.sh steps, which don't
# parallelize well if many build.sh instances try to call them at once.

# If this fails, don't bother trying to build the other targets.

[ -z "$NO_CLEAN" ] && blank_tempdir build

mkdir -p build/logs &&
(EXTRACT_ALL=1 ./download.sh 2>&1 &&
 more/record-commands.sh &&
 ./host-tools.sh 2>&1 &&
 more/record-commands.sh &&
 ./simple-cross-compiler.sh "$CROSS_COMPILER_HOST" 2>&1 ||
 dienow) | tee build/logs/build-host-cc.txt | maybe_quiet

cp packages/MANIFEST build || dienow

# Adjust $CPUS so as not to overload the machine, max 2 build processes
# per gigabyte of RAM

if [ ! -z "$FORK" ] && [ -z "$CPUS" ]
then
  MEGS=$(($(awk '/MemTotal:/{print $2}' /proc/meminfo)/1024))
  TARGET_COUNT=$(find sources/targets -maxdepth 1 -type f | wc -l)
  export CPUS=$(($MEGS/($TARGET_COUNT*512)))
  [ "$CPUS" -lt 1 ] && CPUS=1
fi

# Build all non-hw targets, possibly in parallel

more/for-each-target.sh \
  './build.sh $TARGET 2>&1 | tee build/logs/build-${TARGET}.txt'

# Run smoketest.sh for each non-hw target.

more/for-each-target.sh \
  'more/smoketest.sh $TARGET 2>&1 | tee build/logs/smoketest-$TARGET.txt'

# If we have a control image, build natively

for i in "$@"
do
  more/buildall-native.sh "$1"
done

more/smoketest-report.sh | tee build/logs/status.txt