SUMMARY="Minimize all your apps with the press of a button!"
DESCRIPTION="
MinimizeAll is a small app that minimizes all your apps with the press of a \
button on the Deskbar, or with a keypress. The app contains two parts: A \
standalone app that minimizes the whole app, and a replicant for your Deskbar. \
Both do the same: Minimize all your apps!"
HOMEPAGE="https://github.com/HaikuArchives/MinimizeAll"
COPYRIGHT="2001-2008 Werner Freytag
	2009 Haiku"
LICENSE="MIT"
REVISION="5"
srcGitRev="5afe6d4fab8f7e2a33727ef9152578b7d0c836ec"
SOURCE_URI="$HOMEPAGE/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="b3e8d78e7e7ec723c51b63fac1151ff84a88e4091f29b1204418caf64ce83b16"
SOURCE_DIR="MinimizeAll-$srcGitRev"

ARCHITECTURES="x86_gcc2 x86 x86_64"

PROVIDES="
	minimizeall = $portVersion
	app:MinimizeAll = $portVersion
	"
REQUIRES="
	haiku
	"

BUILD_REQUIRES="
	haiku_devel
	"
BUILD_PREREQUIRES="
	cmd:gcc
	cmd:xres
	"

BUILD()
{
	mkdir -p bin

	if [ "$effectiveTargetArchitecture" = "x86_gcc2" ]; then
		STDLIB="stdc++.r4"
	else
		STDLIB="stdc++"
	fi

	# Step 1 - Building the app
	cd app
	gcc -o ../bin/MinimizeAll -lbe -l$STDLIB main.cpp ../minimize.cpp
	rc -o ../bin/MinimizeAll.rsrc Application.rdef
	xres -o ../bin/MinimizeAll ../bin/MinimizeAll.rsrc
	mimeset -f ../bin/MinimizeAll
	cd ..

	# Step 2 - The DeskBar AddOn!
	cd "deskbar add-on"
	gcc -o ../bin/DeskbarAddOn -lbe -l$STDLIB DeskbarView.cpp ../minimize.cpp
	rc -o ../bin/DeskbarAddOn.rsrc DeskbarAddOn.rdef
	xres -o ../bin/DeskbarAddOn ../bin/DeskbarAddOn.rsrc
	mimeset -f ../bin/DeskbarAddOn
	cd ..
}

INSTALL()
{
	mkdir -p $appsDir/MinimizeAll
	cp bin/MinimizeAll $appsDir/MinimizeAll/MinimizeAll
	cp bin/DeskbarAddOn $appsDir/MinimizeAll/DeskbarAddOn
	addAppDeskbarSymlink $appsDir/MinimizeAll/MinimizeAll
	mkdir -p "$dataDir/deskbar/menu/Desktop applets"
	symlinkRelative -s "$appsDir/MinimizeAll/DeskbarAddOn"  \
		"$dataDir/deskbar/menu/Desktop applets/MinimizeAll"
}
