Skip to content

Commit

Permalink
Add a basic build+install script
Browse files Browse the repository at this point in the history
Change-Id: Ida0702057fda3cbbe9b4674e07aecacb1004fc90
  • Loading branch information
mangupta committed Aug 24, 2017
1 parent 4051b9f commit 5c09f35
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions install.sh
@@ -0,0 +1,48 @@
#!/bin/bash

BUILD_ROOT="$( mktemp -d )"
SRC_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
WORKING_DIR=$PWD
DASH_JAY="-j $(getconf _NPROCESSORS_ONLN)"

err() {
echo "${1-Died}." >&2
}

die() {
err "$1"
exit 1
}

pushd () {
command pushd "$@" > /dev/null
}

popd () {
command popd "$@" > /dev/null
}

function setupENV()
{
sudo apt-get update
sudo apt-get install dpkg-dev rpm doxygen libelf-dev
}

function buildHIP()
{
pushd $BUILD_ROOT
cmake $SRC_ROOT -DCMAKE_BUILD_TYPE=Release -DCOMPILE_HIP_ATP_MARKER=1
make $DASH_JAY
make package
rename -v 's/([a-z0-9_.\-]).deb/$1-amd64.deb/' *.deb;rename -v 's/([a-z0-9_.\-]).rpm/$1.x86_64.rpm/' *.rpm
cp hip_*.deb $WORKING_DIR
sudo dpkg -i hip_base*.deb hip_hcc*.deb hip_sample*.deb hip_doc*.deb
popd
rm -rf $BUILD_ROOT
}

echo "Preparing build environment"
setupENV || die "setupENV failed"
echo "Building and installing HIP packages"
buildHIP || die "buildHIP failed"
echo "Finished building HIP packages"

0 comments on commit 5c09f35

Please sign in to comment.