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/"
SOURCE_URI="git://github.com/HaikuArchives/MinimizeAll.git#5afe6d4fab8f7e2a33727ef9152578b7d0c836ec"

REVISION="3"

COPYRIGHT="
	2001-2008 Werner Freytag
	2009 Haiku
	"

LICENSE="MIT"

ARCHITECTURES="x86_gcc2 x86 x86_64"

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

REQUIRES="
	haiku
	"

BUILD_PREREQUIRES="
	cmd:gcc
	cmd:xres
	"

BUILD_REQUIRES="
	haiku_devel
	"

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"
}
