Add stage 06: Lua bootstrap

The goal of stage 06 is to try parse zig synax in lua. I pulled in
lpeglable 1.2.0 and parser-gen off github to get started. All of this
needs to be cleaned up rather soon.

Lua boostraps using tcc and musl from the previous stage. Since musl
0.6.0 doesn't support dynamic linking this build of lua doesn't support
shared libraries. I couldn't easily patch musl with dlopen and friends
so instead I link statically and call deps with c api.
This commit is contained in:
Dawid Sobczak 2023-07-06 11:48:59 +01:00
parent 2ae045cf8a
commit e6b88d5a0f
170 changed files with 72518 additions and 2 deletions

33
06/Makefile Normal file
View file

@ -0,0 +1,33 @@
CC= ../05/tcc-0.9.27/tcc
TCCINST= ../05/tcc-bootstrap
MUSLINST= ../05/musl-bootstrap
LUAINST= lua-bootstrap
CFLAGS= -I $(MUSLINST)/include -I $(LUAINST)/include -I lpeglabel
SRCS = $(sort $(wildcard **/*.c))
OBJS = $(SRCS:.c=.o)
all: zsh
lua-bootstrap/lib/liblua.a:
$(MAKE) -j8 -C lua-5.4.6
$(MAKE) -C lua-5.4.6 install
%.o: %.c lua-bootstrap/lib/liblua.a
$(CC) $(CFLAGS) -c -o $@ $<
zsh: $(OBJS) lua-bootstrap/lib/liblua.a
$(CC) -nostdlib -B $(TCCINST) -o zsh $(OBJS) $(LUAINST)/lib/liblua.a $(MUSLINST)/lib/*.[oa]
run: zsh
./zsh
c:
rm -f zsh
rm -f src/*.o
rm -f lpeglabel/*.o
clean: c
rm -rf lua-bootstrap
$(MAKE) -C lua-5.4.6 clean