# lzo - Real-time compression library
#
# --enable-shared, because lzo's configure builds a static library only by
# default. Nothing linked against liblzo2 could then run from this package:
# mkfs.btrfs died with "liblzo2.so.2: cannot open shared object file" and took
# the whole install with it, since it is what formats the root filesystem.
name=lzo
version=2.10
release=2
desc="Real-time compression library"
url="https://www.oberhumer.com/opensource/lzo/"
license="GPL-2.0-or-later"
depend="glibc"
makedepend=""
source="https://www.oberhumer.com/opensource/lzo/download/lzo-2.10.tar.gz"
sha256="SKIP"

build() {
	cd "lzo-2.10"
	# Not every configure script accepts the same options - sqlite rejects
	# --disable-nls outright, for instance - so only pass the ones this one
	# actually advertises. Guessing wrong fails the whole build.
	_opts="--prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=/usr/lib"
	_opts="$_opts --enable-shared"
	_help=$(./configure --help 2>/dev/null)
	case "$_help" in *--disable-static*)  _opts="$_opts --disable-static" ;; esac
	case "$_help" in *--disable-nls*)     _opts="$_opts --disable-nls" ;; esac
	# shellcheck disable=SC2086
	./configure $_opts
	make -j"$JOBS"
}

package() {
	cd "lzo-2.10"
	make DESTDIR="$pkgdir" install
}
