void-packages/srcpkgs/choosenim/template
Đoàn Trần Công Danh c987560802 srcpkgs/c*: 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

62 lines
1.8 KiB
Bash

# Template file for 'choosenim'
pkgname=choosenim
version=0.7.4
revision=3
hostmakedepends="git nim openssl-devel pkg-config"
makedepends="openssl-devel zlib-devel libarchive-devel"
depends="gcc"
short_desc="Nim toolchain installer"
maintainer="SolitudeSF <solitudesf@protonmail.com>"
license="MIT"
homepage="https://github.com/dom96/choosenim"
distfiles="${homepage}/archive/v${version}.tar.gz>choosenim-${version}.tar.gz
https://github.com/genotrance/nimarchive/archive/v0.5.4.tar.gz>nimarchive-0.5.4.tar.gz"
checksum="0e78a59cfb3cf7926f8dff3a4215949ccfaecd6c6dddc3b2e062098b5da03edb
c38e8c66c2eac2bc021d450f2b60d0e45c5355df963d0133930448639c0bd8d4"
case "$XBPS_TARGET_MACHINE" in
ppc-musl) broken="ftbfs" ;;
esac
post_extract() {
mv ../nimarchive-0.5.4 nimarchive
}
do_build() {
local arch args
case "$XBPS_TARGET_MACHINE" in
aarch64*) arch=arm64;;
arm*) arch=arm;;
mips*) arch=mips;;
ppc64le*) arch=powerpc64el;;
ppc64*) arch=powerpc64;;
ppc*) arch=powerpc;;
esac
LDFLAGS+=" $($PKG_CONFIG --libs-only-l --static openssl)"
LDFLAGS+=" $($PKG_CONFIG --libs-only-l --static libarchive)"
LDFLAGS+=" -lrt -ldl -lpthread"
: >nim.cfg
if [ -z "$CROSS_BUILD" ]; then
cat >>nim.cfg <<-EOF
gcc.options.always = "$CPPFLAGS $CFLAGS -pthread"
gcc.options.linker = "$LDFLAGS"
EOF
fi
if [ -n "$arch" ]; then
cat >>nim.cfg <<-EOF
$arch.linux.gcc.exe = "$CC"
$arch.linux.gcc.linkerexe = "$CC"
$arch.linux.gcc.options.always = "$CPPFLAGS $CFLAGS -pthread"
$arch.linux.gcc.options.linker = "$LDFLAGS"
EOF
args="--cpu:$arch"
fi
ln -sf $XBPS_CROSS_BASE/usr/include/archive.h src
ln -sf $XBPS_CROSS_BASE/usr/include/archive_entry.h src
nimble -y build -d:release --passC:-flto "$args" --path:$wrksrc/nimarchive
}
do_install() {
vbin bin/choosenim
vlicense LICENSE
}