### this file is sourced not run
PKGVER=2.4.7
PKGBUILD=1
PKGARCH=x86_64

# source: BLFS 2012-09-30 modified and updated to ppp 2.4.7
TARBALL=ppp-$PKGVER.tar.gz
MD5SUM=78818f40e6d33a1d1de68a1551f6595a
SRC_URL=http://www.samba.org/ftp/ppp/$TARBALL
BUNDLE=

SLACKREQ='libpcap'
SLACKDESC="pppd: pppd $PKGVER (PPP Daemon)  
pppd:  
pppd: This package contains the pppd daemon and the chat program. PPP 
pppd: (Point-to-Point Protocol) is used for connecting to other machines; 
pppd: often for connecting to the Internet via a dial-up or PPPoE connection 
pppd: to an ISP.  
pppd: 
pppd: 
pppd: 
pppd: 
pppd:
"

### default pkg_download
### prepare
pkg_prepare() {
	pkg_prepare_default &&
	cd tmp/ppp* &&
	tar -xf $CHROOT_DIR/tmp/pkg/ppp_2.4.6-3.1.debian.tar.xz &&
	
	# apply select debian patches
	patch -Np1 -i debian/patches/close_dev_ppp &&
	patch -Np1 -i debian/patches/fix_linkpidfile &&
	patch -Np1 -i debian/patches/cifdefroute.dif
}
### default pkg_package
### 
pkg_build() {
	cd /tmp/ppp*
	sed -i -e 's|/lib/|/lib64/|' pppd/pathnames.h
	sed -i -e '/LIBDIR/ s|/lib/|/lib64/|' $(grep -RFl LIBDIR *)
	
	MAKEFLAGS="$MAKEFLAGS CBCP=y HAVE_INET6=y"	
	pkg_build_autoconf &&

	### we want these scripts too
	mkdir -p /usr/share/ppp-$PKGVER/scripts /usr/share/man/man1 &&
	install -m755 scripts/pon scripts/poff scripts/plog /usr/bin &&	
	install -m644 scripts/pon.1 /usr/share/man/man1 &&	
	install -m644 scripts/{autopppd,*callback,*add,options*,ppp-*,README,redialer,secure*} \
	    /usr/share/ppp-$PKGVER/scripts &&
	
	### BLFS sample configuration files
	install -d /etc/ppp/peers &&
	install -m600 /tmp/pkg/pap-secrets /etc/ppp/peers &&
	
	### sample pppoe peers
	install -m600 /tmp/pkg/pppoe /etc/ppp/peers &&
	
	### sample pppoatm peer file
	install -m600 /tmp/pkg/pppoatm /etc/ppp/peers &&

	### sample dialup chat and peers file
	install -m644 /tmp/pkg/dialup.chat /etc/ppp &&
	install -m644 /tmp/pkg/dialup /etc/ppp/peers &&

	### sample GPRS/3G chat and peer files
	install -m644 /tmp/pkg/gprs.chat /etc/ppp &&
	install -m644 /tmp/pkg/gprs /etc/ppp/peers &&
	ln -sf ../resolv.conf /etc/ppp/resolv.conf &&

	pkg_build_slackdesc
}



