SUMMARY="Program which allows running Microsoft Windows programs"
DESCRIPTION="Wine is a program which allows running Microsoft Windows programs \
(including DOS, Windows 3.x, Win32, and Win64 executables) on Unix. \
It consists of a program loader which loads and executes a Microsoft \
Windows binary, and a library (called Winelib) that implements Windows \
API calls using their Unix, X11 or Mac equivalents.  The library may also \
be used for porting Windows code into native Unix executables."
HOMEPAGE="https://www.winehq.org/"
COPYRIGHT="1993-2021 the Wine project authors"
LICENSE="GNU LGPL v2.1"
REVISION="1"
SOURCE_URI="https://github.com/wine-mirror/wine/archive/refs/tags/wine-${portVersion}.tar.gz"
CHECKSUM_SHA256="a377546970b780d1d184d7a9dc45cc3c4373541de2861c8fb354008ff965f79a"
SOURCE_DIR="wine-wine-${portVersion}"
PATCHES="wine-$portVersion.patchset"

# disabled: pending Haiku changes
ARCHITECTURES="?all !x86_gcc2"
SECONDARY_ARCHITECTURES="!x86"

PROVIDES="
	wine$secondaryArchSuffix = $portVersion
	cmd:wine64$secondaryArchSuffix = $portVersion
	cmd:function_grep.pl
	cmd:msidb
	cmd:msiexec
	cmd:notepad
	cmd:regedit
	cmd:regsvr32
	cmd:widl
	cmd:wineboot
	cmd:winebuild
	cmd:winecfg
	cmd:wineconsole
	cmd:winecpp
	cmd:winedbg
	cmd:winedump
	cmd:winefile
	cmd:wineg++
	cmd:winegcc
	cmd:winemaker
	cmd:winemine
	cmd:winepath
	cmd:wineserver
	cmd:wmc
	cmd:wrc
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	lib:libvulkan$secondaryArchSuffix
	lib:libusb$secondaryArchSuffix
	"

BUILD_REQUIRES="
	devel:libfreetype$secondaryArchSuffix
	devel:libvulkan$secondaryArchSuffix
	devel:libusb$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel
	cmd:autoconf
	cmd:automake
	cmd:cp
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:sed
	cmd:flex
	cmd:bison
	cmd:pkg_config$secondaryArchSuffix
	cmd:mkdepend
	cmd:gettext
	llvm12
	llvm12_clang
	llvm12_lld
	"

BUILD()
{
	autoreconf -i
	LDFLAGS=-lnetwork runConfigure ./configure --enable-win64 --without-x --without-xshm

	make $jobArgs
}

INSTALL()
{
	make install
}
