joeylib2/installer/components/nasm.sh

41 lines
904 B
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
#
# NASM: assembler for the DOS port's x86 sources. Any 2.x release works,
# so it comes from the distribution.
compDescription="DOS assembler: NASM (distribution package)"
compGroups="toolchain:dos"
compRequires="host"
compHostDeps="nasm"
compPin="distro"
compInstall() {
command -v nasm >/dev/null || die "nasm is not on PATH after installing host packages"
}
compInstalled() {
command -v nasm >/dev/null
}
compVerify() {
local tmp
local status=1
tmp="$(mktemp -d)"
printf 'bits 32\nret\n' > "$tmp/t.asm"
if nasm -f coff "$tmp/t.asm" -o "$tmp/t.o" && [ -s "$tmp/t.o" ]; then
status=0
fi
rm -rf "$tmp"
return $status
}
compEnv() {
envVar DOS_AS "$(command -v nasm)"
}