# SliTaz package receipt.

PACKAGE="wget"
VERSION="1.20.3"
CATEGORY="utilities"
SHORT_DESC="retrieve files from the web"
MAINTAINER="sygne@ombres.eu"
TARBALL="$PACKAGE-$VERSION.tar.gz"
WEB_SITE="http://www.gnu.org/software/wget/wget.html"
WGET_URL="$GNU_MIRROR/$PACKAGE/$TARBALL"

DEPENDS="openssl libidn pcre util-linux-uuid zlib"
BUILD_DEPENDS="openssl-dev libidn-dev flex" # util-linux-uuid-dev

# Rules to configure and make the package.
compile_rules()
{
	cd $src	
	./configure \
		--with-ssl=openssl \
		--with-openssl \
		--sysconfdir=/etc \
	$CONFIGURE_ARGS &&
	make DESTDIR=$DESTDIR install

	gzip -9 $install/usr/share/man/man1/wget.1
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/usr 
	cp -a $_pkg/usr/bin $fs/usr
}

# Post install rules.
post_install()
{
	echo -e "
wget is in conflict with the busybox wget.
If you want to use the busybox wget, do (as root):
\033[1m ln -s /bin/busybox /usr/bin/wget \033[0m
"
}

# Pre and post install commands for Tazpkg.
# We must remove all Busybox symlink before installing.
#
pre_install()
{
	local root
	root=$1
	echo "Processing pre-install commands..."
	echo -n "Removing all Busybox replaced utils... "
	rm -f $root/usr/bin/wget
	status
}

post_remove()
{
	ln -s /bin/busybox $1/usr/bin/wget
}