SUMMARY="A generic library support script"
DESCRIPTION="
	GNU libtool is a set of shell scripts to automatically configure UNIX
	architectures to build shared libraries in a generic fashion.
	"
HOMEPAGE="http://www.gnu.org/software/libtool"
COPYRIGHT="2004-2010 Free Software Foundation, Inc."
LICENSE="GNU GPL v2"
SRC_URI="ftp://ftp.gnu.org/gnu/libtool/libtool-2.4.2.tar.gz"
CHECKSUM_MD5="d2f3b7d4627e69e13514a40e72a24d50"
REVISION="1"
ARCHITECTURES="x86_gcc2 x86 x86_64"

PATCHES="
	2.4.2/adjust_config_for_packaging.patch
	2.4.2/remove_help2man_dependency.patch
	"

PROVIDES="
	libtool = $portVersion compat >= 2.4
	cmd:libtool = $portVersion compat >= 2.4
	cmd:libtoolize = $portVersion compat >= 2.4
	devel:libltdl = 7.3.0 compat >= 7
	"
REQUIRES="
	haiku >= $haikuVersion
	libtool_libltdl == $portVersion base
	cmd:aclocal
	cmd:automake
	cmd:sed
	cmd:tar
	"
BUILD_REQUIRES="
	"
BUILD_PREREQUIRES="
	haiku_devel >= $haikuVersion
	cmd:aclocal
	cmd:autoconf >= 2.62
	cmd:autoheader >= 2.62
	cmd:gcc
	cmd:ld
	cmd:make
	cmd:nm
	cmd:ranlib
	cmd:sed
	"


BUILD()
{
	./bootstrap
	SED='sed' NM='nm' LD=ld runConfigure ./configure \
		--with-gnu-ld
	make $jobArgs
	# Desperate move to remove the absolute paths from libtool. For some reason
	# only for the C++ compiler those are set (not for the C compiler). In
	# openSuse libtool doesn't have those variables set either, but building
	# according to their libroot.spec produces a libtool that has them set as
	# well. My guess is that one has to build libtool without a C++ compiler
	# installed to get that result.
	sed -i -e 's@^predep_objects=".*"$@predep_objects=""'@ \
		-e 's@^postdep_objects=".*"$@postdep_objects=""'@ \
		-e 's@^postdeps=".*"$@postdeps=""'@ \
		-e 's@^compiler_lib_search_path=".*"$@compiler_lib_search_path=""'@ \
		-e 's@^compiler_lib_search_dirs=".*"$@compiler_lib_search_dirs=""'@ \
		libtool
}

INSTALL()
{
	make install
	prepareInstalledDevelLibs libltdl

	# libltdl package
	packageEntries libltdl \
		$libDir/libltdl*

	# main package
	rmdir $libDir
}

TEST()
{
	make check
}

# ----- libltdl package -------------------------------------------------------

SUMMARY_libltdl="The libtool libltdl library"
PROVIDES_libltdl="
	libtool_libltdl = $portVersion compat >= 2.4
	lib:libltdl = 7.3.0 compat >= 7
	"
REQUIRES_libltdl="
	haiku >= $haikuVersion
	"
