c6ce65d3d0
```sh git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" | while read template; do for p in ${template%/template}/patches/*; do sed -i ' \,^[+-][+-][+-] /dev/null,b /^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b s,^[*][*][*] ,&a/, /^--- /{ s,\(^--- \)\(./\)*,\1a/, s,[.-][Oo][Rr][Ii][Gg]\([ /]\),\1, s/[.-][Oo][Rr][Ii][Gg]$// s/[.]patched[.]\([^.]\)/.\1/ h } /^+++ -/{ g s/^--- a/+++ b/ b } s,\(^+++ \)\(./\)*,\1b/, ' "$p" done sed -i '/^patch_args=/d' $template done ```
57 lines
1.9 KiB
Bash
57 lines
1.9 KiB
Bash
# Template file for 'bc'
|
||
pkgname=bc
|
||
version=1.07.1
|
||
revision=5
|
||
build_style=gnu-configure
|
||
configure_args="--with-readline"
|
||
hostmakedepends="ed flex texinfo"
|
||
makedepends="readline-devel"
|
||
short_desc="Arbitrary precision numeric processing language"
|
||
maintainer="Enno Boland <gottox@voidlinux.org>"
|
||
license="GPL-3.0-or-later"
|
||
homepage="http://www.gnu.org/software/${pkgname}/"
|
||
distfiles="${GNU_SITE}/${pkgname}/${pkgname}-${version}.tar.gz"
|
||
checksum=62adfca89b0a1c0164c2cdca59ca210c1d44c3ffc46daf9931cf4942664cb02a
|
||
alternatives="
|
||
bc:bc:/usr/bin/gnu-bc
|
||
bc:bc.1:/usr/share/man/man1/gnu-bc.1
|
||
dc:dc:/usr/bin/gnu-dc
|
||
dc:dc.1:/usr/share/man/man1/gnu-dc.1"
|
||
disable_parallel_build=yes
|
||
|
||
if [ "$CROSS_BUILD" ]; then
|
||
hostmakedepends+=" bc"
|
||
pre_build() {
|
||
# don’t run target built binary 'fbc';
|
||
# run host 'bc' instead
|
||
sed -i -e 's|^\(\s\+\)./fbc|\1bc|g' bc/Makefile
|
||
}
|
||
fi
|
||
do_build() {
|
||
make ${makejobs} LEX="flex -I"
|
||
}
|
||
do_check() {
|
||
# LFS tells us that there are 10 know failures
|
||
# What happens here
|
||
# 1. echo "quit" so bc will quit after running Test/checklib.b
|
||
# 2. tee to /dev/tty so the Maintainer will see the output of the tests
|
||
# 3. grep the Total failures for any number between 1 and 199
|
||
# 4. cut Total failures: from the numbers
|
||
# 5. use awk to sum the numbers
|
||
failures="$(echo "quit" | ./bc/bc -l Test/checklib.b | tee /dev/tty | grep 'Total failures: [1-9]\|1[0-9]\|1[0-9][0-9]' | cut -d: -f2 | awk '{s+=$1} END {print s}' )"
|
||
|
||
# 6. Check if there are more than then 10 Know test failures as pointed by LFS
|
||
# http://www.linuxfromscratch.org/lfs/view/development/chapter06/bc.html
|
||
if [ "$failures" -gt 10 ]; then
|
||
echo "THERE ARE MORE THAN THE 10 KNOW FAILURES"
|
||
return 1
|
||
else
|
||
echo "TESTS PASSED"
|
||
fi
|
||
}
|
||
post_install() {
|
||
mv ${DESTDIR}/usr/bin/{,gnu-}bc
|
||
mv ${DESTDIR}/usr/bin/{,gnu-}dc
|
||
mv ${DESTDIR}/usr/share/man/man1/{,gnu-}bc.1
|
||
mv ${DESTDIR}/usr/share/man/man1/{,gnu-}dc.1
|
||
}
|