view 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
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.
#

: ${CHOST:=$(uname -m)-linux-musl}
: ${CBUILD:=$(uname -m)-linux-musl}
: ${CC:=gcc}
: ${CFLAGS:=-O2}

source ./kmod.info

set -ex

if [ "${SSL:-yes}" = "yes" ]; then
	with_ssl="--with-openssl"
else
	with_ssl="--without-openssl"
fi
if [ "${XZ:-yes}" = "yes" ]; then
	with_xz="--with-xz"
else
	with_xz="--without-xz"
fi
if [ "${ZLIB:-yes}" = "yes" ]; then
	with_zlib="--with-zlib"
else
	with_zlib="--without-zlib"
fi

rm -rf $PKGNAME-$PKGVERSION
tar xvaf $PKGNAME-$PKGVERSION.tar.xz
pushd $PKGNAME-$PKGVERSION

CC="$CC" \
CFLAGS="$CFLAGS" \
./configure \
	--build=$CBUILD \
	--host=$CHOST \
	--prefix=/usr \
	${with_ssl} \
	${with_xz} \
	${with_zlib}
make
make install DESTDIR=$DESTDIR
rm -f $DESTDIR/usr/lib/libkmod.la

# compatibility symlinks manpages like lsmod, rmmod are installed as well.
for tool in {ls,ins,rm,dep}mod mod{info,probe}; do
	ln -sf kmod $DESTDIR/usr/bin/$tool
done

popd
rm -rf $PKGNAME-$PKGVERSION