# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit readme.gentoo-r1

DESCRIPTION="Excellent program to automatically configure PPP sessions"
HOMEPAGE="https://code.google.com/archive/p/wvstreams/"
SRC_URI="
	https://wvstreams.googlecode.com/files/${P/_p*}.tar.gz
	mirror://debian/pool/main/w/${PN}/${PN}_${PV/_p/-}.debian.tar.xz
"
S="${WORKDIR}"/${P/_p*}

LICENSE="LGPL-2"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~sparc ~x86"

DEPEND=">=net-libs/wvstreams-4.4"
RDEPEND="${DEPEND}
	net-dialup/ppp:=
"
BDEPEND="virtual/pkgconfig"

DOC_CONTENTS="
	Use wvdialconf to automagically generate a configuration file.
	Users have to be member of the dialout AND the uucp group to use
	wvdial
"

src_prepare() {
	PATCHES=(
		$(awk '{ print "'"${WORKDIR}"'/debian/patches/" $0; }' < "${WORKDIR}"/debian/patches/series)

		"${FILESDIR}/${P/_p*}-destdir.patch"
		"${FILESDIR}/${P/_p*}-as-needed.patch"
		"${FILESDIR}/${P/_p*}-parallel-make.patch"
	)

	default
}

src_configure() {
	# Hand made configure...
	./configure || die
}

src_install() {
	default
	readme.gentoo_create_doc
}

pkg_postinst() {
	readme.gentoo_print_elog
}