- cdtest takes one lock around release, iso and the VM test; the nested make calls reuse it through BUILD_LOCK_HELD (re-entrant). MAKE_CMD keeps make -n cdtest from executing the recipe: GNU make runs a recipe with $(MAKE) even under -n, and the rest of the line starts a VM. - mcde-linux and mcde-host take the lock too; they read ext/src/mcde and the distfiles a release reads. - build-lock.sh: --held for the tools, --check for read-only callers, pid plus process start time for stale locks, the child is killed on INT/TERM, and nested calls reuse the outer lock. - build-stamp, cd2, cd3, cd-source, images, srctree-stage, userland, mcde-linux and mcde-host refuse to run outside the lock (the file and the message name the way in: make or tools/build-lock.sh).
86 lines
3.1 KiB
Bash
Executable File
86 lines
3.1 KiB
Bash
Executable File
#!/bin/sh
|
|
# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
|
|
#
|
|
# mcde-linux.sh -- build MCDE natively on the (Linux) build host, for development
|
|
#
|
|
# usage: tools/mcde-linux.sh [install [SUBDIR ...] | check SUBDIR ... | plist | SUBDIR ...]
|
|
# (make mcde-linux [MCDE_DIRS="install programs/dtfile"])
|
|
# plist: tools/mcde-plist-check.sh -- every file this tree installs is in
|
|
# the PLIST (no build; needs the build `make mcde-linux' made)
|
|
#
|
|
# MCDE runs on Linux as well as on NetBSD (ext/src/mcde/AGENTS.md), so the host
|
|
# that builds Makronix can build and run it directly: fast turns for work on
|
|
# the desktop, screenshots under Xvfb. This is not how Makronix gets MCDE --
|
|
# that is pkgsrc (ext/src/mcde/pkgsrc) -- and nothing here goes into a set.
|
|
#
|
|
# The working tree of ext/src/mcde (with uncommitted edits, without pkgsrc/) is
|
|
# copied to build/mcde-linux; autogen.sh and configure run again when
|
|
# configure.ac or a Makefile.am is newer than config.status; then make, in the
|
|
# whole tree or only in the SUBDIRs given (e.g. programs/dtfile). The result
|
|
# is installed only with "install": make install into build/mcde-root/dt, so
|
|
# that the programs find their data types, icons and app-defaults when run from
|
|
# there (under Xvfb, for screenshots).
|
|
#
|
|
# The last line of the output is "mcde-linux exit=N".
|
|
|
|
set -u
|
|
|
|
TOP=$(cd "$(dirname "$0")/.." && pwd)
|
|
# This tool writes build/obj or releasedir: only inside the build lock.
|
|
if [ -z "${BUILD_LOCK_HELD:-}" ] || [ ! -d "$BUILD_LOCK_HELD" ]; then
|
|
echo "${0##*/}: run this through make or tools/build-lock.sh" >&2
|
|
exit 1
|
|
fi
|
|
|
|
SRC=$TOP/ext/src/mcde
|
|
B=$TOP/build/mcde-linux
|
|
JOBS=${JOBS:-8}
|
|
|
|
finish() { echo "mcde-linux exit=$1"; exit "$1"; }
|
|
|
|
mkdir -p "$B"
|
|
rsync -a --exclude=/pkgsrc "$SRC/" "$B/" || finish 1
|
|
|
|
cd "$B" || finish 1
|
|
if [ ! -f config.status ] ||
|
|
[ -n "$(find . -name configure.ac -newer config.status -o \
|
|
-name Makefile.am -newer config.status | head -1)" ]; then
|
|
./autogen.sh || finish 1
|
|
# every system path below build/: this host may run a CDE of its own
|
|
# (/etc/pam.d/dtlogin, /etc/dt), and a development build never touches it
|
|
R=$TOP/build/mcde-root
|
|
./configure --prefix="$R/dt" --sysconfdir="$R/etc" \
|
|
--localstatedir="$R/var" --with-config-dir="$R/etc/dt" \
|
|
--with-logfiles-dir="$R/var/dt" --with-pamdir="$R/etc/pam.d" \
|
|
--with-calendar-dir="$R/var/spool/calendar" ||
|
|
finish 1
|
|
fi
|
|
|
|
if [ $# -eq 0 ]; then
|
|
nice -n 19 make -j"$JOBS" || finish $?
|
|
elif [ "$1" = install ] && [ $# -eq 1 ]; then
|
|
nice -n 19 make -j"$JOBS" || finish $?
|
|
make install || finish $?
|
|
elif [ "$1" = plist ] && [ $# -eq 1 ]; then
|
|
# not a build: do the files this tree installs appear in the PLIST of
|
|
# ext/src/mcde/pkgsrc (what pkgsrc's check would stop on, hours later)?
|
|
"$TOP/tools/mcde-plist-check.sh"
|
|
finish $?
|
|
elif [ "$1" = check ]; then
|
|
shift
|
|
for d in "$@"; do
|
|
make -C "$d" check || finish $?
|
|
done
|
|
elif [ "$1" = install ]; then
|
|
shift
|
|
for d in "$@"; do
|
|
nice -n 19 make -j"$JOBS" -C "$d" || finish $?
|
|
make -C "$d" install || finish $?
|
|
done
|
|
else
|
|
for d in "$@"; do
|
|
nice -n 19 make -j"$JOBS" -C "$d" || finish $?
|
|
done
|
|
fi
|
|
finish 0
|