#!/bin/sh echo "*** GET GLIBC BEGIN ***" setglobal SRC_DIR = $[pwd] # Grab everything after the '=' character. setglobal DOWNLOAD_URL = $[grep -i ^GLIBC_SOURCE_URL .config | cut -f2 -d'=] # Grab everything after the last '/' character. setglobal ARCHIVE_FILE = $(DOWNLOAD_URL##*/) # Read the 'USE_LOCAL_SOURCE' property from '.config' setglobal USE_LOCAL_SOURCE = $[grep -i ^USE_LOCAL_SOURCE .config | cut -f2 -d'=] if test $USE_LOCAL_SOURCE = "true" -a ! -f $SRC_DIR/source/$ARCHIVE_FILE { echo "Source bundle $SRC_DIR/source/$ARCHIVE_FILE is missing and will be downloaded." setglobal USE_LOCAL_SOURCE = '"false'" } cd source if test ! $USE_LOCAL_SOURCE = "true" { # Downloading glibc source bundle file. The '-c' option allows the download to resume. echo "Downloading glibc source bundle from $DOWNLOAD_URL" wget -c $DOWNLOAD_URL } else { echo "Using local glibc source bundle $SRC_DIR/source/$ARCHIVE_FILE" } # Delete folder with previously extracted glibc. echo "Removing glibc work area. This may take a while..." rm -rf ../work/glibc mkdir ../work/glibc # Extract glibc to folder 'work/glibc'. # Full path will be something like 'work/glibc/glibc-2.23'. tar -xvf $ARCHIVE_FILE -C ../work/glibc cd $SRC_DIR echo "*** GET GLIBC END ***"