# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=libtool
pkgver=2.5.4
pkgrel=1
pkgdesc="A generic library support script"
arch="all"
license="LGPL-2.0-or-later AND GPL-2.0-or-later"
url="https://www.gnu.org/software/libtool"
source="https://ftp.gnu.org/gnu/libtool/libtool-$pkgver.tar.gz"
depends="libltdl"
makedepends="m4 help2man"
checkdepends="gawk autoconf automake gzip"
subpackages="libltdl-static libltdl $pkgname-doc"
options="libtool"

prepare() {
	default_prepare

	# failing gnulib tests
	sed -i \
		-e "s|test-funclib-quote.sh||" \
		-e "s|test-option-parser.sh||" \
		gnulib-tests/Makefile.in
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr
	make
}

check() {
	# Test 69 shlibpath_overrides_runpath fails
	# Test 169 repeats the entire test suite with shorter max_cmd_len
	make check TESTSUITEFLAGS="1-68 70-168"
}

package() {
	make DESTDIR="$pkgdir" install
}

libltdl() {
	pkgdesc="Runtime libraries for GNU Libtool Dynamic Module Loader"
	depends=
	amove usr/lib/libltdl.so*
}

sha512sums="
60599f5c3168a287fe3a35062fd2e32e0b73433fce820bfd18d28b0e3bd7a8fefde6d6f0505fbbc2d664119ab7c539269184993843289932c895847ea1ab9f04  libtool-2.5.4.tar.gz
"
