Receipt for: awesome

source
# SliTaz package receipt.

PACKAGE="awesome"
VERSION="4.3"
CATEGORY="x-window"
TAGS="window-manager"
SHORT_DESC="Highly configurable framework window manager."
MAINTAINER="mallory@sweetpeople.org"
LICENSE="GPL2"
WEB_SITE="https://awesomewm.org/"

TARBALL="$PACKAGE-$VERSION.tar.xz"
WGET_URL="https://github.com/awesomeWM/$PACKAGE/releases/download/v$VERSION/$TARBALL"

DEPENDS="cairo dbus gdk-pixbuf lgi libxdg-basedir libxkbcommon lua 
	pango-typelib startup-notification xcb-util-cursor xcb-util-image 
	xcb-util-keysyms xcb-util-renderutil xcb-util-wm xcb-util-xrm"
BUILD_DEPENDS="cairo cairo-dev cmake3 dbus-dev fontconfig-dev freetype-dev 
	gdk-pixbuf-dev gperf imagemagick imlib2-dev lgi libev-dev libpng-dev 
	libltdl libxdg-basedir-dev libxkbcommon-dev lua-dev openexr pango-dev 
	pkg-config startup-notification-dev xcb-util-cursor-dev xcb-util-dev 
	xcb-util-image-dev xcb-util-keysyms-dev xcb-util-renderutil-dev 
	xcb-util-wm-dev xcb-util-xrm-dev xorg-libX11-dev"

# What is the latest version available today?
current_version()
{
	wget -O - ${WGET_URL%/down*} 2>/dev/null | \
	sed '/tag\//!d;s|.*tag/v*||;s|".*||;q'
}

# Rules to configure and make the package.
compile_rules()
{
	export LDFLAGS="$LDFLAGS -Wl,--copy-dt-needed-entries -ldl"
	export AWESOME_IGNORE_LGI=1
	make							\
		CMAKE_ARGS=" -DCMAKE_INSTALL_PREFIX:PATH=/usr	\
		-DXDG_CONFIG_DIR=/etc/xdg			\
		-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
		-DCMAKE_BUILD_TYPE=RELEASE" &&
	make install

	# move lua scripts to lua directory
	lua_major=$(sed '/major_version=/!d;s|.*=||' /usr/lib/pkgconfig/lua.pc)
	mkdir -p $DESTDIR/usr/share/lua/$lua_major/
	cp -a $DESTDIR/usr/share/awesome/lib $DESTDIR/usr/share/lua/$lua_major/
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	cp -a $install/*		$fs
}

post_install()
{
	res=$(cat "$1/etc/slim.conf" | grep ^session | sed s/"sessions. *"//)
	# Adding WM to SLIM available sessions.
	if ! echo "$res" | grep -q $PACKAGE
	  then
		sed -i "s/^sessions.*/sessions            ${res},$PACKAGE/" \
			"$1/etc/slim.conf"
	fi
}

post_remove()
{
	# Remove WM from SLIM available sessions.
	if grep -q $PACKAGE "$1/etc/slim.conf"
	  then
		sed -i s/,$PACKAGE// "$1/etc/slim.conf"
	fi
}