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

101 lines
2.4 KiB
Bash

# Template file for 'zbar'
pkgname=zbar
version=0.23.1
revision=3
build_style=gnu-configure
build_helper=gir
configure_args="$(vopt_with qt) --with-gir --with-python=python3"
hostmakedepends="pkg-config python3 glib-devel
$(vopt_if qt 'qt5-qmake qt5-host-tools')"
makedepends="libmagick-devel libXv-devel python3-devel v4l-utils-devel
gtk+3-devel $(vopt_if qt qt5-x11extras-devel)"
depends="libzbar-${version}_${revision}"
short_desc="Barcode reading library and application"
maintainer="Leah Neukirchen <leah@vuxu.org>"
license="LGPL-2.1-or-later"
homepage="https://git.linuxtv.org/zbar.git/"
distfiles="https://linuxtv.org/downloads/zbar/${pkgname}-${version}.tar.bz2"
checksum=dad260b47ef887a639e840a89e5e6e132217b6bba2a8473565d1f459bcb97c1f
build_options="qt"
case "$XBPS_TARGET_MACHINE" in
mips*) ;; # don't enable qt as it can't be built for mips*
*) build_options_default="qt" ;;
esac
case "$XBPS_TARGET_MACHINE" in
*-musl) makedepends+=" argp-standalone"
LDFLAGS="-largp"
;;
esac
export PYTHON_CFLAGS="-I$XBPS_CROSS_BASE/usr/include/python$py3_ver"
CFLAGS="-DNDEBUG"
subpackages="libzbar libzbar-devel"
if [ "$build_option_qt" ]; then
subpackages+=" zbar-qt libzbar-qt"
fi
post_extract() {
# 0.23.1 doesn't ship this file, corrected in master
cat >zbar-qt5.pc.in <<-'_EOF'
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: zbar-qt
Description: bar code scanning and decoding Qt5 widget
URL: http://zbar.sourceforge.net
Version: @VERSION@
Requires: zbar, Qt5Core >= 5, Qt5Gui >= 5
Libs: -L${libdir} -lzbarqt
Cflags: -I${includedir}
_EOF
}
post_patch() {
# https://github.com/mchehab/zbar/commit/a133aea7880bbb56d7553
vsed -i -e 's/^.include.*gettext[.]h.*/#include <locale.h>/' \
zbarcam/zbarcam.c zbarimg/zbarimg.c
}
libzbar_package() {
short_desc+=" - library files"
pkg_install() {
vmove "usr/lib/libzbar.so.*"
vmove "usr/lib/libzbargtk.so.*"
vmove "$py3_lib"
vmove "usr/lib/girepository-1.0"
}
}
zbar-qt_package() {
short_desc+=" - Qt frontend"
pkg_install() {
vmove "usr/bin/*-qt"
}
}
libzbar-qt_package() {
conflicts="libzbar<0.10_10"
short_desc+=" - Qt bindings"
pkg_install() {
vmove "usr/lib/libzbarqt.so.*"
}
}
libzbar-devel_package() {
short_desc+=" - development files"
depends="libzbar>=${version}_${revision}"
pkg_install() {
vmove usr/include
vmove usr/lib/pkgconfig
vmove "usr/lib/*.a"
vmove "usr/lib/*.so"
vmove "usr/share/gir-1.0"
}
}