1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
#!/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:
#
# Initial release.
# 20121220 - Updated for version 2.6: incompatible packaging with 2.4- versions
# 20130530 - Updated for version 2.8 and made samples optional
PRGNAM=amd-app-sdk
INT_NAME=AMD-APP-SDK
VERSION=${VERSION:-2.8}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
SAMPLES=${SAMPLES:-no}
# Automatically determine the architecture we're building on or use supplied ARCH
# (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}"
INT_ARCHIVE_NAME=AMD-APP-SDK-v$VERSION-RC*-lnx${BITNESS}
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $INT_ARCHIVE_NAME
tar xvf $CWD/$ARCHIVE_NAME.tgz
# 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).
if [ ${ARCH} = x86_64 ]
then
EXCLUDES+=" --exclude $INT_ARCHIVE_NAME/samples/opencl/bin/x86"
EXCLUDES+=" --exclude $INT_ARCHIVE_NAME/lib/x86"
EXCLUDES+=" --exclude $INT_ARCHIVE_NAME/bin/x86"
fi
tar xvf $INT_ARCHIVE_NAME.tgz $EXCLUDES
cd $INT_ARCHIVE_NAME
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-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
( cd $PKG && tar xf $TMP/icd-registration.tgz )
# 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.
if [ ${ARCH} = x86 ]
then
install -m0644 $CWD/amd-app-sdk-libs32.sh $PKG/etc/profile.d
install -m0644 $CWD/amd-app-sdk-libs32.csh $PKG/etc/profile.d
else
install -m0644 $CWD/amd-app-sdk-libs64.sh $PKG/etc/profile.d
install -m0644 $CWD/amd-app-sdk-libs64.csh $PKG/etc/profile.d
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
if [ "$SAMPLES" != "no" ]
then
ln -sf /opt/$PRGNAM/samples $PKG/usr/doc/$PRGNAM-$VERSION
fi
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
cat $CWD/README.SLACKWARE > $PKG/usr/doc/$PRGNAM-$VERSION/README.SLACKWARE
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}
|