SUMMARY="A document processor based on structure rather than appearance"
DESCRIPTION="LyX combines the power and flexibility of TeX/LaTeX with the ease \
of use of a graphical interface. This results in world-class support for creation \
of mathematical content (via a fully integrated equation editor) and structured \
documents like academic articles, theses, and books. In addition, staples of \
scientific authoring such as reference list and index creation come standard. But \
you can also use LyX to create a letter or a novel or a theatre play or film \
script. A broad array of ready, well-designed document layouts are built in.

LyX is for people who want their writing to look great, right out of the box. \
No more endless tinkering with formatting details, \"finger painting\" font \
attributes or futzing around with page boundaries. You just write. On screen, \
LyX looks like any word processor; its printed output - or richly \
cross-referenced PDF, just as readily produced - looks like nothing else."
HOMEPAGE="http://www.lyx.org"
LICENSE="GNU GPL v2"
REVISION="1"

ARCHITECTURES="x86_gcc2 x86"
SECONDARY_ARCHITECTURES="x86"

SOURCE_URI="ftp://ftp.lyx.org/pub/lyx/stable/2.1.x/lyx-2.1.3.tar.gz"
CHECKSUM_SHA256="51614a22df749f256aebf768b2066984f1185c1190ce5f7a1b6f9e9bf181846f"
COPYRIGHT="the lyx community"
PATCHES="
	lyx.patchset
	icon.patch
	"
PROVIDES="
	lyx = $portVersion
	app:LyX
	cmd:lyxclient${secondaryArchSuffix}
	cmd:tex2lyx${secondaryArchSuffix}
	"
REQUIRES="
	haiku${secondaryArchSuffix}
	libqt4${secondaryArchSuffix}
	lib:libboost_regex${secondaryArchSuffix}
	lib:libboost_signals${secondaryArchSuffix}
	lib:libstdc++${secondaryArchSuffix}
	lib:libz${secondaryArchSuffix}
	lib:libiconv${secondaryArchSuffix}
	"
# TODO: add support for hunspell
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	boost${secondaryArchSuffix}_devel
	libqt4${secondaryArchSuffix}_devel
	devel:libz${secondaryArchSuffix}
	devel:libiconv${secondaryArchSuffix}
	"
BUILD_PREREQUIRES="
	cmd:gcc${secondaryArchSuffix}
	cmd:make
	cmd:ld${secondaryArchSuffix}
	cmd:autoconf
	cmd:automake
	cmd:gettext${secondaryArchSuffix}
	cmd:find
	cmd:pkg_config${secondaryArchSuffix}
	"

BUILD()
{
	./autogen.sh
	# pkg-config data for libqt4_devel is broken
	# we also can't use runConfigure, as environment variables don't
	# get passed along correctly
	./configure --without-included-boost --prefix=$prefix --bindir=$binDir \
	  --docdir=$docDir --datadir=$dataDir --datarootdir=$dataRootDir \
	  QT4_CORE_CFLAGS=-I/boot/system/develop/headers/x86/QtCore \
	  QT4_FRONTEND_CFLAGS='-I/boot/system/develop/headers/x86/QtCore -I/boot/system/develop/headers/x86/QtGui'
	make V=1 $jobArgs
}

INSTALL()
{
	make install
	addattr -f lib/images/lyx.hvif -t \'VICN\' BEOS:ICON $binDir/lyx
	mkdir $appsDir
	mv $binDir/lyx $appsDir/LyX
	addAppDeskbarSymlink $appsDir/LyX LyX
}
