Skip to content

Instantly share code, notes, and snippets.

@submachine
Last active January 3, 2016 09:29
Show Gist options
  • Save submachine/8443464 to your computer and use it in GitHub Desktop.
Save submachine/8443464 to your computer and use it in GitHub Desktop.
A [work in progress] script to fetch, build, and test fresh glibc sources.
#!/bin/bash
# TODO: Parse and report testsuite failures;
# fetch and execute gnulib testsuite.
GT_NAME=glibc-tester
GT_DIR=$HOME/.$GT_NAME
GT_CONFIG=$GT_DIR/config
if [ ! -d $GT_DIR ]; then
mkdir -p $GT_DIR || exit
fi
if [ -f $GT_CONFIG ]; then
. $GT_CONFIG
else
echo "GLIBC_GIT=\"git://sourceware.org/git/glibc.git\"" > $GT_CONFIG
echo "GLIBC_SRC=\"$GT_DIR/glibc\"" >> $GT_CONFIG
echo "GLIBC_TST=\"$GT_DIR/test\"" >> $GT_CONFIG
echo "GLIBC_INS=\"$GT_DIR/install\"" >> $GT_CONFIG
. $GT_CONFIG
fi
echo "Fetching latest glibc sources."
if [ -d $GLIBC_SRC/.git ]; then
# glibc source was checked out in the past;
# just pull the latest changes
(cd $GLIBC_SRC;
git pull || exit;
git --no-pager log -1)
else
if [ -d $GLIBC_SRC ] && [ -x $GLIBC_SRC/configure ]; then
echo "Looks like we have an extracted glibc source tarball."
else
rm -rf $GLIBC_SRC
git clone $GLIBC_GIT $GLIBC_SRC
(cd $GLIBC_SRC;
git --no-pager log -1)
fi
fi
mkdir -p $GLIBC_TST && cd $GLIBC_TST || exit
echo "Running 'configure'."
$GLIBC_SRC/configure \
--prefix=$GLIBC_INS --enable-hardcoded-path-in-tests &> /dev/null || exit
echo "Running 'make'."
NCPU=$(cat /proc/cpuinfo | grep '^processor\s\+:' | wc -l)
make -j $NCPU &> /dev/null || exit
echo "Running 'make check'."
make -k check &> make-check.log || echo "'make -k check' failed"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment