joeylib2/installer/components/beosR5.sh

66 lines
2.1 KiB
Bash

# shellcheck shell=bash
# Part of JoeyLib, Copyright (c) 2026 Scott Duensing, under the MIT License.
# See LICENSE.md for license information.
# SPDX-License-Identifier: MIT
#
# BeOS R5's own headers and libraries (make beos), copied from the x86
# system on your BeOS 5 Professional CD (installer/lib/beos.sh): the
# Development package's headers and start files and the system libraries,
# into toolchains/opt/beosR5/sysroot. The compiler is
# Haiku's gcc 2.95 (component haikuGcc2), the BeOS ABI;
# make/support/be/gcc2.sh points it at this sysroot.
compDescription="toolchain: BeOS R5 headers + libraries from your BeOS 5 Pro CD (beos; private media: import)"
compGroups="toolchain:beos"
compRequires="haikuGcc2 haikuTools"
compHostDeps="python3"
# shellcheck source=installer/lib/beos.sh
source "$JOEY_INSTALLER/lib/beos.sh"
# What the sysroot is made of, as "path on the CD -> folder in sysroot".
beosSysrootParts=(
"_packages_/Development/develop/headers headers"
"_packages_/Development/develop/lib develop-lib"
"beos/system/lib system-lib"
)
compInstall() {
local build
local part
local from
local to
local sysroot
build="$(freshBuildDir "$compId")"
beosSystemVolume "$build/system.bfs"
rm -rf "$compDir"
mkdir -p "$compDir/sysroot"
# bfs_shell takes host paths whole.
sysroot="$(cd "$compDir/sysroot" && pwd)"
for part in "${beosSysrootParts[@]}"; do
read -r from to <<< "$part"
printf 'cp -r /myfs/%s :%s\n' "$from" "$sysroot/$to"
done | beosBfs "$build/system.bfs" > "$build/bfs.log" 2>&1
compInstalled || die "the BeOS sysroot is incomplete; bfs_shell's log: $build/bfs.log"
dropBuildDir "$compId"
}
compInstalled() {
[ -f "$compDir/sysroot/headers/be/AppKit.h" ] &&
[ -f "$compDir/sysroot/system-lib/libbe.so" ] &&
[ -f "$compDir/sysroot/develop-lib/x86/start_dyn.o" ]
}
compVerify() {
compInstalled
}
compEnv() {
envVar BEOS_R5_SYSROOT "$compDir/sysroot"
}
# The CD and the steps that read it (after them: declare -f needs them).
compPin="$(privateSha1For "$BEOS_CD_FILE"):$(declare -f beosSystemVolume beosBfs compInstall | sha256sum | cut -d' ' -f1)"