|
Packit |
345191 |
#!/bin/bash
|
|
Packit |
345191 |
#
|
|
Packit |
345191 |
# Copyright (C) 2019 Intel Corporation.
|
|
Packit |
345191 |
# All rights reserved.
|
|
Packit |
345191 |
#
|
|
Packit |
345191 |
# Redistribution and use in source and binary forms, with or without
|
|
Packit |
345191 |
# modification, are permitted provided that the following conditions are met:
|
|
Packit |
345191 |
# 1. Redistributions of source code must retain the above copyright notice(s),
|
|
Packit |
345191 |
# this list of conditions and the following disclaimer.
|
|
Packit |
345191 |
# 2. Redistributions in binary form must reproduce the above copyright notice(s),
|
|
Packit |
345191 |
# this list of conditions and the following disclaimer in the documentation
|
|
Packit |
345191 |
# and/or other materials provided with the distribution.
|
|
Packit |
345191 |
#
|
|
Packit |
345191 |
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY EXPRESS
|
|
Packit |
345191 |
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
Packit |
345191 |
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
Packit |
345191 |
# EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
Packit |
345191 |
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
Packit |
345191 |
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
Packit |
345191 |
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
Packit |
345191 |
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
|
Packit |
345191 |
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
Packit |
345191 |
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Packit |
345191 |
|
|
Packit |
345191 |
# docker_install_tbb.sh - is called inside a Docker container;
|
|
Packit |
345191 |
# installs Threading Building Block library
|
|
Packit |
345191 |
#
|
|
Packit |
345191 |
|
|
Packit |
345191 |
set -e
|
|
Packit |
345191 |
|
|
Packit |
345191 |
TBB_RELEASE_URL=https://github.com/01org/tbb/releases/tag/"$TBB_LIBRARY_VERSION"
|
|
Packit |
345191 |
TBB_TAR_GZ="$TBB_LIBRARY_VERSION".tar.gz
|
|
Packit |
345191 |
TBB_TARBALL_URL=https://github.com/01org/tbb/archive/"$TBB_TAR_GZ"
|
|
Packit |
345191 |
TBB_VARS_SH="tbbvars.sh"
|
|
Packit |
345191 |
|
|
Packit |
345191 |
# check if specified TBB release exists
|
|
Packit |
345191 |
if curl --output /dev/null --silent --head --fail "$TBB_RELEASE_URL"; then
|
|
Packit |
345191 |
echo "TBB version ${TBB_LIBRARY_VERSION} exist."
|
|
Packit |
345191 |
else
|
|
Packit |
345191 |
echo "TBB url: ${TBB_RELEASE_URL} is not valid. TBB version: ${TBB_LIBRARY_VERSION} doesn't exist."
|
|
Packit |
345191 |
exit 1
|
|
Packit |
345191 |
fi
|
|
Packit |
345191 |
|
|
Packit |
345191 |
TBB_LOCAL_DIR="$HOME"/tbb/"$TBB_LIBRARY_VERSION"
|
|
Packit |
345191 |
TBB_LOCAL_TAR_GZ="$TBB_LOCAL_DIR"/"$TBB_TAR_GZ"
|
|
Packit |
345191 |
|
|
Packit |
345191 |
# create TBB directory in home directory
|
|
Packit |
345191 |
mkdir -p "$TBB_LOCAL_DIR"
|
|
Packit |
345191 |
|
|
Packit |
345191 |
# download and untar TBB library to TBB directory
|
|
Packit |
345191 |
curl -L "$TBB_TARBALL_URL" -o "$TBB_LOCAL_TAR_GZ"
|
|
Packit |
345191 |
tar -xzf "$TBB_LOCAL_TAR_GZ" -C "$TBB_LOCAL_DIR" --strip-components=1
|
|
Packit |
345191 |
|
|
Packit |
345191 |
# build TBB library
|
|
Packit |
345191 |
make -j "$(nproc --all)" --directory="$TBB_LOCAL_DIR"
|
|
Packit |
345191 |
TBB_RELEASE_DIR=$(ls -d "$TBB_LOCAL_DIR"/build/*release)
|
|
Packit |
345191 |
|
|
Packit |
345191 |
# set environment variables regarding TBB package
|
|
Packit |
345191 |
source "$TBB_RELEASE_DIR"/"$TBB_VARS_SH"
|