# Template file for 'pilot-link'
pkgname=pilot-link
version=0.12.5
revision=1
build_style=gnu-configure
# XXX: Add perl bindings --with-perl and fix bindings/Perl/Makefile
configure_args="--enable-conduits --enable-libusb --enable-threads --disable-static
 --disable-compile-werror --with-python --with-tcl=${XBPS_CROSS_BASE}/usr/lib"
hostmakedepends="automake libtool perl pkg-config tk"
makedepends="libbluetooth-devel libusb-devel libpng-devel popt-devel
 python-devel tcl-devel readline-devel"
depends="tk"
conf_files="/etc/udev/rules.d/60-libpisock.rules"
short_desc="Suite of tools to connect your Palm or PalmOS® handheld"
maintainer="Jürgen Buchmüller <pullmoll@t-online.de>"
license="GPL-2"
homepage="http://www.pilot-link.org/"
# Main site is unreachable (no address record).
#distfiles="http://downloads.pilot-link.org/${pkgname}-${version}.tar.bz2"
distfiles="https://fossies.org/linux/misc/old/${pkgname}-${version}.tar.bz2"
checksum=0e3e0ea4649c7c3441b8be738d5e68332a5e414df622e013daba8e29d78bde56

# Avoid error because of deprecation
CFLAGS="-Wno-deprecated-declarations"
LDFLAGS="-lm"

pre_configure() {
	autoreconf -fi
}
post_configure() {
	# --disable-compile-error does not seem to work so patch Makefiles
	find -name Makefile -exec sed -i "{}" -e "s;-Werror;-Wno-error;g" \;
	# Fix wrong perl Config.pm path
	sed -i bindings/Perl/Makefile \
		-e "s;/usr/lib/perl/5.10/Config.pm;/usr/lib/perl5/core_perl/Config.pm;"
}
post_install() {
	local m

	# Install udev rules for libpisock
	vinstall doc/60-libpisock.rules 644 etc/udev/rules.d

	# Install manual pages
	for m in doc/man/*.1; do
		vman ${m}
	done
}

pilot-link-devel_package() {
	short_desc+=" - development files"
	depends="${makedepends} ${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/pkgconfig
		vmove usr/lib/*.so
	}
}
