SUMMARY="GLib is a cross-platform software utility library"
DESCRIPTION="GLib is a cross-platform software utility library that began as \
part of the GTK+ project. However, before releasing version 2 of GTK+, the \
project's developers decided to separate non-GUI-specific code from the GTK+ \
platform, thus creating GLib as a separate product. GLib was released as a \
separate library so other developers, those who did not make use of the \
GUI-related portions of GTK+, could make use of the non-GUI portions of the \
library without the overhead of depending on the entire GUI library.
Since GLib is a cross-platform library, applications using it to interface \
with the operating system are usually portable across different operating \
systems without major changes
"
HOMEPAGE="http://www.gtk.org/" 
SRC_URI="http://ftp.gnome.org/pub/gnome/sources/glib/1.2/glib-1.2.10.tar.gz"
CHECKSUM_SHA256="6e1ce7eedae713b11db82f11434d455d8a1379f783a79812cd2e05fc024a8d9f"
LICENSE="GNU LGPL v2"
COPYRIGHT="1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
	1991-2002 Free Software Foundation, Inc.
	1997-2002 University of Cambridge.
	1998-2001, 2003-2010 Red Hat, Inc.
	1995-2002 Several others"

REVISION="1"

ARCHITECTURES="?x86_gcc2 x86"
SECONDARY_ARCHITECTURES="?x86_gcc2 x86"

PROVIDES="
	glib$secondaryArchSuffix = $portVersion compat >= 1
	lib:libglib$secondaryArchSuffix = $portVersion compat >= 1
	lib:libglib_1.2$secondaryArchSuffix = $portVersion compat >= 1
	lib:libgmodule$secondaryArchSuffix = $portVersion compat >= 1
	lib:libgmodule_1.2$secondaryArchSuffix = $portVersion compat >= 1
	lib:libgthread$secondaryArchSuffix = $portVersion compat >= 1
	lib:libgthread_1.2$secondaryArchSuffix = $portVersion compat >= 1
	"

REQUIRES="
	haiku$secondaryArchSuffix >= $haikuVersion
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel >= $haikuVersion
	"

BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize
	cmd:libtool
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:m4
	cmd:make
	"

PATCHES="glib-1.2.10.patchset"

BUILD()
{
	libtoolize --force --copy --install
	aclocal
	automake --add-missing
	autoconf

	runConfigure ./configure \
		--enable-shared=yes

	cp -f $portPackageLinksDir/cmd~libtool/bin/libtool .

	make $jobArgs
}

INSTALL()
{
	make install
	
	prepareInstalledDevelLibs libglib libglib-1.2 \
		libgmodule libgmodule-1.2 \
		libgthread libgthread-1.2

	fixPkgconfig

	fixDevelopLibDirReferences $binDir/glib-config

	mv $libDir/glib/include/glibconfig.h $includeDir/glib-1.2
	rm -rf $libDir/glib

	# devel package
	packageEntries devel \
		$developDir $binDir \
		$manDir $infoDir $dataDir
}

# ----- devel package -------------------------------------------------------

PROVIDES_devel="
	glib${secondaryArchSuffix}_devel = $portVersion compat >= 0
	cmd:glib_config$secondaryArchSuffix = $portVersion
	devel:libglib$secondaryArchSuffix = $portVersion compat >= 1
	devel:libglib_1.2$secondaryArchSuffix = $portVersion compat >= 1
	devel:libgmodule$secondaryArchSuffix = $portVersion compat >= 1
	devel:libgmodule_1.2$secondaryArchSuffix = $portVersion compat >= 1
	devel:libgthread$secondaryArchSuffix = $portVersion compat >= 1
	devel:libgthread_1.2$secondaryArchSuffix = $portVersion compat >= 1
	"

REQUIRES_devel="
	glib$secondaryArchSuffix == $portVersion base
	"
