#!/bin/sh # SPDX-FileCopyrightText: 2021 fosslinux # # SPDX-License-Identifier: GPL-3.0-or-later set -ex mkdir build cd build # Extract gunzip ../src/${pkg}.tar.gz tar xf ../src/${pkg}.tar cd ${pkg} # Create config.h and patchlevel.h catm config.h catm patchlevel.h # Patch cp pch.c pch_patched.c sed -i 841,848d pch_patched.c # Compile tcc -c error.c tcc -c getopt.c tcc -c getopt1.c tcc -c -I. addext.c tcc -c -I. argmatch.c tcc -c -I. -DHAVE_DECL_GETENV -DHAVE_DECL_MALLOC -DHAVE_DIRENT_H -Dsize_t="unsigned long" backupfile.c tcc -c -I. -Dsize_t="unsigned long" basename.c tcc -c -I. -Dsize_t="unsigned long" dirname.c tcc -c -I. -DHAVE_LIMITS_H -DHAVE_GETEUID inp.c tcc -c -I. maketime.c tcc -c -I. -Dsize_t="unsigned long" partime.c tcc -c -I. -DHAVE_MKTEMP -DHAVE_LIMITS_H -DHAVE_GETEUID -DPACKAGE_BUGREPORT= patch.c tcc -c -I. -Ded_PROGRAM=\"/nullop\" -DHAVE_LIMITS_H -DHAVE_GETEUID pch_patched.c tcc -c -I. quote.c tcc -c -I. -Dmbstate_t=void -Dsize_t="unsigned long" quotearg.c tcc -c -I. quotesys.c tcc -c -I. -DRETSIGTYPE=int -Dsize_t="unsigned long" -DHAVE_MKDIR -DHAVE_RMDIR -DHAVE_LIMITS_H -DHAVE_GETEUID -DHAVE_FCNTL_H util.c tcc -c -I. -DPACKAGE_NAME=\"patch\" -DPACKAGE_VERSION=\"2.5.9\" version.c tcc -c -I. -DHAVE_MALLOC -DHAVE_REALLOC xmalloc.c # Link tcc -static -o ${bindir}/patch error.o getopt.o getopt1.o addext.o argmatch.o backupfile.o basename.o dirname.o inp.o maketime.o partime.o patch.o pch_patched.o quote.o quotearg.o quotesys.o util.o version.o xmalloc.o # Test patch --version cd ../.. # Checksums sha256sum -c checksums