void-packages/srcpkgs/9base/template
Đoàn Trần Công Danh 75403cef76 srcpkgs/[0-9]*: convert patches to -Np1
```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
```
2021-06-20 13:17:29 +07:00

60 lines
2.3 KiB
Bash

# Template file for '9base'
pkgname=9base
version=6.0.20190911
revision=2
_githash=63916da7bd6d73d9a405ce83fc4ca34845667cce
wrksrc="9base"
build_style=gnu-makefile
# we use byacc instead of internal version
hostmakedepends="byacc"
short_desc="Revived minimalist port of Plan 9 userland to Unix"
maintainer="Tai Chi Minh Ralph Eastwood <tcmreastwood@gmail.com>"
license="custom:Plan9"
homepage="http://git.suckless.org/9base"
# Checked out from http://git.suckless.org/9base/ and created tarball with
# git archive -o 9base-${_githash}.tar.gz --prefix=9base/ master .
distfiles="https://alpha.de.repo.voidlinux.org/distfiles/9base-${_githash}.tar.gz"
checksum=b315509470c25db88595bd0e9478428dea54d7836fe2ba9d07279ae9496366fb
conflicts="plan9port"
provides="plan9port-20160418_4"
CFLAGS="-fcommon"
pre_build() {
# These are platform specific, but aarch64 and mips have their
# program counter in the same place; we'll just use the ARM
# implementation.
cp lib9/getcallerpc-arm.c lib9/getcallerpc-aarch64.c
cp lib9/getcallerpc-arm.c lib9/getcallerpc-mips.c
# config.mk has conflicting flags to the build-style; we enforce
# specific ones in config.mk to make sure they don't get changed
# in do_build.
sed -i 's|^PREFIX \+= /usr/local/plan9|override PREFIX = /usr/lib/plan9|g' config.mk
sed -i 's|^CFLAGS \++=|override CFLAGS += -D_DEFAULT_SOURCE |g' config.mk
sed -i 's|^LDFLAGS.*||g' config.mk
sed -i 's|^CC.*||g' config.mk
# Add rc to the AR flag as the 9base build-scripts require AR to
# be declared with the 'rc' argument. However, AR can be
# different to 'ar' if declared differently within xbps e.g.
# gcc-ar which is necessary for link-time optimisation builds.
sed -i 's|^AR.*|override AR += rc|g' config.mk
sed -i 's|^YACC \+=.*|YACC = byacc|g' config.mk
# This allows 9base's build-style know which getcallerpc
# implementation to use.
case "$XBPS_TARGET_MACHINE" in
i686*) sed -i 's|^OBJTYPE \+=.*|OBJTYPE = 386|g' config.mk ;;
x86_64*) sed -i 's|^OBJTYPE \+=.*|OBJTYPE = x86_64|g' config.mk ;;
arm*) sed -i 's|^OBJTYPE \+=.*|OBJTYPE = arm|g' config.mk ;;
aarch64*) sed -i 's|^OBJTYPE \+=.*|OBJTYPE = aarch64|g' config.mk ;;
mips*) sed -i 's|^OBJTYPE \+=.*|OBJTYPE = mips|g' config.mk ;;
ppc64*) sed -i 's|^OBJTYPE \+=.*|OBJTYPE = power|g' config.mk ;;
esac
}
post_install() {
vinstall $FILESDIR/plan9.sh 644 etc/profile.d
vlicense LICENSE
}