joeylib2/installer/components/cadius.sh

49 lines
1.5 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
#
# cadius: ProDOS disk-image tool used by every IIgs disk script. The
# scripts parse its CATALOG output, so it stays pinned to the mach-kernel
# fork commit they were written against (v1.4.6).
compDescription="IIgs disk images: cadius 1.4.6 (ProDOS image tool)"
compGroups="toolchain:iigs emulator:iigs"
compRequires="host"
compHostDeps="build-tools git"
compUrl="https://github.com/mach-kernel/cadius.git"
compCommit="75c4aa684f6aa0de0c2879b729be465196a348ba"
# Built with _GNU_SOURCE: its strptime() call has no prototype otherwise,
# which gcc 14 (Fedora 40) rejects. The flag is in the pin so existing
# builds redo it.
cflags="-D_GNU_SOURCE"
compPin="$compCommit $cflags"
compInstall() {
local src
src="$(freshBuildDir "$compId")"
gitFetchCommit "$compUrl" "$compCommit" "$src"
# Through the environment: its Makefile appends its own flags to it.
CFLAGS="$cflags" make -C "$src" -j"$JOEY_JOBS"
install -D -m 755 "$src/bin/release/cadius" "$compDir/bin/cadius"
dropBuildDir "$compId"
}
compInstalled() {
[ -x "$compDir/bin/cadius" ]
}
compVerify() {
local banner
# Run with no arguments it prints its banner and exits non-zero.
banner="$("$compDir/bin/cadius" 2>&1 || true)"
[[ "$banner" == *"v 1.4.6"* ]]
}
compEnv() {
envVar CADIUS "$compDir/bin/cadius"
}