slackbuilds/l/libusb/libusb-compat.SlackBuild

83 lines
1.8 KiB
Text
Raw Normal View History

#!/bin/sh -x
# variables
TMP=/tmp
CWD=$(pwd)
APP_NAME=libusb-compat
PKG=$TMP/package-$APP_NAME
VERSION=0.1.3
EXT=tar.bz2
DOCS="AUTHORS ChangeLog COPYING INSTALL NEWS README TODO"
ARCH=x86_64
BUILD=1cyco
PREFIX=/usr
SLCKFLAGS="-fPIC -O2"
# nettoyage pr<70>alable
rm -fr $PKG $TMP/$APP_NAME-$VERSION
mkdir -p $PKG
# mise en place
cd $TMP
tar xf $CWD/$APP_NAME-$VERSION.$EXT
cd $APP_NAME-$VERSION
# configuration
CFLAGS=$SLCKFLAGS \
CPPFLAGS=$SLCKFLAGS \
./configure \
--prefix=$PREFIX \
--mandir=$PREFIX/man \
--libdir=$PREFIX/lib64
# compilation
make -j3 PREFIX=$PREFIX
# installation
make install DESTDIR=$PKG
# correction
cd $PKG
chown -R root:root *
mkdir -p $PKG/usr/doc/$APP_NAME-$VERSION
cd $TMP/$APP_NAME-$VERSION
cp -R $DOCS $PKG/usr/doc/$APP_NAME-$VERSION
[ -d $PKG/usr/man ] && find $PKG/usr/man -type f -name "*.?" -exec gzip -9f {} \;
# Strip binaries
( cd $PKG
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
)
# embaumement
mkdir -p $PKG/install
cat <<EOF > $PKG/install/slack-desc
$APP_NAME: $APP_NAME (replacement for libusb-0.1)
$APP_NAME:
$APP_NAME: libusb-compat-0.1 is a replacement for libusb-0.1. However, instead of
$APP_NAME: being an actual implementation, libusb-0.1 is more of a compatibility
$APP_NAME: layer (or wrapper) which just converts libusb-0.1 calls into their
$APP_NAME: libusb-1.0 equivalents.
$APP_NAME:
$APP_NAME:
$APP_NAME: http://www.libusb.org/wiki/LibusbCompat0.1
$APP_NAME: see /usr/doc/$APP_NAME-$VERSION for more details
$APP_NAME:
EOF
# empaquetage
cd $PKG
makepkg -l y -c n $TMP/$APP_NAME-$(echo $VERSION | sed 's/-//g')-$ARCH-$BUILD.txz