view compression/libarchive/libarchive.sh @ 1218:57dc83a39b13

misc: switch back to standard FHS
author David Demelier <markand@malikania.fr>
date Thu, 30 Sep 2021 08:58:34 +0200
parents 27d1a83dc8d6
children 4ccc42bf0284
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 XML ZLIB ZSTD"

: ${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="acl $PKGDEPENDS"
	with_acl="--enable-acl"
else
	with_acl="--disable-acl"
fi

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

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

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

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

if [ "$LZO" = "yes" ]; then
	PKGDEPENDS="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="libressl $PKGDEPENDS"
	with_ssl="--with-openssl"
else
	with_ssl="--without-openssl"
fi

if [ "$ZLIB" = "yes" ]; then
	PKGDEPENDS="zlib $PKGDEPENDS"
	with_zlib="--with-zlib"
else
	with_zlib="--without-zlib"
fi

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

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=/usr \
	--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_zlib \
	$with_zstd
make
make install DESTDIR=$DESTDIR
find $DESTDIR -type f -name "*.la" -delete

cd ..
rm -rf $PKGNAME-$PKGVERSION