Files
Ken Johnson 23f1c3ba15
All checks were successful
Build & Release Plugin / build (push) Successful in 1m1s
v0.0.8: migrate to declarative DBAPI schema
Rewrite echomail_schema.inc — 19 tables now declared via
TDBATableSpec records using FHost.DeclareTable. Reconciler in the
host handles ADD COLUMN automatically across SQLite/MariaDB/PostgreSQL.

Tooling:
* Vendor fw_plugin_api + dbapi_* units into sdk/ via `make pull-sdk`.
  sdk/VERSION pins the upstream commit hash.
* Makefile adds fcl-db (sqldb/dbase), paszlib, hash paths.
* Removed top-level fw_plugin_api.pas (now under sdk/).
2026-04-18 18:28:25 -07:00

129 lines
4.0 KiB
Makefile

#
# Fastway BBS - Echomail Plugin (Tosser/Scanner/AreaFix)
#
# Usage:
# make Build for Linux x86_64
# make PLATFORM=freebsd-x86_64 Cross-compile for FreeBSD
# make PLATFORM=win64 Cross-compile for Windows
# make clean Remove build artifacts
# make install Copy to server plugins dir
# make package Create distributable ZIP
#
FPC ?= fpc
TARGET = libechomail.so
SOURCE = echomail.pp
PLATFORM ?= linux-x86_64
VERSION = 0.0.6
# ---- fpcup paths ----
FPCUP = /opt/fpcup
FPCSRC = $(FPCUP)/fpcsrc/packages
FPCUNITS = $(FPCUP)/fpc/units
# ---- Vendored SDK ----
# fw_plugin_api.pas + dbapi_* units are vendored from
# ../fastway-plugin-sdk via `make pull-sdk`. sdk/VERSION pins the
# commit hash we built against. See pull-sdk target below.
SDK = sdk
# Common flags (all platforms)
FPCFLAGS = -Mobjfpc -Sh -CX -XXs -O2 -B \
-Fubuild -FUbuild \
-Fu. \
-Fu$(SDK)
ifeq ($(PLATFORM),linux-x86_64)
# Native Linux: compile FCL from source with -fPIC for .so linking
FPCFLAGS += -fPIC \
-Fu/tmp/paszlib_fpic \
-Fu$(FPCSRC)/paszlib/src \
-Fu$(FPCSRC)/fcl-json/src \
-Fu$(FPCSRC)/fcl-base/src \
-Fu$(FPCSRC)/fcl-base/src/unix \
-Fu$(FPCSRC)/fcl-db/src/base \
-Fu$(FPCSRC)/fcl-db/src/sqldb \
-Fu$(FPCSRC)/fcl-db/src/dbase \
-Fu$(FPCSRC)/fcl-extra/src \
-Fu$(FPCSRC)/fcl-extra/src/unix \
-Fu$(FPCSRC)/hash/src \
-Fu$(FPCSRC)/fcl-net/src \
-Fu$(FPCSRC)/fcl-net/src/unix \
-Fu$(FPCSRC)/fcl-process/src \
-Fu$(FPCSRC)/fcl-process/src/unix \
-Fi$(FPCSRC)/fcl-process/src/unix \
-Fi$(FPCSRC)/fcl-base/src/unix \
-Fi$(FPCSRC)/fcl-extra/src/unix \
-Fi$(FPCSRC)/fcl-net/src/unix
endif
ifeq ($(PLATFORM),freebsd-x86_64)
FPC = ppcrossx64
TARGET = libechomail.so
FPCFLAGS += -Tfreebsd \
-Fu$(FPCUNITS)/x86_64-freebsd/*
endif
ifeq ($(PLATFORM),win64)
FPC = ppcrossx64
TARGET = echomail.dll
FPCFLAGS += -Twin64 \
-Fu$(FPCUNITS)/x86_64-win64/*
endif
FPCFLAGS += -o$(TARGET)
INSTALL_DIR ?= ../../Fastway-Server/src/plugins
.PHONY: all clean install package pull-sdk
all:
@mkdir -p build
$(FPC) $(FPCFLAGS) $(SOURCE)
# Vendor the plugin SDK from the sibling fastway-plugin-sdk repo.
# Overrides any earlier copies, writes a VERSION pin so we know
# which SDK commit this plugin was built against. Same vendor pattern
# as Fimail/fpc-msgbase.
FASTWAY_SDK_SRC = ../fastway-plugin-sdk
pull-sdk:
@if [ ! -d "$(FASTWAY_SDK_SRC)" ]; then \
echo "ERROR: $(FASTWAY_SDK_SRC) not found. Set FASTWAY_SDK_SRC=/path/to/fastway-plugin-sdk"; \
exit 1; \
fi
@echo "Pulling fastway-plugin-sdk from $(FASTWAY_SDK_SRC)..."
@UPSTREAM_HASH=$$(cd $(FASTWAY_SDK_SRC) && git rev-parse HEAD 2>/dev/null); \
UPSTREAM_DESC=$$(cd $(FASTWAY_SDK_SRC) && git log -1 --pretty=format:'%s' 2>/dev/null); \
rm -rf $(SDK); \
mkdir -p $(SDK); \
cp $(FASTWAY_SDK_SRC)/fw_plugin_api.pas $(SDK)/; \
cp $(FASTWAY_SDK_SRC)/dbapi_consts.pas $(SDK)/; \
cp $(FASTWAY_SDK_SRC)/dbapi_hooks.pas $(SDK)/; \
cp $(FASTWAY_SDK_SRC)/dbapi_dialect.pas $(SDK)/; \
{ echo "$$UPSTREAM_HASH"; \
echo "# fastway-plugin-sdk vendored snapshot pin."; \
echo "# Upstream: $(FASTWAY_SDK_SRC)"; \
echo "# Commit: $$UPSTREAM_HASH"; \
echo "# Subject: $$UPSTREAM_DESC"; \
echo "# Refreshed: $$(date -Iseconds)"; \
} > $(SDK)/VERSION
@echo "Vendored $$(find $(SDK) -name '*.pas' | wc -l) units, pin written to $(SDK)/VERSION"
@head -1 $(SDK)/VERSION | awk '{print "Pin: " $$1}'
clean:
rm -rf build libechomail.so echomail.dll *.rsj
install: all
@mkdir -p $(INSTALL_DIR)/echomail/web
cp $(TARGET) $(INSTALL_DIR)/
cp plugin.json $(INSTALL_DIR)/echomail/
cp -r web/* $(INSTALL_DIR)/echomail/web/
package: all
@mkdir -p dist/echomail/web
cp $(TARGET) dist/echomail/
cp plugin.json dist/echomail/
cp -r web/* dist/echomail/web/
cd dist && zip -r ../fastway-plugin-echomail-$(VERSION)-$(PLATFORM).zip echomail/
rm -rf dist