live-bootstrap/steps/bzip2-1.0.8/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

50 lines
983 B
Bash
Executable file

#!/bin/sh
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
# SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
#
# 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}.tar.xz ../src/
unxz --file ../src/${pkg}.tar.xz --output ../src/${pkg}.tar
tar xf ../src/${pkg}.tar
rm -r ../src
cd ${pkg}
# Patch
patch -Np1 -i ../../patches/mes-libc.patch
patch -Np1 -i ../../patches/coreutils.patch
# Build
make CC=tcc AR="tcc -ar" LDFLAGS="-static" bzip2
# Install
cp bzip2 ${PREFIX}/bin/bzip2
cp bzip2 ${PREFIX}/bin/bunzip2
chmod 755 ${PREFIX}/bin/bzip2
chmod 755 ${PREFIX}/bin/bunzip2
# Test
bzip2 --help
cd ../..
# Checksums
if match x${UPDATE_CHECKSUMS} xTrue; then
sha256sum -o ${pkg}.checksums \
/usr/bin/bzip2
cp ${pkg}.checksums ${SRCDIR}
else
sha256sum -c ${pkg}.checksums
fi