Fetch BSD regex from GitHub at build time

Replace bundled Spencer regex with a fetch-regex build step that
clones https://github.com/garyhouston/regex.git, generates the
required .ih and regex.h headers via mkh, and copies the result
into sys/amiga/regex/.

Usage: make CROSS_TO_AMIGA=1 fetch-regex

The fetched sources are not tracked in git.
This commit is contained in:
Ingo Paschke
2026-03-24 01:21:00 +01:00
parent cb0b11be11
commit c5dfd1fc5c
13 changed files with 37 additions and 3706 deletions

View File

@@ -269,7 +269,39 @@ $(TARGETPFX)tiles32.iff: ../dat/nhtiles.bmp $(TARGETPFX)bmp2iff_host
AMITILES = $(TARGETPFX)tiles16.iff $(TARGETPFX)tiles32.iff $(TARGETPFX)tomb.iff
.PHONY: amigapkg amitiles
AMIREGEX_URL = https://github.com/garyhouston/regex.git
AMIREGEX_SRCDIR = $(AMISRC)/regex
.PHONY: fetch-regex amigapkg amitiles
fetch-regex:
@DSTDIR=sys/amiga/regex; \
if [ ! -d src ]; then DSTDIR=../$$DSTDIR; fi; \
if [ -f $$DSTDIR/regcomp.c ]; then \
echo "BSD regex already present"; \
else \
echo "Fetching BSD regex from $(AMIREGEX_URL)"; \
tmpdir=$$(mktemp -d) && \
git clone --depth 1 $(AMIREGEX_URL) $$tmpdir && \
cd $$tmpdir && \
sh ./mkh -p regcomp.c > regcomp.ih && \
sh ./mkh -p engine.c > engine.ih && \
sh ./mkh -p regexec.c > regexec.ih && \
sh ./mkh -p regerror.c > regerror.ih && \
sh ./mkh -i _REGEX_H_ regex2.h regcomp.c \
regexec.c regerror.c regfree.c > regex.h && \
cd - > /dev/null && \
mkdir -p $$DSTDIR && \
for f in regcomp.c regexec.c regerror.c regfree.c \
engine.c regex.h regex2.h cclass.h cname.h \
utils.h regcomp.ih engine.ih regexec.ih \
regerror.ih \
COPYRIGHT; do \
cp $$tmpdir/$$f $$DSTDIR/; \
done && \
rm -rf $$tmpdir && \
echo "BSD regex installed in $$DSTDIR"; \
fi
amitiles: $(AMITILES)
amigapkg: $(AMITILES)

View File

@@ -472,6 +472,7 @@ ifdef CROSS_TO_AMIGA
# Install to /opt/amiga, then:
# sys/unix/setup.sh sys/unix/hints/linux.370
# make fetch-lua
# make CROSS_TO_AMIGA=1 fetch-regex
# make CROSS_TO_AMIGA=1 all
# make CROSS_TO_AMIGA=1 package
#=================================================================