101 lines
3.5 KiB
Bash
101 lines
3.5 KiB
Bash
# DVX, the DOS desktop JoeyLib's dvx port runs in: its SDK (the headers,
|
|
# sdk.mk and the host tools every DVX program is built with) and the runtime
|
|
# tree the gates and joey-run boot (dvx.exe with its libraries, widgets,
|
|
# programs, settings and system files). Copied from a built DVX tree, so the
|
|
# builds and the emulator runs never touch the DVX project itself.
|
|
#
|
|
# `install.sh --dvx-dir PATH` names the DVX tree (remembered); the default is
|
|
# a dvxgui checkout beside this repository. Rebuilding DVX there makes this
|
|
# component out of date, and `install dvx` copies it again.
|
|
|
|
compDescription="DVX: desktop runtime + SDK, copied from a DVX tree (--dvx-dir)"
|
|
# Optional: it needs a DVX tree of your own, so `all` and `toolchains` leave
|
|
# it out; `install dvx` (or toolchain:dvx) asks for it.
|
|
compGroups="toolchain:dvx optional"
|
|
compRequires="host djgpp"
|
|
compHostDeps=""
|
|
|
|
dvxDir="$(cat "$JOEY_STATE/dvxDir" 2>/dev/null || true)"
|
|
if [ -z "$dvxDir" ]; then
|
|
dvxDir="$(cd "$JOEY_REPO/.." && pwd)/dvxgui"
|
|
fi
|
|
dvxBin="$dvxDir/bin"
|
|
# What the runtime needs from bin/: not the host test tools (bin/host),
|
|
# the test modules, the link map, the log or the installer.
|
|
dvxRuntime="dvx.exe config system libs widgets apps"
|
|
dvxSdk="sdk"
|
|
|
|
|
|
# dvxListing -- every file copied, with its size and time: the pin, so a
|
|
# rebuilt DVX makes this component out of date.
|
|
dvxListing() {
|
|
local part
|
|
[ -d "$dvxBin" ] || return 0
|
|
for part in $dvxRuntime $dvxSdk; do
|
|
[ -e "$dvxBin/$part" ] || continue
|
|
find "$dvxBin/$part" -type f -printf '%P %s %T@\n'
|
|
done | sort
|
|
}
|
|
|
|
|
|
compPin="dir:$dvxDir:$(dvxListing | sha1sum | cut -d' ' -f1)"
|
|
|
|
|
|
compInstall() {
|
|
local part
|
|
[ -f "$dvxBin/dvx.exe" ] || die "$dvxDir is not a built DVX tree (no bin/dvx.exe); build DVX there, or point --dvx-dir at one"
|
|
[ -f "$dvxBin/$dvxSdk/sdk.mk" ] || die "$dvxDir has no SDK (bin/sdk/sdk.mk); build DVX there first"
|
|
rm -rf "$compDir"
|
|
mkdir -p "$compDir"
|
|
for part in $dvxRuntime $dvxSdk; do
|
|
[ -e "$dvxBin/$part" ] || die "$dvxBin/$part is missing; is the DVX build complete?"
|
|
cp -a "$dvxBin/$part" "$compDir/"
|
|
done
|
|
}
|
|
|
|
|
|
compInstalled() {
|
|
[ -f "$compDir/dvx.exe" ] &&
|
|
[ -f "$compDir/config/DVX.INI" ] &&
|
|
[ -f "$compDir/$dvxSdk/sdk.mk" ] &&
|
|
[ -x "$compDir/$dvxSdk/bin/dvxhlpc" ] &&
|
|
[ -x "$compDir/$dvxSdk/bin/dvxres" ]
|
|
}
|
|
|
|
|
|
# Build a one-window DVX program with the copied SDK and JoeyLib's DJGPP:
|
|
# proves the SDK, its host tools and the compiler work together.
|
|
compVerify() {
|
|
local tmp
|
|
local status=1
|
|
verifyLinked "$compDir/$dvxSdk/bin" || return 1
|
|
tmp="$(mktemp -d)"
|
|
cat > "$tmp/smoke.c" <<'EOF'
|
|
#include "dvxApp.h"
|
|
#include "shellApp.h"
|
|
|
|
int32_t appMain(DxeAppContextT *ctx);
|
|
|
|
SHELL_APP_DESCRIPTOR(.name = "Smoke", .hasMainLoop = false, .multiInstance = false, .stackSize = SHELL_STACK_DEFAULT, .priority = TS_PRIORITY_NORMAL);
|
|
|
|
|
|
int32_t appMain(DxeAppContextT *ctx) {
|
|
return dvxCreateWindowCentered(ctx->shellCtx, "Smoke", 200, 100, false) != NULL ? 0 : -1;
|
|
}
|
|
EOF
|
|
printf '.topic smoke.overview\n.title Smoke\n.toc 0 Smoke\n.default\n\n.h1 Smoke\n\nA test.\n' > "$tmp/smoke.dhs"
|
|
printf 'SDK_DIR = %s\nKIND = app\nNAME = smoke\ninclude $(SDK_DIR)/sdk.mk\n' "$compDir/$dvxSdk" > "$tmp/Makefile"
|
|
if make -s -C "$tmp" DJGPP_PREFIX="$JOEY_OPT/djgpp" > "$tmp/make.log" 2>&1 && [ -s "$tmp/smoke.app" ] && [ -s "$tmp/smoke.hlp" ]; then
|
|
status=0
|
|
else
|
|
cat "$tmp/make.log" >&2
|
|
fi
|
|
rm -rf "$tmp"
|
|
return $status
|
|
}
|
|
|
|
|
|
compEnv() {
|
|
envVar DVX_ROOT "$compDir"
|
|
envVar DVX_SDK "$compDir/$dvxSdk"
|
|
}
|