Files
fpc-msgbase/build.sh
Ken Johnson 95b7a529ef Introduce mb.version + CHANGELOG; bump to 0.5.1
Process gap fix.  Up to today the library had no version constant
and no git tags -- downstream consumers were pinning commit
hashes, which is fragile (any force-push or rebase invalidates
the pin silently, and the hash doesn't convey "breaking" vs
"patch").  Two pieces land together:

  src/mb.version.pas  MB_VERSION = '0.5.1' + split major/minor/patch
                      constants.  Included from build.sh so every
                      target gets it.
  CHANGELOG.md        Index of prior milestones (0.3.0 through 0.5.0)
                      with the commit each one maps to, and the
                      release notes for 0.5.1 (today's security-
                      hardening round).

Retroactive tags follow in the next invocation.  Going forward:
every release bumps MB_VERSION and places a matching v<ver> tag
in the same commit.

README "Status" section now points consumers at CHANGELOG.md and
the v0.5.1 tag.
2026-04-19 15:16:24 -07:00

148 lines
3.9 KiB
Bash
Executable File

#!/bin/bash
#
# build.sh — build fpc-msgbase units for every supported target.
#
# Targets:
# x86_64-linux native
# i386-go32v2 DOS / DPMI
# i386-os2 OS/2
# i386-win32 Windows 32-bit
# i386-linux Linux 32-bit
# i386-freebsd FreeBSD 32-bit
#
# Usage: ./build.sh [target ...]
# (no args -> build everything)
set -e
FPCBASE=/opt/fpcup/fpc
FPCNATIVE=$FPCBASE/bin/x86_64-linux/fpc
PPCROSS386=$FPCBASE/bin/x86_64-linux/ppcross386
# Units we actually want to build. When new public units land in src/,
# add them here (in dependency order).
UNITS=(
src/mb.version.pas
src/mb.types.pas
src/mb.events.pas
src/mb.lock.pas
src/mb.paths.pas
src/mb.kludge.pas
src/mb.api.pas
src/formats/mb.fmt.hudson.pas
src/formats/mb.fmt.hudson.uni.pas
src/formats/mb.fmt.jam.pas
src/formats/mb.fmt.jam.uni.pas
src/formats/mb.fmt.squish.pas
src/formats/mb.fmt.squish.uni.pas
src/formats/mb.fmt.msg.pas
src/formats/mb.fmt.msg.uni.pas
src/formats/mb.fmt.pcboard.pas
src/formats/mb.fmt.pcboard.uni.pas
src/formats/mb.fmt.ezycom.pas
src/formats/mb.fmt.ezycom.uni.pas
src/formats/mb.fmt.goldbase.pas
src/formats/mb.fmt.goldbase.uni.pas
src/formats/mb.fmt.wildcat.pas
src/formats/mb.fmt.wildcat.uni.pas
examples/example_read.pas
examples/example_write.pas
)
ALL_TARGETS=(
x86_64-linux
i386-go32v2
i386-os2
i386-win32
i386-linux
i386-freebsd
)
if [ $# -eq 0 ]; then
TARGETS=("${ALL_TARGETS[@]}")
else
TARGETS=("$@")
fi
cd "$(dirname "$0")"
for tgt in "${TARGETS[@]}"; do
cpu="${tgt%%-*}"
os="${tgt##*-}"
case "$cpu" in
x86_64) compiler=$FPCNATIVE ;;
i386) compiler=$PPCROSS386 ;;
*) echo "unknown CPU $cpu"; exit 1 ;;
esac
mkdir -p "units/$tgt" "exe/$tgt"
# Per-target binutils directories so cross-linking finds the
# right ld / as / etc.
BINUTILS=()
case "$tgt" in
x86_64-linux)
: ;;
i386-linux)
BINUTILS+=("-FD/opt/fpcup/cross/bin/i386-linux"
"-XPi386-linux-"
"-Fl/opt/fpcup/cross/lib/i386-linux") ;;
i386-freebsd)
BINUTILS+=("-FD/opt/fpcup/cross/bin/i386-freebsd"
"-XPi386-freebsd12-"
"-Fl/opt/fpcup/cross/lib/i386-freebsd") ;;
x86_64-freebsd)
BINUTILS+=("-FD/opt/fpcup/cross/bin/x86_64-freebsd"
"-XPx86_64-freebsd12-"
"-Fl/opt/fpcup/cross/lib/x86_64-freebsd") ;;
i386-go32v2|i386-win32)
BINUTILS+=("-FD/opt/fpcup/cross/bin" "-XP$tgt-") ;;
i386-os2)
# EMX a.out linker needs entry point at TEXT_BASE (0x10000).
BINUTILS+=(
"-FD/opt/fpcup/cross/i386-pc-os2-emx"
"-XPi386-emx-"
"-k-e" "-k0x10000"
) ;;
esac
# Build search paths (rtl always present; the rest are optional).
SEARCH=(
"-Fu/opt/fpcup/fpc/units/$tgt/rtl"
)
for sub in fcl-base rtl-objpas regexpr; do
if [ -d "/opt/fpcup/fpc/units/$tgt/$sub" ]; then
SEARCH+=("-Fu/opt/fpcup/fpc/units/$tgt/$sub")
fi
done
# Library source roots
SEARCH+=(
"-Fusrc"
"-Fusrc/formats"
"-Fusrc/wc_sdk"
)
echo "=== $tgt ==="
for u in "${UNITS[@]}"; do
printf ' %-30s ' "$(basename "$u")"
if "$compiler" -Mobjfpc -Sh -Sgic -T"$os" \
"${BINUTILS[@]}" \
"${SEARCH[@]}" \
-FUunits/"$tgt" -FEexe/"$tgt" \
"$u" >/tmp/ma_build.$$.log 2>&1; then
echo "OK"
else
echo "FAIL"
cat /tmp/ma_build.$$.log | sed 's/^/ /'
rm -f /tmp/ma_build.$$.log
exit 1
fi
done
rm -f /tmp/ma_build.$$.log
done
echo
echo "All targets built."