# FYI, usbutils also has a libusb, but it is considerably older than this one.
# To avoid confusion, I remove the old version before installing this one.
# usbutils >= 0.70 uses the version of libusb that is covered here.
# There are two versions below:
# libusb-compat, the latest legacy 0.x release
# libusb 1.x, the latest release
# libusb 1.0.22
# =============
# Get it
cd
test -f installed/libusb-1.0.22.tar.bz2 &&
mv installed/libusb-1.0.22.tar.bz2 .
test ! -f libusb-1.0.22.tar.bz2 &&
wget https://github.com/libusb/libusb/releases/download/v1.0.22/\
libusb-1.0.22.tar.bz2
# Verify tarball w/ sha256sum:
# (this came from mine, if mine is bad, yours is too)
echo "75aeb9d59a4fdb800d329a545c2e6799f732362193b465ea198f2aa2755181\
57 libusb-1.0.22.tar.bz2" | sha256sum -c
# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "libusb-1.*" -exec rm -r {} \;
tar xjvf ~/libusb-1.0.22.tar.bz2
cd libusb-1.0.22
test $UID = 0 && chown -R root:root .
# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
./configure --prefix=/usr --libdir=/usr/lib64 --disable-static
# Configure the build for anything else
test $(uname -m) != 'x86_64' &&
./configure --prefix=/usr --disable-static
# Build it
make
# Become root to install it
su
# Remove the Slackware package, if there is one
# You may find that libusb-* is found in aaa_elflibs too
test -x /sbin/removepkg && /sbin/removepkg libusb
# Clean up old library files if you're sure they're not in use
rm -f /usr/lib/libusb-1.*
# Install it
make install
ldconfig
# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .
# Become yourself again
exit
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/libusb-1.*.tar.*
mv libusb-1.0.22.tar.bz2 installed/
# libusb-compat 0.1.5 (legacy 0.x release)
# ===================
# Get it
cd
test -f installed/libusb-compat-0.1.5.tar.bz2 &&
mv installed/libusb-compat-0.1.5.tar.bz2 .
test ! -f libusb-compat-0.1.5.tar.bz2 &&
wget https://downloads.sf.net/libusb/libusb-compat-0.1.5.tar.bz2
# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "libusb-compat-*" -exec rm -r {} \;
tar xjvf ~/libusb-compat-0.1.5.tar.bz2
cd libusb-compat-0.1.5
test $UID = 0 && chown -R root:root .
# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
./configure --prefix=/usr --libdir=/usr/lib64
# Configure the build for anything else
test $(uname -m) = 'x86_64' &&
./configure --prefix=/usr
# Build it
make
# Become root to install it
su
# Remove the Slackware package, if there is one
# You may find that a libusb-* file is found in aaa_elflibs too
test -x /sbin/removepkg && /sbin/removepkg libusb-compat
# If you're sure nothing else is using it, remove old library files
# still there after removepkg
for libdir in /usr/lib /usr/lib64;
do
( cd $libdir
rm -f libusb-0.* libusb.a libusb.la libusb.so )
done
# Install it
make install
ldconfig
# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .
# Become yourself again
exit
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/libusb-compat-*.tar.*
mv libusb-compat-0.1.5.tar.bz2 installed/
# If you ever want to uninstall libusb and libusb-compat, this should do it:
cd
su
test -d src/libusb-compat-* && ( cd src/libusb-compat-* ; make uninstall )
test -d src/libusb-1.* && ( cd src/libusb-1.* ; make uninstall )
# From 0.x
( cd /usr/include ; rm -f usb.h usbpp.h )
( cd /usr/lib ; rm -f libusb-0.* libusb.a libusb.la libusb.so )
test -d /usr/lib64 &&
( cd /usr/lib64 ; rm -f libusb-0.* libusb.a libusb.la libusb.so )
rm -f /usr/bin/libusb-config /usr/lib/pkgconfig/libusb.pc
# From 1.x
test -d /usr/include/libusb-1.0 && rm -r /usr/include/libusb-1.0
rm -f /usr/lib*/libusb-1.0.* /usr/lib*/pkgconfig/libusb-1.0.pc
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "libusb-*" -exec rm -r {} \;
rm -f ~/installed/libusb-*.tar.*