Receipt for: procps

source stuff/procps-3.2.8+gmake-3.82.patch
# SliTaz package receipt.

PACKAGE="procps"
VERSION="3.2.8"
CATEGORY="utilities"
SHORT_DESC="The proc filesystem utilities."
MAINTAINER="paul@slitaz.org"
LICENSE="GPL2"
WEB_SITE="https://procps.sourceforge.net/"

TARBALL="$PACKAGE-$VERSION.tar.gz"
#WGET_URL="https://procps.sourceforge.net/$TARBALL"
WGET_URL="https://ftp2.osuosl.org/pub/clfs/conglomeration/procps/$TARBALL"

DEPENDS="ncurses"
BUILD_DEPENDS="ncurses-dev"

# What is the latest version available today?
current_version()
{
	wget -O - https://gitlab.com/procps-ng/procps/-/tags 2>/dev/null | \
	sed '/procps-v/!d;/tar/!d;s|.*procps-v||;s|.tar.*||;q'
}

# Rules to configure and make the package.
compile_rules()
{
	sed -i 's|lncurses|& -ltinfo|' Makefile &&
	patch -Np1 -i $stuff/$PACKAGE-$VERSION+gmake-3.82.patch &&
	make &&
	make -j1 install
}

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

	cp -a $install/usr/bin	$fs/usr
	cp -a $install/bin	$fs
	cp -a $install/sbin	$fs
	case "$ARCH" in
		# 64-bit Makefile installs libproc to lib64; ship it as /lib
		x86_64) cp -a $install/lib64 $fs/lib ;;
		*)      cp -a $install/lib   $fs ;;
	esac
}

# Overlap busybox
pre_install()
{
	rm -f "$1/bin/kill"
	rm -f "$1/bin/ps"
	rm -f "$1/bin/watch"
	rm -f "$1/sbin/sysctl"
	rm -f "$1/usr/bin/pkill"
	rm -f "$1/usr/bin/pmap"
	rm -f "$1/usr/bin/pgrep"
	rm -f "$1/usr/bin/top"
	rm -f "$1/usr/bin/free"
	rm -f "$1/usr/bin/uptime"
}

post_remove()
{
	ln -s /bin/busybox /bin/kill
	ln -s /bin/busybox /bin/ps
	ln -s /bin/busybox /bin/watch
	ln -s /bin/busybox /sbin/sysctl	
	ln -s /bin/busybox /usr/bin/pkill
	ln -s /bin/busybox /usr/bin/pmap
	ln -s /bin/busybox /usr/bin/pgrep
	ln -s /bin/busybox /usr/bin/top
	ln -s /bin/busybox /usr/bin/free
	ln -s /bin/busybox /usr/bin/uptime
}