Created
January 15, 2017 08:34
-
-
Save weldpua2008/ef087c0acfcb664f5797775d65b6f001 to your computer and use it in GitHub Desktop.
How to build libudev from Ubuntu 12.04 for gcc 4.7.x
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
# build prefix | |
export BUILD_PATH="/opt/tools/dev-tools-4.7" | |
# the directory of the script | |
DIR="/tmp" | |
# the temp directory used, within $DIR | |
WORK_DIR=`mktemp -d -p "$DIR"` | |
DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH) | |
DEB_HOST_GNU_TYPE=$(dpkg-architecture -qDEB_HOST_GNU_TYPE) | |
DEB_BUILD_GNU_TYPE=$(dpkg-architecture -qDEB_BUILD_GNU_TYPE) | |
DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH) | |
# deletes the temp directory | |
function cleanup { | |
local _exit_code=${1:-1} | |
echo "Temp working directory $WORK_DIR" | |
cd $( dirname "${BASH_SOURCE[0]}" )|| cd ${OLDPWD} | |
if [ ${_exit_code} -eq 0 ];then | |
rm -rf "$WORK_DIR/" && echo "Deleted..." | |
else | |
echo "Failed to build. TMP folder is at $WORK_DIR/" | |
fi | |
} | |
# register the cleanup function to be called on the EXIT signal | |
trap 'cleanup $?' EXIT | |
cd "$WORK_DIR" && \ | |
echo "Installing dependencies" && \ | |
apt-get install build-essential fakeroot dpkg-dev -y && \ | |
apt-get install libgirepository1.0-dev usbutils libpci-dev tree -y && \ | |
apt-get build-dep libudev-dev -y && \ | |
wget http://archive.ubuntu.com/ubuntu/pool/main/u/udev/udev_175-0ubuntu9.10.dsc http://archive.ubuntu.com/ubuntu/pool/main/u/udev/udev_175.orig.tar.gz http://archive.ubuntu.com/ubuntu/pool/main/u/udev/udev_175-0ubuntu9.10.debian.tar.xz && \ | |
dpkg-source -x udev_175-0ubuntu9.10.dsc && \ | |
cd udev* && \ | |
./configure --prefix=$BUILD_PATH \ | |
--build=$DEB_BUILD_GNU_TYPE --host=$DEB_HOST_GNU_TYPE \ | |
--sysconfdir=/etc \ | |
--libdir=${BUILD_PATH}/lib/$DEB_HOST_MULTIARCH \ | |
--with-rootlibdir=$BUILD_PATH/lib/$DEB_HOST_MULTIARCH \ | |
--with-systemdsystemunitdir=/lib/systemd/system \ | |
--without-selinux \ | |
--with-pci-ids-path=/usr/share/misc/pci.ids \ | |
--libexecdir=/lib/udev \ | |
--enable-static && \ | |
make && \ | |
make install && exit 0 | |
exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment