SUMMARY="A native file sharing and chat application"
DESCRIPTION="BeShare is a BeOS/Haiku-native file sharing program. \
It operates similarly to other such programs (IRC, Napster, Hotline, etc) \
but with a few advantages:

- BeShare allows you to upload or download any type of file, not just mp3.
- When browsing files, you can see their attributes (similar to Tracker's\
 view).
- Your query is always \"live\", so if new files that match your query become\
 available, you will see them added to the results list right away (you won't\
 have to click \"refresh\" or anything first).
- BeShare includes a rudimentary chat mechanism for you social types.
- BeShare supports any number of simultaneous uploads and downloads\
 in parallel, but will serialize simultaneous file requests to any\
 given host for efficiency.
- BeShare connects to any MUSCLE server\
 (see https://public.msli.com/lcs/muscle/ for details).
- BeShare source code is available, and serves as an example of how to write\
 a MUSCLE client."
HOMEPAGE="
	https://github.com/HaikuArchives/BeShare
	http://web.ncf.ca/au829/BeOS/
	"
COPYRIGHT="1999-2012 Jeremy Friesner"
LICENSE="Public Domain
	libsanta"
# Use revision 3+ to take priority over existing 3.04 versions.  AGMS20210622
REVISION="3"
SOURCE_URI="http://web.ncf.ca/au829/BeOS/BeShare_3.04.zip"
CHECKSUM_SHA256="37b9e590d2f3f5ce1395fdb6a31e8849ce0d286a79a53908476ea70f942987a2"
SOURCE_FILENAME="BeShare_3.04.zip"
SOURCE_DIR="BeShare"

ADDITIONAL_FILES="beshare-post-install.sh"
POST_INSTALL_SCRIPTS="$relativePostInstallDir/beshare-post-install.sh"

# Note this source code is portable and should compile on all platforms (PPC,
# all x86 varieties), and for both BeOS and Haiku.  Please keep it that way.
ARCHITECTURES="all ?x86 ?arm ?ppc"

PROVIDES="
	beshare$secondaryArchSuffix = $portVersion
	app:BeShare = $portVersion
	"

REQUIRES="haiku$secondaryArchSuffix"

BUILD_REQUIRES="haiku${secondaryArchSuffix}_devel"

BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	if [ $effectiveTargetArchitecture == x86_64 ]; then
		CXXFLAGS="-DMUSCLE_64_BIT_PLATFORM"
	fi
	export CXXFLAGS="-D_BSD_SOURCE $CXXFLAGS"
	cd source/beshare
	make $jobArgs
}

INSTALL()
{
	mkdir -p -v $appsDir
	cp -av $sourceDir/source/beshare/BeShare $appsDir/BeShare
	chmod -v a+rx $appsDir/BeShare
	addAppDeskbarSymlink $appsDir/BeShare

	mkdir -p -v $postInstallDir
	cp -av $portDir/additional-files/beshare-post-install.sh $postInstallDir
	chmod -v a+rx $postInstallDir/beshare-post-install.sh

	mkdir -p -v $docDir
	cp -av documentation/* $docDir
}
