You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
609 B
23 lines
609 B
5 years ago
|
#!/usr/bin/env bash
|
||
|
|
||
|
# Function that downloads an archive with the source code by the given url,
|
||
|
# extracts its files and exports a variable SOURCES_DIR_lib${LIBRARY_NAME}
|
||
|
function downloadArchive() {
|
||
|
LIBRARY_NAME=$1
|
||
|
LIBRARY_VERSION=$2
|
||
|
DOWNLOAD_URL=$3
|
||
|
|
||
|
echo "Ensuring sources of $LIBRARY_NAME $LIBRARY_VERSION"
|
||
|
LIBRARY_SOURCES=${LIBRARY_NAME}-${LIBRARY_VERSION}
|
||
|
|
||
|
if [[ ! -d "$LIBRARY_SOURCES" ]]; then
|
||
|
curl -O ${DOWNLOAD_URL}
|
||
|
|
||
|
ARCHIVE_NAME=${DOWNLOAD_URL##*/}
|
||
|
tar xf ${ARCHIVE_NAME} -C .
|
||
|
rm ${ARCHIVE_NAME}
|
||
|
fi
|
||
|
|
||
|
export SOURCES_DIR_lib${LIBRARY_NAME}=$(pwd)/${LIBRARY_SOURCES}
|
||
|
}
|