#!/bin/bash

echo "Deprecated!"
exit

set -e

cd $ROCM_REL_DIR
wget https://github.com/ROCm/clang-ocl/archive/rocm-$PKGVER.tar.gz
tar xf clang-ocl-$LDIR.tar.gz
rm -rf $ROCM_BUILD_DIR/clang-ocl
mkdir -p $ROCM_BUILD_DIR/clang-ocl
cd $ROCM_BUILD_DIR/clang-ocl

DEST=$OUTPUT/package-clang-ocl
PRGNAM=rocm-clang-ocl
NUMJOBS=${NUMJOBS:-" -j$(expr $(nproc) + 1) "}
BUILD=1

pushd .

cmake \
    -Wno-dev \
    -D CMAKE_BUILD_TYPE=Release \
    -D CLANG_BIN=${ROCM_INSTALL_DIR}/lib/llvm/bin \
    -D BITCODE_DIR=${ROCM_INSTALL_DIR}/amdgcn/bitcode \
    -D CMAKE_INSTALL_PREFIX=${ROCM_INSTALL_DIR} \
    -G Ninja \
    $ROCM_REL_DIR/clang-ocl-$LDIR

"${NINJA:=ninja}" $NUMJOBS || exit 1
DESTDIR=$DEST "$NINJA" install/strip || exit 1

mkdir -p $DEST/install
cat >> $DEST/install/slack-desc << 'END'
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct.  It's also
# customary to leave one space after the ':' except on otherwise blank lines.

                   |-----handy-ruler------------------------------------------------------|
rocm-clang-ocl: rocm-clang-ocl (OpenCL compilation with clang compiler)
rocm-clang-ocl:
rocm-clang-ocl: OpenCL compilation with clang compiler.
rocm-clang-ocl:
rocm-clang-ocl:
rocm-clang-ocl:
rocm-clang-ocl:
rocm-clang-ocl:
rocm-clang-ocl:
rocm-clang-ocl:
rocm-clang-ocl:
END

cd $DEST
makepkg -l y -c n $OUTPUT/$PRGNAM-$PKGVER-$ARCH-${BUILD}$TAG.txz

popd
