161.29. xa-2.4.1
Cross-assembler for the 6502, 65816 and R65C02 (xa65), with the o65 relocation tools
| Version | 2.4.1, release 1 |
| Shelf | embedded — Microcontroller and bare-metal development: cross toolchains, C libraries, flashers, debug probes and serial consoles |
| Phase | 41_system (System), 488 of 1047 in build order |
| Licence | GPL-2.0-or-later |
| Homepage | https://www.floodgap.com/retrotech/xa/ |
| Build time | 0.1 SBU |
| Installed size | 282.9 KiB in 13 files |
| Recipe | ports/core/embedded/xa/kpkgbuild |
About
xa (xa65) is a cross-assembler for the 6502 family: the NMOS 6502, the 65C02 and R65C02, and the 16-bit 65816, with a C-like preprocessor, local labels and segments. It writes plain binaries or relocatable o65 objects, and the package carries the o65 tools beside it: ldo65 links them, reloc65 relocates one, file65 describes one, printcbm lists a Commodore BASIC file, and uncpk manages C64 cpk archives. vice and libsidplayfp look for it when they are configured, to assemble the 6502 code in their sources.
Sources
xa-2.4.1.tar.gz(203.7 KiB)
sha25663c12a6a32a8e364f34f049d8b2477f4656021418f08b8d6b462be0ed3be3ac3
upstream: https://www.floodgap.com/retrotech/xa/dists/xa-2.4.1.tar.gz
archive copy: sources-2/embedded--xa-2.4.1.tar.gz
Dependencies
Depends on: nothing a recipe names.
Required by (2): libsidplayfp, vice.
Patches
build.sh applies these; kpkg applies nothing by itself.
binfnam-bound.patch— Three places insrc/xat.c, one for.includeand two for the passes of.bin, copy the directive’s file name into a 255-byte buffer and stop with an error only once the index passes 255, so a long name writes the byte at index 255 and the terminator past the end. The patch makes each buffer 256 bytes and stops at 255, which leaves room for the terminator.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install xa'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/embedded/xa.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/embedded/xa
echo '63c12a6a32a8e364f34f049d8b2477f4656021418f08b8d6b462be0ed3be3ac3 xa-2.4.1.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/xa
SRC=$SRC_ROOT/xa-2.4.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf xa-2.4.1.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/binfnam-bound.patch"
make -j1 CFLAGS="$CFLAGS $LDFLAGS" LDFLAGS="$LDFLAGS"
make -j1 install CFLAGS="$CFLAGS $LDFLAGS" LDFLAGS="$LDFLAGS" DESTDIR="$PKG/usr"
The switches, and why each is set:
-j1— One job, for the build and for the install, which remakesall. Thealltarget listskillxa, which deletes./xa, beside thexatarget that links it, and under a parallel make the delete can land after the link.CFLAGS="$CFLAGS $LDFLAGS"— The makefile’s ownCFLAGSis only-O2 -g, so the tree’s flags are given on the command line instead. The top-level makefile hands its sub-makesCC="${CC} ${CFLAGS}", and the programs inmisc/are compiled and linked in one command from that, reading noLDFLAGS; the link flags reach them only insideCFLAGS.LDFLAGS="$LDFLAGS"— Replaces the makefile’sLDFLAGS = -lc, and is whatsrc/Makefilelinksxawith.DESTDIR="$PKG/usr"— In this makefileDESTDIRis the installation prefix,/usr/localby default, not a staging root:BINDIRandMANDIRare built from it. Pointing it at$PKG/usrstages the programs in/usr/binand the manual pages in/usr/share/man/man1.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/xa, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf xa-2.4.1-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/xa, and runs the triggers its paths call for.
Contents
Installed programs: file65, ldo65, printcbm, reloc65, uncpk, xa.
Installed directories: /usr/share/licenses/xa.
Short descriptions
file65 |
print information for o65 object files |
ldo65 |
linker for o65 object files |
printcbm |
list a Commodore BASIC file (DEPRECATED) |
reloc65 |
relocator for o65 object files |
uncpk |
manage c64 cpk archives |
xa |
6502/R65C02/65816 cross-assembler |