代码拉取完成,页面将自动刷新
#!/bin/bash
SRC="./glibc_src"
BUILD="./glibc_build"
VERSION="./glibc_versions"
CC='gcc'
CXX='g++'
# Handle arguments
function show_help {
echo "Usage: $0 version [-h|--help] [-j make_threads] [-disable-tcache] [-i686]"
}
if [[ $# < 1 ]]; then
show_help
exit 1
fi
DIR_TCACHE='tcache'
DIR_HOST='x64'
BUILD_OPTS=''
GLIBC_VERSION=''
while :; do
case $1 in
-h|-\?|--help)
show_help
exit
;;
-j)
if [ "$2" ]; then
make_threads="$2"
if [[ ! $make_threads =~ ^[0-9]+$ ]]; then
echo 'Error: "-j" option must be integer'
exit 1
fi
echo " -> Using $make_threads threads"
shift
else
echo 'Error: "-j" requires a non-empty option argument.'
exit 1
fi
;;
-disable-tcache)
echo ' -> Disabling tcache'
DIR_TCACHE='notcache'
BUILD_OPTS="$BUILD_OPTS --disable-experimental-malloc"
;;
-i686)
echo ' -> Building for i686'
DIR_HOST='i686'
BUILD_OPTS="$BUILD_OPTS CC='$CC -m32' CXX='$CXX -m32'"
BUILD_OPTS="$BUILD_OPTS --host=i686-linux-gnu --build=i686-pc-linux-gnu"
BUILD_OPTS="$BUILD_OPTS CFLAGS='-O2 -m32' CXXFLAGS='-O2 -m32' LDFLAGS='-m32'"
;;
'')
break
;;
*)
if [ ! -z $GLIBC_VERSION ]; then
echo "Error: Unknow option $1"
exit 1
fi
GLIBC_VERSION="$1"
;;
esac
shift
done
if [ -z $GLIBC_VERSION ]; then
echo 'Error: First argument must be glibc version'
show_help
exit 1
fi
# Prepare output dir
OUTPUT_DIR=`pwd`/glibc_versions/"$GLIBC_VERSION/${DIR_HOST}_${DIR_TCACHE}"
# Get glibc source
if [ ! -d "$SRC" ]; then
git clone git://sourceware.org/git/glibc.git "$SRC"
fi
cd "$SRC"
git pull --all
# Checkout release
git rev-parse --verify --quiet "refs/remotes/origin/release/$GLIBC_VERSION/master"
if [[ $? != 0 ]]; then
echo "Error: Glibc version \"$GLIBC_VERSION\" does not seem to exists"
exit 1
fi
git checkout "release/$GLIBC_VERSION/master" -f
git pull
cd -
# Prepare build directory
mkdir -p "$BUILD"
cd "$BUILD"
if grep -q "$OUTPUT_DIR" ./how2heap_build_cmd; then
echo " -> Not clearing build directory"
else
echo " -> Clearing build directory"
rm -rf ./*
fi
eval ../"$SRC"/configure --prefix=$OUTPUT_DIR $BUILD_OPTS
echo "$OUTPUT_DIR" > ./how2heap_build_cmd
make -j "$make_threads"
make install
cd -
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。