live-bootstrap/steps/byacc-20240109/pass1.kaem
fosslinux a67db8fcbd Make patches relative to where tarballs are extracted
Ever since an old patch version, it has (for reasonable security
reasons) not supported patched with ../ in the filename.
Many of our patches have been relying on this behaviour being OK,
because we start off with an ancient patch version that didn't perform
such checks. As soon as we need this behaviour after we build a newer
patch though, we will have problems.

So, let's change the policy.
Patches are relative to where tarballs are extracted, rather than the
"working directory" - e.g. have patches for `coreutils-9.4/src/cp.c`
instead of `src/cp.c`.
Keeping this consistent has a few implications;
- patches are applied from the build/ directory in bash era now, with
  `-p0`
- when patches are manually applied in the bash era, use `-p` as
  required, usually `-p1`
- in kaem era where patches are always manually applied, `-p1` is used
2024-12-23 15:20:42 +11:00

45 lines
1,001 B
Bash

#!/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 and patch
cp ../../files/Makefile .
patch -Np1 -i ../../patches/meslibc.patch
# 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}/yacc
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