Add flex 2.6.4.

This commit is contained in:
Andrius Štikonas 2021-02-04 18:37:43 +00:00
parent e9c8313458
commit fb522be854
10 changed files with 80 additions and 84 deletions

View File

@ -262,8 +262,8 @@ cope here.
#### Part 21: m4 1.4
`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.
`m4` is the first piece of software we need in the autotools suite and flex 2.6.4.
It allows macros to be defined and files to be generated from those macros.
#### Part 22: flex 2.5.11
@ -274,11 +274,7 @@ first flex 2.5.11 is compiled, with its scanner definition manually modified so
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).
#### Part 23 flex 2.5.14
Then we recompile unpatched `flex` using its own lexer.
#### Part 24 musl 1.1.24
#### Part 23 musl 1.1.24
`musl` is a C standard library that is lightweight, fast, simple, free, and strives to be correct
in the sense of standards-conformance and safety. `musl` is used by some distributions of GNU/Linux
@ -289,8 +285,14 @@ newer or more complex programs.
we replace all weak symbols with strong symbols and will patch `tcc` in the next step to ignore duplicate
symbols.
#### Part 25 tcc 0.9.27 (musl)
#### Part 24 tcc 0.9.27 (musl)
We recompile `tcc` against musl. This is a two stage process. First we build tcc-0.9.27 that itself
links to Mes C library but produces binaries linked to musl. Then we recompile newly produced tcc
with itself. Interestingly, tcc-0.9.27 linked against musl is self hosting.
#### Part 25 flex 2.6.14
We recompile unpatched GNU `flex` using older flex 2.5.11. This is again two stage process,
first compile flex using scanner generated by old flex, then recompile scan.l using the new version
of flex to remove any buggy artificats from the old flex.

View File

@ -136,12 +136,12 @@ 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
# musl 1.1.24
get_file https://musl.libc.org/releases/musl-1.1.24.tar.gz
# flex 2.6.4
get_file https://github.com/westes/flex/releases/download/v2.6.4/flex-2.6.4.tar.gz
# General cleanup
find tmp -name .git -exec rm -rf \;

View File

@ -1,13 +1,10 @@
# When we rebuild flex it no longer needs patching
# and can use simplified makefile
src_prepare() {
if test -d /lex; then
default_src_prepare
else
cp ../../mk/main2.mk Makefile
fi
default_src_prepare
touch config.h
rm parse.c parse.h scan.c
rm parse.c parse.h scan.c skel.c
}
src_install() {

View File

@ -1,28 +0,0 @@
CFLAGS = -DVERSION=\"2.5.11\"
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

View File

@ -1,6 +0,0 @@
src_prepare() {
default_src_prepare
touch config.h
rm parse.c parse.h scan.c
}

View File

@ -1,29 +0,0 @@
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

19
sysa/flex-2.6.4/flex-2.6.4.sh Executable file
View File

@ -0,0 +1,19 @@
src_prepare() {
default_src_prepare
mv Makefile src/
touch src/config.h
rm src/parse.c src/parse.h src/scan.c src/skel.c
}
src_compile() {
cd src
default_src_compile
cd ..
}
src_install() {
cd src
default_src_install
cd ..
}

View File

@ -0,0 +1,41 @@
CC := tcc
CFLAGS = -DVERSION=\"2.6.4\" \
-DM4=\"m4\" \
-DHAVE_LIMITS_H=1
all: flex
flex: buf.o ccl.o dfa.o ecs.o filter.o gen.o main.o misc.o nfa.o options.o parse.o regex.o scan.o scanflags.o scanopt.o skel.o sym.o tables.o tables_shared.o tblcmp.o yylex.o
$(CC) -o $@ $^ -lm
flex-tmp: buf.o ccl.o dfa.o ecs.o filter.o gen.o main.o misc.o nfa.o options.o parse.o regex.o scan-tmp.o scanflags.o scanopt.o skel.o sym.o tables.o tables_shared.o tblcmp.o yylex.o
$(CC) -o $@ $^ -lm
%.o: %.c
$(CC) $(CFLAGS) -g -c -I. -o $@ $<
main.o: parse.h
scan.o: parse.h
scan-tmp.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
echo 'extern int yylval;' >> parse.h
scan-tmp.c: scan.l
flex scan.l
mv lex.yy.c scan-tmp.c
scan.c: scan.l flex-tmp
./flex-tmp scan.l
mv lex.yy.c scan.c
skel.c: mkskel.sh flex.skl
/bin/sh ./mkskel.sh . m4 2.6.4 > skel.c
install: all
install flex $(PREFIX)/bin
ln -sf $(PREFIX)/bin/flex $(PREFIX)/bin/lex

View File

@ -16,12 +16,12 @@ build m4-1.4
build flex-2.5.11
# Part 23
build flex-2.5.14
# Part 24
build musl-1.1.24
# Part 25
# Part 24
build tcc-0.9.27 tcc-musl.sh
# Part 25
build flex-2.6.4
echo "Bootstrapping completed."