comparison core/kmod/kmod.sh @ 93:27f552b8f761

core/kmod: initial import, closes #1150
author David Demelier <markand@malikania.fr>
date Fri, 08 Mar 2019 13:24:31 +0100
parents
children e737b80da269
comparison
equal deleted inserted replaced
92:8ca2a0576f25 93:27f552b8f761
1 #!/bin/sh
2 #
3 # Copyright (c) 2019 David Demelier <markand@malikania.fr>
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 : ${CHOST:=$(uname -m)-linux-musl}
19 : ${CBUILD:=$(uname -m)-linux-musl}
20 : ${CC:=gcc}
21 : ${CFLAGS:=-O2}
22
23 source ./kmod.info
24
25 set -ex
26
27 if [ "${SSL:-yes}" = "yes" ]; then
28 with_ssl="--with-openssl"
29 else
30 with_ssl="--without-openssl"
31 fi
32 if [ "${XZ:-yes}" = "yes" ]; then
33 with_xz="--with-xz"
34 else
35 with_xz="--without-xz"
36 fi
37 if [ "${ZLIB:-yes}" = "yes" ]; then
38 with_zlib="--with-zlib"
39 else
40 with_zlib="--without-zlib"
41 fi
42
43 rm -rf $PKGNAME-$PKGVERSION
44 tar xvaf $PKGNAME-$PKGVERSION.tar.xz
45 pushd $PKGNAME-$PKGVERSION
46
47 CC="$CC" \
48 CFLAGS="$CFLAGS" \
49 ./configure \
50 --build=$CBUILD \
51 --host=$CHOST \
52 --prefix=/usr \
53 ${with_ssl} \
54 ${with_xz} \
55 ${with_zlib}
56 make
57 make install DESTDIR=$DESTDIR
58 rm -f $DESTDIR/usr/lib/libkmod.la
59
60 # compatibility symlinks manpages like lsmod, rmmod are installed as well.
61 for tool in {ls,ins,rm,dep}mod mod{info,probe}; do
62 ln -sf kmod $DESTDIR/usr/bin/$tool
63 done
64
65 popd
66 rm -rf $PKGNAME-$PKGVERSION