mirror of
https://github.com/fosslinux/live-bootstrap.git
synced 2026-03-18 17:25:24 +01:00
Add byacc parser generator
This is meant to replace heirloom yacc for compiling pre-musl parsers. Unlike heirloom yacc, it's in the public domain, and can be linked with meslibc without licensing concerns.
This commit is contained in:
parent
86e1a5e7f6
commit
3970ee7d1a
5 changed files with 137 additions and 0 deletions
1
steps/byacc-20240109/byacc-20240109.checksums
Normal file
1
steps/byacc-20240109/byacc-20240109.checksums
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
608651c4836eff7f164a0c6d238337a254fca964677bec76d87f85692ce71b59 /usr/bin/yacc
|
||||||
83
steps/byacc-20240109/files/Makefile
Normal file
83
steps/byacc-20240109/files/Makefile
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
DEST = .
|
||||||
|
|
||||||
|
HDRS = defs.h
|
||||||
|
|
||||||
|
CFLAGS ?= -O -DNDEBUG
|
||||||
|
|
||||||
|
LDFLAGS ?=
|
||||||
|
|
||||||
|
LIBS ?=
|
||||||
|
|
||||||
|
LINKER ?= $(CC)
|
||||||
|
|
||||||
|
MAKEFILE = Makefile
|
||||||
|
|
||||||
|
OBJS = closure.o \
|
||||||
|
error.o graph.o \
|
||||||
|
lalr.o \
|
||||||
|
lr0.o \
|
||||||
|
main.o \
|
||||||
|
mkpar.o mstring.o \
|
||||||
|
output.o \
|
||||||
|
reader.o \
|
||||||
|
symtab.o \
|
||||||
|
verbose.o \
|
||||||
|
warshall.o yaccpar.o
|
||||||
|
|
||||||
|
PRINT = pr -f -l88
|
||||||
|
|
||||||
|
PROGRAM = yacc
|
||||||
|
|
||||||
|
SRCS = closure.c \
|
||||||
|
error.c graph.c \
|
||||||
|
lalr.c \
|
||||||
|
lr0.c \
|
||||||
|
main.c \
|
||||||
|
mkpar.c mstring.c \
|
||||||
|
output.c \
|
||||||
|
reader.c \
|
||||||
|
symtab.c \
|
||||||
|
verbose.c \
|
||||||
|
warshall.c yaccpar.c
|
||||||
|
|
||||||
|
all: $(PROGRAM)
|
||||||
|
|
||||||
|
$(PROGRAM): $(OBJS) $(LIBS)
|
||||||
|
@$(LINKER) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(LIBS)
|
||||||
|
|
||||||
|
clean:; @rm -f $(OBJS)
|
||||||
|
|
||||||
|
clobber:; @rm -f $(OBJS) $(PROGRAM)
|
||||||
|
|
||||||
|
depend:; @mkmf -f $(MAKEFILE) PROGRAM=$(PROGRAM) DEST=$(DEST)
|
||||||
|
|
||||||
|
index:; @ctags -wx $(HDRS) $(SRCS)
|
||||||
|
|
||||||
|
install: $(PROGRAM)
|
||||||
|
@echo Installing $(PROGRAM) in $(DEST)
|
||||||
|
@install -s $(PROGRAM) $(DEST)
|
||||||
|
|
||||||
|
listing:; @$(PRINT) Makefile $(HDRS) $(SRCS) | lpr
|
||||||
|
|
||||||
|
lint:; @lint $(SRCS)
|
||||||
|
|
||||||
|
program: $(PROGRAM)
|
||||||
|
|
||||||
|
tags: $(HDRS) $(SRCS); @ctags $(HDRS) $(SRCS)
|
||||||
|
|
||||||
|
###
|
||||||
|
closure.o: defs.h
|
||||||
|
error.o: defs.h
|
||||||
|
lalr.o: defs.h
|
||||||
|
lr0.o: defs.h
|
||||||
|
main.o: defs.h
|
||||||
|
mkpar.o: defs.h
|
||||||
|
output.o: defs.h
|
||||||
|
reader.o: defs.h
|
||||||
|
symtab.o: defs.h
|
||||||
|
verbose.o: defs.h
|
||||||
|
warshall.o: defs.h
|
||||||
|
btyaccpar.o: defs.h
|
||||||
|
yaccpar.o: defs.h
|
||||||
|
graph.o: defs.h
|
||||||
|
mstring.o: defs.h
|
||||||
51
steps/byacc-20240109/pass1.kaem
Normal file
51
steps/byacc-20240109/pass1.kaem
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
|
||||||
|
# SPDX-FileCopyrightText: 2021-22 fosslinux <fosslinux@aussies.space>
|
||||||
|
# SPDX-FileCopyrightText: 2024 Gábor Stefanik <netrolller.3d@gmail.com>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
# Check tarball checksums
|
||||||
|
checksum-transcriber sources
|
||||||
|
sha256sum -c sources.SHA256SUM
|
||||||
|
|
||||||
|
mkdir build src
|
||||||
|
cd build
|
||||||
|
|
||||||
|
# Extract
|
||||||
|
cp ${DISTFILES}/${pkg}.tgz ../src/${pkg}.tar.gz
|
||||||
|
gunzip -f ../src/${pkg}.tar.gz
|
||||||
|
tar xf ../src/${pkg}.tar
|
||||||
|
rm -r ../src/
|
||||||
|
cd ${pkg}
|
||||||
|
|
||||||
|
# Prepare
|
||||||
|
cp ../../files/Makefile .
|
||||||
|
|
||||||
|
# meslibc has no fgetpos/fsetpos - emulate using fseek/ftell
|
||||||
|
sed -i -e "s/fpos_t/long/" -e "s/fgetpos(f, &save_area.line_fpos) != 0/(save_area.line_fpos = ftell(f)) == -1/" \
|
||||||
|
-e "s/fsetpos(input_file, &save_area.line_fpos)/fseek(input_file, save_area.line_fpos, SEEK_SET)/" reader.c
|
||||||
|
|
||||||
|
# likewise, meslibc has no tmpfile()
|
||||||
|
sed -i -e "s/tmpfile()/fopen(label, \"w+\")/" main.c
|
||||||
|
|
||||||
|
# Build yacc
|
||||||
|
make CC=tcc AR=tcc\ -ar CFLAGS=-DMAXPATHLEN=100\ -DEILSEQ=84\ -DMB_LEN_MAX=100 LDFLAGS=-lgetopt\ -static RANLIB=true
|
||||||
|
|
||||||
|
# Install yacc
|
||||||
|
install yacc ${BINDIR}
|
||||||
|
|
||||||
|
cd ../..
|
||||||
|
|
||||||
|
# Checksums
|
||||||
|
if match x${UPDATE_CHECKSUMS} xTrue; then
|
||||||
|
sha256sum -o ${pkg}.checksums \
|
||||||
|
/usr/bin/yacc
|
||||||
|
|
||||||
|
install ${pkg}.checksums ${SRCDIR}
|
||||||
|
else
|
||||||
|
sha256sum -c ${pkg}.checksums
|
||||||
|
fi
|
||||||
1
steps/byacc-20240109/sources
Normal file
1
steps/byacc-20240109/sources
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
https://invisible-island.net/archives/byacc/byacc-20240109.tgz f2897779017189f1a94757705ef6f6e15dc9208ef079eea7f28abec577e08446
|
||||||
|
|
@ -49,6 +49,7 @@ build: tar-1.12
|
||||||
build: sed-4.0.9
|
build: sed-4.0.9
|
||||||
build: bzip2-1.0.8
|
build: bzip2-1.0.8
|
||||||
build: coreutils-5.0
|
build: coreutils-5.0
|
||||||
|
build: byacc-20240109
|
||||||
build: heirloom-devtools-070527
|
build: heirloom-devtools-070527
|
||||||
build: bash-2.05b
|
build: bash-2.05b
|
||||||
improve: setup_repo
|
improve: setup_repo
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue