zsh's configure will happily build without a terminal library -- the probe is AC_SEARCH_LIBS, which is soft -- and produce a shell whose cursor cannot move and whose arrow keys do nothing. ZLE is the reason to want zsh, so this comes first. MIT, so it combines with Apache-2.0 without conditions. Built static, widec (which is what zsh looks for first, and the console's UTF-8 decoder can already take), and --disable-database --with-fallbacks so seven terminal descriptions are compiled into the library. SchOS has no business shipping /usr/share/terminfo, and with the fallbacks the .a is self-contained: verified that no terminfo path strings survive in the binary. Nothing reaches sysroot/ -- a static library is not a file the OS ships -- so `install` means into $(PREFIX). port.mk gains NCURSES beside MUSL for the same reason MUSL is there. tinfotest.c is the acceptance test, and asks the question the build cannot: not "did it link" but "does terminfo work on a SchOS console". It reports TIOCGWINSZ, initialises from the compiled-in fallback, and names every capability ZLE binds. Anything MISSING there is a missing feature in the shell later. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VQ7Qx8E1q1M1bbCq8QLHS2
58 lines
2.1 KiB
Makefile
58 lines
2.1 KiB
Makefile
# SPDX-License-Identifier: Apache-2.0
|
|
# Shared definitions for all SchOS ports.
|
|
# Include this at the top of each port's Makefile: include ../mk/port.mk
|
|
#
|
|
# Layout contract — a port directory contains ONLY hand-written files:
|
|
#
|
|
# ports/<name>/Makefile required
|
|
# ports/<name>/patches/* optional
|
|
#
|
|
# Everything generated goes under $(PORTDIR) = build/ports/<name>/ :
|
|
#
|
|
# build/ports/<name>/src extracted upstream tarball
|
|
# build/ports/<name>/obj out-of-tree build directory
|
|
# build/ports/<name>/prefix install prefix (musl's headers/libs land here)
|
|
#
|
|
# If a file appears inside ports/<name>/ that you did not write by hand,
|
|
# it is in the wrong place. `make clean` deletes $(PORTDIR) and nothing else.
|
|
|
|
PORTSDIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/..)
|
|
TOPDIR := $(abspath $(PORTSDIR)/..)
|
|
|
|
SYSROOT := $(TOPDIR)/sysroot
|
|
DISTDIR := $(TOPDIR)/dist
|
|
BUILDROOT := $(TOPDIR)/build/ports
|
|
|
|
# Verifying a downloaded tarball. Not `sha256sum -c -`: that command does not
|
|
# exist on macOS or the BSDs, and each of them spells it differently. The
|
|
# helper picks whichever of the five possibilities the host actually has.
|
|
SHA256CHECK := $(TOPDIR)/tools/posix/sha256check.sh
|
|
|
|
# Port name is the directory name — no per-port boilerplate needed.
|
|
PORT := $(notdir $(CURDIR))
|
|
PORTDIR := $(BUILDROOT)/$(PORT)
|
|
SRCDIR := $(PORTDIR)/src
|
|
BUILDDIR := $(PORTDIR)/obj
|
|
PREFIX := $(PORTDIR)/prefix
|
|
|
|
# musl is the libc every other port links against; its install prefix is a
|
|
# fixed location so ports don't need to know where musl's own source lives.
|
|
MUSL := $(BUILDROOT)/musl/prefix
|
|
|
|
# ncurses is the second library other ports link against, so its prefix is
|
|
# fixed for the same reason musl's is. Unlike every other port it installs
|
|
# nothing into sysroot/ -- a static library is not a file the OS ships.
|
|
NCURSES := $(BUILDROOT)/ncurses/prefix
|
|
|
|
CC := clang
|
|
# FS register belongs to the kernel; never let the compiler touch %fs directly.
|
|
CFLAGS_BT := -fno-stack-protector
|
|
|
|
.PHONY: all download extract build install clean distclean
|
|
all: install
|
|
|
|
$(DISTDIR):
|
|
mkdir -p $(DISTDIR)
|
|
|
|
$(SYSROOT)/bin:
|
|
mkdir -p $@
|