commit: 2b8394e1f5128bdb821afe3885a6f4b16c85c90c
parent de9548dbff84bc9e6fd25cd240e67c436827c5d4
Author: Andrius Štikonas <andrius@stikonas.eu>
Date: Sat, 30 Jan 2021 19:47:48 +0000
Build flex 2.5.14.
Diffstat:
6 files changed, 45 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
@@ -265,11 +265,13 @@ cope here.
`m4` is the first piece of software we need in the autotools suite. It allows
macros to be defined and files to be generated from those macros.
-#### Part 20: flex 2.5.11
+#### Part 22: flex 2.5.11
`flex` is a tool for generating lexers or scanners: programs that recognize lexical patters.
Unfortunately `flex` also depends on itself for compiling its own scanner, so
first flex 2.5.11 is compiled, with its scanner definition manually modified so that
it can be processed by lex for the Heirloom project (the required modifications
are mostly syntactical, plus a few workarounds to avoid some flex advanced features).
-Then we recompile `flex` using its own lexer.
+
+### Part 23 flex 2.5.14
+Then we recompile unpatched `flex` using its own lexer.
diff --git a/rootfs.sh b/rootfs.sh
@@ -132,6 +132,9 @@ get_file https://ftp.gnu.org/gnu/m4/m4-1.4.tar.gz
# flex 2.5.11
get_file http://download.nust.na/pub2/openpkg1/sources/DST/flex/flex-2.5.11.tar.gz
+# flex 2.5.14
+get_file http://download.nust.na/pub2/openpkg1/sources/DST/flex/flex-2.5.14.tar.gz
+
# General cleanup
find tmp -name .git -exec rm -rf \;
diff --git a/sysa/flex-2.5.14/flex-2.5.14.sh b/sysa/flex-2.5.14/flex-2.5.14.sh
@@ -0,0 +1,6 @@
+src_prepare() {
+ default_src_prepare
+
+ touch config.h
+ rm parse.c parse.h scan.c
+}
diff --git a/sysa/flex-2.5.14/mk/main.mk b/sysa/flex-2.5.14/mk/main.mk
@@ -0,0 +1,29 @@
+CFLAGS = -I . \
+ -DVERSION=\"2.5.14\"
+
+all: flex
+
+flex: ccl.o dfa.o ecs.o gen.o main.o misc.o nfa.o parse.o scan.o skel.o sym.o tblcmp.o yylex.o options.o scanopt.o buf.o
+ tcc -o $@ $^
+
+%.o: %.c
+ tcc -g -c $(CFLAGS) -o $@ $<
+
+scan.o: parse.h
+yylex.o: parse.h
+
+parse.c parse.h: parse.y
+ yacc -d parse.y
+ mv y.tab.h parse.h
+ mv y.tab.c parse.c
+
+scan.c: scan.l
+ flex scan.l
+ mv lex.yy.c scan.c
+
+skel.c: mkskel.sh flex.skl
+ /bin/sh ./mkskel.sh ./flex.skl > skel.c
+
+install: all
+ install flex $(PREFIX)/bin
+ ln -sf $(PREFIX)/bin/flex $(PREFIX)/bin/lex
diff --git a/sysa/flex-2.5.14/src/.placeholder b/sysa/flex-2.5.14/src/.placeholder
diff --git a/sysa/run.sh b/sysa/run.sh
@@ -14,6 +14,8 @@ build m4-1.4
# Part 22
build flex-2.5.11
-build flex-2.5.11
+
+# Part 23
+build flex-2.5.14
echo "Bootstrapping completed."