mirror of
https://github.com/Ponce/slackbuilds
synced 2024-12-05 00:55:44 +01:00
c8fb4db3a3
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
122 lines
3.3 KiB
Bash
122 lines
3.3 KiB
Bash
#!/bin/sh
|
|
|
|
# Slackware build script for libvirt
|
|
# Written by Michal Bialozor <bialyy@o2.pl>
|
|
# Maintained by Bogdan Radulescu <bogdan@nimblex.net>
|
|
|
|
PRGNAM=libvirt
|
|
VERSION=${VERSION:-1.0.3}
|
|
BUILD=${BUILD:-1}
|
|
TAG=${TAG:-_SBo}
|
|
|
|
if [ -z "$ARCH" ]; then
|
|
case "$( uname -m )" in
|
|
i?86) ARCH=i486 ;;
|
|
arm*) ARCH=arm ;;
|
|
*) ARCH=$( uname -m ) ;;
|
|
esac
|
|
fi
|
|
|
|
CWD=$(pwd)
|
|
TMP=${TMP:-/tmp/SBo}
|
|
PKG=$TMP/package-$PRGNAM
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
if [ "$ARCH" = "i486" ]; then
|
|
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
|
|
LIBDIRSUFFIX=""
|
|
elif [ "$ARCH" = "i686" ]; then
|
|
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
|
LIBDIRSUFFIX=""
|
|
elif [ "$ARCH" = "x86_64" ]; then
|
|
SLKCFLAGS="-O2 -fPIC"
|
|
LIBDIRSUFFIX="64"
|
|
else
|
|
SLKCFLAGS="-O2"
|
|
LIBDIRSUFFIX=""
|
|
fi
|
|
|
|
PYTHONSITEPKG=$(python -c "import sys, os; print os.path.join('/usr/lib${LIBDIRSUFFIX}', 'python%s' % sys.version[:3], 'site-packages')")
|
|
|
|
VIRTGROUP=${VIRTGROUP:-users}
|
|
|
|
set -e
|
|
|
|
rm -rf $PKG
|
|
mkdir -p $TMP $PKG $OUTPUT
|
|
cd $TMP
|
|
rm -rf $PRGNAM-$VERSION
|
|
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
|
|
cd $PRGNAM-$VERSION
|
|
chown -R root:root .
|
|
chmod -R u+w,go+r-w,a-s .
|
|
|
|
CFLAGS="$SLKCFLAGS" \
|
|
./configure \
|
|
--prefix=/usr \
|
|
--libdir=/usr/lib${LIBDIRSUFFIX} \
|
|
--bindir=/usr/sbin \
|
|
--sbindir=/usr/sbin \
|
|
--sysconfdir=/etc \
|
|
--localstatedir=/var \
|
|
--mandir=/usr/man \
|
|
--docdir=/usr/doc/$PRGNAM-$VERSION \
|
|
--enable-static=no \
|
|
--enable-shared=yes \
|
|
--with-yajl \
|
|
--with-python=/usr \
|
|
--with-qemu-group=$VIRTGROUP \
|
|
--with-init-script=none
|
|
|
|
make \
|
|
HTML_DIR=/usr/doc/$PRGNAM-$VERSION \
|
|
EXAMPLE_DIR=/usr/doc/$PRGNAM-$VERSION/examples
|
|
make \
|
|
HTML_DIR=/usr/doc/$PRGNAM-$VERSION \
|
|
EXAMPLE_DIR=/usr/doc/$PRGNAM-$VERSION/examples \
|
|
install-strip DESTDIR=$PKG
|
|
|
|
# add an rc.libvirt to start/stop/restart the daemon
|
|
install -D -m 0755 $CWD/rc.libvirt $PKG/etc/rc.d/rc.libvirt.new
|
|
|
|
# we use $VIRTGROUP as our virtualization group, fix auth permissions, and
|
|
# consider the fact that by default we got no certs
|
|
sed -i \
|
|
-e "s|^\#unix_sock_group\ =\ \"libvirt\"|unix_sock_group = \"$VIRTGROUP\"|" \
|
|
-e "s|^\#unix_sock_rw_perms\ =\ \"0770\"|unix_sock_rw_perms = \"0770\"|" \
|
|
-e "s|^\#auth_unix_ro.*|auth_unix_ro = \"none\"|" \
|
|
-e "s|^\#auth_unix_rw.*|auth_unix_rw = \"none\"|" \
|
|
-e "s|^\#listen_tls|listen_tls|" \
|
|
$PKG/etc/libvirt/libvirtd.conf
|
|
|
|
# still, we use $VIRTGROUP as our virtualization group
|
|
sed -i \
|
|
-e "s|^\#group\ =\ \"root\"|group = \"$VIRTGROUP\"|" \
|
|
$PKG/etc/libvirt/qemu.conf
|
|
|
|
find $PKG/usr/man -type f -exec gzip -9 {} \;
|
|
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
|
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
|
cp -a \
|
|
AUTHORS ChangeLog COPYING* INSTALL README NEWS TODO \
|
|
$PKG/usr/doc/$PRGNAM-$VERSION
|
|
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
|
rm -r $PKG/usr/share/doc
|
|
|
|
mkdir -p $PKG/install
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
|
cat $CWD/doinst.sh > $PKG/install/doinst.sh
|
|
|
|
# Don't clobber existing configuration files
|
|
for i in etc/libvirt{,/nwfilter,/qemu/networks} etc/{logrotate.d,sasl2,sysctl.d}; do
|
|
for j in $(ls -1 $PKG/$i); do
|
|
if [ ! -d $PKG/$i/$j ]; then
|
|
mv $PKG/$i/$j{,.new}
|
|
echo "config $i/$j.new" >> $PKG/install/doinst.sh
|
|
fi
|
|
done
|
|
done
|
|
|
|
cd $PKG
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|