summaryrefslogtreecommitdiffstats
path: root/source/l/libusb/libusb.SlackBuild
diff options
context:
space:
mode:
Diffstat (limited to 'source/l/libusb/libusb.SlackBuild')
-rwxr-xr-xsource/l/libusb/libusb.SlackBuild109
1 files changed, 88 insertions, 21 deletions
diff --git a/source/l/libusb/libusb.SlackBuild b/source/l/libusb/libusb.SlackBuild
index 90db52ffa..67d0756a7 100755
--- a/source/l/libusb/libusb.SlackBuild
+++ b/source/l/libusb/libusb.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -21,9 +21,22 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-VERSION=${VERSION:-0.1.12}
-ARCH=${ARCH:-x86_64}
-BUILD=${BUILD:-2}
+VERSION=${VERSION:-1.0.6} # libusb version
+USBCOMPAT=${USBCOMPAT:-0.1.3} # libusb-compat version
+
+BUILD=${BUILD:-1}
+
+NUMJOBS=${NUMJOBS:--j6}
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
CWD=$(pwd)
TMP=${TMP:-/tmp}
@@ -38,20 +51,60 @@ elif [ "$ARCH" = "s390" ]; then
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
fi
rm -rf $PKG
-mkdir -p $PKG
+mkdir -p $TMP $PKG
+
+# First we'll do the main libusb stuff
cd $TMP
rm -rf libusb-$VERSION
-tar xzvf $CWD/libusb-$VERSION.tar.gz
+tar xvf $CWD/libusb-$VERSION.tar.bz2
cd libusb-$VERSION
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
-# We used to apply a Debian patch here, and it's possible
-# that other archs need it still, but vanilla upstream is
-# working on ia32 just fine.
-#zcat $CWD/libusb_0.1.12-2.diff.gz | patch -p1
+CFLAGS="$SLKCFLAGS" \
+./configure \
+ --prefix=/usr \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
+ --mandir=/usr/man \
+ --docdir=/usr/doc/libusb-$VERSION \
+ --disable-static \
+ --build=$ARCH-slackware-linux
+make $NUMJOBS || make || exit 1
+make install DESTDIR=$PKG
+if [ ! -r /usr/lib${LIBDIRSUFFIX}/pkgconfig/libusb-1.0.pc ]; then
+ # We have to install this to proceed:
+ make install
+fi
+
+mkdir -p $PKG/usr/doc/libusb-$VERSION
+cp -a \
+ AUTHORS COPYING INSTALL NEWS PORTING README THANKS TODO \
+ $PKG/usr/doc/libusb-$VERSION
+
+# If there's a ChangeLog, installing at least part of the recent history
+# is useful, but don't let it get totally out of control:
+if [ -r ChangeLog ]; then
+ DOCSDIR=$(echo $PKG/usr/doc/libusb-$VERSION)
+ cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
+ touch -r ChangeLog $DOCSDIR/ChangeLog
+fi
+
+# Now build the libusb-compat stuff
+cd $TMP
+rm -rf libusb-compat-$USBCOMPAT
+tar xvf $CWD/libusb-compat-$USBCOMPAT.tar.bz2
+cd libusb-compat-$USBCOMPAT
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
@@ -62,14 +115,34 @@ find . \
CFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
- --libdir=/usr/lib${LIBDIRSUFFIX}
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
+ --mandir=/usr/man \
+ --docdir=/usr/doc/libusb-$VERSION \
+ --disable-static \
+ --build=$ARCH-slackware-linux
-make -j3 || exit 1
+make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG
+mkdir -p $PKG/usr/doc/libusb-$VERSION/libusb-compat-$USBCOMPAT
+cp -a \
+ AUTHORS COPYING INSTALL LICENSE NEWS README \
+ $PKG/usr/doc/libusb-$VERSION/libusb-compat-$USBCOMPAT
+
+# If there's a ChangeLog, installing at least part of the recent history
+# is useful, but don't let it get totally out of control:
+if [ -r ChangeLog ]; then
+ DOCSDIR=$(echo $PKG/usr/doc/libusb-compat-$USBCOMPAT)
+ cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
+ touch -r ChangeLog $DOCSDIR/ChangeLog
+fi
+
+# Now handle the package-wide stuff
( 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
+ 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
)
# Compress and if needed symlink the man pages:
@@ -87,15 +160,9 @@ if [ -d $PKG/usr/man ]; then
)
fi
-mkdir -p $PKG/usr/doc/libusb-$VERSION
-cp -a \
- AUTHORS COPYING ChangeLog INSTALL.libusb LICENSE NEWS README \
- doc/html \
- $PKG/usr/doc/libusb-$VERSION
-
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
-makepkg -l y -c n $TMP/libusb-$VERSION-$ARCH-$BUILD.txz
+/sbin/makepkg -l y -c n $TMP/libusb-$VERSION-$ARCH-$BUILD.txz