2011-10-21 18:36:28 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Slackware build script for amd-app-sdk
|
|
|
|
|
|
|
|
# Copyright (c) 2011 Alan Alberghini <414N@slacky.it>
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Permission to use, copy, modify, and distribute this software for
|
|
|
|
# any purpose with or without fee is hereby granted, provided that
|
|
|
|
# the above copyright notice and this permission notice appear in all
|
|
|
|
# copies.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED AS IS'' AND ANY EXPRESSED OR IMPLIED
|
|
|
|
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
# IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
|
|
|
|
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
|
|
|
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
|
|
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
|
|
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
|
|
|
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
# SUCH DAMAGE.
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Build history:
|
|
|
|
#
|
2011-12-23 16:47:20 +01:00
|
|
|
# Initial release.
|
|
|
|
# 20121220 - Updated for version 2.6: incompatible packaging with 2.4- versions
|
2013-06-16 19:45:22 +02:00
|
|
|
# 20130530 - Updated for version 2.8 and made samples optional
|
2011-10-21 18:36:28 +02:00
|
|
|
|
|
|
|
PRGNAM=amd-app-sdk
|
|
|
|
INT_NAME=AMD-APP-SDK
|
2013-06-16 19:45:22 +02:00
|
|
|
VERSION=${VERSION:-2.8}
|
2011-10-21 18:36:28 +02:00
|
|
|
BUILD=${BUILD:-1}
|
|
|
|
TAG=${TAG:-_SBo}
|
2013-06-16 19:45:22 +02:00
|
|
|
SAMPLES=${SAMPLES:-no}
|
2011-10-21 18:36:28 +02:00
|
|
|
|
|
|
|
# (only x86 and x86_64 are supported)
|
|
|
|
TESTARCH=${ARCH:-`uname -m`}
|
|
|
|
case "$TESTARCH" in
|
|
|
|
x86|i*86) ARCH=x86; BITNESS=32 ;;
|
|
|
|
x86_64) ARCH=x86_64; BITNESS=64 ;;
|
|
|
|
*) echo "$ARCH architecture not supported. Please specify a supported ARCH (x86 or x86_64)."
|
|
|
|
exit 1 ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
CWD=$(pwd)
|
|
|
|
TMP=${TMP:-/tmp/SBo}
|
|
|
|
PKG=$TMP/package-$PRGNAM
|
|
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
|
|
|
|
ARCHIVE_NAME="AMD-APP-SDK-v$VERSION-lnx${BITNESS}"
|
2013-06-16 19:45:22 +02:00
|
|
|
INT_ARCHIVE_NAME=AMD-APP-SDK-v$VERSION-RC*-lnx${BITNESS}
|
2011-10-21 18:36:28 +02:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
rm -rf $PKG
|
|
|
|
mkdir -p $TMP $PKG $OUTPUT
|
|
|
|
cd $TMP
|
2011-12-23 16:47:20 +01:00
|
|
|
rm -rf $INT_ARCHIVE_NAME
|
2011-10-21 18:36:28 +02:00
|
|
|
tar xvf $CWD/$ARCHIVE_NAME.tgz
|
|
|
|
|
2013-06-16 19:45:22 +02:00
|
|
|
# Keep out the samples from being extracted in the first place, if they're not
|
|
|
|
# desired.
|
|
|
|
|
|
|
|
if [ "$SAMPLES" == "no" ]
|
|
|
|
then
|
|
|
|
EXCLUDES="--exclude $INT_ARCHIVE_NAME/samples"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# If we're packaging a 64 bit package, let's exclude the 32 bit parts from the
|
|
|
|
# extraction (no multilib).
|
2011-10-21 18:36:28 +02:00
|
|
|
|
|
|
|
if [ ${ARCH} = x86_64 ]
|
|
|
|
then
|
2013-06-16 19:45:22 +02:00
|
|
|
EXCLUDES+=" --exclude $INT_ARCHIVE_NAME/samples/opencl/bin/x86"
|
|
|
|
EXCLUDES+=" --exclude $INT_ARCHIVE_NAME/lib/x86"
|
|
|
|
EXCLUDES+=" --exclude $INT_ARCHIVE_NAME/bin/x86"
|
2011-10-21 18:36:28 +02:00
|
|
|
fi
|
|
|
|
|
2013-06-16 19:45:22 +02:00
|
|
|
tar xvf $INT_ARCHIVE_NAME.tgz $EXCLUDES
|
|
|
|
cd $INT_ARCHIVE_NAME
|
|
|
|
|
2011-10-21 18:36:28 +02:00
|
|
|
chown -R root:root .
|
2013-11-22 08:37:19 +01:00
|
|
|
find -L . \
|
|
|
|
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
|
2011-10-21 18:36:28 +02:00
|
|
|
-exec chmod 755 {} \; -o \
|
|
|
|
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
|
|
|
|
-exec chmod 644 {} \;
|
|
|
|
|
|
|
|
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
|
|
|
|
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
|
|
|
|
|
|
|
# Create output directories and copy everything inside /opt
|
|
|
|
|
|
|
|
mkdir -p $PKG/opt/$PRGNAM $PKG/etc/profile.d $PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
|
|
|
|
mv * $PKG/opt/$PRGNAM
|
|
|
|
|
|
|
|
# Install the icd registration tarball into $PKG root
|
|
|
|
|
2011-12-23 16:47:20 +01:00
|
|
|
( cd $PKG && tar xf $TMP/icd-registration.tgz )
|
2011-10-21 18:36:28 +02:00
|
|
|
|
2013-06-16 19:45:22 +02:00
|
|
|
# Copy the main profile scripts in their final location...
|
|
|
|
|
|
|
|
install -m0755 $CWD/amd-app-sdk.sh $PKG/etc/profile.d
|
|
|
|
install -m0755 $CWD/amd-app-sdk.csh $PKG/etc/profile.d
|
|
|
|
|
|
|
|
# ...and then the libs-related ones.
|
2011-10-21 18:36:28 +02:00
|
|
|
|
|
|
|
if [ ${ARCH} = x86 ]
|
|
|
|
then
|
2013-06-16 19:45:22 +02:00
|
|
|
install -m0644 $CWD/amd-app-sdk-libs32.sh $PKG/etc/profile.d
|
|
|
|
install -m0644 $CWD/amd-app-sdk-libs32.csh $PKG/etc/profile.d
|
2011-10-21 18:36:28 +02:00
|
|
|
else
|
2013-06-16 19:45:22 +02:00
|
|
|
install -m0644 $CWD/amd-app-sdk-libs64.sh $PKG/etc/profile.d
|
|
|
|
install -m0644 $CWD/amd-app-sdk-libs64.csh $PKG/etc/profile.d
|
2011-10-21 18:36:28 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
chown -R root:root $PKG/etc
|
|
|
|
|
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
|
|
|
|
# Link documentation and samples from /opt
|
|
|
|
ln -sf /opt/$PRGNAM/docs/opencl $PKG/usr/doc/$PRGNAM-$VERSION
|
2013-06-16 19:45:22 +02:00
|
|
|
|
|
|
|
if [ "$SAMPLES" != "no" ]
|
|
|
|
then
|
|
|
|
ln -sf /opt/$PRGNAM/samples $PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
fi
|
|
|
|
|
2011-10-21 18:36:28 +02:00
|
|
|
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
2013-06-16 19:45:22 +02:00
|
|
|
cat $CWD/README.SLACKWARE > $PKG/usr/doc/$PRGNAM-$VERSION/README.SLACKWARE
|
2011-10-21 18:36:28 +02:00
|
|
|
|
|
|
|
mkdir -p $PKG/install
|
|
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
|
|
|
|
|
|
|
cd $PKG
|
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|