Nexoniarz is the sole author and SchOS was never published under Apache-2.0, so this is a straight relicence. LICENSE is the FSF GPLv2 text, every first-party SPDX header moves to GPL-2.0-or-later, and NOTICE, README.md, docs/licensing.md and the site say so. projects/schfs-linux follows the rest of the tree. The GPL gives copyleft: a fork has to ship its source. It also lifts the old "Linux drivers, never" rule, since GPL-2.0-only code combines with GPL-2.0-or-later. "Or later" leaves room for GPLv3, but one binary still has to pick one version, so docs/licensing.md now keeps Apache-2.0 and GPLv3 code out of the kernel to keep Linux code possible there. BSD 4-clause code goes from "avoid" to "no", because the advertising clause is GPL-incompatible. LDLS still ships no .ko. That boundary is now project policy rather than a legal requirement, and ldls.md, devices.md and licensing.md section 6 say so. refmod declares license=GPL, and ldls-check passes (27 checks). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
128 lines
5 KiB
Makefile
128 lines
5 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
# ncurses -- terminal capability database and screen library, MIT:
|
|
# https://invisible-island.net/ncurses/
|
|
#
|
|
# Here because zsh's line editor is the reason to want zsh, and the line editor
|
|
# drives the terminal through tigetstr/tputs. zsh's configure will happily build
|
|
# without a terminal library -- AC_SEARCH_LIBS is soft -- and produce a shell
|
|
# whose cursor cannot move and whose arrow keys do nothing. So this comes first.
|
|
#
|
|
# Unlike every other port, nothing here reaches sysroot/. ncurses is built
|
|
# static and consumed at link time by zsh; `install` means "into $(PREFIX)".
|
|
#
|
|
# The awkward part of ncurses is that it is a library whose data is a database.
|
|
# Normally that database is ~4000 compiled terminal descriptions under
|
|
# /usr/share/terminfo, which SchOS has no business shipping. --disable-database
|
|
# plus --with-fallbacks compiles a chosen handful directly into the library, so
|
|
# the resulting .a is self-contained and the filesystem stays clean.
|
|
|
|
include ../mk/port.mk
|
|
|
|
NC_VERSION := 6.4
|
|
NC_URL := https://ftp.gnu.org/gnu/ncurses/ncurses-$(NC_VERSION).tar.gz
|
|
NC_SHA256 := 6931283d9ac87c5073f30b6290c4c75f21632bb4fc3603ac8100812bed248159
|
|
|
|
TARBALL := $(DISTDIR)/ncurses-$(NC_VERSION).tar.gz
|
|
|
|
# The terminal types compiled into the library. `linux` is what SchOS's own
|
|
# console is closest to and what TERM is set to; the rest are here so a serial
|
|
# console or an ssh client from a real machine still gets a working editor.
|
|
# Every name added is bytes in the binary, so this list is deliberately short.
|
|
NC_FALLBACKS := linux,vt100,vt102,xterm,xterm-256color,screen,dumb
|
|
|
|
# Cross-compiling ncurses needs tic and infocmp *on the host* to turn those
|
|
# names into C. Both exist here; the paths are looked up rather than written
|
|
# down because on NixOS they live in the store and move on every update.
|
|
HOST_TIC ?= $(shell command -v tic)
|
|
HOST_INFOCMP ?= $(shell command -v infocmp)
|
|
|
|
# gcc, for the same reason fastfetch uses it: -print-libgcc-file-name.
|
|
HOSTCC_NC ?= gcc
|
|
GCC_INC := $(shell $(HOSTCC_NC) -print-file-name=include)
|
|
LIBGCC := $(shell $(HOSTCC_NC) -print-libgcc-file-name)
|
|
|
|
# Split exactly as autoconf consumes them: it links a test as
|
|
# $CC $CFLAGS $LDFLAGS conftest.c $LIBS
|
|
# so crt1.o/crti.o must ride in LDFLAGS (before the object) and libc in LIBS
|
|
# (after it). libc twice -- libgcc reaches back into it, and a static link
|
|
# resolves left to right.
|
|
NC_CPPFLAGS := -nostdinc -isystem $(MUSL)/include -isystem $(GCC_INC) -D__SCHOS__
|
|
NC_CFLAGS := -O2 $(CFLAGS_BT)
|
|
NC_LDFLAGS := -static -nostdlib -L$(MUSL)/lib $(MUSL)/lib/crt1.o $(MUSL)/lib/crti.o
|
|
NC_LIBS := $(MUSL)/lib/libc.a $(LIBGCC) $(MUSL)/lib/libc.a $(MUSL)/lib/crtn.o
|
|
|
|
# ncurses builds make_hash and make_keys to run during the build, not on the
|
|
# target. In a cross build those must be compiled for the host, with the host's
|
|
# own libc -- hence a second, completely separate set of flags.
|
|
NC_BUILD_CC := $(HOSTCC_NC)
|
|
|
|
NC_CONFIGURE := \
|
|
--host=x86_64-linux-musl \
|
|
--build=x86_64-pc-linux-gnu \
|
|
--prefix=$(PREFIX) \
|
|
--disable-database \
|
|
--with-fallbacks=$(NC_FALLBACKS) \
|
|
--with-tic-path=$(HOST_TIC) \
|
|
--with-infocmp-path=$(HOST_INFOCMP) \
|
|
--without-shared --with-normal \
|
|
--enable-widec \
|
|
--enable-overwrite \
|
|
--without-cxx --without-cxx-binding \
|
|
--without-ada --without-tests --without-progs --without-manpages \
|
|
--without-debug --without-profile \
|
|
--disable-stripping \
|
|
--disable-home-terminfo \
|
|
--disable-rpath-hack
|
|
|
|
$(TARBALL): | $(DISTDIR)
|
|
curl -fsSL -o $@ $(NC_URL)
|
|
sh $(SHA256CHECK) "$(NC_SHA256)" "$@"
|
|
|
|
download: $(TARBALL)
|
|
|
|
$(SRCDIR): $(TARBALL)
|
|
mkdir -p $(PORTDIR)
|
|
rm -rf $@ $(PORTDIR)/ncurses-$(NC_VERSION)
|
|
tar -xzf $< -C $(PORTDIR)
|
|
mv $(PORTDIR)/ncurses-$(NC_VERSION) $@
|
|
touch $@
|
|
|
|
extract: $(SRCDIR)
|
|
|
|
$(BUILDDIR)/config.status: | $(SRCDIR)
|
|
@test -n "$(HOST_TIC)" -a -n "$(HOST_INFOCMP)" || { \
|
|
echo "ncurses: host tic/infocmp not found -- install ncurses on the build host" >&2; \
|
|
exit 1; }
|
|
mkdir -p $(BUILDDIR)
|
|
cd $(BUILDDIR) && \
|
|
CC="$(HOSTCC_NC)" \
|
|
CPPFLAGS="$(NC_CPPFLAGS)" \
|
|
CFLAGS="$(NC_CFLAGS)" \
|
|
LDFLAGS="$(NC_LDFLAGS)" \
|
|
LIBS="$(NC_LIBS)" \
|
|
BUILD_CC="$(NC_BUILD_CC)" \
|
|
BUILD_CPPFLAGS= BUILD_CFLAGS= BUILD_LDFLAGS= BUILD_LIBS= \
|
|
$(SRCDIR)/configure $(NC_CONFIGURE)
|
|
|
|
$(PREFIX)/lib/libncursesw.a: $(BUILDDIR)/config.status
|
|
$(MAKE) -C $(BUILDDIR)
|
|
$(MAKE) -C $(BUILDDIR) install
|
|
|
|
build: $(PREFIX)/lib/libncursesw.a
|
|
|
|
# The acceptance test. It is the one thing this port puts in sysroot/, and it
|
|
# earns the space: the build proving the library compiles says nothing about
|
|
# whether terminfo works on a SchOS console, which is a different question
|
|
# with a different answer. sysroot/bin already carries socktest, nettest and
|
|
# shmtest for the same reason.
|
|
$(SYSROOT)/bin/tinfotest: tinfotest.c $(PREFIX)/lib/libncursesw.a | $(SYSROOT)/bin
|
|
$(HOSTCC_NC) $(NC_CPPFLAGS) -isystem $(PREFIX)/include $(NC_CFLAGS) $(NC_LDFLAGS) -L$(PREFIX)/lib -o $@ $< -lncursesw $(NC_LIBS)
|
|
chmod 755 $@
|
|
|
|
install: $(PREFIX)/lib/libncursesw.a $(SYSROOT)/bin/tinfotest
|
|
|
|
clean:
|
|
rm -rf $(PORTDIR)
|
|
|
|
distclean: clean
|
|
rm -f $(TARBALL)
|