mirror of
https://github.com/fosslinux/live-bootstrap.git
synced 2026-03-25 04:26:31 +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
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue