comparison core/libarchive/libarchive.sh @ 157:8f5c82e50554

core/libarchive: initial import, closes #1192
author David Demelier <markand@malikania.fr>
date Wed, 13 Mar 2019 19:56:00 +0100
parents
children 1460ef8bce93
comparison
equal deleted inserted replaced
156:7158e24ad76d 157:8f5c82e50554
1 #!/bin/sh
2 #
3 # Copyright (c) 2019 FirstName LastName <mailaddress>
4 #
5 # Permission to use, copy, modify, and/or distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
8 #
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 #
17
18 PKGNAME=libarchive
19 PKGVERSION=3.3.3
20 PKGREVISION=1
21 PKGLICENSE="BSD"
22 PKGSUMMARY="multi-format archive and compression library"
23 PKGDOWNLOAD="http://www.libarchive.org/downloads/$PKGNAME-$PKGVERSION.tar.gz"
24 #PKGDEPENDS="category/foo category/bar"
25 PKGOPTIONS="ACL BZIP2 EXPAT LZ4 LZMA LZO SSL ZLIB ZSTD"
26
27 : ${CHOST:=$(uname -m)-linux-musl}
28 : ${CBUILD:=$(uname -m)-linux-musl}
29 : ${CC:=gcc}
30 : ${CFLAGS:=-O2}
31 : ${CXX:=g++}
32 : ${CXXFLAGS:=-O2}
33 : ${LDFLAGS:=}
34 : ${LIBS:=}
35 : ${ACL:=yes}
36 : ${BZIP2:=yes}
37 : ${EXPAT:=yes}
38 : ${LZ4:=yes}
39 : ${LZMA:=yes}
40 : ${LZO:=no} # upstream default as of 3.3.3
41 : ${SSL:=yes}
42 : ${ZLIB:=yes}
43 : ${ZSTD:=yes}
44
45 if [ "$ACL" = "yes" ]; then
46 PKGDEPENDS="core/acl $PKGDEPENDS"
47 with_acl="--enable-acl"
48 else
49 with_acl="--disable-acl"
50 fi
51
52 if [ "$BZIP2" = "yes" ]; then
53 PKGDEPENDS="core/bzip2 $PKGDEPENDS"
54 with_bzip2="--with-bz2lib"
55 else
56 with_bzip2="--without-bz2lib"
57 fi
58
59 if [ "$EXPAT" = "yes" ]; then
60 PKGDEPENDS="lib/expat $PKGDEPENDS"
61 with_expat="--with-expat"
62 else
63 with_expat="--without-expat"
64 fi
65
66 if [ "$LZ4" = "yes" ]; then
67 PKGDEPENDS="core/lz4 $PKGDEPENDS"
68 with_lz4="--with-lz4"
69 else
70 with_lz4="--without-lz4"
71 fi
72
73 if [ "$LZMA" = "yes" ]; then
74 PKGDEPENDS="core/xz $PKGDEPENDS"
75 with_lzma="--with-lzma"
76 else
77 with_lzma="--without-lzma"
78 fi
79
80 if [ "$LZO" = "yes" ]; then
81 PKGDEPENDS="lib/lzo $PKGDEPENDS"
82 with_lzo="--with-lzo2"
83 else
84 with_lzo="--without-lzo2"
85 fi
86
87 if [ "$NETTLE" = "yes" ]; then
88 PKGDEPENDS="lib/nettle $PKGDEPENDS"
89 with_nettle="--with-nettle"
90 else
91 with_nettle="--without-nettle"
92 fi
93
94 if [ "$SSL" = "yes" ]; then
95 PKGDEPENDS="network/openssl $PKGDEPENDS"
96 with_ssl="--with-openssl"
97 else
98 with_ssl="--without-openssl"
99 fi
100
101 if [ "$ZSTD" = "yes" ]; then
102 PKGDEPENDS="core/zstd $PKGDEPENDS"
103 with_zstd="--with-zstd"
104 else
105 with_zstd="--without-zstd"
106 fi
107
108 build()
109 {
110 rm -rf $PKGNAME-$PKGVERSION
111 tar xvaf $PKGNAME-$PKGVERSION.tar.gz
112 pushd $PKGNAME-$PKGVERSION
113
114 CC="$CC" \
115 CFLAGS="$CFLAGS" \
116 CXX="$CXX" \
117 CXXFLAGS="$CXXFLAGS" \
118 LDFLAGS="$LDFLAGS" \
119 LIBS="$LIBS" \
120 ./configure \
121 --build=$CBUILD \
122 --host=$CHOST \
123 --prefix=/usr \
124 --disable-static \
125 --enable-shared \
126 --enable-bsdtar=shared \
127 --enable-bsdcat=shared \
128 --enable-bsdcpio=shared \
129 --without-xml2 \
130 $with_acl \
131 $with_bzip2 \
132 $with_expat \
133 $with_lz4 \
134 $with_lzma \
135 $with_lzo \
136 $with_nettle \
137 $with_ssl \
138 $with_zstd
139
140 make
141 make install DESTDIR=$DESTDIR
142 rm -f $DESTDIR/usr/lib/libarchive.la
143
144 popd
145 rm -rf $PKGNAME-$PKGVERSION
146 }