Files
comet/Makefile
Ken Johnson 0a9eaf2370
Some checks failed
Build and Release / build-and-release (push) Failing after 10m56s
Comet 1.2.2: native protocol now backed by fpc-comet
cometfpc.pas (new, ~620 lines) is a daemon-internal wrapper
that bridges TCometConfig / TCometFileProvider /
TBinkpSendEntry onto fpc-comet's TCometSessionConfig /
IComFileProvider, plus an IComTransport adapter over the
already-accepted TCometSocket and a per-session policy
object that routes auth/freq/lst lookups through the
existing CometCfgGet* helpers.

cometdaemon.pas RunInbound + RunOutbound's Comet branches
now call CometFPRunInbound / CometFPRunOutbound instead of
the procedural CometSessionInit / CometHandshake /
CometXferInit / CometTransfer / CometSessionDone chain.
The cometses + cometxfer units stay in the build for the
moment (still listed in CORE_UNITS) but the daemon no
longer calls them directly; future commits can drop them.

Sibling structure to cometbinkpfpc.pas / fpc-binkp:

  protocol  | wrapper             | library
  ----------+---------------------+--------------
  BinkP     | cometbinkpfpc.pas   | fpc-binkp 0.2.0
  Comet     | cometfpc.pas        | fpc-comet 0.1.0

Both wrappers are daemon-internal glue.  Other consumers of
fpc-binkp / fpc-comet do NOT need them -- the libraries
stand alone and ship with their own examples + tests.

Live validation:
  - Inbound: dialed local 1.2.2 daemon from fpc-comet
    example_outbound (NOPWD path), 82-byte file landed
    byte-identical in inbound dir.
  - Outbound: 1.2.2 daemon's `comet call 1:213/721`
    dialed bbsnode2 (canonical 1.2.1, FreeBSD), negotiated
    X25519+ChaCha20 (CRYPT active), clean session-end.

cm.config grows a SkipBanner flag the wrapper sets so the
engine doesn't re-emit COMET/1.0 -- the daemon's accept
loop already did banner detection (Comet vs BinkP) before
dispatching to cometfpc.

Version bump: COMET_VERSION 1.2.1 -> 1.2.2.
2026-04-22 15:27:19 -07:00

201 lines
6.7 KiB
Makefile

# Comet - Direct TCP File Transfer for FidoNet
# Makefile for Free Pascal Compiler
#
# Targets:
# make Build for Linux x86-64 (default)
# make freebsd Build for FreeBSD x86-64
# make freebsd32 Build for FreeBSD i386
# make win64 Build for Windows x86-64
# make linux32 Build for Linux i386
# make dos Build for DOS (DJGPP) - requires Watt-32
# make test Build and run all tests
# make clean Remove build artifacts
# make all-platforms Build for all available platforms
FPC = /opt/fpcup/fpc/bin/x86_64-linux/fpc
FPCFLAGS = -Mobjfpc -Sh -Se -B
FPCOPT =
# Additional unit search paths for WebUI (fcl-web, fcl-json, hash)
FPCUP_UNITS = $(FPCUP)/fpc/units/x86_64-linux
WEBFLAGS = -Fu$(FPCUP_UNITS)/fcl-web -Fu$(FPCUP_UNITS)/fcl-json \
-Fu$(FPCUP_UNITS)/fcl-net -Fu$(FPCUP_UNITS)/fcl-base \
-Fu$(FPCUP_UNITS)/fcl-db -Fu$(FPCUP_UNITS)/hash
# Cross-compiler paths
FPCUP = /opt/fpcup
CROSSBIN = $(FPCUP)/cross/bin
# Directories
SRCDIR = src
WEBUIDIR = src/webui
TESTDIR = test
BUILDDIR = build
# Source files — core mailer protocol + daemon
CORE_UNITS = cometdef cometpath cometcrc cometsha cometlog cometcfg \
comettcp cometfrm cometmd5 cometcram cometcrypt cometdes cometbso cometfile \
cometio cometses cometxfer cometbinkp cometbinkpfpc cometfpc \
cometnodelist \
cometed25519 cometed25519sc cometed25519ge cometed25519bp \
cometdaemon
# Sibling FPC libraries -- fpc-binkp + fpc-comet (and their
# msgbase / log dependencies). Lets cometbinkpfpc.pas wrap
# fpc-binkp as the BinkP backend and cometfpc.pas wrap
# fpc-comet as the Comet native backend without copying
# source.
FPCBINKP = ../fpc-binkp/src
FPCCOMET = ../fpc-comet/src
FPCMSGBASE = ../fpc-msgbase/src
FPCLOG = ../fpc-log/src
LIBFLAGS = -Fu$(FPCBINKP) -Fu$(FPCCOMET) -Fu$(FPCMSGBASE) -Fu$(FPCLOG)
# WebUI units (separate concern — HTTP server, REST, SSE, DB, auth, WebAuthn)
# Kept in src/webui/ to make the separation explicit.
WEBUI_UNITS = cometwebjson cometwebauth cometwebcrypto cometwebauthn \
cometwebcron cometwebdb cometwebsse cometwebapi cometweb
UNITS = $(CORE_UNITS) $(WEBUI_UNITS)
TESTS = test_crc test_sha test_frame test_md5
PROGRAM = comet
SRCDEPS = $(SRCDIR)/comet.pas \
$(addprefix $(SRCDIR)/,$(addsuffix .pas,$(CORE_UNITS))) \
$(addprefix $(WEBUIDIR)/,$(addsuffix .pas,$(WEBUI_UNITS)))
# Unit search paths: src/, src/webui/, and the sibling FPC
# library trees so units can import across.
UNITPATH = -Fu$(SRCDIR) -Fu$(WEBUIDIR) $(LIBFLAGS)
# Default target: Linux x86-64 (native)
all: linux
linux: $(SRCDEPS) webfiles
@mkdir -p $(BUILDDIR)/linux
$(FPC) $(FPCFLAGS) $(FPCOPT) $(WEBFLAGS) $(UNITPATH) -FE$(BUILDDIR)/linux -o$(PROGRAM) $(SRCDIR)/comet.pas
# Copy web files (HTML, CSS, JS, COMETWEB.DOC, OpenAPI) to build dir.
# COMET.DOC stays at the build root since it is the daemon manual,
# not a web asset.
webfiles:
@mkdir -p $(BUILDDIR)/linux/web/css $(BUILDDIR)/linux/web/js
@cp -r $(SRCDIR)/web/* $(BUILDDIR)/linux/web/ 2>/dev/null || true
@cp COMET.DOC COMET.SAM $(BUILDDIR)/linux/ 2>/dev/null || true
# ---- Cross-compilation targets ----
freebsd: $(SRCDEPS)
@mkdir -p $(BUILDDIR)/freebsd
$(FPCUP)/fpc/bin/x86_64-linux/ppcrossx64 $(FPCFLAGS) $(UNITPATH) \
-Tfreebsd -Px86_64 \
-FE$(BUILDDIR)/freebsd \
-FD$(CROSSBIN)/x86_64-freebsd \
-Fl$(FPCUP)/cross/lib/x86_64-freebsd \
-o$(PROGRAM) $(SRCDIR)/comet.pas
freebsd32: $(SRCDEPS)
@mkdir -p $(BUILDDIR)/freebsd32
$(FPCUP)/fpc/bin/x86_64-linux/ppcross386 $(FPCFLAGS) $(UNITPATH) \
-Tfreebsd -Pi386 \
-FE$(BUILDDIR)/freebsd32 \
-XP$(CROSSBIN)/i386-freebsd- \
-Fl$(FPCUP)/cross/lib/i386-freebsd \
-o$(PROGRAM) $(SRCDIR)/comet.pas
win64: $(SRCDEPS)
@mkdir -p $(BUILDDIR)/win
$(FPCUP)/fpc/bin/x86_64-linux/ppcrossx64 $(FPCFLAGS) $(UNITPATH) \
-Twin64 -Px86_64 \
-FE$(BUILDDIR)/win \
-o$(PROGRAM).exe $(SRCDIR)/comet.pas
linux32: $(SRCDEPS)
@mkdir -p $(BUILDDIR)/linux32
$(FPCUP)/fpc/bin/x86_64-linux/ppcross386 $(FPCFLAGS) $(UNITPATH) \
-Tlinux -Pi386 \
-FE$(BUILDDIR)/linux32 \
-XP$(CROSSBIN)/i386-linux- \
-Fl$(FPCUP)/cross/lib/i386-linux \
-o$(PROGRAM) $(SRCDIR)/comet.pas
dos: $(SRCDEPS)
@mkdir -p $(BUILDDIR)/go32v2
$(FPCUP)/fpc/bin/x86_64-linux/ppcross386 $(FPCFLAGS) $(UNITPATH) \
-Tgo32v2 -Pi386 \
-FE$(BUILDDIR)/go32v2 \
-XP$(CROSSBIN)/i386-go32v2- \
-o$(PROGRAM).exe $(SRCDIR)/comet.pas
os2: $(SRCDEPS)
@mkdir -p $(BUILDDIR)/os2
$(FPCUP)/fpc/bin/x86_64-linux/ppcross386 $(FPCFLAGS) $(UNITPATH) \
-Tos2 -Pi386 \
-FE$(BUILDDIR)/os2 \
-FD$(FPCUP)/cross/i386-pc-os2-emx \
-XPi386-os2- \
-o$(PROGRAM).exe $(SRCDIR)/comet.pas
# Build all available platforms
all-platforms: linux freebsd win64 dos os2
@echo "Built for: Linux x86-64, FreeBSD x86-64, Windows x86-64, DOS, OS/2"
# ---- Tests ----
test: $(TESTS)
@echo "=== Running tests ==="
@./test_crc
@./test_sha
@./test_frame
@./test_md5
@echo "=== All tests passed ==="
test_crc: $(TESTDIR)/test_crc.pas $(SRCDIR)/cometcrc.pas
$(FPC) $(FPCFLAGS) $(FPCOPT) -Fu$(SRCDIR) -FE. $(TESTDIR)/test_crc.pas
test_sha: $(TESTDIR)/test_sha.pas $(SRCDIR)/cometsha.pas
$(FPC) $(FPCFLAGS) $(FPCOPT) -Fu$(SRCDIR) -FE. $(TESTDIR)/test_sha.pas
test_frame: $(TESTDIR)/test_frame.pas $(SRCDIR)/cometfrm.pas $(SRCDIR)/comettcp.pas $(SRCDIR)/cometcrc.pas $(SRCDIR)/cometdef.pas $(SRCDIR)/cometlog.pas
$(FPC) $(FPCFLAGS) $(FPCOPT) -Fu$(SRCDIR) -FE. $(TESTDIR)/test_frame.pas
test_md5: $(TESTDIR)/test_md5.pas $(SRCDIR)/cometmd5.pas $(SRCDIR)/cometcram.pas
$(FPC) $(FPCFLAGS) $(FPCOPT) -Fu$(SRCDIR) -FE. $(TESTDIR)/test_md5.pas
# Debug build (with debugging symbols)
debug: FPCOPT += -g -gl -dDEBUG
debug: clean linux
# Clean compiled output
clean:
rm -rf $(BUILDDIR)
rm -f $(SRCDIR)/*.o $(SRCDIR)/*.ppu $(SRCDIR)/*.rsj
rm -f $(WEBUIDIR)/*.o $(WEBUIDIR)/*.ppu $(WEBUIDIR)/*.rsj
rm -f $(TESTDIR)/*.o $(TESTDIR)/*.ppu $(TESTDIR)/*.rsj
rm -f *.o *.ppu *.rsj link.res ppas.sh
rm -f $(TESTS)
# Full clean including backups
distclean: clean
rm -f $(SRCDIR)/*~ $(SRCDIR)/*.bak $(TESTDIR)/*~ $(TESTDIR)/*.bak *~ *.bak
# Install (copy binary to /usr/local/bin)
install: linux
install -m 755 $(BUILDDIR)/linux/$(PROGRAM) /usr/local/bin/$(PROGRAM)
@echo "Installed to /usr/local/bin/$(PROGRAM)"
# Show file statistics
stats:
@echo "=== Core mailer source ==="
@wc -l $(addprefix $(SRCDIR)/,$(addsuffix .pas,$(CORE_UNITS))) $(SRCDIR)/comet.pas COMET.SAM
@echo
@echo "=== WebUI source ==="
@wc -l $(addprefix $(WEBUIDIR)/,$(addsuffix .pas,$(WEBUI_UNITS)))
@echo
@echo "=== Builds ==="
@for d in $(BUILDDIR)/*/; do ls -la "$$d"$(PROGRAM)* 2>/dev/null; done || echo "(none built)"
.PHONY: all linux test debug clean distclean install stats
.PHONY: freebsd freebsd32 win64 linux32 dos os2 all-platforms