view compression/libarchive/libarchive.sh @ 817:0e6c54d47dfb

vanilla: fix many FHS issues While here, remove libtool files in a generic manner to avoid stale files.
author David Demelier <markand@malikania.fr>
date Wed, 21 Aug 2019 09:04:13 +0200
parents 59a2fa6992bc
children a133976e0783
line wrap: on
line source

#!/bin/sh
#
# Copyright (c) 2019 David Demelier <markand@malikania.fr>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#

PKGNAME=libarchive
PKGVERSION=3.3.3
PKGREVISION=1
PKGLICENSE="BSD"
PKGSUMMARY="multi-format archive and compression library"
PKGDOWNLOAD="http://www.libarchive.org/downloads/$PKGNAME-$PKGVERSION.tar.gz"
PKGOPTIONS="ACL BZIP2 LZ4 LZMA LZO SSL ZLIB ZSTD XML"

: ${CHOST:=$(uname -m)-linux-musl}
: ${CBUILD:=$(uname -m)-linux-musl}
: ${CC:=clang}
: ${CFLAGS:=-O2}
: ${CXX:=clang++}
: ${CXXFLAGS:=-O2}
: ${LDFLAGS:=}
: ${LIBS:=}
: ${ACL:=yes}
: ${BZIP2:=yes}
: ${LZ4:=yes}
: ${LZMA:=yes}
: ${LZO:=no}            # upstream default as of 3.3.3
: ${SSL:=yes}
: ${XML:=yes}
: ${ZLIB:=yes}
: ${ZSTD:=yes}

if [ "$ACL" = "yes" ]; then
	PKGDEPENDS="core/acl $PKGDEPENDS"
	with_acl="--enable-acl"
else
	with_acl="--disable-acl"
fi

if [ "$BZIP2" = "yes" ]; then
	PKGDEPENDS="compression/bzip2 $PKGDEPENDS"
	with_bzip2="--with-bz2lib"
else
	with_bzip2="--without-bz2lib"
fi

if [ "$XML" = "yes" ]; then
	PKGDEPENDS="lib/expat $PKGDEPENDS"
	with_expat="--with-expat"
else
	with_expat="--without-expat"
fi

if [ "$LZ4" = "yes" ]; then
	PKGDEPENDS="compression/lz4 $PKGDEPENDS"
	with_lz4="--with-lz4"
else
	with_lz4="--without-lz4"
fi

if [ "$LZMA" = "yes" ]; then
	PKGDEPENDS="compression/xz $PKGDEPENDS"
	with_lzma="--with-lzma"
else
	with_lzma="--without-lzma"
fi

if [ "$LZO" = "yes" ]; then
	PKGDEPENDS="lib/lzo $PKGDEPENDS"
	with_lzo="--with-lzo2"
else
	with_lzo="--without-lzo2"
fi

if [ "$NETTLE" = "yes" ]; then
	PKGDEPENDS="lib/nettle $PKGDEPENDS"
	with_nettle="--with-nettle"
else
	with_nettle="--without-nettle"
fi

if [ "$SSL" = "yes" ]; then
	PKGDEPENDS="crypto/libressl $PKGDEPENDS"
	with_ssl="--with-openssl"
else
	with_ssl="--without-openssl"
fi

if [ "$ZSTD" = "yes" ]; then
	PKGDEPENDS="compression/zstd $PKGDEPENDS"
	with_zstd="--with-zstd"
else
	with_zstd="--without-zstd"
fi

build()
{
	rm -rf $PKGNAME-$PKGVERSION
	tar xvf $PKGNAME-$PKGVERSION.tar.gz
	cd $PKGNAME-$PKGVERSION

	CC="$CC" \
	CFLAGS="$CFLAGS" \
	CXX="$CXX" \
	CXXFLAGS="$CXXFLAGS" \
	LDFLAGS="$LDFLAGS" \
	LIBS="$LIBS" \
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix= \
		--enable-shared \
		--enable-bsdtar=shared \
		--enable-bsdcat=shared \
		--enable-bsdcpio=shared \
		--without-xml2 \
		$with_acl \
		$with_bzip2 \
		$with_expat \
		$with_lz4 \
		$with_lzma \
		$with_lzo \
		$with_nettle \
		$with_ssl \
		$with_zstd

	make
	make install DESTDIR=$DESTDIR
	find $DESTDIR -type f -name "*.la" -delete

	cd ..
	rm -rf $PKGNAME-$PKGVERSION
}